<commit_before># PyRankine

The **step-by-step codes** of the rankine cycle simulator from zero abstraction to the general abstraction are provided in the  PyRankine.
 
We wish that the PyRankine may be a helpful vehicle for  you to understand **Computational Thinking** and improve the skills of programming.

* step 0 :  **Zero Abstraction** of The Ideal Rankine Cycle

      the simple data type and expression only 

* step 1 : **Simple Abstraction** of The Ideal Rankine Cycle

      structure data type: List,Dict and functions
      
* step 2 : **Basic Object-Orientation Abstraction** of The Ideal Rankine Cycle

      object-oriented programming 
     
* step 3 : **Basic Object-Orientation Abstraction**  and **Data Representation** of The Ideal Rankine Cycle
     
     [Rankine Cycle Representation of CSV or JSON File](./step3/README.md)
     
     object-oriented programming and data files: 
                   
       step3-csv: csv file 

       step3-json: json file
      
* step 4 : **General Abstraction** and **Data Representation** of Rankine Cycle

     [The UML diagram of the step4-json](./step4/UML-STEP4-JSON.md)
                
     object-oriented programming,general module
                      
      <NAME>. Fundamentals of Engineering Thermodynamics(7th Edition), Chapter 8 : Vapour Power Systems 
          1) Example 8.1: The Ideal Rankine Cycle, Page 438
          2) Example 8.5: A Regenerative Cycle with Open Feedwater Heater,Page 456

      step4-csv: csv file

      step4-json: json file       

      step4-json-dict: json file  and  __init__ device with dict,modified the component class       

## Run

```bash
cd step0/1/2/3/4
python rankine.py
``` 

## Dependencies：SEUIF97

* IAPWS-IF97 high-speed shared library

  * https://github.com/PySEE/SEUIF97

## Example Rankine Cycles

* <NAME>, <NAME>, <NAME>, <NAME>. Fundamentals of Engineering Thermodynamics(7th Edition). John Wiley & Sons, Inc. 2011

      Chapter 8 : Vapour Power Systems 
        1) Example 8.1: Analyzing an Ideal Rankine Cycle, Page 438
        2) Example 8.5：A Regenerative Cycle with Open Feedwater Heater, Page 456

####  Example 8.1: Analyzing an Ideal Rankine Cycle  Page 438

   * Steam is the working fluid in an ideal Rankine cycle. 

   * Saturated vapor enters the turbine at 8.0 MPa 
   
   * Saturated liquid exits the condenser at a pressure of 0.008 MPa. 

   * The net power output of the cycle is 100 MW.

   * Cooling water enters the condenser at 15°C and exits at 35°C.

![rankine81](./step4/img/rankine81.jpg)

* Determine for the cycle

  * the thermal efficiency, %

  * the back work ratio,  %

  * the mass flow rate of the steam,in kg/h,

  * the rate of heat transfer, Qin, into the working fluid as it passes through the boiler, in MW,

  * the rate of heat transfer, Qout, from the condensing steam as it passes through the condenser, in MW,

  * the mass flow rate of the condenser cooling water, in kg/h

####  Example 8.5: A Regenerative Cycle with Open Feedwater Heater, Page 456

Consider a regenerative vapor power cycle with one open feedwater heater.

* Steam enters the turbine at 8.0 MPa, 480°C and expands to 0.7 MPa, 

* Some of the steam is extracted and diverted to the open feedwater heater operating at 0.7 MPa. 

* The remaining steam expands through the second-stage turbine to the condenser pressure of 0.008 MPa

* Saturated liquid exits the open feedwater heater at 0.7 MPa. 

* The isentropic efficiency of each turbine  stage is 85% and each pump operates isentropically. 

If the net power output of the cycle is 100 MW, determine

* (a) the thermal efficiency  %

* (b) the mass flow rate of steam entering the first turbine stage, in kg/h.

If the mass flow rate of steam entering the first-stage turbine were 150 kg/s 

* (a) what would be the net power, in MW

* (b) the fraction of steam extracted, y? 

![rankine85](./step4/img/rankine85.jpg)

Engineering Model:

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.

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.

3. The turbines, pumps, and feedwater heater operate adiabatically.

4. Kinetic and potential energy effects are negligible.

5. Saturated liquid exits the open feedwater heater, and saturated liquid exits the condenser.

### The Jupyter Notebooks of Rankine Cycle

* [Example 8.1: Ideal Rankine Cycle: Step0,Step1](http://nbviewer.jupyter.org/github/PySEE/PyRankine/blob/master/notebook/IdealRankineCycle-Step0-1.ipynb)

* [Example 8.1: Ideal Rankine Cycle: Step2](http://nbviewer.jupyter.org/github/PySEE/PyRankine/blob/master/notebook/IdealRankineCycle-Step2.ipynb)

* [Example 8.3,8.4: A Reheat Cycle and Turbine Irreversibility: Step0](http://nbviewer.jupyter.org/github/PySEE/PyRankine/blob/master/notebook/RankineCycle83-84-Step0.ipynb)

* [Example 8.5: A Regenerative Cycle with Open Feedwater Heater: Step0](http://nbviewer.jupyter.org/github/PySEE/PyRankine/blob/master/notebook/RankineCycle85-Step0.ipynb)
<commit_msg>add jupyter example<commit_after># PyRankine

The **step-by-step codes** of the rankine cycle simulator from zero abstraction to the general abstraction are provided in the  PyRankine.
 
We wish that the PyRankine may be a helpful vehicle for  you to understand **Computational Thinking** and improve the skills of programming.

* step 0 :  **Zero Abstraction** of The Ideal Rankine Cycle

      the simple data type and expression only 

* step 1 : **Simple Abstraction** of The Ideal Rankine Cycle

      structure data type: List,Dict and functions
      
* step 2 : **Basic Object-Orientation Abstraction** of The Ideal Rankine Cycle

      object-oriented programming 
     
* step 3 : **Basic Object-Orientation Abstraction**  and **Data Representation** of The Ideal Rankine Cycle
     
     [Rankine Cycle Representation of CSV or JSON File](./step3/README.md)
     
     object-oriented programming and data files: 
                   
       step3-csv: csv file 

       step3-json: json file
      
* step 4 : **General Abstraction** and **Data Representation** of Rankine Cycle

     [The UML diagram of the step4-json](./step4/UML-STEP4-JSON.md)
                
     object-oriented programming,general module
                      
      <NAME>. Fundamentals of Engineering Thermodynamics(7th Edition), Chapter 8 : Vapour Power Systems 
          1) Example 8.1: The Ideal Rankine Cycle, Page 438
          2) Example 8.5: A Regenerative Cycle with Open Feedwater Heater,Page 456

      step4-csv: csv file

      step4-json: json file       

      step4-json-dict: json file  and  __init__ device with dict,modified the component class       

## Run

```bash
cd step0/1/2/3/4
python rankine.py
``` 

## Dependencies：SEUIF97

* IAPWS-IF97 high-speed shared library

  * https://github.com/PySEE/SEUIF97

## Example Rankine Cycles

* <NAME>, <NAME>, <NAME>, <NAME>. Fundamentals of Engineering Thermodynamics(7th Edition). John Wiley & Sons, Inc. 2011

      Chapter 8 : Vapour Power Systems 
        1) Example 8.1: Analyzing an Ideal Rankine Cycle, Page 438
        2) Example 8.5：A Regenerative Cycle with Open Feedwater Heater, Page 456

####  Example 8.1: Analyzing an Ideal Rankine Cycle  Page 438

   * Steam is the working fluid in an ideal Rankine cycle. 

   * Saturated vapor enters the turbine at 8.0 MPa 
   
   * Saturated liquid exits the condenser at a pressure of 0.008 MPa. 

   * The net power output of the cycle is 100 MW.

   * Cooling water enters the condenser at 15°C and exits at 35°C.

![rankine81](./step4/img/rankine81.jpg)

* Determine for the cycle

  * the thermal efficiency, %

  * the back work ratio,  %

  * the mass flow rate of the steam,in kg/h,

  * the rate of heat transfer, Qin, into the working fluid as it passes through the boiler, in MW,

  * the rate of heat transfer, Qout, from the condensing steam as it passes through the condenser, in MW,

  * the mass flow rate of the condenser cooling water, in kg/h

####  Example 8.5: A Regenerative Cycle with Open Feedwater Heater, Page 456

Consider a regenerative vapor power cycle with one open feedwater heater.

* Steam enters the turbine at 8.0 MPa, 480°C and expands to 0.7 MPa, 

* Some of the steam is extracted and diverted to the open feedwater heater operating at 0.7 MPa. 

* The remaining steam expands through the second-stage turbine to the condenser pressure of 0.008 MPa

* Saturated liquid exits the open feedwater heater at 0.7 MPa. 

* The isentropic efficiency of each turbine  stage is 85% and each pump operates isentropically. 

If the net power output of the cycle is 100 MW, determine

* (a) the thermal efficiency  %

* (b) the mass flow rate of steam entering the first turbine stage, in kg/h.

If the mass flow rate of steam entering the first-stage turbine were 150 kg/s 

* (a) what would be the net power, in MW

* (b) the fraction of steam extracted, y? 

![rankine85](./step4/img/rankine85.jpg)

Engineering Model:

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.

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.

3. The turbines, pumps, and feedwater heater operate adiabatically.

4. Kinetic and potential energy effects are negligible.

5. Saturated liquid exits the open feedwater heater, and saturated liquid exits the condenser.

## The Jupyter Notebooks of Rankine Cycle

* [Example 8.1: Ideal Rankine Cycle: Step0,Step1](http://nbviewer.jupyter.org/github/PySEE/PyRankine/blob/master/notebook/IdealRankineCycle-Step0-1.ipynb)

* [Example 8.1: Ideal Rankine Cycle: Step2](http://nbviewer.jupyter.org/github/PySEE/PyRankine/blob/master/notebook/IdealRankineCycle-Step2.ipynb)

* [Example 8.3,8.4: A Reheat Cycle and Turbine Irreversibility: Step0](http://nbviewer.jupyter.org/github/PySEE/PyRankine/blob/master/notebook/RankineCycle83-84-Step0.ipynb)

* [Example 8.5: A Regenerative Cycle with Open Feedwater Heater: Step0](http://nbviewer.jupyter.org/github/PySEE/PyRankine/blob/master/notebook/RankineCycle85-Step0.ipynb)

{'fraction_non_alphanumeric': 0.07484828051247472, 'fraction_numerical': 0.027742992004623834, 'mean_word_length': 3.371368421052632, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '271656', 'n_tokens_mistral': 3456, 'n_tokens_neox': 3025, 'n_words': 1282}