├── P2 ├── start.bat ├── img │ └── rankine86.jpg ├── 03016403-刘祎璇-P2.pdf ├── data │ ├── rankine86-de.csv │ ├── rankine86-nd.csv │ └── rankine86-sp.txt ├── rankine86.md ├── README.md └── RankineCycle86-Step0.ipynb ├── self-exercises ├── startnb.bat ├── README.md └── Python-Quick-Review.ipynb ├── P4 ├── table.jpg ├── Anscombe.png ├── Anscombe.csv └── README.md ├── Bonus ├── img │ └── spring.jpg ├── data │ └── spring_data.csv └── README.md ├── P3 ├── img │ ├── rankine81.jpg │ ├── rankine85.jpg │ └── rankine86.jpg ├── rankine81.md ├── rankine85.md ├── rankine86.md ├── rankine81-sp.txt ├── README.md ├── rankine85-sp.txt └── rankine86-sp.txt ├── P1 ├── 03016403-刘祎璇-1.zip ├── cpp │ └── hello.cpp └── README.md ├── P5 ├── img │ └── vscode-gcc.jpg ├── src │ └── fastipow.cpp └── README.md ├── In-classExercise.md └── README.md /P2/start.bat: -------------------------------------------------------------------------------- 1 | jupyter notebook -------------------------------------------------------------------------------- /self-exercises/startnb.bat: -------------------------------------------------------------------------------- 1 | jupyter notebook -------------------------------------------------------------------------------- /P4/table.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horoscopes/Practices/S2019/P4/table.jpg -------------------------------------------------------------------------------- /P4/Anscombe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horoscopes/Practices/S2019/P4/Anscombe.png -------------------------------------------------------------------------------- /Bonus/img/spring.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horoscopes/Practices/S2019/Bonus/img/spring.jpg -------------------------------------------------------------------------------- /P2/img/rankine86.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horoscopes/Practices/S2019/P2/img/rankine86.jpg -------------------------------------------------------------------------------- /P3/img/rankine81.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horoscopes/Practices/S2019/P3/img/rankine81.jpg -------------------------------------------------------------------------------- /P3/img/rankine85.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horoscopes/Practices/S2019/P3/img/rankine85.jpg -------------------------------------------------------------------------------- /P3/img/rankine86.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horoscopes/Practices/S2019/P3/img/rankine86.jpg -------------------------------------------------------------------------------- /P1/03016403-刘祎璇-1.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horoscopes/Practices/S2019/P1/03016403-刘祎璇-1.zip -------------------------------------------------------------------------------- /P2/03016403-刘祎璇-P2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horoscopes/Practices/S2019/P2/03016403-刘祎璇-P2.pdf -------------------------------------------------------------------------------- /P5/img/vscode-gcc.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horoscopes/Practices/S2019/P5/img/vscode-gcc.jpg -------------------------------------------------------------------------------- /self-exercises/README.md: -------------------------------------------------------------------------------- 1 | # Self Exercises 2 | 3 | ## Python Quick Review(0 points) 4 | 5 | The notebook is designed for you to review python conveniently. Please finish the notebook by yourself. 6 | 7 | You may reference the structure to learn any new programming language 8 | -------------------------------------------------------------------------------- /Bonus/data/spring_data.csv: -------------------------------------------------------------------------------- 1 | #Distance(m),Mass(kg) 2 | 0.0865,0.1 3 | 0.1015,0.15 4 | 0.1106,0.2 5 | 0.1279,0.25 6 | 0.1892,0.3 7 | 0.2695,0.35 8 | 0.2888,0.4 9 | 0.2425,0.45 10 | 0.3465,0.5 11 | 0.3225,0.55 12 | 0.3764,0.6 13 | 0.4263,0.65 14 | 0.4562,0.7 15 | 0.4502,0.75 16 | 0.4499,0.8 17 | 0.4534,0.85 18 | 0.4416,0.9 19 | 0.4304,0.95 20 | 0.437,1.0 -------------------------------------------------------------------------------- /P2/data/rankine86-de.csv: -------------------------------------------------------------------------------- 1 | NAME,TYPE,EFF,NODE0,NODE1,NODE2,NODE3 2 | HP Turbine,TURBINE-EX1,100,0,2,1, 3 | Reheater,REHEATER,,2,3,, 4 | LP Turbine,TURBINE-EX1,100,3,5,4, 5 | Condenser,CONDENSER,,5,6,, 6 | Condensate Pump,PUMP,100,6,7,, 7 | LP Feedwater Heater,OH-FEEDWATER-DW1,,4,7,8,12 8 | Feedwater Pump,PUMP,100,8,9,, 9 | HP Feedwater Heater,CH-FEEDWATER-DW0,,1,11,9,10 10 | Steam Generator,BOILER,,10,0,, 11 | Trap,TRAP,,11,12,, 12 | -------------------------------------------------------------------------------- /P2/data/rankine86-nd.csv: -------------------------------------------------------------------------------- 1 | NAME,NID,p,t,x, mdot, fdot 2 | MainSteam,0,8,480,,,1 3 | ExtractedSteamOfHP,1,2,,,, 4 | EXhaustedSteamofHP,2,0.7,,,, 5 | InletSteamOfLP,3,0.7,440,,, 6 | ExtractedSteamOfLP,4,0.3,,,, 7 | EXhaustedSteamofLP,5,0.008,,,, 8 | CondensateWater,6,0.008,,0,, 9 | FW of OutletCondensatePump,7,0.3,,,, 10 | FW of InletFeedwaterPump,8,0.3,,0,, 11 | FW of OutletFeedwaterPump,9,8,,,, 12 | MainFeedwater,10,8,205,,, 13 | DrainwaterInletOfTrap,11,2,,0,, 14 | DrainwaterOutletOfTrap,12,0.3,,,, 15 | -------------------------------------------------------------------------------- /P1/cpp/hello.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Compiling: 3 | 4 | g++ -o hello hello.cpp 5 | 6 | Compiling for output Chinese to console in GBK 7 | 8 | g++ -o hello hello.cpp -fexec-charset=GBK 9 | 10 | Running 11 | 12 | For PowerShell 13 | 14 | ./hello 15 | 16 | For cmd 17 | 18 | hello 19 | 20 | */ 21 | #include 22 | using namespace std; 23 | 24 | int main() { 25 | cout << " Name: "<<"Change the text to your name(PIN YIN)"< 6 | 7 | using namespace std; 8 | 9 | double ipow(double x, int n); 10 | 11 | int main() 12 | { 13 | cout << "\nThe simple example of the repeated squaring method by" << endl; 14 | cout << " Name: " 15 | << "Change the text to your name" << endl; 16 | cout << " Student ID: " 17 | << "Change the text to your student ID" << endl; 18 | 19 | double x = 2.0; 20 | int n = 8; 21 | cout << "\n ipow(x, n): " << x << "^" << n << "=" << ipow(x, n) << endl; 22 | }; 23 | 24 | /* 25 | ipow: repeated squaring method 26 | https://en.wikipedia.org/wiki/Exponentiation_by_squaring 27 | */ 28 | double ipow(double x, int n) 29 | { 30 | double value = 1.0; 31 | 32 | if (!n) 33 | return 1.0; /* x^0 = 1 */ 34 | 35 | if (n == 1) 36 | return x; 37 | 38 | if (x == 0.0) 39 | return 0.0; /* 0^n = 0 */ 40 | 41 | if (n < 0) 42 | { 43 | n = -n; 44 | x = 1.0 / x; 45 | } 46 | 47 | do 48 | { 49 | if (n & 1) /* n is odd */ 50 | value *= x; 51 | n >>= 1; /* n/2 */ 52 | x *= x; 53 | } while (n); 54 | 55 | return value; 56 | } -------------------------------------------------------------------------------- /P3/rankine85.md: -------------------------------------------------------------------------------- 1 | ## A Regenerative Cycle with Open Feedwater Heater 2 | 3 | Michael J . Mora. Fundamentals of Engineering Thermodynamics(7th Edition). John Wiley & Sons, Inc. 2011 4 | 5 | Chapter 8 : Vapour Power Systems Example 6 | 7 | * EXAMPLE 8.5 :A Regenerative Cycle with Open Feedwater Heater,Page 456 8 | 9 | Consider a regenerative vapor power cycle with one open feedwater heater. 10 | 11 | * Steam enters the turbine at 8.0 MPa, 480°C and expands to 0.7 MPa, 12 | 13 | * Some of the steam is extracted and diverted to the open feedwater heater operating at 0.7 MPa. 14 | 15 | * The remaining steam expands through the second-stage turbine to the condenser pressure of 0.008 MPa 16 | 17 | * Saturated liquid exits the open feedwater heater at 0.7 MPa. 18 | 19 | * The isentropic efficiency of each turbine stage is 85% and each pump operates isentropically. 20 | 21 | If the net power output of the cycle is 100 MW, determine 22 | 23 | * (a) the thermal efficiency % 24 | 25 | * (b) the mass flow rate of steam entering the first turbine stage, in kg/h. 26 | 27 | If the mass flow rate of steam entering the first-stage turbine were 150 kg/s 28 | 29 | * (a) what would be the net power, in MW 30 | 31 | * (b) the fraction of steam extracted, y? 32 | 33 | ![rankine85](./img/rankine85.jpg) 34 | 35 | Engineering Model: 36 | 37 | 1. Each component in the cycle is analyzed as a steady-state control volume. The control volumes are shown in the accompanying sketch by dashed lines. 38 | 39 | 40 | 2. All processes of the working fluid are internally reversible, except for the expansions through the two turbine stages and mixing in the open feedwater heater. 41 | 42 | 43 | 3. The turbines, pumps, and feedwater heater operate adiabatically. 44 | 45 | 46 | 4. Kinetic and potential energy effects are negligible. 47 | 48 | 49 | 5. Saturated liquid exits the open feedwater heater, and saturated liquid exits the condenser. -------------------------------------------------------------------------------- /P2/rankine86.md: -------------------------------------------------------------------------------- 1 | # A Reheat–Regenerative Cycle with Two Feedwater Heaters 2 | 3 | Michael J . Mora. Fundamentals of Engineering Thermodynamics (7th Edition). John Wiley & Sons, Inc. 2011 4 | 5 | Chapter 8 vapor Power System: (Page 460-463) 6 | 7 | Example 8.6 : Considering a Reheat–Regenerative Cycle with Two Feedwater Heaters, a closed feedwater heater and an open feedwater heater. 8 | 9 | * Steam enters the first turbine at 8.0 MPa, 480°C and expands to 0.7 MPa. 10 | 11 | * The steam is reheated to 440°C before entering the second turbine, where it expands to the condenser pressure of 0.008 MPa. 12 | 13 | * Steam is extracted from the first turbine at 2 MPa and fed to the closed feedwater heater. 14 | 15 | * Feedwater leaves the closed heater at 205°C and 8.0 MPa, and condensate exits as saturated liquid at 2 MPa. 16 | 17 | * The condensate is trapped into the open feedwater heater. 18 | 19 | * Steam extracted from the second turbine at 0.3 MPa is also fed into the open feedwater heater, which operates at 0.3 MPa. The stream exiting the open feedwater heater is saturated liquid at 0.3 MPa. 20 | 21 | * The net power output of the cycle is 100 MW. 22 | 23 | * There is no stray heat transfer from any component to its surroundings. 24 | 25 | * If the working fluid experiences no irreversibilities as it passes through the turbines, pumps, steam generator, reheater, and condenser, 26 | 27 | ## SOLUTION 28 | 29 | * **Known:** A reheat–regenerative vapor power cycle operates with steam as the working fluid. Operating pressures 30 | and temperatures are specified, and the net power output is given. 31 | 32 | * **Find:** Determine the thermal efficiency and the mass flow rate entering the first turbine, in kg/h. 33 | 34 | ![rankine86](./img/rankine86.jpg) 35 | 36 | ## Engineering Model: 37 | 38 | 1. Each component in the cycle is analyzed as a control volume at steady state. The control volumes are 39 | shown on the accompanying sketch by dashed lines. 40 | 41 | 2. There is no stray heat transfer from any component to its surroundings. 42 | 43 | 3. The working fluid undergoes internally reversible processes as it passes through the turbines, pumps, 44 | steam generator, reheater, and condenser. 45 | 46 | 4. The expansion through the trap is a throttling process. 47 | 48 | 5. Kinetic and potential energy effects are negligible. 49 | 50 | 6. Condensate exits the closed heater as a saturated liquid at 2 MPa. Feedwater exits the open heater as a saturated liquid at 0.3 MPa. Condensate exits the condenser as a saturated liquid. 51 | 52 | 53 | -------------------------------------------------------------------------------- /P3/rankine86.md: -------------------------------------------------------------------------------- 1 | ## A Reheat–Regenerative Cycle with Two Feedwater Heaters 2 | ``` 3 | Michael J . Mora. Fundamentals of Engineering Thermodynamics (7th Edition). John Wiley & Sons, Inc. 2011 4 | 5 | Chapter 8 vapor Power System: (Page 460-463) 6 | 7 | Example 8.6 : Considering a Reheat–Regenerative Cycle with Two Feedwater Heaters, a closed feedwater heater and an 8 | open feedwater heater. 9 | ``` 10 | * Steam enters the first turbine at 8.0 MPa, 480°C and expands to 0.7 MPa. 11 | 12 | * The steam is reheated to 440°C before entering the second turbine, where it expands to the condenser pressure of 0.008 MPa. 13 | 14 | * Steam is extracted from the first turbine at 2 MPa and fed to the closed feedwater heater. 15 | 16 | * Feedwater leaves the closed heater at 205°C and 8.0 MPa, and condensate exits as saturated liquid at 2 MPa. 17 | 18 | * The condensate is trapped into the open feedwater heater. 19 | 20 | * Steam extracted from the second turbine at 0.3 MPa is also fed into the open feedwater heater, which operates at 0.3 MPa. The stream exiting the open feedwater heater is saturated liquid at 0.3 MPa. 21 | 22 | * The net power output of the cycle is 100 MW. 23 | 24 | * There is no stray heat transfer from any component to its surroundings. 25 | 26 | * If the working fluid experiences no irreversibilities as it passes through the turbines, pumps, steam generator, reheater, and condenser, 27 | 28 | * SOLUTION 29 | 30 | * **Known:** A reheat–regenerative vapor power cycle operates with steam as the working fluid. Operating pressures 31 | and temperatures are specified, and the net power output is given. 32 | 33 | * **Find:** Determine the thermal efficiency and the mass flow rate entering the first turbine, in kg/h. 34 | 35 | ![rankine86](./img/rankine86.jpg) 36 | 37 | * Engineering Model: 38 | 39 | 1. Each component in the cycle is analyzed as a control volume at steady state. The control volumes are 40 | shown on the accompanying sketch by dashed lines. 41 | 42 | 2. There is no stray heat transfer from any component to its surroundings. 43 | 44 | 3. The working fluid undergoes internally reversible processes as it passes through the turbines, pumps, 45 | steam generator, reheater, and condenser. 46 | 47 | 4. The expansion through the trap is a throttling process. 48 | 49 | 5. Kinetic and potential energy effects are negligible. 50 | 51 | 6. Condensate exits the closed heater as a saturated liquid at 2 MPa. Feedwater exits the open heater as a saturated liquid at 0.3 MPa. Condensate exits the condenser as a saturated liquid. 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /P3/rankine81-sp.txt: -------------------------------------------------------------------------------- 1 | 2 | Rankine Cycle: Rankine8 3 | Net Power(MW) 100.00 4 | Mass Flow(kg/h) 376770.81 5 | Efficiency(%) 37.08 6 | Heat Rate(kJ/kWh) 9708.30 7 | Steam Rate(kg/kWh) 3.77 8 | totalWExtracted(MW) 100.84 9 | totalWRequired(MW) 0.84 10 | totalQAdded(MW) 269.68 11 | 12 | NodeID Name P(MPa) T(°C) H(kJ/kg) S(kJ/kg.K) V(m^3/kg) X FDOT MDOT(kg/h) 13 | 0 Main Steam 8.0 295.01 2758.61 5.74 0.024 1.0 1.0000 376770.81 14 | 1 Outlet Steam of HP 0.008 41.51 1795.08 5.74 12.215 0.675 1.0000 376770.81 15 | 2 Condenser Water 0.008 41.51 173.85 0.59 0.001 0.0 1.0000 376770.81 16 | 3 Main FeedWater 8.0 41.75 181.90 0.59 0.001 0.0 1.0000 376770.81 17 | 18 | Turbine Ex0 19 | NodeID Name P(MPa) T(°C) H(kJ/kg) S(kJ/kg.K) V(m^3/kg) X FDOT MDOT(kg/h) 20 | 0 Main Steam 8.0 295.01 2758.61 5.74 0.024 1.0 1.0000 376770.81 21 | 1 Outlet Steam of HP 0.008 41.51 1795.08 5.74 12.215 0.675 1.0000 376770.81 22 | workExtracted(kJ/kg): 963.53 23 | WExtracted(MW): 100.84 24 | 25 | Condenser 26 | NodeID Name P(MPa) T(°C) H(kJ/kg) S(kJ/kg.K) V(m^3/kg) X FDOT MDOT(kg/h) 27 | 1 Outlet Steam of HP 0.008 41.51 1795.08 5.74 12.215 0.675 1.0000 376770.81 28 | 2 Condenser Water 0.008 41.51 173.85 0.59 0.001 0.0 1.0000 376770.81 29 | heatExtracted(kJ/kg) 1621.23 30 | QExtracted(MW): 169.68 31 | 32 | Feedwater Pump 33 | NodeID Name P(MPa) T(°C) H(kJ/kg) S(kJ/kg.K) V(m^3/kg) X FDOT MDOT(kg/h) 34 | 2 Condenser Water 0.008 41.51 173.85 0.59 0.001 0.0 1.0000 376770.81 35 | 3 Main FeedWater 8.0 41.75 181.90 0.59 0.001 0.0 1.0000 376770.81 36 | workRequired(kJ/kg): 8.05 37 | WRequired(MW): 0.84 38 | 39 | Boiler 40 | NodeID Name P(MPa) T(°C) H(kJ/kg) S(kJ/kg.K) V(m^3/kg) X FDOT MDOT(kg/h) 41 | 3 Main FeedWater 8.0 41.75 181.90 0.59 0.001 0.0 1.0000 376770.81 42 | 0 Main Steam 8.0 295.01 2758.61 5.74 0.024 1.0 1.0000 376770.81 43 | heatAdded(kJ/kg) 2576.71 44 | QAdded(MW) 269.68 45 | -------------------------------------------------------------------------------- /P5/README.md: -------------------------------------------------------------------------------- 1 | 2 | ## Practice 5 3 | 4 | **C/C++ Programming**(5):C/C++ Programming with MinGW-w64(GCC),MakeFile,the Shared Library 5 | 6 | Deadline: 2019.06.09 7 | 8 | ## To Do(5 marks): 9 | 10 | The exponentiating by squaring is a general method for fast computation of large positive integer powers of a number. 11 | 12 | * https://en.wikipedia.org/wiki/Exponentiation_by_squaring 13 | 14 | Please use the [fastipow.cpp](./src/fastipow.cpp) to do the following tasks: 15 | 16 | * Coding C/C++(C/C++ code/header):(1 marks) 17 | 18 | Split the [fastipow.cpp](./src/fastipow.cpp) into the two parts: 19 | 20 | * The function of The Repeated Squaring Method 21 | 22 | * The example application to call The Repeated Squaring Method 23 | 24 | * Building dll, exe with three makefiles(3 marks) 25 | 26 | * Making the executable file with multiple source files: the function of The Repeated Squaring Method and it's caller 27 | 28 | * Making the shared library of the Repeated Squaring Method 29 | 30 | * Making the executable file to call the shared library 31 | 32 | * Documenting your works: README.md and Images:(1 marks) 33 | 34 | * README.md: intro of your works 35 | 36 | * The screenshot of coding,making exe to use `the shared library` and running the executable file 37 | 38 | Example: 39 | 40 | ![screenshots](./img/vscode-gcc.jpg) 41 | 42 | ## Directories and Files 43 | 44 | ```txt 45 | 46 | |── 47 | │ 48 | │── README.md: intro of your works(display the screenshots of coding,making and running) 49 | | 50 | │── makefile: building the executable file with multiple source 51 | │ 52 | │── makefile-dll: building the shared library 53 | │ 54 | │── makefile-exe: building the executable file to call the shared library 55 | │ 56 | |── : screenshots of coding,making and running 57 | | │ 58 | | |── *.jpg/png 59 | | 60 | |── : 61 | | │ 62 | | |── *.exe 63 | | | 64 | | |── *.dll 65 | | 66 | |── : 67 | │ 68 | |──*.c/cpp, *.h 69 | ``` 70 | 71 | ## Submission: 72 | 73 | Compress your practice folder to :**StudentNumber-Name-5.zip** 74 | 75 | * 1 Email to:cmh@seu.edu.cn 76 | 77 | * Subject:StudentNumber-Name-5 78 | 79 | * Attachment:**StudentNumber-Name-5.zip** 80 | 81 | * 2 Deadline:2019.06.09 82 | 83 | * make up after deadline: points<=3 (2019.06.16) 84 | 85 | * 3 Improvement: due:2019.06.16 86 | 87 | ## Reference 88 | 89 | * [GCC_MAKE](http://nbviewer.ipython.org/github/PySEE/home/tree/S2019/notebook/Unit8-1-GCC_MAKE.ipynb) 90 | 91 | * [GCC_DLL](http://nbviewer.ipython.org/github/PySEE/home/tree/S2019/notebook/Unit8-2-GCC_DLL.ipynb) 92 | 93 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # [行是知之始,知是行之成 - 陶行知](http://yuedu.163.com/source/2963f558d8cc47dda31faa19c4e776e9_4) 2 | 3 | | Class | P1(03.17) | P2(04.21) | P3 | P4 | P5 | Bonus | 4 | |:-------:|:---------:|:---------:|:--------:|:--------:|:--------:|:--------:| 5 | | 030163 | 31(-1) | | | | | | 6 | | 030164 | 36 | | | | | | 7 | 8 | | Class | C1(04.01) | ... | 9 | |:-------:|:---------:|:---------:| 10 | | 030163 | 26(-6) | | 11 | | 030164 | 34(+2) | | 12 | 13 | --- 14 | 15 | [1. Basic Programming(15)](./P1):Python,Jupyter,MinGW-W64,Visual Studio Code,Github 16 | 17 | * Deadline: 2019.03.17 18 | 19 | |03016430 | 03016316 | 03016427 | 03016426 | 03016428 | 03016404 |03016331 |03016401 | 03016429 | 20 | |:-------:|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:|:------:|:--------:| 21 | | 李唐昊 | 王晨 | 彭铖 | 倪浩伟 | 徐鹏 | 王雨萱 | 王馨铁 | 陈美君 | 陈宇恒 | 22 | 23 | 24 | | 03016332 | 03016407 | 03016318 |03016431 | 03016312 | 03016319 | 03016405 | 03016406 |03016403 | 25 | |:--------:|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:| 26 | | 陈显浩 | 田葆 | 路裕 | 苏焕文 | 詹卓轩 | 王达之 | 石婧 | 蔡玉 | ★刘祎璇 | 27 | 28 | --- 29 | 30 | [2. Python and Interactive Computing(15)](./P2):Jupyter Notebook of the Rankine Cycle Simulator 31 | 32 | * Deadline: 2019.04.21 33 | 34 | | 03016330 |03016310 | 03016312 | 03016318 | 03016427 | 03016332 | 03016432 | 03016329 | 03016331 35 | |:--------:|:--------:|:---------:|:---------:|:--------:|:--------:|:---------:|:--------:|:--------:| 36 | | 陈浩 | 任满乾 | 詹卓轩 | 路裕 | 彭铖 | ★陈显浩 | 张翼 | 吴笛 | 王馨铁 | 37 | 38 | |03016401 | 03016311 | 03016429 |03016426 | 03016323| 03016403 | 03016327 |03016404 | 39 | |:-------:|:--------:|:--------:|:--------:|:--------:|:-----------:|:----------:|:--------:| 40 | | 陈美君 | 郑丙乐 | 陈宇恒 | 倪浩伟 | 金扬皓 | **★刘祎璇** | 张崇辉 | 王雨萱 | 41 | 42 | --- 43 | 44 | [3. Object-oriented Programming(20)](./P3): The General Rankine Cycle Simulator 45 | 46 | * Deadline: 2019.05.19 47 | --- 48 | 49 | [4. Data Analysis(10)](./P4):Statistics, regression and visualization 50 | 51 | * Deadline: 2019.06.02 52 | 53 | --- 54 | 55 | [5. C/C++ Programming(5)](./P5):C/C++ Programming with GCC(MinGW-w64),Makefile,Shared Library 56 | 57 | * Deadline: 2019.06.09 58 | --- 59 | 60 | [Bonus(+5)](./Bonus): Scientific Programming with GCC,GSL and Gnuplot under Ubuntu,Version control 61 | 62 | * Deadline: 2019.06.16 63 | 64 | --- 65 | 66 | ## Self Exercises 67 | 68 | [Python Quick Review](./self-exercises)(0 points) 69 | 70 | The notebook is designed for you to review python conveniently. Please finish the notebook by yourself. 71 | 72 | You may reference the structure to learn any new programming Language 73 | 74 | -------------------------------------------------------------------------------- /P4/README.md: -------------------------------------------------------------------------------- 1 | ## Practice 4 2 | 3 | **Data Analysis**(10):Statistics, regression and visualization 4 | 5 | * Deadline: 2019.06.02 6 | 7 | ## Problem 8 | 9 | John V. Guttag. Introduction to Computation and Programming Using Python: With Application to Understanding Data(Second Edition). MIT Press, 2016. 10 | 11 | **21.5 Statistical Measures Don't, Tell the Whole Story**(Page411-412) 12 | 13 | In 1973, the statistician F.J. Anscombe published a paper containing the table below. It contains the coordinates of the points in each of four data sets. 14 | 15 | |x0 |y0|x1|y2|x2|y2|x3|y3| 16 | | ---- |:------:| :------:| :------:| :------:| :------:| :------:| ----:| 17 | |10.0| 8.04 | 10.0| 9.14 | 10.0 |7.46 |8.0 |6.58| 18 | |8.0| 6.95 | 8.0 | 8.14 | 8.0 |6.77 |8.0 |5.76| 19 | |13.0| 7.58 | 13.0| 8.74 | 13.0 |12.74 |8.0 |7.71| 20 | |9.0| 8.81 | 9.0 | 8.77 | 9.0 |7.11 |8.0 |8.84| 21 | |11.0| 8.33 | 11.0| 9.26| 11.0 |7.81 |8.0 |8.47| 22 | |14.0| 9.96 | 14.0| 8.10 | 14.0 |8.84 |8.0 |7.04| 23 | |6.0| 7.24 | 6.0 | 6.13 | 6.0 |6.08 |8.0 |5.25| 24 | |4.0| 4.26 | 4.0 | 3.10| 4.0 |5.39 |19.0 |12.5| 25 | |12.0| 10.84| 12.0| 9.13| 12.0 |8.15 |8.0 |5.56| 26 | |7.0| 4.82 | 7.0 | 7.26| 7.0 |6.42 |8.0 |7.91| 27 | |5.0| 5.68 | 5.0 | 4.74| 5.0 |5.73 |8.0 |6.89| 28 | 29 | ## 要求(10分): 30 | 31 | 使用Jupyter Notebook实现 32 | 33 | * 1 读取数据文件及数据对象表达(3分): 使用Python语言读取数据文件[Anscombe.csv](./Anscombe.csv), 使用List,Dict表达数据分析对象。**不使用: csv,NumPy和Pandas软件包** 34 | 35 | * 2 统计指标计算和输出(2分):计算均值、方差和相关系数等统计指标(1分,可使用Python统计库、Numpy或Scipy);统计结果表格化输出(1分,可使用表格化数据输出软件包,如prettytable) 36 | 37 | 参考输出数据表 38 | 39 | ![统计结果数据表](table.jpg) 40 | 41 | * 3 线性回归和图形输出(3分): **线性回归**(1分,可使用Numpy或Scipy);多图输出(2分,使用Matplotlib) 42 | 43 | 参考输出图 44 | 45 | ![数据点图和回归曲线](Anscombe.png) 46 | 47 | * 4 小结(2):如何做一个好的统计分析结果的提供者和消费者?(建议分析角度:数据获取,数据分析,结果解析和展示方式) 48 | 49 | ## 提交: 50 | 51 | * 1 电邮:cmh@seu.edu.cn 52 | * 主题:学号-姓名-4 53 | * 附件:程序文件压缩包:**学号-姓名-4.zip** 54 | 55 | * 2 截至时间: 2019.06.02 56 | * 截至时间后可补交,补交得分<=6. (2019.06.16) 57 | 58 | * 3 改进更新:提交作业后可改进,改进截至时间:2019.06.16 59 | 60 | ## 参考: 61 | 62 | * [21_LIES_DAMNED_LIES_AND_STATISTICS](http://nbviewer.ipython.org/github/PySEE/home/tree/S2019/notebook/Unit5-2-21_LIES_DAMNED_LIES_AND_STATISTICS.ipynb) 63 | 64 | * [List,Dict and Data Table(Files)](http://nbviewer.ipython.org/github/PySEE/home/tree/S2019/notebook/Unit1-5-4-46-Files-List-Dict.ipynb) 65 | 66 | * [11-1_PLOTTING_USING_MATPLOTLIB](http://nbviewer.ipython.org/github/PySEE/home/tree/S2019/notebook/Unit3-2-11-1_PLOTTING_USING_MATPLOTLIB.ipynb) 67 | 68 | * [18_UNDERSTANDING_EXPERIMENTAL_DATA](http://nbviewer.ipython.org/github/PySEE/home/tree/S2019/notebook/Unit5-1-18_UNDERSTANDING_EXPERIMENTAL_DATA.ipynb) 69 | 70 | * Scipy. http://www.scipy.org/ 71 | 72 | * Numpy. http://www.numpy.org/ 73 | 74 | * Matplotlib. http://matplotlib.org/ 75 | 76 | * Robert Johansson. [Lectures on scientific computing with python](https://github.com/jrjohansson/scientific-python-lectures) 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /Bonus/README.md: -------------------------------------------------------------------------------- 1 | # Bonus(+5 marks) 2 | 3 | Scientific Programming with GCC,GSL and Gnuplot under Ubuntu,Version control 4 | 5 | Deadline: 2019.06.16 6 | 7 | ## To do 8 | 9 | ### 1 Scientific Programming with `GCC`,`GSL and GNUPlot`(+3 marks) 10 | 11 | * Using **GSL** to do Linear Regression of Springs Behavior Data in [spring_data.csv](./data/spring_data.csv) 12 | 13 | * **Note**: read data from the file of `spring_data.csv` 14 | 15 | * Using **Gnuplot** to visualize the data and Linear Regression results 16 | 17 | ![Linear Regression of Springs Behavior](./img/spring.jpg) 18 | 19 | ### 2 Version control with Git,Github(+2 marks) 20 | 21 | * Version control with Git 22 | 23 | * Submit to your Github 24 | 25 | ### 3 Directories and Files 26 | 27 | ```txt 28 | ├── 29 | │ │ 30 | │ |── 31 | │ │ │ 32 | |── README.md 工作简要说明(需要显示the image of Linear Regression) 33 | │ 34 | |── makefile : 编译源码生成、运行exe文件 35 | │ 36 | |── *.exe 37 | | 38 | |── 源码 39 | | | 40 | | │ ── *.c/cpp 41 | | 42 | |── 数据 43 | | | 44 | | │ ── *.csv 45 | | 46 | |── 图片 47 | | 48 | │ ── *.jpg/png 49 | ``` 50 | 51 | ## Submission requirements 52 | 53 | The zipped files in the `Bonus` directory: 54 | 55 | * 1 README.md:introduction of your works 56 | 57 | * 2 source codes, makefile, exe, data files and image of Linear Regression 58 | 59 | * 3 images of your locate git and remote Github repository for the codes 60 | 61 | **Email to:** cmh@seu.edu.cn 62 | 63 | * Subject:StudentNumber-Name-B 64 | 65 | * Attachment:StudentNumber-Name-B.zip 66 | 67 | **Deadline**:2019.06.16 68 | 69 | ## Reference 70 | 71 | **GCC,GSL,Gnuplot** 72 | 73 | * [18. UNDERSTANDING EXPERIMENTAL DATA](http://nbviewer.ipython.org/github/PySEE/home/tree/S2019/notebook/Unit5-1-18_UNDERSTANDING_EXPERIMENTAL_DATA.ipynb) 74 | 75 | * [Ubuntu, GSL, GNUPLOT](http://nbviewer.ipython.org/github/PySEE/home/tree/S2019/notebook/Unit8-5-Ubuntu_GSL_GNUPLOT.ipynb) 76 | 77 | * [Ubuntu, Python, CPP](https://github.com/PySEE/home/blob/S2019/guide/Ubuntu-Python-CPP(Chinese).md) 78 | 79 | * GSL - GNU Scientific Library https://www.gnu.org/software/gsl/ 80 | 81 | * [The GSL Reference Manual online]( https://www.gnu.org/software/gsl/doc/html/index.html) 82 | 83 | * Gnuplot homepage http://gnuplot.info/ 84 | 85 | * Nishanth Sastry. [Visualize your data with gnuplot](http://fitzkee.chemistry.msstate.edu/sites/default/files/ch8990/ibm-gnuplot.pdf) 86 | 87 | * [中文版:Gnuplot让您的数据可视化](https://www.ibm.com/developerworks/cn/linux/l-gnuplot/) 88 | 89 | **Git and Github** 90 | 91 | * 知乎:怎样使用GitHub. http://www.zhihu.com/question/20070065 92 | 93 | * [The Simple Steps Github(Chinese)](https://github.com/PySEE/home/blob/S2019/guide/TheSimpleStepsGithub(Chinese).md) 94 | 95 | * [DevTools-Git](http://nbviewer.jupyter.org/github/PySEE/home/blob/S2019/notebook/Unit7-5-DevTools-Git.ipynb) 96 | 97 | * [How to get started with GIT and work with GIT Remote Repo](http://www3.ntu.edu.sg/home/ehchua/programming/howto/Git_HowTo.html) 98 | 99 | * Git Version Control in VS Code:https://code.visualstudio.com/docs/editor/versioncontrol 100 | 101 | * Git:https://git-scm.com/ 102 | 103 | * Scott Chacon,Ben Straub. [Pro Git]( https://git-scm.com/book/en/v2/Getting-Started-About-Version-Control) 104 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /P3/README.md: -------------------------------------------------------------------------------- 1 | ## Practice 3(20) 2 | 3 | **Object-oriented Programming**:The General Rankine Cycle Simulator 4 | 5 | Apply computational thinking to solve more complex problems 6 | 7 | **Deadline:** 2019.05.19 8 | 9 | ## Contents and Requirements 10 | 11 | Reference [PyRankine](https://github.com/PySEE/PyRankine), design a general energy balance software with Python to analysis the following cycles: 12 | 13 | * [Example 8.1:An Ideal Regenerative Cycle](./rankine81.md) 14 | 15 | * [Example 8.5:A Regenerative Cycle with Open Feedwater Heater](./rankine85.md) 16 | 17 | * [Example 8.6:A Reheat–Regenerative Cycle with Two Feedwater Heaters](./rankine86.md) 18 | 19 | **注意**:练习不使用Jupyter Notebook;使用Visual Studio Code进行代码设计等工作,使用MS Word编写设计文档。 20 | 21 | ### 数据文件和Python3源码(12) 22 | 23 | * 数据文件:建立描述循环系统和设备的json文件(2) 24 | 25 | * Python3源码 26 | 27 | * 使用类描述循环中的设备(组件)、节点(5) 28 | 29 | * 编程读取系统描述json文件,解析其描述的循环系统,进行循环的能量平衡分析(4) 30 | 31 | * 数据文件:输出分析结果到数据文件(1) 32 | 33 | ### 软件设计工作Word文档(8) 34 | 35 | * 设计问题简要描述(1); 36 | 37 | * 程序设计方案简要描述(5) 38 | * 总体思路; 39 | * 系统json文件描述; 40 | * 节点和设备类的设计; 41 | * 循环能量平衡计算过程; 42 | 43 | * 设计工作小结(1) 44 | 45 | * Word排版(1): 版面整洁,合理划分和组织文档段落;页眉:练习三 学号 姓名; 页脚:页码 46 | 47 | * **无需** 封面和目录 48 | 49 | ## 提示 50 | 51 | [Example 8.6:A Reheat–Regenerative Cycle with Two Feedwater Heaters](./rankine86.md) 比 `Example8.1,8.5`, 多了不同类型的设备 52 | 53 | * reheater, trap 54 | 55 | * the closed feedwater heater, the opended feedwater heater with 1 drain water inlet 56 | 57 | 需要在理解示例基础上,增加新设备。 58 | 59 | 增加新设备的工作: 首先,需要规定好新设备的**唯一类型标识字符串**,然后,是设备的json描述,计算分析Python类实现及相关代码工作,实现更通用的循环计算程序。 60 | 61 | 通用Rankine Cycle程序的泛化要点: 62 | 63 | 1. 设备 64 | 65 | 2. 设备间连接关系 66 | 67 | 3. 系统能量平衡计算方法 68 | 69 | **Results for reference** 70 | 71 | * Example 8.1: [rankine81-sp.txt](./rankine81-sp.txt) 72 | 73 | * Example 8.5: [rankine85-sp.txt](./rankine85-sp.txt) 74 | 75 | * Example 8.6: [rankine86-sp.txt](./rankine86-sp.txt) 76 | 77 | **Download the ebook** 78 | 79 | Michael J . Moran. Fundamentals of Engineering Thermodynamics (7th Edition). John Wiley & Sons, Inc. 2011/(8th Edition) 2015 80 | 81 | Please download the ebook from SEU: http://www.lib.seu.edu.cn/ (查找资源->外文电子书->Wiley电子教材->T(工业技术)->TK(能源与动力工程)->TK1(热力工程,热机) 82 | 83 | ## Directories and Files 84 | 85 | ```bash 86 | ├── 87 | │ 88 | |── 89 | │ 90 | |── *.docx 设计工作Word文档 91 | | 92 | |── *.py 循环分析Python源码文件 93 | | 94 | |── components包的源码文件 95 | │ | 96 | │ │ ── *.py 97 | │ 98 | |── 各循环描述json文件 99 | │ | 100 | │ │ ── *.json 101 | │ 102 | |── 各循环分析结果文件 103 | | 104 | │ ── *.txt 105 | ``` 106 | 107 | ## 提交: 108 | 109 | * 1 电邮: cmh@seu.edu.cn 110 | * 主题:学号-姓名-3 111 | * 附件:工作目录压缩文件: **学号-姓名-3.zip**; 112 | 113 | * 2 截至时间:2019.05.19 114 | * 截至时间后可补交,补交得分<=13. (2019.06.16) 115 | 116 | * 3 改进更新:提交作业后可修改,修改截至时间:2019.06.16 117 | 118 | ## 参考资源: 119 | 120 | * [PySEE/PyRankine: step4,step5](https://github.com/PySEE/PyRankine) 121 | 122 | ### PyThermo 123 | 124 | * [RankineCycle OOP](http://nbviewer.ipython.org/github/PySEE/home/tree/S2019/notebook/Unit4-1-PyThermo-RankineCycle-OOP.ipynb) 125 | 126 | * [RankineCycle General](http://nbviewer.ipython.org/github/PySEE/home/tree/S2019/notebook/Unit4-2-PyThermo-RankineCycle-General.ipynb) 127 | 128 | * [Python: JSON](http://nbviewer.ipython.org/github/PySEE/home/tree/S2019/notebook/Unit4-3-PyThermo-Python-JSON.ipynb) 129 | 130 | -------------------------------------------------------------------------------- /P3/rankine85-sp.txt: -------------------------------------------------------------------------------- 1 | 2 | Rankine Cycle: Rankine85 3 | Net Power(MW) 100.00 4 | Mass Flow(kg/h) 368813.09 5 | Efficiency(%) 36.91 6 | Heat Rate(kJ/kWh) 9752.56 7 | Steam Rate(kg/kWh) 3.69 8 | totalWExtracted(MW) 100.88 9 | totalWRequired(MW) 0.88 10 | totalQAdded(MW) 270.90 11 | 12 | NodeID Name P(MPa) T(°C) H(kJ/kg) S(kJ/kg.K) V(m^3/kg) X FDOT MDOT(kg/h) 13 | 0 Boiler to Turbine 8.0 480.00 3349.53 6.66 0.040 1.0 1.0000 368813.09 14 | 1 Extracted Steam To Opened FWH 0.7 194.85 2833.66 6.86 0.296 1.0 0.1965 72482.58 15 | 2 Exhausted Steam to CD 0.008 41.51 2250.10 7.19 15.642 0.864 0.8035 296330.50 16 | 3 Condensate Water to CDW Pump 0.008 41.51 173.85 0.59 0.001 0.0 0.8035 296330.50 17 | 4 CDW Pump to Opened FWH 0.7 41.53 174.55 0.59 0.001 0.0 0.8035 296330.50 18 | 5 Opened FWH to FW Pump 0.7 164.95 697.14 1.99 0.001 0.0 1.0000 368813.09 19 | 6 FW Pump to Boiler 8.0 165.85 705.22 1.99 0.001 0.0 1.0000 368813.09 20 | 21 | Turbine Ex1 22 | NodeID Name P(MPa) T(°C) H(kJ/kg) S(kJ/kg.K) V(m^3/kg) X FDOT MDOT(kg/h) 23 | 0 Boiler to Turbine 8.0 480.00 3349.53 6.66 0.040 1.0 1.0000 368813.09 24 | 2 Exhausted Steam to CD 0.008 41.51 2250.10 7.19 15.642 0.864 0.8035 296330.50 25 | 1 Extracted Steam To Opened FWH 0.7 194.85 2833.66 6.86 0.296 1.0 0.1965 72482.58 26 | workExtracted(kJ/kg): 984.74 27 | WExtracted(MW): 100.88 28 | 29 | Condenser 30 | NodeID Name P(MPa) T(°C) H(kJ/kg) S(kJ/kg.K) V(m^3/kg) X FDOT MDOT(kg/h) 31 | 2 Exhausted Steam to CD 0.008 41.51 2250.10 7.19 15.642 0.864 0.8035 296330.50 32 | 3 Condensate Water to CDW Pump 0.008 41.51 173.85 0.59 0.001 0.0 0.8035 296330.50 33 | heatExtracted(kJ/kg) 1668.21 34 | QExtracted(MW): 170.90 35 | 36 | Condensate Pump 37 | NodeID Name P(MPa) T(°C) H(kJ/kg) S(kJ/kg.K) V(m^3/kg) X FDOT MDOT(kg/h) 38 | 3 Condensate Water to CDW Pump 0.008 41.51 173.85 0.59 0.001 0.0 0.8035 296330.50 39 | 4 CDW Pump to Opened FWH 0.7 41.53 174.55 0.59 0.001 0.0 0.8035 296330.50 40 | workRequired(kJ/kg): 0.56 41 | WRequired(MW): 0.06 42 | 43 | Opened Feedwater Heater 44 | NodeID Name P(MPa) T(°C) H(kJ/kg) S(kJ/kg.K) V(m^3/kg) X FDOT MDOT(kg/h) 45 | 1 Extracted Steam To Opened FWH 0.7 194.85 2833.66 6.86 0.296 1.0 0.1965 72482.58 46 | 4 CDW Pump to Opened FWH 0.7 41.53 174.55 0.59 0.001 0.0 0.8035 296330.50 47 | 5 Opened FWH to FW Pump 0.7 164.95 697.14 1.99 0.001 0.0 1.0000 368813.09 48 | heatAdded(kJ/kg) 522.59 49 | heatExtracted(kJ/kg) 522.59 50 | QAdded(MW) 53.54 51 | QExtracted(MW) 53.54 52 | 53 | Feedwater Pump 54 | NodeID Name P(MPa) T(°C) H(kJ/kg) S(kJ/kg.K) V(m^3/kg) X FDOT MDOT(kg/h) 55 | 5 Opened FWH to FW Pump 0.7 164.95 697.14 1.99 0.001 0.0 1.0000 368813.09 56 | 6 FW Pump to Boiler 8.0 165.85 705.22 1.99 0.001 0.0 1.0000 368813.09 57 | workRequired(kJ/kg): 8.07 58 | WRequired(MW): 0.83 59 | 60 | Boiler 61 | NodeID Name P(MPa) T(°C) H(kJ/kg) S(kJ/kg.K) V(m^3/kg) X FDOT MDOT(kg/h) 62 | 6 FW Pump to Boiler 8.0 165.85 705.22 1.99 0.001 0.0 1.0000 368813.09 63 | 0 Boiler to Turbine 8.0 480.00 3349.53 6.66 0.040 1.0 1.0000 368813.09 64 | heatAdded(kJ/kg) 2644.31 65 | QAdded(MW) 270.90 66 | -------------------------------------------------------------------------------- /P2/README.md: -------------------------------------------------------------------------------- 1 | ## Practice 2(15) 2 | 3 | **Python and Interactive Computing**:The Simple Simulator of Rankine Cycle 4 | 5 | Deadline: 2019.04.21 6 | 7 | ## Goal 8 | 9 | Use **Jupyter Notebook** to simulate the Rankine Cycle 10 | 11 | * description of the objects with the structure types,abstraction of procedure with functions 12 | 13 | * interactive analysis and literate programming 14 | 15 | ## 要求:(15) 16 | 17 | 设计分析 [Example 8.6:The Reheat–Regenerative Cycle with Two Feedwater Heater](./rankine86.md) 的Jupyter Notebook。 18 | 19 | 合理组织Notebook中的文档(Markdown Cell)和代码(Code Cell)。如:先给出被计算对象描述,然后,给出总体设计思路,进一步是各部分程序模块说明文字、代码,最后,是设计小结。 20 | 21 | ### Jupyter Notebook中的代码(10) 22 | 23 | 参考 [RankineCycle:SimVer](https://nbviewer.jupyter.org/github/PySEE/home/blob/S2019/notebook/Unit2-2-PyThermo-RankineCycle-SimVer.ipynb) 和 [RankineCycle:AdvVer](https://nbviewer.jupyter.org/github/PySEE/home/blob/S2019/notebook/Unit2-3-PyThermo-RankineCycle-AdvVer.ipynb) 24 | 25 | * 使用结构数据类型:**列表、字典**等描述循环中的状态点,设备和循环性能指标(4) 26 | 27 | * 基于数据结构的设计,使用**函数**封装计算模块,组织循环计算(3) 28 | 29 | * 参考循环计算结果输出: [rankine86-sp.txt](./data/rankine86-sp.txt),在Jupyter Notebook中输出工整的循环参数和性能指标等结果(3) 30 | 31 | * **可选:** 使用数据文件作为循环分析软件的输入输出 32 | 33 | * 参考循环状态点(节点:nodes)数据文件: [rankine86-nd.csv](./data/rankine86-nd.csv) 34 | 35 | * 参考设备数据文件: [rankine86-de.csv](./data/rankine86-de.csv) 36 | 37 | ### Jupyter Notebook中的文档(5) 38 | 39 | **格式(1)** 40 | 41 | 原则上采用Markdown,如果需特殊效果,可少量使用HTML/CSS; 公式用LaTeX(Math) 42 | 43 | **内容**: 44 | 45 | 问题描述(1);设计思路(1); 模块说明(1);小结(1) 46 | 47 | ## 工作提示 48 | 49 | 1. 阅读、运行和分析 [RankineCycle:SimVer](https://nbviewer.jupyter.org/github/PySEE/home/blob/S2019/notebook/Unit2-2-PyThermo-RankineCycle-SimVer.ipynb) 和 [RankineCycle:AdvVer](https://nbviewer.jupyter.org/github/PySEE/home/blob/S2019/notebook/Unit2-3-PyThermo-RankineCycle-AdvVer.ipynb),熟悉语言和设计思路 50 | 51 | 2. 阅读和运行 [RankineCycle86-Step0.ipynb](./RankineCycle86-Step0.ipynb) 熟悉分析对象 52 | 53 | 3. `Make a copy` [RankineCycle86-Step0.ipynb](./RankineCycle86-Step0.ipynb) 为`*-Copy1.ipynb`, 然后,重命名为设计用ipynb文件,如:`03016???-P2.ipynb` 54 | 55 | 4. 一般设计:可参考[RankineCycle:SimVer](https://nbviewer.jupyter.org/github/PySEE/home/blob/S2019/notebook/Unit2-2-PyThermo-RankineCycle-SimVer.ipynb),使用List,Dict和Function做较简单的抽象,编程实现计算,以后再逐步改进。 56 | 57 | 5. 更好设计:可参考[RankineCycle:AdvVer](https://nbviewer.jupyter.org/github/PySEE/home/blob/S2019/notebook/Unit2-3-PyThermo-RankineCycle-AdvVer.ipynb)。基于此设计思路的要点是:`新设备`程序设计的如下4个方面: 58 | 59 | * 1 设备的字典描述及计算函数; 2 增加设备到系统设备字典;3 从数据文件生成系统设备字典;4 基于系统设备字典的循环计算 60 | 61 | 6. 完善ipynb中的文字内容 62 | 63 | 7. `一般设计` 基本要求,做好可以有满意分数。`更好设计` 给有时间和兴趣,目标是满分的同学。 64 | 65 | 66 | ## Directories and Files 67 | 68 | ```bash 69 | ├── 70 | │ │ 71 | │ |── 72 | │ │ │ 73 | │ │ |── start.bat (内容为jupyter notebook的bat文件) 74 | │ │ │ 75 | │ │ |── *.ipynb (Example 8.6循环分析ipynb文件) 76 | │ │ | 77 | |── 存放数据文件 78 | │ | 79 | │ │ ── *.csv/txt 80 | │ 81 | |── 存放ipynb文件中使用的图片文件 82 | | 83 | │ ── *.jpg/png 84 | ``` 85 | 86 | ## 提交: 87 | 88 | * 1 电邮: cmh@seu.edu.cn 89 | 90 | * 主题:学号-姓名-2 91 | * 附件:压缩工作目录(如:P2),命名为: **学号-姓名-2.zip** 92 | 93 | * 2 **截至时间:** 2019.04.21 94 | 95 | * 截至时间后补交,补交得分<10. (2019.06.16) 96 | 97 | * 3 改进更新:提交作业后可改进,改进截至时间:2019.06.16 98 | 99 | ## Reference: 100 | 101 | * Michael J. Moran, Howard N. Shapiro, Daisie D. Boettner, Margaret B. Bailey. Fundamentals of Engineering Thermodynamics(7th Edition). John Wiley & Sons, Inc. 2011 102 | 103 | * The ebook at SEU http://www.lib.seu.edu.cn/ 104 | 105 | 查找资源->外文电子书->Wiley电子教材->T(工业技术)->TK(能源与动力工程)->TK1(热力工程,热机) 106 | 107 | * [Markdown](https://github.com/PySEE/home/blob/S2019/guide/Introduction2Markdown(Chinese).md) 108 | 109 | * Jupyter 110 | 111 | * Documentation. http://jupyter.readthedocs.org/en/latest/ 112 | 113 | * IPython https://ipython.org/ 114 | 115 | * A gallery of interesting notebook:https://github.com/jupyter/jupyter/wiki/A-gallery-of-interesting-Jupyter-Notebooks 116 | 117 | * [LaTeX Math](https://nbviewer.jupyter.org/github/PySEE/home/blob/S2019/notebook/Unit2-3-PyThermo-LaTeX-Math.ipynb) 118 | 119 | * [IAPWS-IF97 high-speed shared library:SEUIF97](https://github.com/PySEE/SEUIF97) 120 | 121 | 122 | 123 | 124 | 125 | -------------------------------------------------------------------------------- /P1/README.md: -------------------------------------------------------------------------------- 1 | ## Practice 1(15) 2 | 3 | **Basic Programming**: Python,Jupyter,Visual Studio Code,MinGW-W64,Github 4 | 5 | Deadline: 2019.03.17 6 | 7 | ## 练习内容 8 | 9 | 了解课程教学内容;参考 [The Guide of Building Software Environment](https://github.com/PySEE/home/tree/S2019/guide/BuildingSoftwareEnvironment.md), 建立软件开发环境; 编写简单代码,练习软件操作,完成相应的Word文档。 10 | 11 | **1** 了解Github给出简介 12 | 13 | **2** 建立Github账户,Fork不少于2个和课程学习内容有关的Github仓库到个人Github账户; 14 | 15 | **3** 安装Python解释器和软件包autopep8, pylint;用IDLE编一个简单Python程序: 代码中须有输出本人的学号和姓名的print语句。(不是使用 **Python Shell**解释输入的Python语句,是使用 **File** 编辑和运行Python程序源码) 16 | 17 | 科学计算等软件包可本次练习后,根据学习进度逐步安装` 18 | 19 | **4** 安装Jupyter, 编写一个Jupyter Notebook交互计算文件(ipynb) 20 | 21 | 从 [INTRODUCTION_TO_PYTHON](http://nbviewer.jupyter.org/github/PySEE/home/blob/S2019/notebook/Unit1-1-02-INTRODUCTION_TO_PYTHON.ipynb)中任选一小段文本和代码,编写练习要求的Jupyter Notebook文件: 22 | 23 | * 1)文本部分加上自己的学号和姓名(Markdown格式) 24 | * 2)代码部分加上用print输出自己的学号和姓名(Python3) 25 | 26 | **5** 安装MinGW-W64,Visual Studio Code和Python,C/C++插件; 用VS Code编写Python、C/C++程序 27 | 28 | * Python程序:从[INTRODUCTION_TO_PYTHON](http://nbviewer.jupyter.org/github/PySEE/home/blob/S2019/notebook/Unit1-1-02-INTRODUCTION_TO_PYTHON.ipynb)中任选一段代码,代码加上用print输出自己的学号和姓名。 29 | 30 | * C++程序: 使用VS Code修改 [hello.cpp](./cpp/hello.cpp) 代码, 将其中的"Change the text to your name"和"Change the text to your student ID",修改为自己的姓名( **用拼音,不要用中文** )和学号,使用MinGW-W64编译、运行. 31 | 32 | ```cpp 33 | #include 34 | using namespace std; 35 | 36 | int main() { 37 | cout << " Name: "<<"Change the text to your name(PIN YIN)"<`分页`,对文档分页) 64 | 65 | * 页脚:页码(通过`布局`->`分隔符`,插入`分节符`, 设定从`分节符`开始的页码编号) 66 | 67 | ## 练习目录和文件组织 68 | 69 | ```bash 70 | ├── 71 | │ │ 72 | │ |── 73 | │ │ │ 74 | │ │ |── 学号-姓名-1.docx 75 | │ │ │ 76 | │ │ |── : 存放练习中python源码文件夹, 文件名不要使用中文 77 | │ │ | | 78 | │ │ | │ ── *.py 79 | │ │ | 80 | │ │ |── : 存放练习中C/C++源码文件夹, 文件名不要使用中文 81 | │ │ | | 82 | │ │ | │ ── *.c/cpp 83 | │ │ │ 84 | │ │ │── 存放练习中Jupyter Notebook等文件夹, 文件名不要使用中文 85 | │ │ │ 86 | │ │ │── start.bat: 内容为jupyter notebook的bat文件 87 | │ │ │ 88 | │ │ |── *.ipynb 89 | │ │ 90 | | │ ── 91 | │ │ 92 | ``` 93 | 94 | ## 电邮提交: 95 | 96 | 将练习目录(如:P1)压缩为:**学号-姓名-1.zip** (Word文件,Python源码,Jupyter Notebook文件,C++源码等) 97 | 98 | * 1 电邮:cmh@seu.edu.cn 99 | 100 | * 主题:学号-姓名-1 101 | 102 | * 附件:学号-姓名-1.zip 103 | 104 | * 2 **截至时间:** 2019.03.17 105 | 106 | * 截至时间后可补交,补交得分<=10. (2019.06.16) 107 | 108 | * 3 改进更新:提交作业后可改进,改进截至时间:2019.06.16 109 | 110 | ## 参考: 111 | 112 | * [The Guide of Building Software Environment](https://github.com/PySEE/home/tree/S2019/guide/BuildingSoftwareEnvironment.md) 113 | 114 | * [Computer Terminal](https://github.com/PySEE/home/tree/S2019/guide/ComputerTerminal.md) 115 | 116 | * [Windows File System](https://github.com/PySEE/home/tree/S2019/guide/WindowsFileSystem.md) 117 | 118 | * [Problem and Answer](https://github.com/PySEE/home/tree/S2019/guide/Problem_Solution.md) 119 | 120 | * Github 121 | 122 | * 知乎:怎样使用GitHub. http://www.zhihu.com/question/20070065 123 | 124 | * [The Simple Guide of Github](https://github.com/PySEE/home/blob/S2019/guide/TheSimpleGuide2Github.md) 125 | 126 | * Thank you for 100 million repositories https://blog.github.com/2018-11-08-100M-repos/ 127 | 128 | * Git 129 | 130 | * Git:https://git-scm.com/ 131 | 132 | * [How to get started with GIT and work with GIT Remote Repo](http://www3.ntu.edu.sg/home/ehchua/programming/howto/Git_HowTo.html) 133 | 134 | * Scott Chacon,Ben Straub. [Pro Git](https://git-scm.com/book/en/v2/Getting-Started-About-Version-Control) 135 | 136 | * [DevTools-Git](http://nbviewer.jupyter.org/github/PySEE/home/blob/S2019/notebook/Unit7-5-DevTools-Git.ipynb) 137 | 138 | * Python https://www.python.org/ 139 | 140 | * Python development team. [Python Tutorial](https://docs.python.org/tutorial/index.html) 141 | 142 | * Jupyter http://jupyter.org/ 143 | 144 | * Jupyter Documentation. http://jupyter.readthedocs.org/en/latest/ 145 | 146 | * IPython https://ipython.org/ 147 | 148 | * A gallery of interesting notebook: https://github.com/jupyter/jupyter/wiki/A-gallery-of-interesting-Jupyter-Notebooks 149 | 150 | * Visual Studio Code https://code.visualstudio.com/ 151 | 152 | * Documentation: https://code.visualstudio.com/docs 153 | 154 | * Getting Started with **Python** https://code.visualstudio.com/docs/python/python-tutorial 155 | 156 | * **C/C++** for VS Code: https://code.visualstudio.com/docs/languages/cpp 157 | 158 | * **Git** Version Control in VS Code:https://code.visualstudio.com/docs/editor/versioncontrol 159 | 160 | * GCC, the GNU Compiler Collection:http://gcc.gnu.org/ 161 | 162 | * MinGW-W64:GCC for Windows 64 & 32 bits:http://mingw-w64.org/ 163 | 164 | * GCC and Make:Compiling, Linking and Building C/C++ Applications http://www3.ntu.edu.sg/home/ehchua/programming/cpp/gcc_make.html 165 | 166 | -------------------------------------------------------------------------------- /P2/data/rankine86-sp.txt: -------------------------------------------------------------------------------- 1 | 2 | Rankine Cycle: Rankine86 3 | Net Power(MW) 100.00 4 | Mass Flow(kg/h) 279487.57 5 | Efficiency(%) 43.05 6 | Heat Rate(kJ/kWh) 8361.70 7 | Steam Rate(kg/kWh) 2.79 8 | totalWExtracted(MW) 100.66 9 | totalWRequired(MW) 0.66 10 | totalQAdded(MW) 232.27 11 | 12 | NID STRID P(MPa) T(°C) H(kJ/kg) S(kJ/kg.K) V(m^3/kg) X FDOT MDOT(kg/h) 13 | 0 BO01-TB01-S 8.000 480.00 3349.527 6.661 0.0404 1.0 1.0000 279487.57 14 | 1 TB01-HH01-S 2.000 274.52 2964.051 6.661 0.1185 1.0 0.1497 41840.49 15 | 2 TB01-RH01-S 0.700 164.95 2742.629 6.661 0.2701 0.99 0.8503 237647.09 16 | 3 RH01-TB02-S 0.700 440.00 3353.806 7.759 0.4668 1.0 0.8503 237647.09 17 | 4 TB02-LH01-S 0.300 315.69 3101.619 7.759 0.9000 1.0 0.0947 26479.25 18 | 5 TB02-CD01-S 0.008 41.51 2428.789 7.759 16.9886 0.939 0.7556 211167.84 19 | 6 CD01-CP01-W 0.008 41.51 173.852 0.593 0.0010 0.0 0.7556 211167.84 20 | 7 CP01-LH01-W 0.300 41.52 174.146 0.593 0.0010 0.0 0.7556 211167.84 21 | 8 LH01-FP01-W 0.300 133.53 561.455 1.672 0.0011 0.0 1.0000 279487.57 22 | 9 FP01-HH01-W 8.000 134.25 569.704 1.672 0.0011 0.0 1.0000 279487.57 23 | 10 HH01-BO01-W 8.000 205.00 877.410 2.368 0.0012 0.0 1.0000 279487.57 24 | 11 HH01-TR01-W 2.000 212.38 908.622 2.447 0.0012 0.0 0.1497 41840.49 25 | 12 TR01-LH01-W 0.300 133.53 908.622 2.525 0.0981 0.16 0.1497 41840.49 26 | 27 | Steam Generator(BO01) 28 | NID STRID P(MPa) T(°C) H(kJ/kg) S(kJ/kg.K) V(m^3/kg) X FDOT MDOT(kg/h) 29 | 10 HH01-BO01-W 8.000 205.00 877.410 2.368 0.0012 0.0 1.0000 279487.57 30 | 0 BO01-TB01-S 8.000 480.00 3349.527 6.661 0.0404 1.0 1.0000 279487.57 31 | heatAdded(kJ/kg) 2472.12 32 | QAdded(MW) 191.92 33 | 34 | HP Turbine(TB01) 35 | NID STRID P(MPa) T(°C) H(kJ/kg) S(kJ/kg.K) V(m^3/kg) X FDOT MDOT(kg/h) 36 | 0 BO01-TB01-S 8.000 480.00 3349.527 6.661 0.0404 1.0 1.0000 279487.57 37 | 2 TB01-RH01-S 0.700 164.95 2742.629 6.661 0.2701 0.99 0.8503 237647.09 38 | 1 TB01-HH01-S 2.000 274.52 2964.051 6.661 0.1185 1.0 0.1497 41840.49 39 | workExtracted(kJ/kg): 573.75 40 | WExtracted(MW): 44.54 41 | 42 | Reheater(RH01) 43 | NID STRID P(MPa) T(°C) H(kJ/kg) S(kJ/kg.K) V(m^3/kg) X FDOT MDOT(kg/h) 44 | 2 TB01-RH01-S 0.700 164.95 2742.629 6.661 0.2701 0.99 0.8503 237647.09 45 | 3 RH01-TB02-S 0.700 440.00 3353.806 7.759 0.4668 1.0 0.8503 237647.09 46 | heatAdded(kJ/kg) 519.68 47 | QAdded(MW) 40.35 48 | 49 | LP Turbine(TB02) 50 | NID STRID P(MPa) T(°C) H(kJ/kg) S(kJ/kg.K) V(m^3/kg) X FDOT MDOT(kg/h) 51 | 3 RH01-TB02-S 0.700 440.00 3353.806 7.759 0.4668 1.0 0.8503 237647.09 52 | 5 TB02-CD01-S 0.008 41.51 2428.789 7.759 16.9886 0.939 0.7556 211167.84 53 | 4 TB02-LH01-S 0.300 315.69 3101.619 7.759 0.9000 1.0 0.0947 26479.25 54 | workExtracted(kJ/kg): 722.79 55 | WExtracted(MW): 56.11 56 | 57 | Condenser(CD01) 58 | NID STRID P(MPa) T(°C) H(kJ/kg) S(kJ/kg.K) V(m^3/kg) X FDOT MDOT(kg/h) 59 | 5 TB02-CD01-S 0.008 41.51 2428.789 7.759 16.9886 0.939 0.7556 211167.84 60 | 6 CD01-CP01-W 0.008 41.51 173.852 0.593 0.0010 0.0 0.7556 211167.84 61 | heatExtracted(kJ/kg) 1703.73 62 | QExtracted(MW): 132.27 63 | 64 | Condensate Pump(CP01) 65 | NID STRID P(MPa) T(°C) H(kJ/kg) S(kJ/kg.K) V(m^3/kg) X FDOT MDOT(kg/h) 66 | 6 CD01-CP01-W 0.008 41.51 173.852 0.593 0.0010 0.0 0.7556 211167.84 67 | 7 CP01-LH01-W 0.300 41.52 174.146 0.593 0.0010 0.0 0.7556 211167.84 68 | workRequired(kJ/kg): 0.22 69 | WRequired(MW): 0.02 70 | 71 | LP Feedwater Heater(LH01) 72 | NID STRID P(MPa) T(°C) H(kJ/kg) S(kJ/kg.K) V(m^3/kg) X FDOT MDOT(kg/h) 73 | 4 TB02-LH01-S 0.300 315.69 3101.619 7.759 0.9000 1.0 0.0947 26479.25 74 | 7 CP01-LH01-W 0.300 41.52 174.146 0.593 0.0010 0.0 0.7556 211167.84 75 | 8 LH01-FP01-W 0.300 133.53 561.455 1.672 0.0011 0.0 1.0000 279487.57 76 | 12 TR01-LH01-W 0.300 133.53 908.622 2.525 0.0981 0.16 0.1497 41840.49 77 | heatAdded(kJ/kg) 292.63 78 | heatExtracted(kJ/kg) 292.63 79 | heatExtracted_s(kJ/kg) 240.66 80 | heatExtracted_d(kJ/kg) 51.97 81 | QAdded(MW) 22.72 82 | QExtracted(MW) 22.72 83 | QExtracted_s(MW) 18.68 84 | QExtracted_d(MW) 4.03 85 | 86 | Feedwater Pump(FP01) 87 | NID STRID P(MPa) T(°C) H(kJ/kg) S(kJ/kg.K) V(m^3/kg) X FDOT MDOT(kg/h) 88 | 8 LH01-FP01-W 0.300 133.53 561.455 1.672 0.0011 0.0 1.0000 279487.57 89 | 9 FP01-HH01-W 8.000 134.25 569.704 1.672 0.0011 0.0 1.0000 279487.57 90 | workRequired(kJ/kg): 8.25 91 | WRequired(MW): 0.64 92 | 93 | HP Feedwater Heater(HH01) 94 | NID STRID P(MPa) T(°C) H(kJ/kg) S(kJ/kg.K) V(m^3/kg) X FDOT MDOT(kg/h) 95 | 1 TB01-HH01-S 2.000 274.52 2964.051 6.661 0.1185 1.0 0.1497 41840.49 96 | 11 HH01-TR01-W 2.000 212.38 908.622 2.447 0.0012 0.0 0.1497 41840.49 97 | 9 FP01-HH01-W 8.000 134.25 569.704 1.672 0.0011 0.0 1.0000 279487.57 98 | 10 HH01-BO01-W 8.000 205.00 877.410 2.368 0.0012 0.0 1.0000 279487.57 99 | heatAdded(kJ/kg): 307.71 100 | heatExtracted(kJ/kg): 307.71 101 | heatExtracted_s(kJ/kg): 307.71 102 | QAdded(MW) 23.89 103 | QExtracted(kJ/kg): 23.89 104 | QExtracted_s(kJ/kg): 23.89 105 | 106 | Trap(TR01) 107 | NID STRID P(MPa) T(°C) H(kJ/kg) S(kJ/kg.K) V(m^3/kg) X FDOT MDOT(kg/h) 108 | 11 HH01-TR01-W 2.000 212.38 908.622 2.447 0.0012 0.0 0.1497 41840.49 109 | 12 TR01-LH01-W 0.300 133.53 908.622 2.525 0.0981 0.16 0.1497 41840.49 110 | -------------------------------------------------------------------------------- /P3/rankine86-sp.txt: -------------------------------------------------------------------------------- 1 | 2 | Rankine Cycle: Rankine86 3 | Net Power(MW) 100.00 4 | Mass Flow(kg/h) 279487.57 5 | Efficiency(%) 43.05 6 | Heat Rate(kJ/kWh) 8361.70 7 | Steam Rate(kg/kWh) 2.79 8 | totalWExtracted(MW) 100.66 9 | totalWRequired(MW) 0.66 10 | totalQAdded(MW) 232.27 11 | 12 | NodeID Name P(MPa) T(°C) H(kJ/kg) S(kJ/kg.K) V(m^3/kg) X FDOT MDOT(kg/h) 13 | 0 MainSteamToHP 8.0 480.00 3349.53 6.66 0.040 1.0 1.0000 279487.57 14 | 1 ExtrateamHPToHH 2.0 274.52 2964.05 6.66 0.119 1.0 0.1497 41840.49 15 | 2 ExhauSteamHPToRH 0.7 164.95 2742.63 6.66 0.270 0.99 0.8503 237647.09 16 | 3 RHSteamToLP 0.7 440.00 3353.81 7.76 0.467 1.0 0.8503 237647.09 17 | 4 ExtraSteamLPToLH 0.3 315.69 3101.62 7.76 0.900 1.0 0.0947 26479.25 18 | 5 ExhauSteamLPToCd 0.008 41.51 2428.79 7.76 16.989 0.939 0.7556 211167.84 19 | 6 CdWaterToCdPump 0.008 41.51 173.85 0.59 0.001 0.0 0.7556 211167.84 20 | 7 CdPumpToLH 0.3 41.52 174.15 0.59 0.001 0.0 0.7556 211167.84 21 | 8 LHToFwPump 0.3 133.53 561.46 1.67 0.001 0.0 1.0000 279487.57 22 | 9 FwPumpToHH 8.0 134.25 569.70 1.67 0.001 0.0 1.0000 279487.57 23 | 10 HHToBoiler 8.0 205.00 877.41 2.37 0.001 0.0 1.0000 279487.57 24 | 11 HHDrainToTrap 2.0 212.38 908.62 2.45 0.001 0.0 0.1497 41840.49 25 | 12 TrapToLH 0.3 133.53 908.62 2.53 0.098 0.16 0.1497 41840.49 26 | 27 | Boiler1 28 | NodeID Name P(MPa) T(°C) H(kJ/kg) S(kJ/kg.K) V(m^3/kg) X FDOT MDOT(kg/h) 29 | 10 HHToBoiler 8.0 205.00 877.41 2.37 0.001 0.0 1.0000 279487.57 30 | 0 MainSteamToHP 8.0 480.00 3349.53 6.66 0.040 1.0 1.0000 279487.57 31 | heatAdded(kJ/kg) 2472.12 32 | QAdded(MW) 191.92 33 | 34 | HP Turbine 35 | NodeID Name P(MPa) T(°C) H(kJ/kg) S(kJ/kg.K) V(m^3/kg) X FDOT MDOT(kg/h) 36 | 0 MainSteamToHP 8.0 480.00 3349.53 6.66 0.040 1.0 1.0000 279487.57 37 | 2 ExhauSteamHPToRH 0.7 164.95 2742.63 6.66 0.270 0.99 0.8503 237647.09 38 | 1 ExtrateamHPToHH 2.0 274.52 2964.05 6.66 0.119 1.0 0.1497 41840.49 39 | workExtracted(kJ/kg): 573.75 40 | WExtracted(MW): 44.54 41 | 42 | Reheater 43 | NodeID Name P(MPa) T(°C) H(kJ/kg) S(kJ/kg.K) V(m^3/kg) X FDOT MDOT(kg/h) 44 | 2 ExhauSteamHPToRH 0.7 164.95 2742.63 6.66 0.270 0.99 0.8503 237647.09 45 | 3 RHSteamToLP 0.7 440.00 3353.81 7.76 0.467 1.0 0.8503 237647.09 46 | heatAdded(kJ/kg) 519.68 47 | QAdded(MW) 40.35 48 | 49 | LP Turbine 50 | NodeID Name P(MPa) T(°C) H(kJ/kg) S(kJ/kg.K) V(m^3/kg) X FDOT MDOT(kg/h) 51 | 3 RHSteamToLP 0.7 440.00 3353.81 7.76 0.467 1.0 0.8503 237647.09 52 | 5 ExhauSteamLPToCd 0.008 41.51 2428.79 7.76 16.989 0.939 0.7556 211167.84 53 | 4 ExtraSteamLPToLH 0.3 315.69 3101.62 7.76 0.900 1.0 0.0947 26479.25 54 | workExtracted(kJ/kg): 722.79 55 | WExtracted(MW): 56.11 56 | 57 | Condenser 58 | NodeID Name P(MPa) T(°C) H(kJ/kg) S(kJ/kg.K) V(m^3/kg) X FDOT MDOT(kg/h) 59 | 5 ExhauSteamLPToCd 0.008 41.51 2428.79 7.76 16.989 0.939 0.7556 211167.84 60 | 6 CdWaterToCdPump 0.008 41.51 173.85 0.59 0.001 0.0 0.7556 211167.84 61 | heatExtracted(kJ/kg) 1703.73 62 | QExtracted(MW): 132.27 63 | 64 | Condensate Pump 65 | NodeID Name P(MPa) T(°C) H(kJ/kg) S(kJ/kg.K) V(m^3/kg) X FDOT MDOT(kg/h) 66 | 6 CdWaterToCdPump 0.008 41.51 173.85 0.59 0.001 0.0 0.7556 211167.84 67 | 7 CdPumpToLH 0.3 41.52 174.15 0.59 0.001 0.0 0.7556 211167.84 68 | workRequired(kJ/kg): 0.22 69 | WRequired(MW): 0.02 70 | 71 | LP Feedwater Heater 72 | NodeID Name P(MPa) T(°C) H(kJ/kg) S(kJ/kg.K) V(m^3/kg) X FDOT MDOT(kg/h) 73 | 4 ExtraSteamLPToLH 0.3 315.69 3101.62 7.76 0.900 1.0 0.0947 26479.25 74 | 7 CdPumpToLH 0.3 41.52 174.15 0.59 0.001 0.0 0.7556 211167.84 75 | 8 LHToFwPump 0.3 133.53 561.46 1.67 0.001 0.0 1.0000 279487.57 76 | 12 TrapToLH 0.3 133.53 908.62 2.53 0.098 0.16 0.1497 41840.49 77 | heatAdded(kJ/kg) 387.31 78 | heatExtracted(kJ/kg) 387.31 79 | heatExtracted_s(kJ/kg) 277.36 80 | heatExtracted_d(kJ/kg) 109.95 81 | QAdded(MW) 22.72 82 | QExtracted(MW) 22.72 83 | QExtracted_s(MW) 18.68 84 | QExtracted_d(MW) 4.03 85 | 86 | Feedwater Pump 87 | NodeID Name P(MPa) T(°C) H(kJ/kg) S(kJ/kg.K) V(m^3/kg) X FDOT MDOT(kg/h) 88 | 8 LHToFwPump 0.3 133.53 561.46 1.67 0.001 0.0 1.0000 279487.57 89 | 9 FwPumpToHH 8.0 134.25 569.70 1.67 0.001 0.0 1.0000 279487.57 90 | workRequired(kJ/kg): 8.25 91 | WRequired(MW): 0.64 92 | 93 | HP Feedwater Heater 94 | NodeID Name P(MPa) T(°C) H(kJ/kg) S(kJ/kg.K) V(m^3/kg) X FDOT MDOT(kg/h) 95 | 1 ExtrateamHPToHH 2.0 274.52 2964.05 6.66 0.119 1.0 0.1497 41840.49 96 | 11 HHDrainToTrap 2.0 212.38 908.62 2.45 0.001 0.0 0.1497 41840.49 97 | 9 FwPumpToHH 8.0 134.25 569.70 1.67 0.001 0.0 1.0000 279487.57 98 | 10 HHToBoiler 8.0 205.00 877.41 2.37 0.001 0.0 1.0000 279487.57 99 | heatAdded(kJ/kg): 307.71 100 | heatExtracted(kJ/kg): 307.71 101 | Qdded(MW) 23.89 102 | QExtracted(MW) 23.89 103 | 104 | Trap 105 | NodeID Name P(MPa) T(°C) H(kJ/kg) S(kJ/kg.K) V(m^3/kg) X FDOT MDOT(kg/h) 106 | 11 HHDrainToTrap 2.0 212.38 908.62 2.45 0.001 0.0 0.1497 41840.49 107 | 12 TrapToLH 0.3 133.53 908.62 2.53 0.098 0.16 0.1497 41840.49 108 | -------------------------------------------------------------------------------- /P2/RankineCycle86-Step0.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# A Reheat–Regenerative Cycle with Two Feedwater Heaters\n", 8 | "\n", 9 | "Michael J . Mora. Fundamentals of Engineering Thermodynamics (7th Edition). John Wiley & Sons, Inc. 2011\n", 10 | "\n", 11 | "Chapter 8 vapor Power System: (Page 460-463)\n", 12 | "\n", 13 | "Example 8.6 : Considering a Reheat–Regenerative Cycle with Two Feedwater Heaters, a closed feedwater heater and an an\n", 14 | "open feedwater heater.\n", 15 | "\n", 16 | "* Steam enters the first turbine at 8.0 MPa, 480°C and expands to 0.7 MPa. \n", 17 | "\n", 18 | "* The steam is reheated to 440°C before entering the second turbine, where it expands to the condenser pressure of 0.008 MPa.\n", 19 | "\n", 20 | "* Steam is extracted from the first turbine at 2 MPa and fed to the closed feedwater heater. \n", 21 | "\n", 22 | "* Feedwater leaves the closed heater at 205°C and 8.0 MPa, and condensate exits as saturated liquid at 2 MPa. \n", 23 | "\n", 24 | "* The condensate is trapped into the open feedwater heater. \n", 25 | "\n", 26 | "* Steam extracted from the second turbine at 0.3 MPa is also fed into the open feedwater heater, which operates at 0.3 MPa. The stream exiting the open feedwater heater is saturated liquid at 0.3 MPa. \n", 27 | " \n", 28 | "* The net power output of the cycle is 100 MW. \n", 29 | "\n", 30 | "* There is no stray heat transfer from any component to its surroundings. \n", 31 | "\n", 32 | "* If the working fluid experiences no irreversibilities as it passes through the turbines, pumps, steam generator, reheater, and condenser, \n", 33 | "\n", 34 | "## SOLUTION\n", 35 | "\n", 36 | " * **Known:** A reheat–regenerative vapor power cycle operates with steam as the working fluid. Operating pressures\n", 37 | "and temperatures are specified, and the net power output is given.\n", 38 | "\n", 39 | " * **Find:** Determine the thermal efficiency and the mass flow rate entering the first turbine, in kg/h.\n", 40 | "\n", 41 | "![rankine86](./img/rankine86.jpg) \n", 42 | "\n", 43 | "## Engineering Model\n", 44 | "\n", 45 | " 1. Each component in the cycle is analyzed as a control volume at steady state. The control volumes are\n", 46 | "shown on the accompanying sketch by dashed lines.\n", 47 | "\n", 48 | " 2. There is no stray heat transfer from any component to its surroundings.\n", 49 | "\n", 50 | " 3. The working fluid undergoes internally reversible processes as it passes through the turbines, pumps,\n", 51 | "steam generator, reheater, and condenser.\n", 52 | "\n", 53 | " 4. The expansion through the trap is a throttling process.\n", 54 | "\n", 55 | " 5. Kinetic and potential energy effects are negligible.\n", 56 | "\n", 57 | " 6. Condensate exits the closed heater as a saturated liquid at 2 MPa. Feedwater exits the open heater as a saturated liquid at 0.3 MPa. Condensate exits the condenser as a saturated liquid.\n", 58 | " \n", 59 | "## Analysis\n", 60 | "\n", 61 | "Let us determine the specific enthalpies at the principal states of the cycle. \n" 62 | ] 63 | }, 64 | { 65 | "cell_type": "code", 66 | "execution_count": 1, 67 | "metadata": {}, 68 | "outputs": [ 69 | { 70 | "name": "stdout", 71 | "output_type": "stream", 72 | "text": [ 73 | "3349.5266902175404 6.661057438926857\n", 74 | "2964.050683560418 274.5205247261215\n", 75 | "2742.6287011144473 164.95275256333002\n", 76 | "3353.8055316540863 7.758809845023727\n", 77 | "3101.619288461554 315.68698354148023\n", 78 | "2428.7888945173413 41.51005270424139\n", 79 | "41.51005270424139 173.8517685972624 0.592531583591964 0.0010084729266462307\n", 80 | "174.14622426359287 41.51884414555008\n", 81 | "133.52535795710025 561.4554103021982 1.6717646729802556\n", 82 | "569.7038239103355 134.25233387175092\n", 83 | "877.4103307230511 2.3677163445155527\n", 84 | "212.38453533486518 908.621851211164 2.4470239085159298\n", 85 | "2.5254327498828832 133.52535795710025\n" 86 | ] 87 | } 88 | ], 89 | "source": [ 90 | "# determine the specific enthalpies at the principal states of the cycle. \n", 91 | "\n", 92 | "import seuif97 as if97\n", 93 | "\n", 94 | "# State 1 is superheated vapor at 8MPa, 480C.\n", 95 | "p1=8\n", 96 | "t1=480\n", 97 | "h1 = if97.pt2h(p1,t1)\n", 98 | "s1 =if97.pt2s(p1,t1) \n", 99 | "print(h1,s1)\n", 100 | "\n", 101 | "# State 2 is fixed by p2 =2.0MPa and the specific entropy s2, which is the same as that of state 1\n", 102 | "p2=2.0\n", 103 | "s2=s1\n", 104 | "h2 = if97.ps2h(p2,s2) \n", 105 | "t2=if97.ps2t(p2,s2) \n", 106 | "print(h2,t2)\n", 107 | "\n", 108 | "# State 3 is fixed by p2 =0.7MPa and the specific entropy s2, which is the same as that of state 1\n", 109 | "p3=0.7\n", 110 | "s3=s1\n", 111 | "h3 = if97.ps2h(p3,s3)\n", 112 | "t3=if97.ps2t(p3,s3) \n", 113 | "print(h3,t3) \n", 114 | "\n", 115 | "# State 4 is superheated vapor at 0.7 MPa, 440C.\n", 116 | "p4=0.7\n", 117 | "t4=440\n", 118 | "h4 = if97.pt2h(p4,t4) # in kj/kg\n", 119 | "s4 =if97.pt2s(p4,t4) \n", 120 | "print(h4,s4)\n", 121 | "\n", 122 | "# State 5 : p5 =0.3MPa and s5 = s4\n", 123 | "p5=0.3\n", 124 | "s5=s4\n", 125 | "h5 =if97.ps2h(p5,s5) \n", 126 | "t5=if97.ps2t(p5,s5)\n", 127 | "print(h5,t5) \n", 128 | "\n", 129 | "# State 6: p6=0.008MPA, s6= s4\n", 130 | "p6=0.008\n", 131 | "s6=s4\n", 132 | "h6 =if97.ps2h(p6,s6)\n", 133 | "t6 =if97.ps2t(p6,s6) \n", 134 | "print(h6,t6) \n", 135 | "\n", 136 | "# State 7 : p7=0.008MP Saturated water at the condenser exit\n", 137 | "p7=0.008\n", 138 | "t7=if97.px2t(p7,0)\n", 139 | "h7=if97.px2h(p7,0)\n", 140 | "s7=if97.px2s(p7,0)\n", 141 | "v7=if97.px2v(p7,0)\n", 142 | "print(t7,h7,s7,v7) \n", 143 | "\n", 144 | "# State 8 : p8=0.3MP at the exit of the first pump \n", 145 | "p8=0.3\n", 146 | "s8=s7\n", 147 | "h8=if97.ps2h(p8,s8)\n", 148 | "t8=if97.ps2t(p8,s8)\n", 149 | "print(h8,t8)\n", 150 | "\n", 151 | "# state 9 : The liquid leaving the open feedwater heater at is saturated liquid at 0.3 MPa\n", 152 | "p9=0.3\n", 153 | "t9=if97.px2t(p9,0)\n", 154 | "h9=if97.px2h(p9,0) \n", 155 | "s9=if97.px2s(p9,0)\n", 156 | "print(t9,h9,s9) \n", 157 | "\n", 158 | "# State 10 p=8.0Mpa, at the exit of the second pump,\n", 159 | "p10=8.0\n", 160 | "s10=s9\n", 161 | "h10 =if97.ps2h(p10,s10)\n", 162 | "t10 =if97.ps2t(p10,s10) \n", 163 | "print(h10,t10) \n", 164 | "\n", 165 | "# State 11: the feedwater exiting the closed heater\n", 166 | "p11=8.0\n", 167 | "t11=205\n", 168 | "h11 = if97.pt2h(p11,t11) # in kj/kg\n", 169 | "s11 =if97.pt2s(p11,t11) \n", 170 | "print(h11,s11) \n", 171 | "\n", 172 | "# State 12: the condensate leaving the closed heater is saturated at 2 MPa.\n", 173 | "p12=2.0\n", 174 | "t12=if97.px2t(p12,0)\n", 175 | "h12=if97.px2h(p12,0)\n", 176 | "s12=if97.px2s(p12,0)\n", 177 | "print(t12,h12,s12)\n", 178 | "\n", 179 | "# State 13: the fluid passing through the trap undergoes a throttling process\n", 180 | "p13=0.3\n", 181 | "h13=h12\n", 182 | "s13=if97.ph2s(p13,h13)\n", 183 | "t13=if97.ph2t(p13,h13)\n", 184 | "print(s13,t13)" 185 | ] 186 | }, 187 | { 188 | "cell_type": "markdown", 189 | "metadata": {}, 190 | "source": [ 191 | "The schematic diagram of the cycle is labeled with the fractions of the total flow into the turbine that remain\n", 192 | "at various locations. The fractions of the total flow diverted to the closed heater and open heater, respectively,\n", 193 | "are $y^{'}=\\frac{\\dot{m}_2}{\\dot{m}_1}$ and $y^{\"}=\\frac{\\dot{m}_5}{\\dot{m}_1}$, where $\\dot{m}_1$ denotes the mass flow rate entering the first turbine.\n", 194 | "\n", 195 | "The fraction $y^{'}$ can be determined by application of mass and energy rate balances to a control volume enclosing the closed heater. The result is\n", 196 | "\n", 197 | "$y^{'}=\\frac{h_{11}-h_{10}}{h_2-h_{12}}$\n", 198 | "\n", 199 | "The fraction $y^{\"}$ can be determined by application of mass and energy rate balances to a control volume enclosing\n", 200 | "the open heater, resulting in\n", 201 | "\n", 202 | "$0=y^{\"}h_5+(1-y^{'}-y^{\"})h_8+ y^{'}h_{13}-h_9$\n", 203 | "\n", 204 | "Solving for $y^{\"}$\n", 205 | "\n", 206 | "$y^{\"}=\\frac{(1-y^{'})h_8+ y^{'}h_{13}-h_9}{h_8-h_5}$" 207 | ] 208 | }, 209 | { 210 | "cell_type": "code", 211 | "execution_count": 2, 212 | "metadata": {}, 213 | "outputs": [ 214 | { 215 | "name": "stdout", 216 | "output_type": "stream", 217 | "text": [ 218 | "0.14970428650697784 0.09474213093251493\n" 219 | ] 220 | } 221 | ], 222 | "source": [ 223 | "ydash = (h11-h10)/(h2-h12) # the fraction of the total flow diverted to the closed heater\n", 224 | "ydashdash = ((1-ydash)*h8+ydash*h13-h9)/(h8-h5) # the fraction of the total flow diverted to the open heater\n", 225 | "print(ydash,ydashdash)" 226 | ] 227 | }, 228 | { 229 | "cell_type": "markdown", 230 | "metadata": {}, 231 | "source": [ 232 | "**SOLUTION**\n", 233 | "\n", 234 | "**(a)** The following work and heat transfer values are expressed on the basis of a unit mass entering the first turbine. \n", 235 | "\n", 236 | "The work developed by the first turbine per unit of mass entering is the sum\n", 237 | "\n", 238 | "$\\frac{\\dot{W}_{t1}}{\\dot{m}_1}=(h_1-h_2)+(1-y^{'})(h_2-h_3)$\n", 239 | "\n", 240 | "Similarly, for the second turbine\n", 241 | "\n", 242 | "$\\frac{\\dot{W}_{t2}}{\\dot{m}_1}=(1-y^{'})(h_4-h_5)+(1-y^{'}-y^{\"})(h_5-h_6)$\n", 243 | "\n", 244 | "For the first pump\n", 245 | "\n", 246 | "$\\frac{\\dot{W}_{p1}}{\\dot{m}_1}=(1-y^{'}-y^{\"})(h_8-h_7)$\n", 247 | "\n", 248 | "and for the second pump\n", 249 | "\n", 250 | "$\\frac{\\dot{W}_{p2}}{\\dot{m}_1}=(h_{10}-h_9)$\n", 251 | "\n", 252 | "The total heat added is the sum of the energy added by heat transfer during boiling/superheating and reheating. When expressed on the basis of a unit of mass entering the first turbine, this is\n", 253 | "\n", 254 | "$\\frac{\\dot{Q}_{in}}{\\dot{m}_1}=(h_1-h_{11})+(1-y^{'})(h_4-h_3)$\n", 255 | "\n", 256 | "With the foregoing values, the thermal efficiency is\n", 257 | "\n", 258 | "$\\eta =\\frac{\\dot{W}_{t1}/\\dot{m}_1+\\dot{W}_{t2}/\\dot{m}_1-\\dot{W}_{p1}/\\dot{m}_1-\\dot{W}_{p2}/\\dot{m}_1}{\\dot{Q}_{in}/\\dot{m}_1}$\n" 259 | ] 260 | }, 261 | { 262 | "cell_type": "code", 263 | "execution_count": 3, 264 | "metadata": {}, 265 | "outputs": [ 266 | { 267 | "name": "stdout", 268 | "output_type": "stream", 269 | "text": [ 270 | " The thermal efficiency is 43.05%\n" 271 | ] 272 | } 273 | ], 274 | "source": [ 275 | "# Part(a)\n", 276 | "wt1dot = (h1-h2) + (1-ydash)*(h2-h3) # The work developed by the first turbine per unit of mass entering in kj/kg\n", 277 | "wt2dot = (1-ydash)*(h4-h5) + (1-ydash-ydashdash)*(h5-h6) # The work developed by the second turbine per unit of mass in kj/kg\n", 278 | "\n", 279 | "wp1dot = (1-ydash-ydashdash)*(h8-h7) # The work for the first pump per unit of mass in kj/kg\n", 280 | "wp2dot = h10-h9 # The work for the second pump per unit of mass in kj/kg\n", 281 | "\n", 282 | "qindot = (h1-h11) + (1-ydash)*(h4-h3) # The total heat added expressed on the basis of a unit of mass entering the first turbine\n", 283 | "eta = (wt1dot+wt2dot-wp1dot-wp2dot)/qindot # thermal efficiency\n", 284 | "\n", 285 | "# Result\n", 286 | "print(' The thermal efficiency is {:>.2f}%'.format(100.0*eta))\n" 287 | ] 288 | }, 289 | { 290 | "cell_type": "markdown", 291 | "metadata": {}, 292 | "source": [ 293 | "**(b)** The mass flow rate entering the first turbine can be determined using the given value of the net power output. Thus\n", 294 | "\n", 295 | "$m_1=\\frac{W_{cycle}}{W_{t1}/m_1+W_{t2}/m_1-W_{p1}/m_1-W_{p2}/m_1}$" 296 | ] 297 | }, 298 | { 299 | "cell_type": "code", 300 | "execution_count": 4, 301 | "metadata": {}, 302 | "outputs": [ 303 | { 304 | "name": "stdout", 305 | "output_type": "stream", 306 | "text": [ 307 | " The mass flow rate of the steam entering the first turbine is 279487.57kg/h\n" 308 | ] 309 | } 310 | ], 311 | "source": [ 312 | "# Part(b)\n", 313 | "Wcycledot = 100.0 # the net power output of the cycle in MW\n", 314 | "m1dot = (Wcycledot*3600*10**3)/(wt1dot+wt2dot-wp1dot-wp2dot)\n", 315 | "# Result\n", 316 | "print(' The mass flow rate of the steam entering the first turbine is {:>.2f}kg/h'.format(m1dot))" 317 | ] 318 | }, 319 | { 320 | "cell_type": "code", 321 | "execution_count": null, 322 | "metadata": {}, 323 | "outputs": [], 324 | "source": [] 325 | } 326 | ], 327 | "metadata": { 328 | "kernelspec": { 329 | "display_name": "Python 3", 330 | "language": "python", 331 | "name": "python3" 332 | }, 333 | "language_info": { 334 | "codemirror_mode": { 335 | "name": "ipython", 336 | "version": 3 337 | }, 338 | "file_extension": ".py", 339 | "mimetype": "text/x-python", 340 | "name": "python", 341 | "nbconvert_exporter": "python", 342 | "pygments_lexer": "ipython3", 343 | "version": "3.7.2" 344 | }, 345 | "toc": { 346 | "base_numbering": 1, 347 | "nav_menu": {}, 348 | "number_sections": false, 349 | "sideBar": true, 350 | "skip_h1_title": false, 351 | "title_cell": "Table of Contents", 352 | "title_sidebar": "Contents", 353 | "toc_cell": false, 354 | "toc_position": {}, 355 | "toc_section_display": true, 356 | "toc_window_display": true 357 | } 358 | }, 359 | "nbformat": 4, 360 | "nbformat_minor": 1 361 | } 362 | -------------------------------------------------------------------------------- /self-exercises/Python-Quick-Review.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# The Quick Review of Python\n", 8 | "\n", 9 | "The notebook is designed for you to review python conveniently. Please finish the notebook by yourself.\n", 10 | "\n", 11 | "You may reference the structure to learn any new programming language\n", 12 | "\n", 13 | "## 1 Base Types and Operations\n", 14 | "\n", 15 | "* int, float,bool,None,Complex\n", 16 | "\n", 17 | "* String" 18 | ] 19 | }, 20 | { 21 | "cell_type": "code", 22 | "execution_count": null, 23 | "metadata": {}, 24 | "outputs": [], 25 | "source": [ 26 | "i=2\n", 27 | "f=2.0\n", 28 | "b=True\n", 29 | "none=None\n", 30 | "c=1+3j\n", 31 | "s='abc'\n", 32 | "print(i,f,b,none,c,s)" 33 | ] 34 | }, 35 | { 36 | "cell_type": "markdown", 37 | "metadata": {}, 38 | "source": [ 39 | "## 2 Control Flow\n", 40 | "\n", 41 | "The `if` statement\n", 42 | "\n", 43 | "The `while` Statement\n", 44 | "\n", 45 | "The `for` loop\n", 46 | "\n", 47 | "The `break` Statement\n", 48 | "\n", 49 | "The `continue` Statement" 50 | ] 51 | }, 52 | { 53 | "cell_type": "code", 54 | "execution_count": null, 55 | "metadata": {}, 56 | "outputs": [], 57 | "source": [] 58 | }, 59 | { 60 | "cell_type": "code", 61 | "execution_count": null, 62 | "metadata": {}, 63 | "outputs": [], 64 | "source": [] 65 | }, 66 | { 67 | "cell_type": "code", 68 | "execution_count": null, 69 | "metadata": {}, 70 | "outputs": [], 71 | "source": [] 72 | }, 73 | { 74 | "cell_type": "code", 75 | "execution_count": null, 76 | "metadata": {}, 77 | "outputs": [], 78 | "source": [] 79 | }, 80 | { 81 | "cell_type": "code", 82 | "execution_count": null, 83 | "metadata": {}, 84 | "outputs": [], 85 | "source": [] 86 | }, 87 | { 88 | "cell_type": "code", 89 | "execution_count": null, 90 | "metadata": {}, 91 | "outputs": [], 92 | "source": [] 93 | }, 94 | { 95 | "cell_type": "markdown", 96 | "metadata": {}, 97 | "source": [ 98 | "## 3 Function" 99 | ] 100 | }, 101 | { 102 | "cell_type": "code", 103 | "execution_count": null, 104 | "metadata": {}, 105 | "outputs": [], 106 | "source": [] 107 | }, 108 | { 109 | "cell_type": "code", 110 | "execution_count": null, 111 | "metadata": {}, 112 | "outputs": [], 113 | "source": [] 114 | }, 115 | { 116 | "cell_type": "markdown", 117 | "metadata": {}, 118 | "source": [ 119 | "## 4 Input, output and File" 120 | ] 121 | }, 122 | { 123 | "cell_type": "code", 124 | "execution_count": null, 125 | "metadata": {}, 126 | "outputs": [], 127 | "source": [] 128 | }, 129 | { 130 | "cell_type": "code", 131 | "execution_count": null, 132 | "metadata": {}, 133 | "outputs": [], 134 | "source": [] 135 | }, 136 | { 137 | "cell_type": "markdown", 138 | "metadata": {}, 139 | "source": [ 140 | "## 5 Module and Package" 141 | ] 142 | }, 143 | { 144 | "cell_type": "code", 145 | "execution_count": null, 146 | "metadata": {}, 147 | "outputs": [], 148 | "source": [] 149 | }, 150 | { 151 | "cell_type": "markdown", 152 | "metadata": {}, 153 | "source": [ 154 | "## 6 Data Structures\n", 155 | "\n", 156 | "Tuple,List,Dict" 157 | ] 158 | }, 159 | { 160 | "cell_type": "markdown", 161 | "metadata": {}, 162 | "source": [ 163 | "### Tuple\n", 164 | "\n", 165 | "* Collection of data ()\n", 166 | "\n", 167 | "* Members are accessed as strings(`index,slicing`)\n", 168 | "\n", 169 | "* Not immutable\n", 170 | "\n", 171 | "* Sequence unpacking\n", 172 | "\n", 173 | "* Processed faster than lists\n", 174 | " " 175 | ] 176 | }, 177 | { 178 | "cell_type": "code", 179 | "execution_count": null, 180 | "metadata": {}, 181 | "outputs": [], 182 | "source": [ 183 | "single_tuple=(10,)\n", 184 | "print(single_tuple)\n", 185 | "tuples=(1,2,9,4)\n", 186 | "print(tuples)\n", 187 | "print(tuples[1])\n", 188 | "print(tuples[1:3])" 189 | ] 190 | }, 191 | { 192 | "cell_type": "code", 193 | "execution_count": null, 194 | "metadata": {}, 195 | "outputs": [], 196 | "source": [ 197 | "tuples[0] = 10" 198 | ] 199 | }, 200 | { 201 | "cell_type": "code", 202 | "execution_count": null, 203 | "metadata": {}, 204 | "outputs": [], 205 | "source": [ 206 | "w,x,y,z, = tuples\n", 207 | "print(w,x)" 208 | ] 209 | }, 210 | { 211 | "cell_type": "markdown", 212 | "metadata": {}, 213 | "source": [ 214 | "### List\n", 215 | "\n", 216 | "* Collection of data [ ]\n", 217 | "\n", 218 | "* Members are accessed as strings(`index,slicing`)\n", 219 | "\n", 220 | "* `Mutable`: modify `in place` without creating a new object\n", 221 | "\n", 222 | "* `Often` used to store `homogeneous` values\n", 223 | " \n", 224 | " * e.g., Numbers, names with one data type \n", 225 | " \n", 226 | "* Sequence unpacking\n", 227 | "\n", 228 | "* **Cloning**: aliasing\n" 229 | ] 230 | }, 231 | { 232 | "cell_type": "code", 233 | "execution_count": null, 234 | "metadata": {}, 235 | "outputs": [], 236 | "source": [ 237 | "list1=[1,2,9,4]\n", 238 | "list1" 239 | ] 240 | }, 241 | { 242 | "cell_type": "code", 243 | "execution_count": null, 244 | "metadata": {}, 245 | "outputs": [], 246 | "source": [ 247 | "list1[0]" 248 | ] 249 | }, 250 | { 251 | "cell_type": "code", 252 | "execution_count": null, 253 | "metadata": {}, 254 | "outputs": [], 255 | "source": [ 256 | "list1[2:4] # slicing [start:end] [start to (end-1)]" 257 | ] 258 | }, 259 | { 260 | "cell_type": "code", 261 | "execution_count": null, 262 | "metadata": {}, 263 | "outputs": [], 264 | "source": [ 265 | "a,b,c,d=list1\n", 266 | "print(a,b,c,d)" 267 | ] 268 | }, 269 | { 270 | "cell_type": "code", 271 | "execution_count": null, 272 | "metadata": {}, 273 | "outputs": [], 274 | "source": [ 275 | "friends = ['john', 'pat', 'gary', 'michael']\n", 276 | "for name in friends:\n", 277 | " print(name)" 278 | ] 279 | }, 280 | { 281 | "cell_type": "markdown", 282 | "metadata": {}, 283 | "source": [ 284 | "#### Mutable" 285 | ] 286 | }, 287 | { 288 | "cell_type": "code", 289 | "execution_count": null, 290 | "metadata": {}, 291 | "outputs": [], 292 | "source": [ 293 | "list1=[1,2,9,4]\n", 294 | "list1" 295 | ] 296 | }, 297 | { 298 | "cell_type": "code", 299 | "execution_count": null, 300 | "metadata": {}, 301 | "outputs": [], 302 | "source": [ 303 | "list1[0]=100\n", 304 | "list1" 305 | ] 306 | }, 307 | { 308 | "cell_type": "code", 309 | "execution_count": null, 310 | "metadata": {}, 311 | "outputs": [], 312 | "source": [ 313 | "list1.append(0)\n", 314 | "list1" 315 | ] 316 | }, 317 | { 318 | "cell_type": "code", 319 | "execution_count": null, 320 | "metadata": {}, 321 | "outputs": [], 322 | "source": [ 323 | "list1.insert(0,22)\n", 324 | "list1" 325 | ] 326 | }, 327 | { 328 | "cell_type": "code", 329 | "execution_count": null, 330 | "metadata": {}, 331 | "outputs": [], 332 | "source": [ 333 | "del list1[0]\n", 334 | "list1" 335 | ] 336 | }, 337 | { 338 | "cell_type": "code", 339 | "execution_count": null, 340 | "metadata": {}, 341 | "outputs": [], 342 | "source": [ 343 | "list1.remove(9)\n", 344 | "list1" 345 | ] 346 | }, 347 | { 348 | "cell_type": "code", 349 | "execution_count": null, 350 | "metadata": {}, 351 | "outputs": [], 352 | "source": [ 353 | "list1.sort()\n", 354 | "list1" 355 | ] 356 | }, 357 | { 358 | "cell_type": "code", 359 | "execution_count": null, 360 | "metadata": {}, 361 | "outputs": [], 362 | "source": [ 363 | "list1.reverse()\n", 364 | "list1" 365 | ] 366 | }, 367 | { 368 | "cell_type": "markdown", 369 | "metadata": {}, 370 | "source": [ 371 | "#### List Comprehensions" 372 | ] 373 | }, 374 | { 375 | "cell_type": "code", 376 | "execution_count": null, 377 | "metadata": {}, 378 | "outputs": [], 379 | "source": [ 380 | "nums =[1,2,9,4]\n", 381 | "square = [ n*n for n in nums]\n", 382 | "square" 383 | ] 384 | }, 385 | { 386 | "cell_type": "markdown", 387 | "metadata": {}, 388 | "source": [ 389 | "#### Switch to list" 390 | ] 391 | }, 392 | { 393 | "cell_type": "code", 394 | "execution_count": null, 395 | "metadata": {}, 396 | "outputs": [], 397 | "source": [ 398 | "tuple1=(1,2)\n", 399 | "list1=list(tuple1)\n", 400 | "print(type(list1),list1)" 401 | ] 402 | }, 403 | { 404 | "cell_type": "markdown", 405 | "metadata": {}, 406 | "source": [ 407 | "### Dictionary\n", 408 | "\n", 409 | "* List of key-value pairs:{key:value,...}\n", 410 | "\n", 411 | " * the most common data type of key is **string** : dictionary = {\"key1”: value1, “key2”: value2}\n", 412 | "\n", 413 | "* `Unordered` collections of objects, `not indexed`\n", 414 | "\n", 415 | " * Store objects in a random order to provide faster lookup(`hash table`)\n", 416 | "\n", 417 | "* Element are `accessed by a keyword`, not index\n", 418 | "\n", 419 | "* Mutable: modify in place without creating a new object\n" 420 | ] 421 | }, 422 | { 423 | "cell_type": "code", 424 | "execution_count": null, 425 | "metadata": {}, 426 | "outputs": [], 427 | "source": [ 428 | "dict1={'Python':'language','linux':'GNU OS','Windows':'MS OS'}\n", 429 | "keys=dict1.keys()\n", 430 | "values=dict1.values()\n", 431 | "items=dict1.items()" 432 | ] 433 | }, 434 | { 435 | "cell_type": "code", 436 | "execution_count": null, 437 | "metadata": {}, 438 | "outputs": [], 439 | "source": [ 440 | "keys" 441 | ] 442 | }, 443 | { 444 | "cell_type": "code", 445 | "execution_count": null, 446 | "metadata": {}, 447 | "outputs": [], 448 | "source": [ 449 | "values" 450 | ] 451 | }, 452 | { 453 | "cell_type": "code", 454 | "execution_count": null, 455 | "metadata": {}, 456 | "outputs": [], 457 | "source": [ 458 | "items" 459 | ] 460 | }, 461 | { 462 | "cell_type": "code", 463 | "execution_count": null, 464 | "metadata": {}, 465 | "outputs": [], 466 | "source": [ 467 | "dict1[1]" 468 | ] 469 | }, 470 | { 471 | "cell_type": "code", 472 | "execution_count": null, 473 | "metadata": {}, 474 | "outputs": [], 475 | "source": [ 476 | "for key in dict1.keys():\n", 477 | " print(key, dict1[key])" 478 | ] 479 | }, 480 | { 481 | "cell_type": "code", 482 | "execution_count": null, 483 | "metadata": {}, 484 | "outputs": [], 485 | "source": [ 486 | "for key, value in dict1.items():\n", 487 | " print(key,value)" 488 | ] 489 | }, 490 | { 491 | "cell_type": "markdown", 492 | "metadata": {}, 493 | "source": [ 494 | "#### Mutable" 495 | ] 496 | }, 497 | { 498 | "cell_type": "code", 499 | "execution_count": null, 500 | "metadata": {}, 501 | "outputs": [], 502 | "source": [ 503 | "dict1['Python']='Programming Language'\n", 504 | "dict1" 505 | ] 506 | }, 507 | { 508 | "cell_type": "code", 509 | "execution_count": null, 510 | "metadata": {}, 511 | "outputs": [], 512 | "source": [ 513 | "dict1['C++']='Compiling Language'\n", 514 | "dict1" 515 | ] 516 | }, 517 | { 518 | "cell_type": "code", 519 | "execution_count": null, 520 | "metadata": {}, 521 | "outputs": [], 522 | "source": [ 523 | "keys" 524 | ] 525 | }, 526 | { 527 | "cell_type": "code", 528 | "execution_count": null, 529 | "metadata": {}, 530 | "outputs": [], 531 | "source": [ 532 | "values" 533 | ] 534 | }, 535 | { 536 | "cell_type": "code", 537 | "execution_count": null, 538 | "metadata": {}, 539 | "outputs": [], 540 | "source": [ 541 | "items" 542 | ] 543 | }, 544 | { 545 | "cell_type": "markdown", 546 | "metadata": {}, 547 | "source": [ 548 | "## 7 Class " 549 | ] 550 | }, 551 | { 552 | "cell_type": "code", 553 | "execution_count": null, 554 | "metadata": {}, 555 | "outputs": [], 556 | "source": [] 557 | }, 558 | { 559 | "cell_type": "code", 560 | "execution_count": null, 561 | "metadata": {}, 562 | "outputs": [], 563 | "source": [] 564 | }, 565 | { 566 | "cell_type": "code", 567 | "execution_count": null, 568 | "metadata": {}, 569 | "outputs": [], 570 | "source": [] 571 | }, 572 | { 573 | "cell_type": "markdown", 574 | "metadata": {}, 575 | "source": [ 576 | "## 8 Exception " 577 | ] 578 | }, 579 | { 580 | "cell_type": "code", 581 | "execution_count": null, 582 | "metadata": {}, 583 | "outputs": [], 584 | "source": [] 585 | }, 586 | { 587 | "cell_type": "markdown", 588 | "metadata": {}, 589 | "source": [ 590 | "## 9 The Standard Library" 591 | ] 592 | }, 593 | { 594 | "cell_type": "code", 595 | "execution_count": null, 596 | "metadata": {}, 597 | "outputs": [], 598 | "source": [] 599 | }, 600 | { 601 | "cell_type": "code", 602 | "execution_count": null, 603 | "metadata": {}, 604 | "outputs": [], 605 | "source": [] 606 | }, 607 | { 608 | "cell_type": "markdown", 609 | "metadata": {}, 610 | "source": [ 611 | "## 10 The Third Packages(Libraries)\n", 612 | "\n", 613 | "* numpy,scipy,matplotlib\n", 614 | "\n", 615 | "* seuif97" 616 | ] 617 | }, 618 | { 619 | "cell_type": "code", 620 | "execution_count": null, 621 | "metadata": {}, 622 | "outputs": [], 623 | "source": [] 624 | }, 625 | { 626 | "cell_type": "markdown", 627 | "metadata": {}, 628 | "source": [ 629 | "## 11 Development Tools\n", 630 | "\n", 631 | "* Unit test\n", 632 | "\n", 633 | "* Performance Analysis" 634 | ] 635 | }, 636 | { 637 | "cell_type": "code", 638 | "execution_count": null, 639 | "metadata": {}, 640 | "outputs": [], 641 | "source": [] 642 | }, 643 | { 644 | "cell_type": "code", 645 | "execution_count": null, 646 | "metadata": {}, 647 | "outputs": [], 648 | "source": [] 649 | }, 650 | { 651 | "cell_type": "code", 652 | "execution_count": null, 653 | "metadata": {}, 654 | "outputs": [], 655 | "source": [] 656 | }, 657 | { 658 | "cell_type": "code", 659 | "execution_count": null, 660 | "metadata": {}, 661 | "outputs": [], 662 | "source": [] 663 | }, 664 | { 665 | "cell_type": "markdown", 666 | "metadata": {}, 667 | "source": [ 668 | "## 12 Advanced Topics\n", 669 | "\n", 670 | "* Generators,Decorator\n", 671 | "\n", 672 | "* ctypes\n" 673 | ] 674 | }, 675 | { 676 | "cell_type": "code", 677 | "execution_count": null, 678 | "metadata": {}, 679 | "outputs": [], 680 | "source": [] 681 | }, 682 | { 683 | "cell_type": "code", 684 | "execution_count": null, 685 | "metadata": {}, 686 | "outputs": [], 687 | "source": [] 688 | } 689 | ], 690 | "metadata": { 691 | "kernelspec": { 692 | "display_name": "Python 3", 693 | "language": "python", 694 | "name": "python3" 695 | }, 696 | "language_info": { 697 | "codemirror_mode": { 698 | "name": "ipython", 699 | "version": 3 700 | }, 701 | "file_extension": ".py", 702 | "mimetype": "text/x-python", 703 | "name": "python", 704 | "nbconvert_exporter": "python", 705 | "pygments_lexer": "ipython3", 706 | "version": "3.7.2" 707 | }, 708 | "toc": { 709 | "base_numbering": 1, 710 | "nav_menu": {}, 711 | "number_sections": false, 712 | "sideBar": true, 713 | "skip_h1_title": false, 714 | "title_cell": "Table of Contents", 715 | "title_sidebar": "Contents", 716 | "toc_cell": false, 717 | "toc_position": {}, 718 | "toc_section_display": true, 719 | "toc_window_display": true 720 | } 721 | }, 722 | "nbformat": 4, 723 | "nbformat_minor": 2 724 | } 725 | --------------------------------------------------------------------------------