ISRN LUTMDN/TMHP-12/5261-SE ISSN 0282-1990 A working fluid selection program for Organic Rankine Cycle Mikael Olsson 2012 Master Thesis Department of Energy sciences Division of Thermal power engineering Abstract This thesis handles the problem with fluid selection in organic Rankine cycles application. The main goal was to write a program that based on user defined variables finds the maximum power output from a range of fluids. The program was programmed in Matlab and is coupled with REFPROP that return the fluids characteristics as enthalpy and entropy etc. The program is preloaded with the fluids found from the literature review. These fluids were the best to use according to the respective authors. The result is generated with the main code of the program but using a different solver. The result section consists of multiple temperatures while the main program is designed to be used with one fix heating and one cooling temperature. Also a turbine calculation was written to be coupled with the main program. The results show that superheating have a negative impact on the output power and should be kept as small as possible. Some fluids however should have some superheating to avoid moisture in the expansion process. There are three types of fluids that is found: wet, dry and isentropic. The wet fluids are the ones that should have a degree of superheating as their expansion process otherwise might end in the wet region of the T-s diagram i.e. moisture at the end. The cooling has a major impact on the performance. A fluid that’s the best performing with a low cooling temperature isn’t necessary the best if the cooling temperature is increased. As the superheating should be kept low the main program uncertain parameter, if the user should define the pinch-point to the heating media or the amount of superheating, is set to last the mentioned. ii iii Contents 1 2 Introduction ..................................................................................................................................... 1 1.1 Background ............................................................................................................................. 1 1.2 Objective ................................................................................................................................. 1 1.3 Organic fluids properties ......................................................................................................... 2 1.4 Limitations............................................................................................................................... 4 1.5 Acknowledgements ................................................................................................................. 5 Method............................................................................................................................................. 7 2.1 Used ......................................................................................................................................... 7 2.2 Literature review ..................................................................................................................... 7 2.3 ORC Program .......................................................................................................................... 9 2.3.1 Subcritical ...................................................................................................................... 10 2.3.2 Supercritical................................................................................................................... 17 2.3.3 Optimum ........................................................................................................................ 20 2.4 2.4.1 Saturated cycle............................................................................................................... 21 2.4.2 Superheating with no evaporation in the reheater ......................................................... 21 2.4.3 Superheating with evaporation allowed in the reheater ................................................. 21 2.5 3 Tweaked ORC program ......................................................................................................... 21 Turbine .................................................................................................................................. 22 2.5.1 Turbine calculation ........................................................................................................ 22 2.5.2 Stage calculation............................................................................................................ 29 Result ............................................................................................................................................. 35 3.1 Result from the main code..................................................................................................... 35 3.1.1 Saturated ........................................................................................................................ 35 3.1.2 Superheated with no evaporation in reheater ................................................................ 37 3.1.3 Superheating with evaporation allowed in reheater ...................................................... 38 3.1.4 Mass flow superheated and saturated ............................................................................ 40 3.2 The Main Program................................................................................................................. 41 4 Discussion ..................................................................................................................................... 42 5 Conclusion and Future Work ......................................................................................................... 45 6 5.1 Conclusion ............................................................................................................................. 45 5.2 Future work ........................................................................................................................... 45 5.2.1 ORC program ................................................................................................................ 45 5.2.2 Turbine .......................................................................................................................... 45 Program use ................................................................................................................................... 47 6.1.1 Initial screen showing on startup. .................................................................................. 47 iv 6.1.2 Heat source selected ...................................................................................................... 47 6.1.3 Cycle properties selected ............................................................................................... 48 6.1.4 Component Data ............................................................................................................ 49 6.1.5 Substances ..................................................................................................................... 50 6.1.6 Cooling .......................................................................................................................... 50 6.1.7 End result ....................................................................................................................... 51 7 References ..................................................................................................................................... 55 8 Appendix A.................................................................................................................................... 57 9 8.1 ORC Program ........................................................................................................................ 57 8.2 Heat source files .................................................................................................................. 104 Appendix B.................................................................................................................................. 106 9.1 Turbine ................................................................................................................................ 106 9.2 Turbine calculation .............................................................................................................. 123 9.3 Stage calculation.................................................................................................................. 127 10 Appendix C.............................................................................................................................. 132 10.1 How to connect REFPROP to MATLAB ............................................................................ 132 v Nomenclature A a b c cN, cr cp Cp Cp cv h m M P ploss Q q R r Re s T, t U v w Ytot Annular area Velocity of sound Axial chord Absolute velocity Blade chord Constant pressure specific heat Diffuser pressure recovery coefficient Diffuser Pressure recovery coefficient Constant volume specific heat Enthalpy Mass flow Molar weight Pressure Pressure loss Heat Dynamic pressure, specific heat Specific gas constant Radius, reaction Reynolds number Entropy Temperature Blade speed Absolute velocity Relative velocity Total loss coefficient Greek α β ε η θ λ μ ν ρ ϕ ψ Absolute flow angle Relative flow angle Efficiency heat exchanger Isentropic efficiency Stagger angle Stage load coefficient Axial velocity ratio Specific volume, Blade speed ratio Density Stage flow coefficient Stage load coefficient vi Subscript 0 1 2 3 4 5 6 7 8 9 cool high hub low m N p r s SPVH t tip VPPH Total states Nozzle entry. State after condenser Nozzle exit and rotor inlet. State after pump Rotor exit. State after reheater pump pressure side. State before turbine State after turbine Condensation state State after preheater State after evaporator State after reheater condenser pressure side Cooling media Heat source inlet Blade hub Heat source outlet Mean value Nozzle Pump Rotor isentropic State of heat source between super heater and evaporator. turbine Blade tip State of heat source between evaporator and preheater vii 1 Introduction 1.1 Background Organic Rankine cycles are becoming more and more interesting as the need for energy conservation is increasing. An ORC can be used to produce electrical power from low-grade heat like industrial waste heat, geothermal water and solar. The major part of the world’s electricity is produced with fossil fuels [1] and a large part of the energy is wasted. Quoilin et al. [2] even states that as much as 50 % of heat generated in industry is waste heat, i.e. the potential of energy recovery is vast. Many reports have been published on the subject of optimal fluids to be used in an ORC. The conditions for these “optimum” fluids differs which makes the results hard to overview. Also the screening process of fluids differs from the reports, as some screens for high critical temperature while others screen for low environmental impact. A program is needed for calculation of electrical power output, available from a heat source where the working fluid(s) can be chosen and find the optimum pressure and medium for highest power output. 1.2 Objective There is no such thing as an optimum fluid to use in ORC and there is therefore much confusion in what to choose as working fluid. Many reports show an optimum fluid under their respective conditions thus stating that the other fluids perform worse. However with a decrease or increase of temperature the optimal fluid could change as some of the other fluids might perform better. Also many reports do not focus on what could be produced from a given heat source but instead decides a power output and finds what heat is needed. The goal of this Master thesis work is to write a program that with a given temperature and mass flow of an heat source, oil or water, calculate what fluid and pressure from user defined parameters that gives the highest power output. The user defined parameters that will be set by the user is: What heat source, water or oil. Temperature and mass flow of the heat source If water is used, then the pressure of this must be set Pressures, between which pressures is the program going to search between and what interval If the fluid should be superheated when running subcritical cycle. Isentropic efficiencies of pump and turbine Which fluids the program is going to try Cooling, air or water. User can choose to specify the inlet temperature or use a default value. Ambient temperature Pinch-points for condenser and preheater, pressure drop heat exchangers, efficiency of reheater and temperature rise of the cooling media during the condensation. All of these have default values that can be loaded by the user. The program has been written in MATLAB and has a graphical interface to make it easier for the user. 1 The program is also tweaked to do an analysis of the ambient temperature effect on the performance of the cycle for different heating temperatures with two mediums. The result of this will be presented in section 5. A turbine program was also created to enable the user to do a turbine calculation if wanted. The turbine will not be a part of the result. 1.3 Organic fluids properties From the normal steam cycle we know the look of the saturation curve of water in the T-s diagram. Organic fluids (and refrigerants) however can have a different kind of curves. The different mediums can be characterized based on three different curves that occur and can be seen in figures 1-3. The bell-shaped curve, or b-cycle [3], as seen in figure 1 is familiar from waters saturation curve. The slope is positive on the liquid side and negative on the vapour side. With the negative slope of the curve and without superheating the expansion often ends somewhere in the moist region and therefore fluids of this type is referred to as wet fluids. Figure 1: The b-cycle or the wet fluids T-s diagram Figure 2: The o-cycle or the dry fluids T-s diagram. Figure 3: The isentropic fluids T-s diagram 2 The overhanging shape, the o-cycle, can be seen in figure 2. The fluids of this type is often referred to as dry fluids because the positive slope on the vapour side makes moisture in the end of expansion almost impossible because it’s still in the superheated area. Only very small expansions from a high pressure or expansion to very small pressures might result in moisture. The last shape is found for isentropic fluids and is seen in figure 3. The vapour side slope is infinitely large and therefore the fluids of this type have the same advantage as the dry, no moisture in or after the expansion. The fact that the expansion process never is isentropic will result in that the end of expansion is superheated. Isentropic is actually an idealized view as many isentropic fluids could be classed as a dry fluid. The saturation curves can also be shown by Troutons rule. With a known boiling temperature and enthalpy of vaporization the entropy of vaporization follows the simple rule of [4]: ∆𝑆𝑣𝑎𝑝 (𝑇𝑏 ) = ∆𝐻𝑣𝑎𝑝 (𝑇𝑏 ) 𝑇𝑏 𝐽 ≈ 88 𝑚𝑜𝑙·𝐾 Where the value 88 is when the boiling temperature is at the pressure 1 bar. The result is not always correct as its accuracy are reduced when there’s hydrogen bonds although it gives a good approximation. The number of fluids that could be used is many, and the suitability of one fluid depends on numerous of things. Firstly one must consider the location of the power plant in the event of a leak. If it’s located in the vicinity of populated area, more flammable and toxic fluids might be exchanged for less hazardous mediums. Secondly the environmental aspect has to be considered, e.g., what global warming potential has the fluid. Lastly the economical part has to be weighted in. The best performing fluid might not be the best economically. The program does not account for these important parts because the application may differ and the user has to decide what’s acceptable concerning economics, risks and environment. Figure 4 show how the properties of three fluids from the same “family” changes in T-s diagram with a fix evaporation and condenser temperature that’s been set to 100 °C and 20 °C respectively. Note that the figure have been tampered with because different reference states is used for each fluid but the temperature and entropy difference between two points in the curve is still the same. The figure shows that three fluids that are very alike have different properties. 3 Figure 4: T-s diagram of butane, pentane and hexane showing increase of the overhanging shape the bigger the molecule gets. P = pressure in bar and T= temperature in Kelvin. 1.4 Limitations Autoignition is mentioned but not taken into account for the fluids. The user needs to be aware of this when selecting fluids along with other risks when leakage might occur as ignition sources and toxicity etc. The heat exchanger areas is not studied and this can somewhat tip the scale in some fluids favor. No economic study is made. A fluid that’s have the best thermo dynamical performance might not be the best investment due to component size, i.e. an economic optimum could be found where component size are smaller with lower thermo dynamical performance. Only pure fluids are considered. The fluids that are run are pre-selected by screening of literature. REFPROP is a program that calculated the fluids properties and there are some uncertainties in the values. Depending on what parameter or fluid it calculates this uncertainty is ranging from between 0 to 2 % fault from the correct value. The main program can only handle one heating temperature and one cooling temperature so the tweaked program needs to be adjusted. However no major changes needs to be made because the main code is still used. The difference is that the main program only search for maximum value from a list of pressure and fluids while the tweaked program collects the maximum values for many temperatures. It’s this way because the program is intended to only find one fluid and pressure from a range of values. The fluids vapor states are assumed to be ideal gases for the turbine calculations so the ideal gas rules can be applied. 4 1.5 Acknowledgements I would like to thank the department of thermal power engineering for allowing me to do this master thesis. A special thanks goes out to Marcus Thern, Magnus Genrup and Björn Nyberg for guiding me through the times when I saw the light at the end of the tunnel and it turned out to be a train. I would also give thanks to the coffee machine at the department of energy sciences for giving me the energy to start working in the mornings. 5 6 2 Method This chapter presents the methods and calculations made in the thesis 2.1 Used The aim of this work has been to investigate how different fluids affect the thermodynamic performance of an organic Rankine cycle. The organic Rankine cycle was studied with a program developed in MATLAB. The program makes it possible to do thermodynamic evaluation of the Rankine cycle. The program is divided into two different parts, the main program and the graphical user interface (GUI) in one file while the heat mediums have been put in separate files. The program has the option of using different physical fluids and the fluids properties is made available by a program called REFPROP [5]. REFPROP is called as a subroutine from inside MATLAB. REFPROP return one or more values given two input values (e.g. enthalpy and entropy as input values give temperature, pressure etc.). The programs graphical interface (GUI) is built up using MATLABs built in function guide. Guide is a click and drag interface that enables the user to, after defining size of the window, drag edit boxes, text boxes, check boxes etc. and generates the code needed to later access and program what the item is supposed to do. Turbine is programmed in MATLAB with the help of the loss program AMDC-KO-MK (Ainley Mathieson et al. loss model) that’s already been programmed and in use by LUAX-T. 2.2 Literature review Several authors have studied the organic Rankine cycle but the studies made on the influence of the working fluids on performance can differ. Most studies have a screening process of some sort where the authors selected fluids that fulfilled their criteria’s. Some studies screened with safety and environmental aspects as criteria where others screened based on critical temperatures or size of the components. The temperature range also differed for the studies. The literature review identified the fluids in table 1 that where suggested by the respective authors. One fluid, R24fa was recommended but has been disregarded as it’s not found in the REFPROP database. A few of the fluids were recommended by more than one source. The different studies have been made for applications with power output ranging from a few kW using solar energy up to MW class with high temperature geothermal heat source. 7 Table 1: Optimum fluids from papers written on the subject. Medium Ref R114 [6] R245fa [6] R123 [6], [7] iso-pentane [6] n-pentane [6] [8] R141b [6] R113 [6], [9] R227ea [10] cyclopentane [11] ammonia [8] n-butane [2] R134a [12] Table 2 show some reference values of the fluids. The column REFPROP TPFLSH shows the maximum temperature that can be used in REFPROP for the specific fluid. Beyond this temperature REFPROP can’t calculate the fluids properties. If the fluid is called with a temperature higher than this an error message is displayed and all calculations are stopped. Therefore the limit value of each fluid has to be added manually so a calculation run of multiple fluids and temperatures don’t stop because the limitation is reached. Column “type of fluid” shows the classification of the fluid, with definitions from section 3.3. As stated in that section there are three kinds of fluids, wet, dry and isentropic. The isentropic fluid shape as shown in figure 3 is rarely found because it’s merely an idealization. The isentropic fluids often have the tendency of an overhanging shape, i.e. dry and are therefore sometimes referred to as dry. Table 2: Highest temperature on the working fluids that REFPROP handles, type of fluid and the critical pressure and temperature. Medium R245fa R134a R227ea iso-pentane R141b R114 R113 n-butane R123 n-pentane cyclopentane ammonia REFPROP TPFLSH (°C) 167 182 202 227 227 234 252 302 326 327 327 427 Type of fluid Critical pressure (bar) Critical temperature (°C) Isentropic/dry wet dry dry Isentropic/dry Isentropic/dry Isentropic/dry Isentropic/dry Isentropic/dry dry dry wet 36.5 40.6 29.2 33.8 42.2 32.6 33.9 37.96 36.6 33.7 45.15 113.33 154 101 101.7 187.2 204.3 145.7 214.06 152 183.6 196.5 238.5 132.2 8 2.3 ORC Program Program is split up into two parts, subcritical and supercritical cycles. The user needs not choose what cycle to run, the program chooses based on the pressure. The structure can be seen in figure 5 and is explained briefly below. The subcritical and supercritical calculations are presented in detail in section 4.3.1 and 4.3.2 respectively. The user specifies values that the selection is based on. Values that need to be provided are listed in the objectives. The fluids available are predetermined from section 4.2 and the user selects which of these fluids to run. The program starts with the first fluid and the starting pressure and chooses what cycle to run. If all the pressures in the range are below the condenser pressure the program starts with the next fluid. After every cycle calculation that is done all values are stored and the next pressure in the range starts. When all the pressures are done the program continues to the next fluid. When all fluids have been calculated the selection takes place. The program searches for the largest value of either efficiency or power output depending on what’s been selected. When this is finished the result of the fluid with the highest value is displayed. 9 User specified values All pressures lower than condenser pressure Fluids Pressure range P>Pc T>Tc P<Pc Supercritical Subcritical Store results All pressures done Next pressure All fluids done Find maximum Maximum power Maximum efficiency Display result Display result Figure 5: Calculation procedure of the ORC program where the super- and sub-critical are two different calculation routines chosen based on the pressure (P=pressure). 2.3.1 Subcritical Figure 6 shows where the following state points are. The order they are presented is in the sequence the program works. 10 Figure 6: View of components in the subcritical cycle. SH = super heater, VP = evaporator, PH = preheater. Turbine between state 4 and 5, pump between 1 and 2. Reheater is located between 2 and 3 (and 5 to 9) and the condenser between state 9 to 1. Inlet heat source is at high_heat and the outlet at low_heat. Numbered states are for the working fluid and the named states are for the heat source and cooling medium. 2.3.1.1 State 1 State 1 is located just after the condenser and at this point the fluid is completely condensed. It is assumed that the level of cooling is pre-determined before the study continues. This means that the temperature of the incoming cooling media and the temperature rise of the condensation phase (state 6 to 1) is known. The pinch-point of the condenser, i.e. the size of it, is assumed to be known. As the temperature is constant over the condensation phase the fluid temperature at state 1, after condensation, is set by the cooling media inlet temperature, the condenser pinch-point and the temperature rise of the cooling media during the condensation phase. Temperature t1 is equal to t6. 𝑡1 = 𝑡6 = 𝑡𝑖𝑛_𝑐𝑜𝑜𝑙 + 𝑝𝑖𝑛𝑐ℎ𝑐𝑜𝑛𝑑 + 𝑡𝑒𝑚𝑝_𝑟𝑖𝑠𝑒𝑐𝑜𝑜𝑙 (2.3.1.1) With the temperature known the condenser pressure can be calculated with REFPROP because point 1 lies on the saturation curve as saturated liquid (state 6 as saturated vapour). The thermodynamic state is thus completely determined and the condenser pressure is calculated with REFPROP with the temperature and saturated liquid. A condition has been set that the condenser pressure must be 10 kPa or higher. If the pressure is larger than 10 kPa enthalpy and entropy is returned by using the pressure and state of saturated liquid as input. If the pressure has been forced to 10 kPa the enthalpy and entropy is returned using pressure and temperature as input instead. Often this isn’t a problem but for fluid with high critical temperature (and low critical pressure) this problem could occur. Temperature instead of saturated liquid value isn’t used as input value from the beginning because REFPROP might have problems separating the liquid values from the vapour values when on the saturation curve. 11 2.3.1.2 State 2 Pressure at state 2, after the pump, is defined by the user and can be a range of values that’s to be tested. The condition to continue is that the pump pressure is larger than the condenser pressure otherwise the program tests the next pressure, if the user has defined more than one. If the pressures given don’t work for a fluid the program continues to the next fluid if more than one has been selected. If the pressure condition fails for all fluids an error message is returned. The isentropic efficiency of a pump can be expressed as: 𝜂𝑝 = ℎ2𝑠 −ℎ1 ℎ2 −ℎ1 (4.3.1.2) h2s, isentropic enthalpy, is calculated with the pump pressure and entropy of state 1. By using eq. 2.3.1.2 h2 can now be calculated because the efficiency is defined by the user. As the pressure is known the temperature t2 and entropy s2 can be returned from REFPROP. 2.3.1.3 State 7 State 7 is after the preheater (PH) i.e. the fluid is in the state of saturated liquid. However a condition needs to be fulfilled, the saturation temperature must not exceed the inlet temperature of the heat carrier. In case this happens the program goes to the next fluid if more than one has been selected. All properties can be found by using pressure and the fact that this state is saturated liquid. However, the pressure is lower than that in state 2 because pressure drops occur in the reheater (state 2=>3) and preheater. The pressure drop (ploss) is predefined as 5% in each heat exchanger but this can be changed by the user by not checking the box “use default values” and entering a value. The pressure drop is denoted ploss. The pressure becomes: 𝑃7 = 𝑃3 · (1 − 𝑝𝑙𝑜𝑠𝑠 ) (2.3.1.3) 2.3.1.4 State 8 This state is after the evaporator (VP) and the fluid is in the state of saturated vapour. With the pressure drop accounted for the properties can be found with the pressure and state of saturated vapour. Note that the temperature, t8, will be lower than t7 because the pressure, P8, is lower than P7 if pressure drop is greater than nought. The fluid passed three heat exchangers i.e. the exponent becomes 3. 𝑃8 = 𝑃7 ∙ (1 − 𝑝𝑙𝑜𝑠𝑠 ) (2.3.1.4) 2.3.1.5 State 4 State 4 properties depends if the user selected superheating or not. If the superheating value is set to nought, state 4 becomes state 8 (saturated vapour) and the super heater is removed. If the user sets it to a value greater than nought then: 𝑡4 = 𝑡8 + 𝑢𝑠𝑒𝑟 𝑠𝑝𝑒𝑐𝑖𝑓𝑖𝑒𝑑 𝑣𝑎𝑙𝑢𝑒 (2.3.1.5) 𝑃4 = 𝑃8 ∙ (1 − 𝑝𝑙𝑜𝑠𝑠 ) (2.3.1.6) 12 A control is made that the temperature t4 isn’t higher than the heat source for the specific pressure. If the temperature is too high it stops for that pressure and moves on to the next fluid. If it passes, the program continues. With t4 and P4 known the enthalpy and entropy of state 4 is found. 2.3.1.6 State 5 State 5 is after the expansion through the turbine. The isentropic efficiency a turbine is expressed as: ℎ −ℎ 𝜂𝑡 = ℎ 4−ℎ 5 4 5𝑠 (2.3.1.7) Pressure at turbine outlet is the same as condenser pressure. Isentropic expansion, i.e. s5=s4, and pressure gives h5s. Using eq. 2.3.1.7, h5 is calculated. Pressure and enthalpy gives temperature and entropy. Figure 7: The subcritical process for a dry fluid with isentropic pump and turbine work shown in a T-s diagram. The numbered states correspond to the ones in figure 6. Before continuing a check needs to be made of where state 5 lies in the T-s diagram, see figure 7. If state 5 is in the moist region or on the saturation curve a reheater can’t be used and state 9 and 3 is skipped and leaves state 6 equal to state 5. If the reheater is removed the program restarts the calculation beginning with state 2 with one less heat exchanger, i.e. the states 7,8 and 4 will now experience one less pressure drop. State 3 and 9 only exist if a reheater is used. 2.3.1.7 State 6 State 6 is always saturated and is located inside the condenser as saturated vapour when the end of expansion is superheated. If the expansion end in the moist region state 6 is equal to state 5. 13 2.3.1.8 State 9 State 9 position in the above T-s diagram is dependent of the reheater efficiency. Low reheater efficiency brings state 9 closer to state 5 while with a higher efficiency closer to state 6. Heat exchanger efficiency is defined as [13]: 𝜀 = 𝑄̇ 𝑄̇ 𝑚𝑎𝑥 (2.3.1.8) The maximal transferrable heat is from state 5 down to the temperature at state 2, i.e. state 9 can never be as low as state 6. 𝑄̇𝑚𝑎𝑥 = 𝑚̇ ∙ (ℎ5 − ℎ@𝑡2,𝑃𝑐𝑜𝑛𝑑 ) (2.3.1.9) The mass flow is constant and eq. 4.3.1.8 then gives: 𝜀=ℎ ℎ5 −ℎ9 5 −ℎ@𝑡2,𝑃_𝑐𝑜𝑛𝑑 (2.3.1.10) h5 known, h@t2,P_cond is returned by REFPROP and with the efficiency set by user enthalpy, h9 is calculated. Condenser pressure and h9 gives the temperature and entropy of state 9. 2.3.1.9 State 3 State 3 is depending on state 9, and therefore on the reheater efficiency. Its upper limitation is the temperature of state 5. With an energy balance h3 is calculated and its dependency of state 9 can be seen as state 2 and 5 are fix. 𝑚̇ ∙ (ℎ3 − ℎ2 ) = 𝑚̇ ∙ (ℎ5 − ℎ9 ) (2.3.1.11) Pressure is: 𝑃3 = 𝑃2 ∙ (1 − 𝑝𝑙𝑜𝑠𝑠 ) (2.3.1.12) In eq. 2.3.1.4, mass flows are the same and 2.3.1.4 can be written as: ℎ3 = (ℎ5 − ℎ9 ) + ℎ2 (2.3.1.13) Enthalpy h3 and pressure P3 gives temperature and entropy. 2.3.1.10 Heat source and working fluid mass flow Temperature of the heat source media is calculated using the temperature at state 7 and adding the pinch-point of the preheater like this: 𝑡𝑉𝑃𝑃𝐻 = 𝑡7 + 𝑝𝑖𝑛𝑐ℎ𝑝𝑟𝑒ℎ𝑒𝑎𝑡𝑒𝑟 (2.3.1.14) Mass flow of the fluid is calculated by a heat balance over the vaporizer and super heater, see figure 8. 𝑚̇ℎ𝑒𝑎𝑡 ∙ (ℎℎ𝑖𝑔ℎ − ℎ𝑉𝑃𝑃𝐻 ) = 𝑚̇ ∙ (ℎ4 − ℎ7 ) (2.3.1.15) Rearranging eq. 2.3.1.15 gives: 14 𝑚̇ = 𝑚̇ℎ𝑒𝑎𝑡 ∙(ℎℎ𝑖𝑔ℎ_𝑖𝑛 −ℎ𝑉𝑃𝑃𝐻 ) (2.3.1.16) (ℎ4 −ℎ7 ) Figure 8: Heat balance over the super heater and evaporator. The method of calculating hhigh_in-hVPHP depends on what heating media is being used. REFPROP is used when water is selected. Temperature thigh and pressure set by user and tVPPH known gives hhigh-hVPHP. When using oil things get a little more complicated. Different thermal oils have different thermal properties. Instead of using a specific oil the specific heat is approximated using [14]: 𝑐𝑝 = ( 𝐴 √𝜌 𝐽 ] 𝑔℃ + 𝐵 ∙ (𝑡 − 15)) · 4186 [ (2.3.1.17) Where A and B are factors depending on the type of oil, ρ density at 15 ºC and t the temperature. The factors A and B are set to 0.415 and 0.0009 respectively (petroleum oils) [14]. Density has been set to 870 kg/m3. This value has been chosen because the density of many thermal oils seems to be in the area of 850-900 kg/m³. Enthalpy is a function of temperature and pressure. Therfore: 𝜕ℎ 𝜕ℎ 𝑑ℎ = 𝜕𝑇 | 𝑑𝑇 + 𝜕𝑃| 𝑑𝑃 𝑃 𝑇 (2.3.1.18) Last term is nought and therefore the specific heat can be expressed as: 𝜕ℎ 𝜕𝑇 𝑃 𝑐𝑝 = ( ) (2.3.1.19) This together with eq. 3.3.1.7 gives the enthalpy difference (general notation): 𝑇 ℎ2 − ℎ1 = ∫𝑇 2 𝑐𝑝 (𝑇)𝑑𝑇 = 1 𝐴 √𝜌 ∙ (𝑇2 − 𝑇1 ) + 𝐵 ∙ (𝑇22 −𝑇12 ) 2 + 15 ∙ (𝑇1 − 𝑇2 ) Temperatures thigh and tVPPH known gives the enthalpy difference from eq. 2.3.1.20. 15 (2.3.1.20) Outlet temperature on the heating side, tlow is calculated from a heat balance around the whole heating side and using eq. 2.3.1.20 or REFPROP, depending on if oil or water are used. Outlet temperature is iterated based on the heat. Transferred heat is known and by using eq. 2.3.1.20 for oil and REFPROP for water the temperature can be found by using the Newton-Raphson method: 𝑥𝑛+1 = 𝑥𝑛 − 𝑓(𝑥𝑛 )−𝑓(𝑥𝑛+1 ) 𝑓′(𝑥𝑛 ) (2.3.1.21) Figure 9: The Newton-Raphson method. Blue line is the function and the red lines the tangents. x1 is the initial guess. The method is a quick way of finding the solution. Based on an initial guess the method is reducing the error for every new guess until convergence as seen in figure 9. The program employs this method as: 𝑒𝑟𝑟𝑜𝑟 𝑛) 𝑡𝑛+1 = 𝑡𝑛 − 𝑅𝐿𝑋 ∙ 𝑓′(𝑡 (2.3.1.22) Error is the difference of known and calculated transferred heat. RLX is a relaxation factor between 0 and 1to make the iteration more stable. t is in this case the outlet temperature and the slope f’(tn) is cp. A problem that may arise is that the outlet temperature is lower than the temperature at state 3. Therefore a condition is that the outlet temperature always is at least 5°C higher than in state 3. If this isn’t fulfilled the pinch-point is increased by one degree at a time until the condition is fulfilled. Therefore the mass flow and temperatures above is nested into this loop. 2.3.1.11 Cooling The cooling is divided into two parts, the condensation and the cooling down to condensation temperature. User has the choice of water or air cooling. The energy removed between state 6 and state 1 (condensation) is calculated with a energy balance over the condensation phase: 𝑚̇ ∙ (ℎ6 − ℎ1 ) = 𝑚̇𝑐𝑜𝑜𝑙 ∙ (ℎ𝑐𝑜𝑜𝑙𝑖𝑛 − ℎ𝑐𝑜𝑜𝑙𝑐𝑜𝑛𝑑 ) (2.3.1.23) 16 The temperature at tcool_cond is fully decided by the user with the inputs of inlet temperature and temperature rise and tcool_in is the inlet temperature. REFPROP with pressure and temperature as input variables together with eq. 4.3.1.22 gives the mass flow of the coolant. Pressure for water is set to 5 bar and air is set to atmospheric (1 bar). A heat balance over the condenser results in: 𝑚̇𝑐𝑜𝑜𝑙 ∙ (ℎ𝑐𝑜𝑜𝑙𝑜𝑢𝑡 − ℎ𝑐𝑜𝑜𝑙𝑖𝑛 ) = 𝑚̇ ∙ (ℎ9 − ℎ1 ) (2.3.1.24) Eq. 2.3.1.24 returns hcool_out and with this as input together with pressure, the temperature t cool_out is returned from REFPROP. 2.3.1.12 Super heater-vaporizer heat side A heat balance around the super heater gives that the transferred heat is known. With this, the same procedure as for tlow is used i.e. using eq. 2.3.1.20 or REFPROP depending on if oil or water is used and then iterates the temperature based on the known transferred heat. 2.3.1.13 Performance subcritical cycle Following equations give the performance of the cycle: 𝑊𝑜𝑢𝑡 = 𝑚̇ ∙ (ℎ4 − ℎ5 ) (2.3.1.25) 𝑊𝑖𝑛 = 𝑚̇ ∙ (ℎ2 − ℎ1 ) (2.3.1.26) 𝑄𝑖𝑛 = 𝑚̇ ∙ (ℎ4 − ℎ3 ) (2.3.1.27) The maximum transferable heat from the heat source is: 𝑄ℎ𝑒𝑎𝑡_𝑠𝑜𝑢𝑟𝑐𝑒 = 𝑚̇ℎ𝑒𝑎𝑡 · (ℎℎ𝑖𝑔ℎ𝑖𝑛 − ℎ@𝑡𝑎𝑚𝑏𝑖𝑒𝑛𝑡 ) (2.3.1.28) The efficiency can be calculated in two different ways, cycle efficiency (eq. 2.3.1.29) or the total efficiency (eq. 2.3.1.30) 𝜂𝑜𝑟𝑐 = 𝑊𝑜𝑢𝑡 −𝑊𝑖𝑛 𝑄𝑖𝑛 𝑊𝑜𝑢𝑡 −𝑊𝑖𝑛 𝜂𝑡ℎ = 𝑄 ℎ𝑒𝑎𝑡_𝑠𝑜𝑢𝑟𝑐𝑒 (2.3.1.29) (2.3.1.30) Eq. 4.3.1.29 describes how well the fluid performs in the cycle while eq. 4.3.1.30 describes how well the fluid utilize the given heat source. 2.3.2 Supercritical Figure 10 shows the supercritical cycle and is modelled up in very much the same way as the subcritical. The biggest difference is that instead of using three heat exchangers (PH, VP, SH) it only uses one on the heating side. The state 9 is continued to be called 9 even though state 7 and 8 don’t exist to make it easier to translate the subcritical to supercritical cycle. 17 Figure 10: Schematic view of the components in the supercritical cycle. Turbine, reheater, condenser and pump unchanged. Only one heat exchanger needed. The program chooses if its runs sub- or supercritical or cycle for each selected fluid based on the pressure. If the pressure after the heat exchanger is greater than critical pressure of the fluid it runs the supercritical cycle. However a temperature condition must also be fulfilled to make it work. The critical temperature plus a pinch-point needs to be lower than the inlet temperature of the heat media. This pinch-point has been set to 25 °C. The temperature at state 4 is set to the heating media inlet temperature minus the pinch-point of 25 °C. REFPROP then gives the enthalpy and entropy of this state. Otherwise state 1,2,3,5,6 and 9 is calculated in the same way as for subcritical. The mass flow for the fluid and the outlet temperature of the heating media calculation differs from the subcritical cycle. Inside the heat exchanger a pinch point is set by the user (not to be confused with the previous pinch that decided state 4). The pinch-point takes the same value that the user defines for the preheater in subcritical. Instead of the describing the temperature difference of the fluid and heating media after the preheater the pinch is now the minimum difference between the two mediums somewhere inside the heat exchanger, see figure 11 as an example. The mass flow of the fluid is iterated by searching, point by point, for the temperature difference using eq. 4.3.1.19 for oil or REFPROP for water and the Newton-Raphson method as described earlier. The temperature and mass flow dependency on each other can be hard to show. The following equations are used to show this. 𝑚̇ = 𝑚̇ℎ𝑒𝑎𝑡 ∙(ℎℎ𝑖𝑔ℎ_ℎ𝑒𝑎𝑡 −ℎ𝑙𝑜𝑤_ℎ𝑒𝑎𝑡 ) (ℎ4 −ℎ3 ) (2.3.2.1) 18 The mass flow is dependent on outlet temperature of the heat source. The outlet temperature however is dependent on where the pinch point lies. 𝑄𝑓𝑙𝑢𝑖𝑑 = 𝑚̇ ∗ (ℎ4 − ℎ@𝑝𝑜𝑖𝑛𝑡 𝑜𝑓 𝑖𝑛𝑡𝑒𝑟𝑒𝑠𝑡 ) (2.3.2.2) 𝑄ℎ𝑒𝑎𝑡 = 𝑄𝑓𝑙𝑢𝑖𝑑 (2.3.2.3) The outlet temperature is therefore a function of the mass flow while the mass flow is a function of the temperature. The number of points it runs varies with the enthalpy difference between state 3 and 4. Each point is 100 J/kg apart. E.g. if starting point is state 3 the next point (point 2) is 100 J/kg larger than that, point 3 is 200 J/kg larger than point 1 etc. until state 4 is reached. The iteration result in the fluid mass flow and the outlet temperature of the heat source as the mass flow and temperature are depending on each other. Figure 11: An example of the T-Q diagram for supercritical cycle. The green vertical line shows the smallest difference between the heat source (red) and working fluid (blue). The smallest difference is the pinch point. 19 The advantage of the supercritical can be seen by comparing the T-Q diagrams of a subcritical (figure 12) and a supercritical (figure 11) cycle. The area between the working fluid and heat source is a loss, i.e. it should be as small as possible. The subcritical has a limitation with the evaporation process taking a large portion of the energy available. The end of evaporation will always have a larger temperature difference to the heat source than after the preheater with a loss that not can be reduced for the evaporator. With superheating the loss after the evaporation phase is reduced. The supercritical do not have any phase change and therefore the area between the fluid and heat source can be reduced. Figure 12: A sketch of a T-Q diagram of a subcritical cycle. The heat source is the top line and the working fluid is the one below. The pinch point is at the “notch” between PH (preheater) and VP (evaporator) encircled in the figure. 2.3.3 Optimum All state points and performance data has their respective values stored in matrixes. Depending on what the user is searching for, power or efficiency, the maximum value is found and returns the row and column for that value, i.e. pressure and media. With these, all the values are collected so that the T-s and T-Q diagrams can be plotted. By searching the maximum efficiency or work output matrixes the row and column of the highest value is returned. With the row and column numbers the following values of interest are collected and displayed: What fluid was best Sub- or supercritical cycle Pressure Power output Mass flow Cycle and total efficiency Temperature of the heat source outlet Temperature of the cooling outlet If the pinch needed to be moved the new pinch are displayed The T-s and T-Q diagrams with the cycle plotted. 20 2.4 Tweaked ORC program The tweaked program uses the same calculation procedure as the program in section 4.3. The difference is that the cooling and heating temperatures can be varied. This is to investigate the temperature impact on the cycle for two fluids. Three different cases are made and are presented below. The cooling temperature only affect the condenser pressure and therefore how long the expansion is while the heating temperature affect the reheater and preheater depending on which case is run. All the conditions set in section 4.3 is still active on top off the new in each case. 2.4.1 Saturated cycle The highest cycle temperature (t4) is limited to the saturation temperature, i.e. no super heating. This makes the cycle temperature independent on how high the heating temperature is, but the fluid temperature must still be lower than the heating temperature. As it only running the saturated cycle no super heater is used. 2.4.2 Superheating with no evaporation in the reheater The highest cycle temperature (t4) follows the heating temperature with a pinch of 10 °C. This means that at some point the fluids is going to be superheated. If the temperature becomes high enough there can be enough energy to do all of the preheating in the reheater. In this case this isn’t allowed and therefore the reheater efficiency is lowered (removed when the efficiency reaches nought) until the preheater is still needed. All evaporation is made in the evaporator. 2.4.3 Superheating with evaporation allowed in the reheater The highest temperature is set as in 4.4.2. This case however allows evaporation in the reheater. This means that if there’s enough energy the preheater is removed and all the preheating is made in the reheater. If there’s still energy left the fluid is also allowed to do a part of its evaporation in the reheater. Therefore all of the evaporation doesn’t necessary take place in the evaporator. 21 2.5 Turbine 2.5.1 Turbine calculation Figure 13 shows the turbine calculation and is described briefly below. User defines five design parameters of the turbine. These are stage loading coefficient, reaction, flow coefficient, mean radius and the rotational speed where the three first is defined as [15]: 𝜓= Δℎ0 𝑈2 (2.5.1.1) ℎ −ℎ 𝑟 = ℎ2 −ℎ3 1 𝜙= 𝐶𝑥 𝑈 3 (2.5.1.2) (2.5.1.3) The calculation starts with the built in initial guess of one stage. Firstly the flow angles are determined. Since only one stage has been guessed the last stage calculation starts. The outlet absolute angle from the rotor is tested at 10 degrees. If the reaction for this value is outside the interval of 0.05<r<0.5 the reaction is set to the corresponding limit value and returns the angles. The flow coefficient and the blade velocity give the axial velocity through the stage. With angles, axial velocity and the imported values the stage calculation can be run. The imported values contain the mass flow and the pressure, enthalpy and entropy before and after the turbine. After this is complete the static pressure out of the rotor is compared to the pressure calculated from the diffuser. If they aren’t equal a new stage load is calculated and starts over with the angle calculation. This continues until the pressures are equal. If the stage load required is higher than the value the user selected another stage are added and all calculations are restarted. The flow angles for all but the last stage are calculated with the stage load and reaction the user selected. This continues and if necessary more stages are added until the stage load is lower or equal to the user defined value. When this condition is fulfilled the turbine are done. The described turbine is not to be seen as full out turbine design. The purpose of it is to give the user an estimation of the turbine performance and geometry, not an actual turbine design. 22 User defined N, r_m,ψ,ϕ,r and imported values One stage guessed, n=1 Flow angles n-1 stages Last stage Stage calculation Flow angle out 10 or 0.05<r<0.5 P3≠ P3_diffuser, adjust ψ ψ_new>ψ n=n+1 Stage calculation Pressure before diffuser, P3_diffuser P3=P3_diffuser ψ_new ψ_new <= ψ Result Figure 13: Calculation procedure of the turbine. P=pressure, n=nr. of stages, ψ=stage loading, ϕ=stage flow, r=reaction, N=revs per minute and r_m = mean radius. 23 2.5.1.1 Flow angles Figure 14: Angle definitions according to Schobeiri [16]. Left triangle is after the nozzle and the right after the rotor. V is absolute and W the relative velocities. With a program provided by Magnus Genrup, the flow angles can be determined from following equations [16] with the angles defined as in figure 14: 𝜇2 𝜙 2 (1 − 𝜈 2 ) tan2 𝛼2 + 2 𝜇𝜈𝜙𝜓 tan 𝛼2 − 𝜆2 − 2(1 − 𝑟)𝜆 + (𝜇2 − 1)𝜙 2 = 0 (2.5.1.4) 𝜙 2 (1 − 𝜈 2 )(𝜙 tan2 𝛼3 + 2𝜙𝜆 tan 𝛼3 + 𝜆2 − 2(1 − 𝑟)𝜆𝜈 2 + (𝜇2 − 1)𝜙 2 𝜈 2 = 0 (2.5.1.5) (1 − 𝜈 2 )(𝜇𝜙 tan 𝛽2 + 𝜈)2 + 2𝜈𝜆(𝜙𝜇 tan 𝛽2 + 𝜈) − 𝜆2 − 2(1 − 𝑟)𝜆 + (𝜇2 − 1)𝜙 2 = 0 (2.5.1.6) (1 − 𝜈 2 )(𝜙 tan 𝛽3 + 1)2 + 2𝜆(𝜙 tan 𝛽3 + 1) + 𝜆2 − 2(1 − 𝑟)𝜆𝜈 2 + (𝜇2 − 1)𝜙 2 𝜈 2 = 0 (2.5.1.7) In the equation above λ is the stage loading that is defined by eq. 2.5.1.1 with the more familiar notation ψ and μ is the axial speed ratio between station 2 and 3. Station notation can be seen in figure 17 in section 2.5.2. In the special case of constant blade speed throughout the stage (v=U2/U3=1) the angles can be expressed as: 1 𝜙2 𝜆 tan 𝛼2 = 𝜙𝜇 [2 + (1 − 𝑟) − (𝜇2 − 1) 2𝜆 ] 1 𝜆 (2.5.1.8) 𝜙 tan 𝛼3 = 𝜙 [− 2 − (1 − 𝑟) − (𝜇2 − 1) 2𝜆] 1 (2.5.1.9) 𝜙2 𝜆 tan 𝛽2 = 𝜙𝜇 [2 + (1 − 𝑟) − (𝜇2 − 1) 2𝜆 − 1] 1 𝜆 (2.5.1.10) 𝜙 tan 𝛽3 = 𝜙 [− 2 + (1 − 𝑟) − (𝜇2 − 1) 2𝜆 − 1] (2.5.1.11) In the further special case where the axial velocity through the stage is constant (μ=Cx2/Cx3=1) making the flow angles a function of only the three parameters: stage load, stage flow and the reaction. 24 tan 𝛼2 = 1 𝜆 [ + 𝜙 2 1 (1 − 𝑟)] 𝜆 tan 𝛼3 = 𝜙 [− 2 − (1 − 𝑟)] 1 𝜆 tan 𝛽2 = 𝜙 [2 − 𝑟] 1 (2.5.1.12) (2.5.1.13) (2.5.1.14) 𝜆 tan 𝛽3 = 𝜙 [− 2 + (1 − 𝑟) − 1] (2.5.1.15) As seen later in section 2.5.2 the angles need to be redefined so that zero degree velocity is in the axial direction. This is simply done as: The angles from eq. 2.5.1.12-2.5.1.15 then become: 1 𝜆 𝛼2 = tan−1 [𝜙 (2 + (1 − 𝑟))] 1 𝜆 𝛼3 = tan−1 [𝜙 (− 2 − (1 − 𝑟))] 1 𝜆 𝜙 2 𝛽2 = tan−1 [ ( − 𝑟)] 1 𝜙 𝜆 2 𝛽3 = tan−1 [ (− − (1 − 𝑟) − 1)] (2.5.1.16) (2.5.1.17) (2.5.1.18) (2.5.1.19) These angle definitions will result in that the angles are positive in nozzle blades direction and negative in the rotor blades. Inlet and outlet states of the turbine are known from the results in the ORC program and leave the user to define five parameters: stage load, reaction, flow coefficient, rotational speed and the mean radius (assumed constant), i.e. the special case above is used. Using the flow angles, mean radius, speeds, enthalpy, entropy and pressure as input to the stage calculation the turbine is built up stage by stage. An initial guess of the number of stages has to be done and is set to one. This because the program doesn’t work if the guessed number of stages is higher than actually needed. The number of stages is iterated based on the stage loading defined earlier. If the required stage load for the last stage is higher than the user defined value another stage is added. This is repeated until the stage loading of the last stage is less or equal to the defined value. The last stage is also designed so that the flow angle out of the turbine is small. This is accomplished by changing the degree of reaction of the last stage. The program tries to set the angle to 10 degrees. However, if the reaction for that angle is smaller than 0.05 or greater than 0.5 the reaction is set to the corresponding limit value. Therefore the angle may not necessary be 10 degrees. The low flow angle is needed as the diffuser, that recovers pressure, otherwise isn’t as effective as it should be. With this in mind one might think that the outlet flow should be purely axial (0°), however as there often are supports mounted, the flow is disturbed if the angle are too low and therefore a small angle is needed. 2.5.1.2 Diffuser After last stage a diffuser is placed for pressure recovery. Without a diffuser the turbine only can expand down to the condenser pressure but with a diffuser, a larger expansion in the turbine is made as 25 the static pressure after the last stage can be lowered. Figure 15 shows the expansion with and without a diffuser and shows that the enthalpy difference is larger with the diffuser than without i.e. the work output is larger. Figure 15: Expansion line in the h-s diagram for a turbine with and without a diffuser. P ref is the condenser static pressure. Station 2 is after the last turbine stage where the 2,D denotes a diffuser being used and 2 no diffuser. Mass flow over a diffuser is constant as: 𝑚̇ = 𝑐1 · 𝜌1 · 𝐴1 = 𝑐2 · 𝜌2 · 𝐴2 (2.5.1.20) Diffuser pressure recovery coefficient is expressed as (general notation as in figure 16): 𝑃 −𝑃 𝐶𝑝 = 𝑃 2 −𝑃1 01 𝐶𝑝 = (2.5.1.21) 1 𝑃2 −𝑃1 𝑃 𝑃1 ( 01 −1) (2.5.1.22) 𝑃1 𝑃 𝑃 𝐶𝑝 · ( 𝑃01 − 1) = 𝑃2 − 1 1 1 (2.5.1.23) 26 Figure 16: Diffuser. 1 is after the last rotor (i.e. inlet of diffuser) and 2 is the outlet of the diffuser. L is the length and B is width of the diffuser. Using eq. (4.4.1.23) the static pressure after the turbine stage is expressed as: 𝑃1 = 𝑃2 𝑃 1+𝐶𝑝 ·( 01 −1) (2.5.1.24) 𝑃1 Figure 17: Annular Diffuser-Sovran & Klomp chart. Pressure recovery factor depending on the area ratio and the length over width ratio. AR= A2/A1. Notation in figure 16 With perfect gas assumed the following relationships can be used: 𝛾 𝑃01 𝑃1 = 𝑇 𝛾−1 ( 𝑇01 ) 1 𝑇01 = 𝑇1 + 𝑐1 2 2·𝑐𝑝 (2.5.1.25) (2.5.1.26) 27 𝑐𝑝 = 𝑐𝑣 + 𝑅 𝑐 (2.5.1.27) 𝑅 1 = 𝑐𝑣 + 𝑐 𝑝 𝛾= (2.5.1.28) 𝑝 𝑐𝑝 (2.5.1.29) 𝑐𝑣 𝛾·𝑅 𝑐𝑝 = 𝛾−1 (2.5.1.30) Eq. 4.4.1.31 and eq. 4.4.1.27 give: 𝑇01 𝑇1 =1+ 𝑐1 2 ·(𝛾−1) 2·𝛾·𝑅·𝑇1 (2.5.1.31) The Mach number is calculated as: 𝑀𝑎 = 𝑐 (2.5.1.32) √𝛾𝑅𝑇 Inserting eq. 2.5.1.32 in eq. 2.5.1.31 then gives: 𝑇01 𝑇1 =1+ 𝛾−1 2 · 𝑀𝑎1 2 (2.5.1.33) Using eq. 2.5.1.24, 2.5.1.25 and 2.5.1.33 the pressure before the diffuser is written: 𝑃1 = 𝑃2 𝛾 𝛾1 −1 1+𝐶𝑝 {(1+ 𝑀𝑎1 2 )𝛾−1 −1} 2 (2.5.1.34) P1 is the pressure before the diffuser, i.e. P3 for the last stage, and will be referred to as P3_diffuser so it not becomes mixed up with the P3 calculated from the stage. Cp is set to a fix value of 0.6. This value means that the diffuser has quite good pressure recovery and is “medium” sized as seen in figure 17. The error is calculated as: 𝑒𝑟𝑟𝑜𝑟 = 𝑃3 − 𝑃3𝑑𝑖𝑓𝑓𝑢𝑠𝑒𝑟 (2.5.1.35) The slope is expressed as [17]: 𝑑𝜓 𝑑𝑃3 ≈− 1−𝛾 1 𝛾−1 𝛾 𝛾 ∙𝑐𝑝 ∙𝜂𝑠 ∙𝑇01 ∙𝑃01 ∙𝑃03 𝛾 𝑈2 (2.5.1.36) 𝛾 𝑃0 𝑃 = (1 + 𝛾−1 𝛾−1 𝑀𝑎2 ) 2 (2.5.1.37) Eq. 2.5.1.37 shows that the error for higher Mach numbers are small. Using eq. 2.5.1.2 and Newton-Raphson the new ψ is calculated as: 𝜓𝑛+1 = 𝜓𝑛 − 𝑅𝐿𝑋 · 𝑒𝑟𝑟𝑜𝑟 𝑑𝜓 𝑑𝑃3 (2.5.1.38) 28 2.5.1.3 Choosing the stage load and reaction An investigation was carried out by Macchi and Perdichizzi [18] of predicting efficiency of a turbine stage for nonconventional fluids. They concluded that the optimum stage load and reaction is dependent on the expansion ratio. This has to do with decreasing the Mach number in the rotor blades. For high expansion ratios (compressible) the stage load coefficient needs to be smaller than for the incompressible case with same reaction. The trend is also that higher reaction means the stage load must decrease. For the large expansion ratios (Vout/Vin = 10) the authors suggest stage load factor of around 2 down to 1 for the reaction interval of 0.1 to 0.45. The values for the incompressible case, ranges from around 2.5-2.8 down to 0.7-1 for reactions between 0.08 to 0.68. 2.5.2 Stage calculation The stage is divided into two iteration loops, stator and rotor loop, both built up in the same way. The iteration is built on the connection between pressure losses and the increase of entropy. Figure 18: Schematic of a turbine stage with assumed constant mean radius. N = nozzle and R= rotor. Nozzle Gibbs equation [19] states that: 𝑇0 ∙ 𝑑𝑠 = 𝑑ℎ0 − 𝑣 ∙ 𝑑𝑃0 (2.5.2.1) Entropy for the total state is the same as for static. Eq. 2.5.2.1 rewritten gives: 𝑑𝑠 = 𝑑ℎ0 𝑇0 − 𝑣∙𝑑𝑃0 𝑇0 (2.5.2.2) No work is done across the nozzle, i.e. h02 = h01 and eq. 2.5.2.2 becomes: 𝑑𝑠 = − 𝑣∙𝑑𝑃0 𝑇0 (2.5.2.3) Assuming perfect gas gives v as: 𝑣= 𝑅∙𝑇0 𝑃0 (2.5.2.4) Eq. 2.5.2.3 is then temperature independent as: 29 𝑑𝑠 = − 𝑅∙𝑑𝑃0 𝑃0 (2.5.2.5) By integrating ds, an expression for the entropy difference is found: 𝑠2 𝑃 ∫𝑠1 𝑑𝑠 = ∆𝑠 = −𝑅 ∙ ln 𝑃02 01 (2.5.2.6) The gas constant R is calculated as: 𝑅= 𝑅𝑢 𝑀 (2.5.2.7) Ru is the universal gas constant and M is the molar weight of the fluid. All properties of the fluid are found with REFPROP with enthalpy and entropy as in variables. The loss model AMDCKOMK [20] also used by the gas turbine calculation program LUAX-T is used to find the losses. Figure 19: Angle definition for the loss model. Angles are positive in the blades direction i.e. when the velocity in the direction of the blade the angle is positive. Angle definition in the loss model is different of that in the flow angle calculation and is seen in figure 19 where the angles always is positive in blade direction and the zero degree angle means axial velocity. Because of the definition in previous section the angles α3 and β3 needs to be called as negative (a minus sign in front). This is due to that it gives negative angle for the rotor blade direction. The negative sign when called will make the angle positive, if the velocity is in the blades direction. 30 The annulus are is calculated by using the mass flow, density and axial velocity of the fluid. 𝑚̇ 2 ∙𝐶𝑥 𝐴=𝜌 (2.5.2.8) Blade height is calculated with the annulus area and mean radius as: 2 2 𝐴 = 𝜋 · (𝑟𝑡𝑖𝑝 − 𝑟ℎ𝑢𝑏 ) 𝑟𝑚 = 𝑟𝑡𝑖𝑝 +𝑟ℎ𝑢𝑏 (2.5.2.9) (2.5.2.10) 2 Eq. 2.5.2.9 and 2.5.2.10 give the tip radius: 𝐴 𝑟𝑡𝑖𝑝 = 4·𝜋·𝑟 + 𝑟𝑚 (2.5.2.11) 𝑟ℎ𝑢𝑏 = 2 · 𝑟𝑚 − 𝑟𝑡𝑖𝑝 (2.5.2.12) 𝑚 Reynolds number is expressed as [21]: 𝑅𝑒𝑁 = 𝜌2 ∙𝐶2 ∙𝑐𝑁 𝜇2 (2.5.2.13) Where density and dynamic viscosity is given by REFPROP and absolute speed from the turbine program. The blade chord, cN, is calculated with the models lonb1 (returns blade height-axial chord ratio) and stagger_1 (returns stagger angle, θ). Blade height known from eq. 2.5.2.11- 2.5.2.12 and cN is easily calculated: 𝑏 𝑐𝑁 = cos 𝜃 (2.5.2.14) Figure 20: Blade chord c, with axial chord b and stagger angle θ. The pitch is denoted s. The total loss coefficient, Ytot, returned by AMDCKOMK is expressed in pressure loss as: 𝑌𝑡𝑜𝑡 = ∆𝑃 𝑞 (2.5.2.15) Where q is the dynamic pressure: 𝑞 = 𝑃02 − 𝑃2 ≈ 𝑃­𝛾·𝑀𝑎 2 2 (2.5.2.16) 31 Eq. 2.5.2.5 and 2.5.2.9 then gives the entropy change as a function of loss coefficient and pressure: ∆𝑠 = −𝑅 ∙ ln(1 − 𝑌𝑡𝑜𝑡 ∙(𝑃02 −𝑃2 ) ) 𝑃01 (2.5.2.17) The error is calculated as: 𝑒𝑟𝑟𝑜𝑟 = ∆𝑠𝑛𝑒𝑤 − ∆𝑠𝑜𝑙𝑑 (2.5.2.18) Rotor The equations for calculating the nozzle are also valid for the rotor. By using the fact that the relative work on the rotor is nought, i.e. h03_rel = h02_rel, the equations for the nozzle is also valid for the rotor because it “acts” as a nozzle relative to the flow. Using the relative values for states 2 and 3 instead of the absolute the calculation carries out exactly as for the nozzle. To clarify the Reynolds number and Δs are written as: 𝑅𝑒𝑟𝑜𝑡 = 𝜌3 ∙𝑊3 ∙𝑐𝑟 𝜇3 ∆𝑠 = −𝑅 ∙ ln(1 − (2.5.2.19) 𝑌𝑡𝑜𝑡 ∙(𝑃03_𝑟𝑒𝑙 −𝑃3 ) 𝑃02_𝑟𝑒𝑙 ) (2.5.2.20) 32 Mach Pressure Entropy Enthalpy Turbine calc Flow angles, absolute components Flow angles, relative components Mach Pressure Entropy Enthalpy guess ”old ds” error > 0.1 guess ”old ds” ds= old ds + error ds= old ds + error ZweStaSBC1, lonb1, Ang_stagger ZweStaSBC1, lonb1, Ang_stagger Input values AMDCKOMK Input values AMDCKOMK AMDCKOMK AMDCKOMK Loss koeff. Y_tot Loss koeff. Y_tot New ds error= new ds - old ds New ds error < 0.1 error= new ds - old ds error > 0.1 error < 0.1 Turbine calc Figure 21: Flow chart of the stage calculation. Left loop is the stator and the right the rotor. 33 34 3 Result This section presents the result from the modified program running the two fluids pentane and R134a. Sections 5.1.1-5.1.4 shows the different cycles and mass flow. Section 5.1.5 shows an example of the main program that’s done a subcritical calculation. 3.1 Result from the main code Assumptions made: Turbine and pump efficiency’s set to 85 % and 80 % respectively. Initial reheater efficiency set to 80 %. No pressure drops in the heat exchangers. Pinch between highest cycle temperature and heating media is set to 10 °C. Thermal oil as heat source with a mass flow set to 1 kg/s. Pressure range is set from 2 to 25 bar with steps of 0.1 bar. No mechanical losses are considered. The result section only consider subcritical cycles. The x axis is the heat source temperature and the number at the end of each line is the temperature of the coolant. 3.1.1 Saturated The maxmimum temperature of the fluid is the saturation temperatures. Instead of raising the temperature closer to the heating media the mass flow is increased. Figure 22: Cycle efficency of the saturated cycle 35 Figure 23: Power output curves of the saturated cycle. Figure 24: Total efficiency of the saturated cycle The power curves sudden change seen for pentane around 240 °C has to do with the pinch-point in the preheater have been adjusted so that the mass boiled isn’t greater than what can be preheated. This also explains why the total efficiency has a sudden change, as more and more of the heat available is not being used when the pinch point increase. The same goes for R134a but for a lower heating temperature. This explains why the total efficiency levels out while the power is increasing. 36 3.1.2 Superheated with no evaporation in reheater Cycle temperature set to the oil temperatures minus the pinch. Figure 25: Cycle efficiency of the superheated cycle with no evaporation in the reheater. Figure 26: Power curves of the superheated cycle with no evaporation in the reheater. 37 Figure 27: Total efficiency of the superheated cycle with no evaporation in the reheater. The decrease in cycle efficiency for pentane is explained by the reheater. The preheater was set to always exist and therefore, for the higher temperatures, the reheater efficiency was decreased until state 3 lies beneath state 7 in the T-s diagram. The total efficiency on the other hand increases as more of the heat source is used. R134a has a break point for the superheated cycles as the fluids temperature is following the heat source instead of saturation temperature. This means that R134a:s TPFLSH temperature is reached and therefore can’t go further. 3.1.3 Superheating with evaporation allowed in reheater In this case the fluid is allowed to evaporate between state 2 and 3 if the transferable heat is enough. If it’s enough to evaporate then the preheater is removed and the evaporator comes after the reheater. Figure 28: Cycle efficiency with evaporation allowed in the reheater i.e. when this occurs the preheater is removed 38 Figure 29: Power curves with evaporation allowed in the reheater Figure 30: Total efficiency with evaporation allowed in the reheater Boiling in the preheater is allowed and when it occurs the preheater is removed. This doesn’t affect the power and total efficiency much however the cycle efficiency becomes the highest of the three cases. 39 3.1.4 Mass flow superheated and saturated Following graph shows the mass flow of the saturated cycle and the superheated with no evaporation in the reheater. Figure 31: Mass flows of the saturated and superheated cycles from the power curves with 10 ºC cooling. Solid line for the saturated and dashed for the superheated. As seen the mass flow is greater for the saturated cycle, especially as the temperature goes up. The saturated cycle of R134a can also be used for a longer temperature range than the superheated as the fluid temperature never goes above the saturation temperature. 40 3.2 The Main Program Figure 31 shows a calculation made by the program for all the fluids. The heat source were set at 160 °C with a mass flow of 10 kg/s. Pressure range were set 5 to 25 bar with 10 °C superheating. The result was that R227ea gave the highest power output for this case. Figure 32: Example of the program for a subcritical calculation. Input values on the left side of the program and result section on the right. Note that the program finished although it says working. This box is supposed to turn green but there’s a bug. 41 4 Discussion The figures show the efficiency and power curves of two mediums for three different cases. As seen in figure 23 the highest power output comes from the saturated cycle while the highest cycle efficiency comes from when the media is allowed to evaporate in the reheater thus removing the preheater. The total efficiency gives the same result as the power curves. This means that the preferred cycle is the saturated as it gives the highest power output and the highest total efficiency. Note that because values in the figures are the maximums of a range of pressures the highest cycle efficiency may be on a different pressure than the maximum power in respective cycle. Also optimal pressure can differ for the same fluid on different cooling temperatures. Though only two mediums are shown for three different cases in result, the problem with finding an optimum fluid can be seen. A closer look on one of the superheated results shows that R134a higher power output than pentane up to its break point and for the coldest cooling temperature. When the cooling temperature goes up the performance of R134a comes closer to pentane and eventually perform worse over a certain cooling and heating temperature. The heat source temperature where the lines cross decreases as the cooling temperature goes up. The same trend is seen on the saturated although it has no breakpoints as the temperature of the fluid never exceeds saturation temperature. A fluid with a low critical temperature often has high critical pressure. This means that also the condensation pressure is higher than for a fluid with lower critical pressure. Therefore, for a fix maximum pressure, the performance is greatly affected by the condenser pressure i.e. the condenser temperature. With a higher condensation temperature a low critical pressure fluid performance will be better at lower heating temperatures compared to a high critical pressure fluid. However R134acan produce electrical power with heating temperatures as low as 60 °C, although not much, while pentane needs a temperature almost 20 °C higher than that. As said the power production is very small, <5 kW for this temperature on 1 kg/s of the heat source. This do not seems as much but if the heat source used is the return line from district heating there are big mass flows involved thus resulting in quite high power output for the very low grade heat source, not taking into account the size of the components as a result of the high mass flow. The increased power output from saturated cycle is explained by figure 31. As seen the mass flow increases with the temperature more rapid than the superheated which leads to higher power output. Because there’s no superheating the mass flow can be increased more than for the superheated cycles thus for maximum power output the saturated cycle is preferred. Problems may arise with saturated cycle as moisture can form and damage the turbine. For dry and isentropic fluids, problems with moisture occur at inlet of the turbine as the outlet is superheated while for wet fluids it can occur both at inlet and outlet. The cycle efficiency becomes constant as the specific work, both out and in, and the specific heat in become constant. The small decrease of the mass flow for saturated pentane is hard to explain. The curve as a whole follows the expected trend that it increases with the temperature. One explanation could be that the power of this point where found for two different pressure levels and therefore the “wrong” mass flow was picked. Another explanation could be that REFPROP calculated the states erroneously for this point thus giving a high power output for lower mass flow. The cycle that allows boiling in the reheater has best cycle efficiency of the three while its power output is similar to that of the superheated. However, with ORC cycle using waste heat, the highest cycle efficiency is not as interesting as the highest power because the heat source from the beginning 42 is a loss. Cycle efficiency, as can be seen in all the cycles, can also be misleading. Efficiency can be quite high but the power output small, i.e. most of the heat available isn’t used. Therefore the more correct comparison is to look at the power output or the total efficiency which gives a better comparison between mediums. When there’s a fix heat source the comparison between fluids should be done by either the power output or the total efficiency while the cycle efficiency is useful when the heat source can be adjusted. As stated earlier superheating has a negative influence on the total efficiency and power output and for dry fluids it should be avoided. The wet fluids can however sometimes benefit from superheating [22] and it’s safer for the turbine as less moisture occur when superheated compared to saturated. With this result it’s shown that best way for the ORC program is to let the user decide how many degrees of superheating to have instead of setting the pinch between the heating medium and working fluid. A small amount of superheating can be preferable even for dry fluids to ensure that there’s no moisture at the inlet of the turbine. The main program, seen in section 5.1.5 gives the user the cycle performance numbers with the T-s and T-Q diagrams. The result section gives the user information on what fluid performed best, in what cycle and the performance data such as efficiency, power output and mass flow. The results show the thermo dynamical performance of the optimum fluid for the particular case. By pressing the button Turbine calculation the optional turbine calculation can be made. The needed properties (e.g. pressure, enthalpy, entropy) before and after the turbine are imported for the resulting fluid. With the imported values and defining the five design parameters the turbine is calculated. Note that the ORC program must have made a calculation and the window is still open for the turbine program to work. The number of fluids that could be run is quite few considering how many fluids there is. However as the 12 chosen are from other reports under different conditions they should suffice. A problem could occur thou, especially for the refrigerants as legislations can make them illegal to use as they often have high global warming potential. In the future an exchange of some of the fluids might be necessary. More fluids could potentially be added by adding more pages of fluids if needed. 43 44 5 Conclusion and Future Work 5.1 Conclusion The subcritical cycle should as close to saturated as possible. The dry fluids only should be running almost on the saturation curve while the wet should only superheat until an acceptable level of moisture in the end of expansion is achieved. The cooling temperature has a large impact on the performance. Changing the cooling temperature can change what the optimal fluid is for a fix heating temperature As the result is made over a pressure range the program is useful as it finds the specific values for the optimum fluid for a certain case. The cycle and total efficiency’s temperature breakpoints or maximums differ except for the cycle that allows evaporation in the reheater. The cycle efficiency reaches its maximum at a lower temperature than the total and for the evaporation in the reheater they are the same. The cycle efficiency is a good measurement in theory when the heat source can be adjusted as it is a measure of how well the fluid performs. In practice however it’s not useful as the maximum power output can’t be related to the cycle efficiency. The cycle does not consider how much of the energy available is used as only the temperature of the heat source sets it limits and is independent of mass flows. For real cycle comparing the power output or the total efficiency is a better measurement of performance of a fluid as these gives the real maximum values of the fluid. For a specific case these values is the best when comparing multiple fluids. 5.2 Future work 5.2.1 ORC program The ORC program has only twelve fluids can be chosen giving the user limited option on fluid selection. The list of fluids could be increased. Caution with adding more fluids has to be made though as REFPROP labeling of the fluids isn’t always logical. The heat source would benefit from a greater selection. E.g. the ability to handle flue gases. Now the flue gases have to be heat exchanged to water or oil. The overcritical calculations, especially when using water is quite slow and therefore leaves room for improvement. 5.2.2 Turbine The turbine program has difficulty calculating supercritical cycles and for fluids ending their expansion in the moist region. This needs improving so that the program can handle them. 45 46 6 Program use This section gives a small guide of how to use the program by doing a calculation. Each of the stations is briefly explained and lastly a run trough of the buttons is done. Blue rectangles are used to show what section that have been changed from the figure before. 6.1.1 Initial screen showing on startup. This screen shows when the program is started. Figure 33: Initial screen when started The user starts with selecting the heat source, oil or water. Continued the mass flow and temperature is set and in the case of water also the pressure needs to be selected. 6.1.2 Heat source selected The heat source was selected to be oil and with a temperature of 150 ºC and a mass flow of 10 kg/s. Because no pressure needs to be set for this heat source this field is left blank. 47 Figure 34: The heat source defined. The cycle properties now need to be set. The starting pressure and pressure is selected. If only one pressure is to be tested the start and end pressure are set to the same value and step is set to any value greater than nought. If a range of pressures is to be tested (end pressure > start pressure) the field step is set with what interval the pressures are going to be tested. The field overheat sets how many degrees of superheating the cycle is to have. If only a saturated cycle is desired (no superheating) this field is set to nought. 6.1.3 Cycle properties selected The pressure were set to start at 2 bar and run with 1 bar interval up to 25 bar. The superheating were set to 5 ºC (i.e. the state 4 temperature is 5 ºC higher than saturation temperature). 48 Figure 35: The cycle properties chosen. The next step is to set the efficiency of the pump and turbine. 6.1.4 Component Data The isentropic efficiency of the turbine was set to 85 % and the pump was set to 80 %. Figure 36: Pump and Turbine efficiencies chosen 49 Now the fluids need to be set. There are twelve to choose from. User can select one or more for the calculation. If all fluids are to be tested the button “select all” (circled in figure 36) can be pressed rather than clicking on every fluid. 6.1.5 Substances In this case all the fluids were selected to run by pressing “select all”. Figure 37: Fluids chosen The properties of the cooling media now need to be selected. The choice is between using water or air for cooling. After clicking on what media to use a box appear where the temperature the cooling media is to be set. If the default values in the program want to be used (10 ºC for water and 25 ºC for air) the box “default temp in” can be clicked and the values are loaded. Also the ambient temperature needs to be set. If air was selected the ambient temperature is to be set to the same value as for cooling temperature while for water the temperatures doesn’t need to be the same. 6.1.6 Cooling Water was selected with its default value of 10 ºC. The ambient temperature was set to 20 ºC. 50 Figure 38: Cooling selected Now the values for the heat exchangers need to be set. There are five parameters to set which are: 1. 2. 3. 4. 5. Efficiency reheater (80 %) Pinch-point condenser (2 ºC) Temperature rise of the coolant (10 ºC) Pressure drop in the heat exchangers (5 %) Pinch-point of the preheater (10 ºC) The numbers in the brackets are the predefined numbers that will be loaded by pressing “Use default values” (encircled in figure 38). 6.1.7 End result The heat exchangers are using the default values. By deciding what to search for, highest power output or highest cycle efficiency and then pressing “calculate” the program starts to calculate for all the fluids selected. The end result is seen in figure 39 where the highest power was decided to be searched for. 51 Figure 39: Heat exchangers and what to search for chosen. The end result displayed. The result shows the data of the cycle that delivered the highest power output. Besides what fluid, power output and efficiencies the temperature of the heat source and cooling outlet is shown. In this particular case the best fluid needed to move its preheater pinch point and therefore also this is displayed. Below the results the T-s and T-Q diagrams have been plotted. Figure 40 is also displayed showing the temperatures and pressures in all the points of the cycle. If for some reason the user wants to save or enlarge the diagrams this can easily be done. Right click in the graph and choose “open plot in new window”. The diagram then is opened in a fig file from where it can be saved. 52 Figure 40: The tempeartures and pressures of the points in the cycle displayed A few of buttons in program have not been mentioned yet but are presented here with what they do. 1. “clear result”: clears the “Result & Plots” section still leaving the indata. Useful if a single indata value is to be changed. 2. “reset”: Clears both the indata section and results section. 3. “deselect all”: Is the inverse to the button “select all”. Deselects all of the fluids. 4. “Turbine Calculation”: Opens the turbine calculation program and imports the values needed from the ORC program to compute the turbine. 53 54 7 References [1] Energimyndigheten, “Energiläget 2011,” Energimyndigheten, Eskilstuna, 2011. [2] S. Quoilin, S. Declaye, B. F. Tchanche and V. Lemort, “Thermo-economic optimization of waste heat recovery Organic Rankine Cycles,” Applied Thermal Engineering, no. 31, 2011. [3] B. Saleh, G. Koglbauer, M. Wendland and J. Fischer, “Working fluids for low-temperature organic Rankine cycles,” Energy, vol. 32, no. 7, 2007. [4] L. K. Nash, “Trouton and T-H-E Rule,” Journal of Chemical Education, vol. 61, no. 11, 1984. [5] E. Lemmon, M. Huber and M. McLinden, NIST Standard Reference Database 23: Reference Fluid Thermodynamic and Transport Properties-REFPROP, Version 9.0, Gaithersburg: National Institute of Standards and Technology, Standard Reference Data Program, 2010. [6] C. He, C. Liu, H. Gao, H. Xie, Y. Li, S. Wu and J. Xu, “The optimal evaporation temperature and working fluids for subcritical organic Rankine cycle,” Energy, no. 38, 2012. [7] J. Roy, M. Mishra and A. Misra, “Performance analysis of an Organic Rankine Cycle with superheating under different heat source temperature conditions,” Applied Energy, no. 88, 2011. [8] H. M. Hettiarachchi, M. Golubovic, W. M. Worek and Y. Ikegami, “Optimum design criteria for an Organic Rankine cycle using low-temperature geothermal heat sources,” Energy, no. 32, 2007. [9] P. J. Mago, L. M. Chamra, K. Srinivasan and C. Somayaji, “An examination of regenerative organic Rankine cycles using dry fluids,” Applied Thermal Engineering, no. 28, 2008. [10] A. A. Lakew and O. Bolland, “Working fluids for low-temperature heat source,” Applied Thermal Engineering, no. 30, 2010. [11] N. A. Lai, M. Wendland and J. Fischer, “Working fluids for high-temperature organic Rankine cycles,” Energy, no. 36, 2011. [12] B. F. Tchanche, G. Papadakis, G. Lambrinos and A. Frangoudakis, “Fluid selection for a lowtemperature solar organic Rankine cycle,” Apllied Thermal Engineering, no. 29, 2009. [13] B. Sundén, “Värmeöverföring,” Lund, 2006, p. 333. [14] D. W. GREEN and R. H. PERRY, “PERRY'S CHEMICAL ENGINEERS' HANDBOOK 8th edition,” pp. 2-185. [15] S. L. Dixon and C. A. Hall, Fluid Mechanics and Thermodynamics of Turbomachinery, 6 ed., 2010. [16] M. Schobeiri, Turbomachinery Flow Physics and Dynamic Performance, 2005. 55 [17] D. Olsson, “LUAX-T,” Lund, 2008. [18] E. Macchi and A. Perdichizzi, “Efficiency Prediction for Axial-Flow Turbines Operating with Nonconventional Fluids,” Journal of engineering for power, pp. 718-724, 1981. [19] Y. A. Cengel and M. A. Boles, THERMODYNAMICS An Engineering Approach, 6th ed., 2007. [20] H. Moustapha, M. F. Zelesky, N. C. Baines and D. Japikse, Axial and Radial Turbines, Vermont: Concepts ETI, 2003. [21] H. Saravanamuttoo, G. Rogers, h. Cohen and P. Straznicky, Gas turbine Theory, 6th ed. ed., 2009. [22] H. Chen, D. Y. Goswami and E. K. Stefanakos, “A review of thermodynamic cycles and working fluids for the conversion of low-grade heat,” Renewable and Sustainable Energy Reviews, no. 14, 2010. 56 8 Appendix A 8.1 ORC Program function varargout = ORC(varargin) %##################################################################### %## ## %## ## %## Mikael Olsson 2012 ## %## ## %## ## %##################################################################### % %HEAT SOURCE %Choose whether you have thermal oil (oil) or water. Oil uses the %oil_source.m and h_diff.m files for iteration & entalphy difference. No %pressure needs to be defined. Water uses the water_source.m file for %iteration only. %A pressure needs to be defined for water, thats in the subcooled area for %the given temperature. % %CYCLE PROPERTIES %Set your starting pressure,range and end pressure thats is going to be %calculated. If only one pressure is to be calculated set the start and end %pressure to the same value and steps to any number >0. %The overheat input is how many degrees it should superheat. If no %superheating is wanted set this value to 0. Then no superheater is needed. % %COMPONENT DATA %Enter the isentropic efficencys of turbine and pump. The value is to be in %percent, NOT decimals. E.g for 85% efficeny, enter 85, not 0.85; % %SUBSTANCE %Select which substance/substances to try. % %COOLING %Select if water or air is used as condensor cooling. Enter what temperature %the cooling media has at condensor inlet or click the box "Default Temp %In" to use default temperatures. For water it is 10 C and air 25 C. % %PINCH-POINTS & REHEATER EFFICENY %Efficency Reheater: If no reheater is to be used, set this value to 0 else %the value is to be in percent, NOT decimals. E.g 80%, not 0.8. Default %value for this is set to 80% % %Pinch-Point condenser: Temperature difference between cooling medie and %working fluid at starting point of condensation. Default value set to 2 C. % %Temperature rise coolant: Temperature difference of the cooling medie at %inlet and start of condensation. Default value set to 10 C. % %Pressuredrop Hex: Pressure drop in the heat exchangers on the working %fluid side. Default value set to 5%. % %Pinch-Point Preheater: Temperature difference between the sat. liquid and %the heat source after the preheater. Default value set to 10 C. % %SEARCH FOR 57 %Choose what you want to find, highest power or efficency. % %PUSHBUTTONS %Calculate starts the calculation %Reset clears "Indata","Search for" & "Result&Plots". %clear result only clears the "Result&Plots". % %IMPORTANT!!! %If the numbers and letters in the plots are upside down after %calculating or opening in seperate figure it might be a problem with the %hardware of the machine and matlab (at least for ver.2009b). To get around %this, type "opengl info" in command window. If "Software = false" %type: "opengl software". Then type "opengl info" again and it should %say: "software=true". Now the numbers and letters always should be the %right way up when program is restarted or "clear result" has been pushed. %This has to be done every time matlab has been closed. % %Caution!!! %When doing supercritical cycles (typically P>30-35 bar) and using %water as heat source the iteration is slow because the communication %between matlab and refprop. Therefore its recomended to only do one %fluid at a time when running supercritical cycles with water as heat %source. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % LLL TTTTTTTTTTTTTT HHH HHH % LLL TTTTTTTTTTTTTT HHH HHH % LLL TTT HHH HHH % LLL TTT HHH HHH % LLL TTT HHHHHHHHHHHHHH % LLL TTT HHHHHHHHHHHHHH % LLL TTT HHH HHH % LLL TTT HHH HHH % LLLLLLLLLLLL TTT HHH HHH % LLLLLLLLLLLL TTT HHH HHH % % See also: GUIDE, GUIDATA, GUIHANDLES % Edit the above text to modify the response to help ORC % Last Modified by GUIDE v2.5 26-Jun-2012 09:24:21 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @ORC_OpeningFcn, ... 'gui_OutputFcn', @ORC_OutputFcn, ... 'gui_LayoutFcn', [] , ... 'gui_Callback', []); if nargin && ischar(varargin{1}) gui_State.gui_Callback = str2func(varargin{1}); end if nargout [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else gui_mainfcn(gui_State, varargin{:}); end % End initialization code - DO NOT EDIT clc; 58 % --- Executes just before ORC is made visible. function ORC_OpeningFcn(hObject, eventdata, handles, varargin) % This function has no output args, see OutputFcn. % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % varargin command line arguments to ORC (see VARARGIN) % Choose default command line output for ORC handles.output = hObject; %Add logo bild2 = imread('Logo.bmp'); axes(handles.logo); imshow(bild2); set(handles.logo,'HandleVisibility','off') axis off set(handles.pp_new_descrip,'Visible','off'); set(handles.pp_new,'Visible','off'); set(handles.pp_new_unit,'Visible','off'); set(handles.text88,'Visible','off'); set(handles.temp_coolt,'Visible','off'); set(handles.Turb_calc,'Visible','off'); guidata(hObject, handles); % UIWAIT makes ORC wait for user response (see UIRESUME) % uiwait(handles.figure1); % --- Outputs from this function are returned to the command line. function varargout = ORC_OutputFcn(hObject, eventdata, handles) % varargout cell array for returning output args (see VARARGOUT); % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Get default command line output from handles structure varargout{1} = handles.output; function effic_t_Callback(hObject, eventdata, handles) % hObject handle to effic_t (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of effic_t as text % str2double(get(hObject,'String')) returns contents of effic_t as a double effic_t =str2double(get(hObject,'String')); if isnan(effic_t) set(hObject, 'String', 0); errordlg('Input must be a number','Error','on'); end handles.val.effic_t = effic_t; guidata(hObject,handles) 59 % --- Executes during object creation, after setting all properties. function effic_t_CreateFcn(hObject, eventdata, handles) % hObject handle to effic_t (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function effic_p_Callback(hObject, eventdata, handles) % hObject handle to effic_p (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of effic_p as text % str2double(get(hObject,'String')) returns contents of effic_p as a double effic_p =str2double(get(hObject,'String')); if isnan(effic_p) set(hObject, 'String', 0); errordlg('Input must be a number','Error','on'); end handles.val.effic_p = effic_p; guidata(hObject,handles) % --- Executes during object creation, after setting all properties. function effic_p_CreateFcn(hObject, eventdata, handles) % hObject handle to effic_p (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function start_pressure_Callback(hObject, eventdata, handles) % hObject handle to start_pressure (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of start_pressure as text % str2double(get(hObject,'String')) returns contents of start_pressure as a double start_pressure =str2double(get(hObject,'String')); if isnan(start_pressure) set(hObject, 'String', 0); errordlg('Input must be a number','Error','on'); 60 end handles.val.start_pressure = start_pressure; guidata(hObject,handles) % --- Executes during object creation, after setting all properties. function start_pressure_CreateFcn(hObject, eventdata, handles) % hObject handle to start_pressure (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function steps_Callback(hObject, eventdata, handles) % hObject handle to steps (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of steps as text % str2double(get(hObject,'String')) returns contents of steps as a double steps =str2double(get(hObject,'String')); if isnan(steps) set(hObject, 'String', 0); errordlg('Input must be a number','Error','on'); end handles.val.steps = steps; guidata(hObject,handles) % --- Executes during object creation, after setting all properties. function steps_CreateFcn(hObject, eventdata, handles) % hObject handle to steps (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function end_pressure_Callback(hObject, eventdata, handles) % hObject handle to end_pressure (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of end_pressure as text % str2double(get(hObject,'String')) returns contents of end_pressure as a double end_pressure =str2double(get(hObject,'String')); if isnan(end_pressure) set(hObject, 'String', 0); errordlg('Input must be a number','Error','on'); end 61 handles.val.end_pressure = end_pressure; guidata(hObject,handles) % --- Executes during object creation, after setting all properties. function end_pressure_CreateFcn(hObject, eventdata, handles) % hObject handle to end_pressure (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function overheat_Callback(hObject, eventdata, handles) % hObject handle to overheat (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of overheat as text % str2double(get(hObject,'String')) returns contents of overheat as a double overheat =str2double(get(hObject,'String')); if isnan(overheat) set(hObject, 'String', 0); errordlg('Input must be a number','Error','on'); end handles.val.overheat = overheat; guidata(hObject,handles) % --- Executes during object creation, after setting all properties. function overheat_CreateFcn(hObject, eventdata, handles) % hObject handle to overheat (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- Executes on button press in oil_heat. function oil_heat_Callback(hObject, eventdata, handles) % hObject handle to oil_heat (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if (get(hObject,'Value')==get(hObject,'Max')) minVal = get(handles.water_heat,'Min'); set(handles.water_heat,'Value',minVal); end % if (get(hObject,'Value')==get(hObject,'Min')) % maxVal = get(handles.water_heat,'Max'); % set(handles.water_heat,'Value',maxVal); % end 62 set(handles.mass_heat,'String','Massflow oil') set(handles.temp_heat,'String','Oil temperature in') set(handles.pressure_heat,'String','Not in use for oil') %set(handles.pressure_in,'String','Only used if heat source is water') % set(handles.pressure_in,'Visible','off') % set(handles.text48,'Visible','off') % Hint: get(hObject,'Value') returns toggle state of oil_heat % --- Executes on button press in water_heat. function water_heat_Callback(hObject, eventdata, handles) % hObject handle to water_heat (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if (get(hObject,'Value')==get(hObject,'Max')) minVal = get(handles.oil_heat,'Min'); set(handles.oil_heat,'Value',minVal); end % if (get(hObject,'Value')==get(hObject,'Min')) % maxVal = get(handles.oil_heat,'Max'); % set(handles.oil_heat,'Value',maxVal); % end set(handles.mass_heat,'String','Massflow water') set(handles.temp_heat,'String','Water temperature in') set(handles.pressure_heat,'String','Water pressure') %set(handles.pressure_in,'String','0') % set(handles.pressure_heat,'Visible','on') % set(handles.pressure_in,'Visible','on') set(handles.text48,'String','Bar') % set(handles.text48,'Visible','on') % Hint: get(hObject,'Value') returns toggle state of water_heat function massflow_Callback(hObject, eventdata, handles) % hObject handle to massflow (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of massflow as text % str2double(get(hObject,'String')) returns contents of massflow as a double massflow =str2double(get(hObject,'String')); if isnan(massflow) set(hObject, 'String', 0); errordlg('Input must be a number','Error','on'); end handles.val.massflow = massflow; guidata(hObject,handles) % --- Executes during object creation, after setting all properties. function massflow_CreateFcn(hObject, eventdata, handles) % hObject handle to massflow (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); 63 end function temperature_heat_Callback(hObject, eventdata, handles) % hObject handle to temperature_heat (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of temperature_heat as text % str2double(get(hObject,'String')) returns contents of temperature_heat as a double temperature_heat =str2double(get(hObject,'String')); if isnan(temperature_heat) set(hObject, 'String', 0); errordlg('Input must be a number','Error','on'); end handles.val.temperature_heat = temperature_heat; guidata(hObject,handles) % --- Executes during object creation, after setting all properties. function temperature_heat_CreateFcn(hObject, eventdata, handles) % hObject handle to temperature_heat (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function pressure_in_Callback(hObject, eventdata, handles) % hObject handle to pressure_in (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of pressure_in as text % str2double(get(hObject,'String')) returns contents of pressure_in as a double pressure_in =str2double(get(hObject,'String')); if isnan(pressure_in)&& (get(handles.water_heat,'Value')==get(handles.water_heat,'Max')) set(hObject, 'String', 0); errordlg('Input must be a number','Error','on'); end handles.val.pressure_in = pressure_in; guidata(hObject,handles) % --- Executes during object creation, after setting all properties. function pressure_in_CreateFcn(hObject, eventdata, handles) % hObject handle to pressure_in (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); 64 end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %Lägg in alla ämnen här under. % --- Executes on button press in pentane. function pentane_Callback(hObject, eventdata, handles) % hObject handle to pentane (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of pentane % if (get(hObject,'Value') == get(hObject,'Max')) % set(hObject,'Value',1); % end % --- Executes on button press in butane. function butane_Callback(hObject, eventdata, handles) % hObject handle to butane (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of butane % --- Executes on button press in R227ea. function R227ea_Callback(hObject, eventdata, handles) % hObject handle to R227ea (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of R227ea % --- Executes on button press in ammonia. function ammonia_Callback(hObject, eventdata, handles) % hObject handle to ammonia (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of ammonia % --- Executes on button press in R134a. function R134a_Callback(hObject, eventdata, handles) % hObject handle to R134a (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of R134a % --- Executes on button press in R114. function R114_Callback(hObject, eventdata, handles) % hObject handle to R114 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of R114 % --- Executes on button press in R245fa. function R245fa_Callback(hObject, eventdata, handles) % hObject handle to R245fa (see GCBO) 65 % eventdata % handles reserved - to be defined in a future version of MATLAB structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of R245fa % --- Executes on button press in R113. function R113_Callback(hObject, eventdata, handles) % hObject handle to R113 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of R113 % --- Executes on button press in R123. function R123_Callback(hObject, eventdata, handles) % hObject handle to R123 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of R123 % --- Executes on button press in R141b. function R141b_Callback(hObject, eventdata, handles) % hObject handle to R141b (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of R141b % --- Executes on button press in isopentane. function isopentane_Callback(hObject, eventdata, handles) % hObject handle to isopentane (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of isopentane % --- Executes on button press in cyc_pentane. function cyc_pentane_Callback(hObject, eventdata, handles) % hObject handle to cyc_pentane (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of cyc_pentane %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%Kylning%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % --- Executes on button press in water_cool. function water_cool_Callback(hObject, eventdata, handles) % hObject handle to water_cool (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) 66 set(handles.text88,'Visible','on'); set(handles.temp_coolt,'Visible','on'); set(handles.temp_coolt,'style','edit') set(handles.temp_coolt,'String','0') set(handles.temp_coolt,'BackgroundColor','white') set(handles.default_temp_in,'Value',0) if (get(hObject,'Value')==get(hObject,'Max')) minVal = get(handles.air_cool,'Min'); set(handles.air_cool,'Value',minVal); set(handles.temp_coolt,'style','edit') end % Hint: get(hObject,'Value') returns toggle state of water_cool % --- Executes on button press in air_cool. function air_cool_Callback(hObject, eventdata, handles) % hObject handle to air_cool (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) set(handles.text88,'Visible','on'); set(handles.temp_coolt,'Visible','on'); set(handles.temp_coolt,'style','edit') set(handles.temp_coolt,'String','0') set(handles.temp_coolt,'BackgroundColor','white') set(handles.default_temp_in,'Value',0) if (get(hObject,'Value')==get(hObject,'Max')) minVal = get(handles.water_cool,'Min'); set(handles.water_cool,'Value',minVal); end % Hint: get(hObject,'Value') returns toggle state of air_cool function ambient_Callback(hObject, eventdata, handles) % hObject handle to ambient (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) ambient =str2double(get(hObject,'String')); if isnan(ambient) set(hObject, 'String', 0); errordlg('Input must be a number','Error','on'); end handles.val.ambient = ambient; guidata(hObject,handles) % Hints: get(hObject,'String') returns contents of ambient as text % str2double(get(hObject,'String')) returns contents of ambient as a double % --- Executes during object creation, after setting all properties. function ambient_CreateFcn(hObject, eventdata, handles) % hObject handle to ambient (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end 67 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%% Calculation & PLOT %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % --- Executes on button press in calculate. function calculate_Callback(hObject, eventdata, handles) % hObject % eventdata % handles handle to calculate (see GCBO) reserved - to be defined in a future version of MATLAB structure with handles and user data (see GUIDATA) set(handles.pp_new_descrip,'Visible','off'); set(handles.pp_new,'Visible','off'); set(handles.pp_new_unit,'Visible','off'); cla(handles.wait) set(handles.wait,'BackgroundColor','red') set(handles.wait,'String','Working') set(handles.uipanel13,'BackgroundColor',[0.94,0.94,0.94]) set(handles.uipanel18,'BackgroundColor',[0.94,0.94,0.94]) if (get(handles.water_heat,'Value')==get(handles.water_heat,'Min'))&&(get(hand les.oil_heat,'Value')==get(handles.oil_heat,'Min')) errordlg('Choose heatsource medie','Error','on') return; end if (get(handles.water_cool,'Value')==get(handles.water_cool,'Min'))&&(get(hand les.air_cool,'Value')==get(handles.air_cool,'Min')) errordlg('Choose coolant','Error','on') set(handles.uipanel18,'BackgroundColor','red') set(handles.wait,'BackgroundColor','red'); set(handles.wait,'String','Error'); end cla(handles.T_s); cla(handles.T_Q); if (get(handles.water_heat,'Value')==get(handles.water_heat,'Max')) if handles.val.pressure_in<1 errordlg('You must set a pressure for the water','Error','on') return; end if refpropm('Q','T',handles.val.temperature_heat+273.15,'P',handles.val.pressu re_in*10^2,'water')>0 errordlg('You have not subcooled water, it will not work. Increase pressure','Error','on') return; end end if (get(handles.search_power,'Value')==get(handles.search_power,'Min'))&&(get( handles.search_effic,'Value')==get(handles.search_effic,'Min')) errordlg('Choose what you want to find','Error','on') return end maxval(1) = get(handles.pentane,'Value'); amne(1)={'pentane'};%{'cyclopen'}; maxval(2) = get(handles.butane,'Value'); amne(2)={'butane'}; 68 maxval(3) = get(handles.R227ea,'Value'); amne(3)={'R227ea'}; maxval(4) = get(handles.ammonia,'Value'); amne(4)={'ammonia'}; maxval(5) = get(handles.R134a,'Value'); amne(5)={'R134a'}; maxval(6) = get(handles.R114,'Value'); amne(6)={'R114'}; maxval(7) = get(handles.R245fa,'Value'); amne(7)={'R245fa'}; maxval(8) = get(handles.R113,'Value'); amne(8)={'R113'}; maxval(9) = get(handles.R123,'Value'); amne(9)={'R123'}; maxval(10) = get(handles.R141b,'Value'); amne(10)={'R141b'}; maxval(11) = get(handles.isopentane,'Value'); amne(11)={'ipentane'}; maxval(12) = get(handles.cyc_pentane,'Value'); amne(12)={'cyclopen'}; plats = 1; for u = 1:1:length(maxval) if maxval(u)==1 medie(plats)=amne(u); plats = plats+1; end end if plats-1<1 errordlg('You must set a substance/substances','Error','on') set(handles.uipanel13,'BackgroundColor','red') return end if (get(handles.water_heat,'Value')==get(handles.water_heat,'Max')) P_heat_water = handles.val.pressure_in*10^2; %kPa end P = [handles.val.start_pressure:handles.val.steps:handles.val.end_pressure]; m_heat = handles.val.massflow; thigh_heat = handles.val.temperature_heat+273.15; efficturbine = handles.val.effic_t/100; efficpump = handles.val.effic_p/100; if (get(handles.default_val,'Value')==get(handles.default_val,'Max')) effic_reheat = 0.8; else effic_reheat = handles.val.effic_reheat/100; end t_overheat = handles.val.overheat; if (get(handles.water_cool,'Value')==get(handles.water_cool,'Max')) if(get(handles.default_temp_in,'Value')== get(handles.default_temp_in,'Max')) coolt = 10; else coolt = handles.val.temp_coolt; end end if (get(handles.air_cool,'Value')==get(handles.air_cool,'Max')) if(get(handles.default_temp_in,'Value')== get(handles.default_temp_in,'Max')) 69 coolt = 25; else coolt = handles.val.temp_coolt; end end t_ambient = handles.val.ambient; tin_cool = 273.15+coolt; Wout_vek = zeros(length(P),length(medie)); m_vek = zeros(length(P),length(medie)); wout_vek = zeros(length(P),length(medie)); Wout_ok_vek = zeros(length(P),length(medie)); effic_vek = zeros(length(P),length(medie)); Wout_ok_vek = zeros(length(P),length(medie)); effic_ok = zeros(length(P),length(medie)); warn = zeros(length(P),length(medie)); %%%%%%%%%%%%%%%%%%%%%%%%%Pressuredrop HEX%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% if (get(handles.default_val,'Value')==get(handles.default_val,'Max')) p_drop = 0.05; % 5% från Thern else p_drop=handles.val.pressure_drop/100; end if effic_reheat==0 %Subcritical p23_drop = 1; p37_drop = p23_drop*(1-p_drop); p78_drop = p37_drop*(1-p_drop); p84_drop = p78_drop*(1-p_drop); %Supercritical p23_drop_ok = 1; p34_drop_ok = p23_drop_ok*(1-p_drop); else %Subcritical p23_drop = (1-p_drop); p37_drop = p23_drop*(1-p_drop); p78_drop = p37_drop*(1-p_drop); p84_drop = p78_drop*(1-p_drop); %Supercritical p23_drop_ok = (1-p_drop); p34_drop_ok = p23_drop_ok*(1-p_drop); end %%%%%%%%%%%%%%%%%%%%%%Pinch-points%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% if (get(handles.default_val,'Value')==get(handles.default_val,'Max')) pinch = 10; %degrees C else pinch = handles.val.pp_preheater; end if (get(handles.default_val,'Value')==get(handles.default_val,'Max')) pinch_cond = 2; else pinch_cond = handles.val.pp_cond; 70 end if (get(handles.default_val,'Value')==get(handles.default_val,'Max')) temp_rise_coolt = 10; else temp_rise_coolt = handles.val.temp_rise_coolt; end pinch_thigh_tf4_ok = 25; %for supercritical. Temp diff between hot medie in and fluid out %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% for j=1:length(medie) %Reset values to avoid and leftovers that corrupt result T = 0; sl = 0; sv = 0; hf1 = 0; tf1=0; sf1=0; Qfv=0; tfafv_heat=0; hf2 = 0; tf2=0; sf2=0; Qfa=0; tut_kyl=0; hf3 = 0; tf3=0; sf3=0; Qoh=0; hf4 = 0; tf4=0; sf4=0; sf2s=0; hf5 = 0; tf5=0; sf5=0; sf5s=0; hf5s=0; hf6 = 0; tf6=0; sf6=0; tf5s=0; hf7 = 0; tf7=0; sf7=0; tf2s=0; hf8 = 0; tf8=0; sf8=0; hf9 = 0; tf9=0; sf9=0; hf2_ok hf3_ok hf4_ok hf5_ok hf6_ok hf9_ok = = = = = = 0; 0; 0; 0; 0; 0; sf2_ok=0; sf3_ok=0; sf4_ok=0; sf5_ok=0; sf6_ok=0; sf9_ok=0; tf2_ok tf3_ok tf4_ok tf5_ok tf6_ok tf9_ok = = = = = = 0; 0; 0; 0; 0; 0; tf1 = tin_cool+pinch_cond+temp_rise_coolt ; P_cond = refpropm('P','T',tf1,'Q',0,char(medie(j))); hf1 = refpropm('H','P',P_cond,'Q',0,char(medie(j))); %J/kg sf1 = refpropm('S','P',P_cond,'Q',0,char(medie(j))); %J/kgK %%%%%% Limits the condensor pressure to a minimum off 10kPa or higher %%% if P_cond<10 %P_cond = refpropm('P','T',tf1,'Q',0,char(medie(j))); P_cond=10; hf1 = refpropm('H','T',tf1,'P',P_cond,char(medie(j))); %J/kg sf1 = refpropm('S','T',tf1,'P',P_cond,char(medie(j))); %J/kgK else hf1 = refpropm('H','P',P_cond,'Q',0,char(medie(j))); %J/kg sf1 = refpropm('S','P',P_cond,'Q',0,char(medie(j))); %J/kgK end for i=1:1:length(P) P_pump = P(i)*10^2; %kPa P_cond_vek(i,j)=P_cond; 71 P_pump_vek(i,j) = P_pump; %if the the working pressure is lower than or equal to condensor pressure %its not allowed run if P_pump<=P_cond continue end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%% Subcritical %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% if P_pump<refpropm('P','C',0,'',0,char(medie(j))) m=0; %After pump hf2s = refpropm('H','P',P_pump,'S',sf1,char(medie(j)));%J/kg tf2s = refpropm('T','H',hf2s,'P',P_pump,char(medie(j))); sf2s = sf1; hf2 = ((hf2s-hf1)/efficpump)+hf1; %J/kg tf2 = refpropm('T','H',hf2,'P',P_pump,char(medie(j))); sf2 = refpropm('S','P',P_pump,'H',hf2,char(medie(j))); %If saturation temperature higher than heat source in, its not allowed run if refpropm('T','P',P_pump,'Q',0,char(medie(j)))<thigh_heat count = 1; change_p_drop=1; while change_p_drop>0 && count<3 if count==1 && effic_reheat>0 change_p_drop = 0; end if change_p_drop==1 && count==2 p23_drop = 1; p37_drop = p23_drop*(1-p_drop); p78_drop = p37_drop*(1-p_drop); p84_drop = p78_drop*(1-p_drop); else %Subcritical p23_drop = (1-p_drop); p37_drop = p23_drop*(1-p_drop); p78_drop = p37_drop*(1-p_drop); p84_drop = p78_drop*(1-p_drop); end %After preheater hf7 = refpropm('H','P',P_pump*p37_drop,'Q',0,char(medie(j))); tf7 = refpropm('T','P',P_pump*p37_drop,'Q',0,char(medie(j))); 72 sf7 = refpropm('S','P',P_pump*p37_drop,'Q',0,char(medie(j))); %After evaporator hf8 = refpropm('H','P',P_pump*p78_drop,'Q',1,char(medie(j)));%J/kg tf8 = refpropm('T','P',P_pump*p78_drop,'Q',1,char(medie(j))); sf8 = refpropm('S','P',P_pump*p78_drop,'Q',1,char(medie(j))); %After superheater if t_overheat ==0; tf4=tf8; else tf4 = tf8+t_overheat; %tf4 = thigh_heat-t_overheat; end if strcmp(char(medie(j)),'R245fa') && tf4>440 break; end if strcmp(char(medie(j)),'R134a') && tf4>455 break; end if strcmp(char(medie(j)),'R227ea') && tf4>475 break; end if strcmp(char(medie(j)),'ipentane') && tf4>500 break; end if strcmp(char(medie(j)),'R141b') && tf4>500 break; end if strcmp(char(medie(j)),'R114') && tf4>507 break; end if strcmp(char(medie(j)),'R113') && tf4>525 break; end if strcmp(char(medie(j)),'butane') && tf4>575 break; end if strcmp(char(medie(j)),'R123') && tf4>599 break; end if strcmp(char(medie(j)),'pentane') && tf4>600 break; end if strcmp(char(medie(j)),'cyclopen') && tf4>600 break; end if strcmp(char(medie(j)),'ammonia') && tf4>700 break; end %If tf4 = tf8 no superheater is to be used which means that the %pressure drop from the superheater is not to be included. 73 if tf4 == refpropm('T','P',P_pump*p78_drop,'Q',1,char(medie(j))) hf4 = refpropm('H','P',P_pump*p78_drop,'Q',1,char(medie(j))); sf4 = refpropm('S','P',P_pump*p78_drop,'Q',1,char(medie(j))); else hf4 = refpropm('H','T',tf4,'P',P_pump*p84_drop,char(medie(j))); sf4 = refpropm('S','T',tf4,'P',P_pump*p84_drop,char(medie(j))); end if tf4>thigh_heat break end %After turbine hf5s = refpropm('H','P',P_cond,'S',sf4,char(medie(j))); %J/kg sf5s = sf4; hf5 = hf4-efficturbine*(hf4-hf5s); sf5 = refpropm('S','P',P_cond,'H',hf5,char(medie(j))); tf5 = refpropm('T','P',P_cond,'H',hf5,char(medie(j))); tf5s = refpropm('T','P',P_cond,'H',hf5s,char(medie(j))); %Check for moisture. No reheater if moist beacuse you are in the %saturated area. x = refpropm('Q','P', P_cond,'H',hf5,char(medie(j))); x_vek(i,j)=x; %Needed to be able to plot and calculate if in the saturated area. if x>0 && hf6 = tf6 = sf6 = x<1 hf5; tf5; sf5; hf3 = hf2; tf3=tf2; sf3 = sf2; hf9 = hf6; tf9 = tf6; sf9 = sf6; change_p_drop = 1; else change_p_drop = 0; hf6 = refpropm('H','P',P_cond,'Q',1,char(medie(j))); 74 tf6 = refpropm('T','P',P_cond,'Q',1,char(medie(j))); sf6 = refpropm('S','P',P_cond,'Q',1,char(medie(j))); h_min_reheater = refpropm('h','t',tf2,'P',P_cond,char(medie(j))); %Can't heatexchange down to condensation temperature if %efficeny of the reheater is less than 100% hf9 = hf5-((hf5-h_min_reheater)*effic_reheat); %Formel 15-14 värmeöverföring Sunden tf9 = refpropm('T','P',P_cond,'H',hf9,char(medie(j))); sf9 = refpropm('S','P',P_cond,'H',hf9,char(medie(j))); %After reheater hf3 = hf5-hf9+hf2; tf3 = refpropm('T','P',P_pump*p23_drop,'H',hf3,char(medie(j))); sf3 = refpropm('S','P',P_pump*p23_drop,'H',hf3,char(medie(j))); prheat_gone = 0; if tf3>=tf7 prheat_gone=1; end end count=count+1; end %fafv= between preheater & evaporator. tfafv_heat = tf7+pinch; %temp between preheater & evaporator of oil/water %Eliminates negative massflows that occurs if tfafv>thigh and sets %m=0 so it dosen't corrupt the results. if tfafv_heat<thigh_heat if (get(handles.oil_heat,'Value')==get(handles.oil_heat,'Max')) m = m_heat*h_diff(thigh_heat-273.15,tfafv_heat273.15)/(hf4-hf7); else if (get(handles.water_heat,'Value')==get(handles.water_heat,'Max')) m= m_heat*(refpropm('H','T',thigh_heat,'P',P_heat_water,'water')-... refpropm('H','T',tfafv_heat,'P',P_heat_water,'water'))/(hf4-hf7); end end else m=0; end qtot = (m/m_heat)*(hf4-hf3); qfv = (m/m_heat)*(hf7-hf3); 75 if (get(handles.oil_heat,'Value')==get(handles.oil_heat,'Max')) tlow_heat = oil_source(thigh_heat-273.15,qtot)+273.15; else if (get(handles.water_heat,'Value')==get(handles.water_heat,'Max')) tlow_heat = water_source(thigh_heat,qtot,P_heat_water); end end pinch_vek(i,j)=pinch; if (tlow_heat-5)<tf3 pinch_ny = 10; while (tlow_heat-5-tf3)<0 tfafv_heat = tf7+pinch_ny; if tfafv_heat<thigh_heat if (get(handles.oil_heat,'Value')==get(handles.oil_heat,'Max')) m = m_heat*h_diff(thigh_heat273.15,tfafv_heat-273.15)/(hf4-hf7); else if (get(handles.water_heat,'Value')==get(handles.water_heat,'Max')) m= m_heat*(refpropm('H','T',thigh_heat,'P',P_heat_water,'water')-... refpropm('H','T',tfafv_heat,'P',P_heat_water,'water'))/(hf4-hf7); end end end qtot = (m/m_heat)*(hf4-hf3); if (get(handles.oil_heat,'Value')==get(handles.oil_heat,'Max')) tlow_heat = oil_source(thigh_heat273.15,qtot)+273.15; else if (get(handles.water_heat,'Value')==get(handles.water_heat,'Max')) tlow_heat = water_source(thigh_heat,qtot,P_heat_water); end end pinch_ny = pinch_ny+1; end warn(i,j) = 1; pinch_vek(i,j)=pinch_ny; tfafv_heat = tf7+pinch_ny; end Qcond_kyl = m*(hf6-hf1); tcond_kyl = tin_cool+temp_rise_coolt; %Pressure on cooling water set to 5 bar and air to ambient pressure if (get(handles.water_cool,'Value')==get(handles.water_cool,'Max')) m_kyl=Qcond_kyl/(refpropm('H','T',tcond_kyl,'P',5*10^2,'water')-... 76 refpropm('H','T',tin_cool,'P',5*10^2,'water')); qkyl = m*(hf9-hf1)/m_kyl; hcool_out = refpropm('H','T',tin_cool,'P',5*10^2,'water')+ m*(hf9-hf1)/m_kyl; %tout_cool = water_cond(tin_cool,qkyl,5*10^2); tout_cool = refpropm('T','H',hcool_out,'P',5*10^2,'water'); end if (get(handles.air_cool,'Value')==get(handles.air_cool,'Max')) m_kyl = Qcond_kyl/(refpropm('H','T',tcond_kyl,'P',101,'air.ppf')-... refpropm('H','T',tin_cool,'P',101,'air.ppf')); density_air = refpropm('H','T',(tin_cool+tut_kyl)/2,'P',101,'air.ppf'); Volume_flow_air = density_air/m_kyl; qkyl = m*(hf9-hf1)/m_kyl; hcool_out = refpropm('H','T',tin_cool,'P',101,'air.ppf')+ m*(hf9-hf1)/m_kyl; %tout_cool = air_cond(tin_cool,qkyl,101); tout_cool = refpropm('T','H',hcool_out,'P',101,'air.ppf'); end Qkyl = m*(hf9-hf1); Qfv = m*(hf7-hf3); Qfa = m*(hf8-hf7); Qoh = m*(hf4-hf8); Qtot = Qfv+Qfa+Qoh; Qreheat = m*(hf5-hf6); %%%Temperature and Cp unknown and need to be iterated%%%%%%%%%%%%% qoh = (m/m_heat)*(hf4-hf8); if (get(handles.oil_heat,'Value')==get(handles.oil_heat,'Max')) tohfa_heat = oil_source(thigh_heat-273.15,qoh)+273.15; else if (get(handles.water_heat,'Value')==get(handles.water_heat,'Max')) tohfa_heat = water_source(thigh_heat,qoh,P_heat_water); end end if (get(handles.oil_heat,'Value')==get(handles.oil_heat,'Max')) Qoil = m_heat*h_diff(thigh_heat-273.15,tlow_heat273.15); else if (get(handles.water_heat,'Value')==get(handles.water_heat,'Max')) Qoil = m_heat*(refpropm('H','T',thigh_heat,'P',P_heat_water,'water')-... refpropm('H','T',tlow_heat,'P',P_heat_water,'water')); end end Qreheat = m*(hf5-hf6); 77 qmax_transf = h_diff(thigh_heat-273.15,t_ambient); %%%%%%%%%%%%%%%%%%%%%%%%Performance%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Wout = m*(hf4-hf5); %J/kg Win = m*(hf2-hf1); Qin = m*(hf4-hf3); %J/kg effic = (Wout-Win)/Qin; effic_tot = (Wout-Win)/(m_heat*qmax_transf); else break %If the substance don't fulfill the condition it starts on the %next substance %%%%%%%%%%%%%% End of if statement checking saturation temp %%%%%%%%%%%%%% end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%Volymflöden%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Df4 = refpropm('D','T',tf4,'P',P2*10^2,char(medie(j))); % Vf4 = m/Df4; % Df6 = refpropm('D','T',tf6,'P',P_kond,char(medie(j))); % Vf6 = m/Df6; %%%%%%%%%%%%%%%%%%%% Vectorizes usefull data %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% hf1_vek(i,j) = hf1; tf1_vek(i,j) = tf1; sf1_vek(i,j) = sf1; hf2s_vek(i,j) = hf2s; tf2s_vek(i,j) = tf2s; sf2s_vek(i,j) = sf2s; hf2_vek(i,j) = hf2; tf2_vek(i,j) = tf2; sf2_vek(i,j) = sf2; hf7_vek(i,j) = hf7; tf7_vek(i,j) = tf7; sf7_vek(i,j) = sf7; hf8_vek(i,j) = hf8; tf8_vek(i,j) = tf8; sf8_vek(i,j) = sf8; hf4_vek(i,j) = hf4; tf4_vek(i,j) = tf4; sf4_vek(i,j) = sf4; hf5s_vek(i,j) = hf5s; tf5s_vek(i,j) = tf5s; sf5s_vek(i,j) = sf5s; hf5_vek(i,j) = hf5; tf5_vek(i,j) = tf5; 78 sf5_vek(i,j) hf6_vek(i,j) tf6_vek(i,j) sf6_vek(i,j) hf3_vek(i,j) tf3_vek(i,j) sf3_vek(i,j) hf9_vek(i,j) tf9_vek(i,j) sf9_vek(i,j) = = = = = = = = = = sf5; hf6; tf6; sf6; hf3; tf3; sf3; hf9; tf9; sf9; tfafv_heat_vek(i,j) = tfafv_heat; tlow_heat_vek(i,j) = tlow_heat; tohfa_heat_vek(i,j) = tohfa_heat; tout_cool_vek(i,j) = tout_cool; m_vek(i,j) = m; m_kyl_vek(i,j) = m_kyl; %tut_kyl(i,j) = tut_kyl; Qfv_vek(i,j) = Qfv; Qfa_vek(i,j) = Qfa; Qoh_vek(i,j) = Qoh; Qtot_vek(i,j) = Qtot; Qoil_vek(i,j) = Qoil; Qkyl_vek(i,j) = Qkyl; Wout_vek(i,j) = Wout; %kW effic_vek(i,j) = effic; effic_tot_vek(i,j)=effic_tot; x_vek(i,j) = x; change(i,j) = change_p_drop; end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%% End of subcritical %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%% Supercritical %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%if P_pump*p34_drop_ok>=refpropm('P','C',0,'',0,char(medie(j))) if P_pump*p34_drop_ok>=refpropm('P','C',0,'',0,char(medie(j))) && refpropm('T','C',0,'',0,char(medie(j)))<(thigh_heat-pinch_thigh_tf4_ok) tlow_heat = 0; %After pump hf2s_ok = refpropm('H','P',P_pump,'S',sf1,char(medie(j)));%J/kg tf2s_ok = refpropm('T','H',hf2s_ok,'P',P_pump,char(medie(j))); sf2s_ok = sf1; hf2_ok = ((hf2s_ok-hf1)/efficpump)+hf1; %J/kg tf2_ok = refpropm('T','H',hf2_ok,'P',P_pump,char(medie(j))); sf2_ok = refpropm('S','P',P_pump,'H',hf2_ok,char(medie(j))); 79 tf4_ok = thigh_heat-pinch_thigh_tf4_ok; %Needs to fulfill the conditions before continuing: if strcmp(char(medie(j)),'R245fa') && tf4>440 break; end if strcmp(char(medie(j)),'R134a') && tf4>455 break; end if strcmp(char(medie(j)),'R227ea') && tf4>475 break; end if strcmp(char(medie(j)),'ipentane') && tf4>500 break; end if strcmp(char(medie(j)),'R141b') && tf4>500 break; end if strcmp(char(medie(j)),'R114') && tf4>507 break; end if strcmp(char(medie(j)),'R113') && tf4>525 break; end if strcmp(char(medie(j)),'butane') && tf4>575 break; end if strcmp(char(medie(j)),'R123') && tf4>599 break; end if strcmp(char(medie(j)),'pentane') && tf4>600 break; end if strcmp(char(medie(j)),'cyclopen') && tf4>600 break; end if strcmp(char(medie(j)),'ammonia') && tf4>700 break; end hf4_ok = refpropm('H','T',tf4_ok,'P',P_pump*p34_drop_ok,char(medie(j))); sf4_ok = refpropm('S','T',tf4_ok,'P',P_pump*p34_drop_ok,char(medie(j))); sf5s_ok = sf4_ok; hf5s_ok = refpropm('H','P',P_cond,'S',sf5s_ok,char(medie(j))); tf5s_ok = refpropm('T','P',P_cond,'H',hf5s_ok,char(medie(j))); hf5_ok = hf4_ok - efficturbine*(hf4_ok-hf5s_ok); sf5_ok = refpropm('S','P',P_cond,'H',hf5_ok,char(medie(j))); tf5_ok = refpropm('T','P',P_cond,'H',hf5_ok,char(medie(j))); %Check for moisture. No reheater if moist beacuse you are in the %saturated area. x = refpropm('Q','P', P_cond,'H',hf5_ok,char(medie(j))); x_vek_ok(i,j) = x; if x>0 && x<1 hf6_ok = hf5_ok; 80 tf6_ok = tf5_ok; sf6_ok = sf5_ok; hf3_ok = hf2_ok; tf3_ok=tf2_ok; sf3_ok = sf2_ok; hf9_ok = hf6_ok; tf9_ok = tf6_ok; sf9_ok = sf6_ok; else hf6_ok = refpropm('H','P',P_cond,'Q',1,char(medie(j))); tf6_ok = refpropm('T','H',hf6_ok,'P',P_cond,char(medie(j))); sf6_ok = refpropm('S','H',hf6_ok,'P',P_cond,char(medie(j))); %Can't heatexchange down to condensation temperature if %efficeny of the reheater is less than 100% hf9_ok = hf5_ok-(hf5_ok-hf6_ok)*effic_reheat; %Formel 15-14 värmeöverföring Sunden tf9_ok = refpropm('T','P',P_cond,'H',hf9_ok,char(medie(j))); sf9_ok = refpropm('S','P',P_cond,'H',hf9_ok,char(medie(j))); %After reheater hf3_ok = hf5_ok-hf9_ok+hf2_ok; tf3_ok = refpropm('T','P',P_pump*p23_drop,'H',hf3_ok,char(medie(j))); sf3_ok = refpropm('S','P',P_pump*p23_drop,'H',hf3_ok,char(medie(j))); end %Reset vectors to avoid faults in the iteration Qheat_ok_vek=0; qheat_ok_vek=0; theat_vek=0; Q=0; t=0; h=0; %Start values tempdiff_cold = 11; %setting a temperature to guess m tlow_heat = tf3_ok+tempdiff_cold; if (get(handles.oil_heat,'Value')==get(handles.oil_heat,'Max')) m_ref = m_heat*h_diff(thigh_heat-273.15,tlow_heat273.15)/(hf4_ok-hf3_ok); end if (get(handles.water_heat,'Value')==get(handles.water_heat,'Max')) m_ref = m_heat*(refpropm('H','T',thigh_heat,'P',P_heat_water,'water')-... refpropm('H','T',tlow_heat,'P',P_heat_water,'water'))/(hf4_ok-hf3_ok); end h = [hf3_ok:100:hf4_ok]; P_3=P_pump*p23_drop_ok; P_4 = P_pump*p34_drop_ok; P_drop_point = (P_3-P_4)/length(h); 81 dpp_dm = 0; pp = 100; raknare = 0; whilerak=0; m=m_ref; while abs(pinch-pp)>0.1 m = m-dpp_dm; for l=1:1:length(h) Q(l) = m*(h(l)-h(1)); t(l) = refpropm('T','P',P_3P_drop_point*l,'H',h(l),char(medie(j))); end raknare = 0; for o=length(h):-1:1 Qheat = Q(length(h)-o+1); Qheat_vek(o) = Qheat; qheat = Qheat/m_heat; qheat_vek(o)= qheat; end q2 = 0; if (get(handles.oil_heat,'Value')==get(handles.oil_heat,'Max')) theat = thigh_heat-273.15; for l=length(h):-1:1 qheat = qheat_vek(l)-q2; theat = oil_source(theat,qheat); %See fkn file oil_source theat_vek(l)=theat+273.15; q2 = qheat_vek(l); raknare = raknare+1; end end if (get(handles.water_heat,'Value')==get(handles.water_heat,'Max')) theat = thigh_heat; for l=length(h):-1:1 qheat = qheat_vek(l)-q2; theat = water_source(theat,qheat,P_heat_water); %See fkn file water_source theat_vek(l)=theat; q2 = qheat_vek(l); raknare = raknare+1; end end whilerak=whilerak+1 m_while(whilerak)=m; tdiff = theat_vek-t; pp = min(tdiff); pp_vek(whilerak) = pp; dpp_dm = (pinch-pp)/m; 82 end tlow_heat = theat_vek(1); Qcond_kyl_ok = m*(hf6_ok-hf1); tcond_kyl = tin_cool+temp_rise_coolt; if (get(handles.water_cool,'Value')==get(handles.water_cool,'Max')) m_kyl=Qcond_kyl_ok/(refpropm('H','T',tcond_kyl,'P',5*10^2,'water')-... refpropm('H','T',tin_cool,'P',5*10^2,'water')); qkyl = m*(hf9_ok-hf1)/m_kyl; tout_cool = water_cond(tin_cool,qkyl,5*10^2); end if (get(handles.air_cool,'Value')==get(handles.air_cool,'Max')) m_kyl = Qcond_kyl_ok/(refpropm('H','T',tcond_kyl,'P',101,'air.ppf')-... refpropm('H','T',tin_cool,'P',101,'air.ppf')); density_air = refpropm('H','T',(tin_cool+tut_kyl)/2,'P',101,'air.ppf'); Volume_flow_air = density_air/m_kyl; qkyl = m*(hf9_ok-hf1)/m_kyl; tout_cool = air_cond(tin_cool,qkyl,101); end qmax_transf_ok = h_diff(thigh_heat,t_ambient); Qkyl_ok = m*(hf9_ok-hf1); y =find(tdiff==pp); theat_pp = theat_vek(y); tf_pp = t(y); Q_pp = Q(y); tt = [theat_pp tf_pp]; en = [Q_pp Q_pp]; Wout_ok = m*(hf4_ok-hf5_ok); Win_ok = m*(hf2_ok-hf1); Qin_ok = m_heat*h_diff(thigh_heat,tlow_heat); effic_ok(i,j) = (Wout_ok-Win_ok)/Qin_ok; effic_tot_ok(i,j) = (Wout_ok-Win_ok)/(m_heat*qmax_transf_ok); m_kyl_ok_vek(i,j) = m_kyl; m_ok_vek(i,j) = m; Wout_ok_vek(i,j)=Wout_ok; tlow_ok_vek(i,j)= tlow_heat; tout_cool_ok(i,j) = tout_cool; Qkyl_ok_vek(i,j) = Qkyl_ok; hf1_ok_vek(i,j) = hf1; sf1_ok_vek(i,j) = sf1; tf2_ok_vek(i,j) = tf2_ok; hf2s_ok_vek(i,j) = hf2s_ok; sf2s_ok_vek(i,j) = sf2s_ok; tf3_ok_vek(i,j) = tf3_ok; hf4_ok_vek(i,j) = hf4_ok; sf4_ok_vek(i,j) = sf4_ok; tf5_ok_vek(i,j) = tf5_ok; hf5s_ok_vek(i,j) = hf5s_ok; 83 tf1_ok_vek(i,j) = tf1; hf2_ok_vek(i,j) = hf2_ok; sf2_ok_vek(i,j) = sf2_ok; tf2s_ok_vek(i,j) = tf2s_ok; hf3_ok_vek(i,j) = hf3_ok; sf3_ok_vek(i,j) = sf3_ok; tf4_ok_vek(i,j) = tf4_ok; hf5_ok_vek(i,j) = hf5_ok; sf5_ok_vek(i,j) = sf5_ok; tf5s_ok_vek(i,j) = tf5s_ok; sf5s_ok_vek(i,j) = sf5s_ok; tf6_ok_vek(i,j) = tf6_ok; hf9_ok_vek(i,j) = hf9_ok; sf9_ok_vek(i,j) = sf9_ok; hf6_ok_vek(i,j) = hf6_ok; sf6_ok_vek(i,j) = sf6_ok; tf9_ok_vek(i,j) = tf9_ok; end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%% End Supercritical %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%% End of for loop on pressure %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%% End of for loop on medie %%%%%%%%%%%%%%%%%%%%%%%%%%%%% end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%% Find Best %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% W_ok_uk =Wout_vek+Wout_ok_vek; effic_ok_uk = effic_vek+effic_ok; if (get(handles.search_power,'Value')==get(handles.search_power,'Max')) max_effekt = 0; koll_effekt = 0; koll_effic=0; for u=1:length(P) for k=1:length(medie) effekt = W_ok_uk(u,k); if effekt>max_effekt max_effekt = effekt; rad=u; col=k; koll_effekt=koll_effekt+1; end end end end if (get(handles.search_effic,'Value')==get(handles.search_effic,'Max')) koll_effic=0; max_effic = 0; koll_effekt = 0; for u = 1:length(P) for k=1:length(medie) effic = effic_ok_uk(u,k); if effic>max_effic max_effic=effic; rad = u; col = k; koll_effic=koll_effic+1; 84 end end end end if koll_effic==0 && koll_effekt==0 errordlg('Can not calculate for choosen substance/substances. Temperature might be to low alt. pressure to high','Error','on') end %for the plot of saturation curve if strcmp(medie(col),'R114') range=(33:refpropm('P','C',0,'',0,char(medie(col)))-10); else range=(33:refpropm('P','C',0,'',0,char(medie(col)))-2); end nsat=0; for o=1:length(range) nsat=nsat+1; T(nsat)=refpropm('T','P',range(o),'Q',0,char(medie(col))); sl(nsat)=refpropm('S','P',range(o),'Q',0,char(medie(col))); sv(nsat)=refpropm('S','P',range(o),'Q',1,char(medie(col))); end T(nsat+1)= refpropm('T','C',0,'',0,char(medie(col))); sl(nsat+1)=refpropm('S','C',0,'',0,char(medie(col))); sv(nsat+1)=refpropm('S','C',0,'',0,char(medie(col))); %%%%%%%%%%%%%%%%%%%%%%%%%% Sub critical %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% if P(rad)*10^2<refpropm('P','C',0,'',0,char(medie(col))) t1 = tf1_vek(rad,col); s1 = sf1_vek(rad,col); t2s = tf2s_vek(rad,col); s2s=sf2s_vek(rad,col); t2 = tf2_vek(rad,col); s2 = sf2_vek(rad,col); t3 = tf3_vek(rad,col); s3 = sf3_vek(rad,col); t4 = tf4_vek(rad,col); s4 = sf4_vek(rad,col); t5s = tf5s_vek(rad,col); s5s=sf5s_vek(rad,col); t5 = tf5_vek(rad,col); s5 = sf5_vek(rad,col); t6 = tf6_vek(rad,col); s6 = sf6_vek(rad,col); t7 = tf7_vek(rad,col); s7 = sf7_vek(rad,col); t8 = tf8_vek(rad,col); s8 = sf8_vek(rad,col); t9 = tf9_vek(rad,col); s9 = sf9_vek(rad,col); Tm = (hf4_vek(rad,col)-hf3_vek(rad,col))/(sf4_vek(rad,col)sf3_vek(rad,col))-273.15; if warn(rad,col)==1 warndlg('Pinchpoint has changed to lower the mass to be boiled. See new pinchpoint preheater in result','Trying to boil to much mass'); set(handles.pp_new_descrip,'Visible','on'); set(handles.pp_new,'Visible','on'); set(handles.pp_new_unit,'Visible','on'); set(handles.pp_new,'String',pinch_vek(rad,col)) end t12s =[t1 t2s]; s12s = [s1 s2s]; t12 = [t1 t2]; s12 = [s1 s2]; t23 = [t2s t3]; s23 = [s2s s3]; t37 = [t3 t7]; s37 = [s3 s7]; t78 = [t7 t8]; s78 = [s7 s8]; t84 = [t8 t4]; s84 = [s8 s4]; t45s =[t4 t5s]; s45s = [s4 s5s]; 85 t45 t59 t96 t61 t53 t92 = = = = = = [t4 [t5 [t9 [t6 [t5 [t9 t5]; t9]; t6]; t1]; t3]; t2]; s45 s59 s96 s61 s53 s92 = = = = = = [s4 [s5 [s9 [s6 [s5 [s9 s5]; s9]; s6]; s1]; s3]; s2]; if t4>=thigh_heat errordlg('your superheating are to high, lower this','Error','on') end hold on plot(handles.T_s,sl,T,'r-','linesmoothing','on') plot(handles.T_s,sv,T,'r-','linesmoothing','on') title(handles.T_s,'T-s diagram') ylabel(handles.T_s,'T(K)') xlabel(handles.T_s,'s (J/kgK)') plot(handles.T_s,s12s,t12s,'b--') plot(handles.T_s,s12,t12,'b-') plot(handles.T_s,s23,t23,'b-','Linewidth',1.5,'linesmoothing','on') plot(handles.T_s,s37,t37,'b-','Linewidth',1.5,'linesmoothing','on') plot(handles.T_s,s78,t78,'b-','Linewidth',1.5,'linesmoothing','on') plot(handles.T_s,s84,t84,'b-','Linewidth',1.5,'linesmoothing','on') plot(handles.T_s,s45s,t45s,'b--','Linewidth',1.5,'linesmoothing','on') plot(handles.T_s,s45,t45,'b-','Linewidth',1.5,'linesmoothing','on') plot(handles.T_s,s59,t59,'b-','Linewidth',1.5,'linesmoothing','on') plot(handles.T_s,s96,t96,'g-','Linewidth',1.5,'linesmoothing','on') plot(handles.T_s,s61,t61,'b-','Linewidth',1.5,'linesmoothing','on') if effic_reheat>0 && x_vek(rad,col)>=1 plot(handles.T_s,s53,t53,'r--','Linewidth',1.5,'linesmoothing','on') plot(handles.T_s,s92,t92,'r--','Linewidth',1.5,'linesmoothing','on') end hold off %T-Q Qheatplot = [Qfv_vek(rad,col)+Qfa_vek(rad,col)+Qoh_vek(rad,col),... Qfv_vek(rad,col)+Qfa_vek(rad,col),Qfv_vek(rad,col),0]; theatplot = [thigh_heat,tohfa_heat_vek(rad,col),tfafv_heat_vek(rad,col),... tlow_heat_vek(rad,col)]; tplot = [tf4_vek(rad,col),tf8_vek(rad,col),tf7_vek(rad,col),tf3_vek(rad,col)]; hold on title(handles.T_Q,'T-Q diagram') ylabel(handles.T_Q,'T(K)') xlabel(handles.T_Q,'Q(W)') plot(handles.T_Q,Qheatplot,theatplot,'r','Linewidth',1.5,'linesmoothing','on') plot(handles.T_Q,Qheatplot,tplot,'b','Linewidth',1.5,'linesmoothing','on') hold off pressure = P(rad); set(handles.pressure,'String',pressure); power = round(10*(W_ok_uk(rad,col)/10^3))/10; set(handles.power,'String',power); effic = round(10000*effic_ok_uk(rad,col))/100; 86 set(handles.effic,'String',effic); tot_effic = round(10000*effic_tot_vek(rad,col))/100; set(handles.tot_effic,'String',tot_effic); substance = char(medie(col)); set(handles.substance,'String',substance); set(handles.cycle,'String','subcritical'); mass_fluid=round(10*m_vek(rad,col))/10; set(handles.mass_fluid,'String',mass_fluid); set(handles.tout_heat,'String',round(10*(tlow_heat_vek(rad,col)273.15))/10) set(handles.cool_out,'String',round(10*(tout_cool_vek(rad,col)273.15))/10) if change(rad,col)==1; p23_drop = 1; p37_drop = p23_drop*(1-p_drop); p78_drop = p37_drop*(1-p_drop); p84_drop = p78_drop*(1-p_drop); else %Subcritical p23_drop = (1-p_drop); p37_drop = p23_drop*(1-p_drop); p78_drop = p37_drop*(1-p_drop); p84_drop = p78_drop*(1-p_drop); end if t4>t8 if effic_reheat==0 || x_vek(rad,col)<=1 figure(2) hold on imshow('Overheat_No_reheat.bmp'); %Heat & Cool text(34,85,['\color[rgb]{0.745,0.294,0.282}m=',num2str(m_heat),' kg/s'],'FontSize',8) text(34,105,['\color[rgb]{0.745,0.294,0.282}T=',num2str(round(thigh_heat273.15)),' C'],'FontSize',8) text(255,201,['\color[rgb]{0.745,0.294,0.282}T=',num2str(round(tohfa_heat_v ek(rad,col)-273.15)),' C'],'FontSize',8) text(36,309,['\color[rgb]{0.745,0.294,0.282}T=',num2str(round(tfafv_heat_ve k(rad,col)-273.15)),' C'],'FontSize',8) text(34,448,['\color[rgb]{0.745,0.294,0.282}T=',num2str(round(tlow_heat_vek (rad,col)-273.15)),' C'],'FontSize',8) text(673,735,['\color[rgb]{0.29,0.494,0.733}m=',num2str(round(10*m_kyl_vek( rad,col))/10),' kg/s'],'FontSize',8) text(673,755,['\color[rgb]{0.29,0.494,0.733}T=',num2str(round(tin_cool273.15)),' C'],'FontSize',8) text(673,646,['\color[rgb]{0.29,0.494,0.733}T=',num2str(round(tout_cool_vek (rad,col)-273.15)),' C'],'FontSize',8) %1 text(566,810,['P=',num2str(round(P_cond_vek(rad,col))/100),' Bar'],'FontSize',8) 87 text(566,830,['T=',num2str(round(tf1-273.15)),' C'],'FontSize',8) %2 text(346,637,['m=',num2str(mass_fluid),' kg/s'],'FontSize',8) text(346,657,['P=',num2str(pressure),' Bar'],'FontSize',8) text(346,677,['T=',num2str(round(tf2_vek(rad,col)-273.15)),' C'],'FontSize',8) %4 text(299,28,['P=',num2str(round(10*pressure*p84_drop)/10),' Bar'],'FontSize',8) text(299,48,['T=',num2str(round(tf4_vek(rad,col)-273.15)),' C'],'FontSize',8) %5 text(637,304,['P=',num2str(round(P_cond_vek(rad,col))/100),' Bar'],'FontSize',8) text(637,324,['T=',num2str(round(tf5_vek(rad,col)-273.15)),' C'],'FontSize',8) %6 %7 text(182,330,['P=',num2str(round(10*pressure*p37_drop)/10),' Bar'],'FontSize',8) text(182,361,['T=',num2str(round(tf7_vek(rad,col)-273.15)),' C'],'FontSize',8) %8 text(73,191,['P=',num2str(round(10*pressure*p78_drop)/10),' Bar'],'FontSize',8) text(73,211,['T=',num2str(round(tf8_vek(rad,col)-273.15)),' C'],'FontSize',8) %Tm text(327,271,['Tm=',num2str(round(10*Tm)/10),' C'],'Fontsize',10) hold off else figure(2) hold on imshow('Overheat.bmp'); %Heat & Cool text(34,85,['\color[rgb]{0.745,0.294,0.282}m=',num2str(m_heat),' kg/s'],'FontSize',8) text(34,105,['\color[rgb]{0.745,0.294,0.282}T=',num2str(round(thigh_heat273.15)),' C'],'FontSize',8) text(255,201,['\color[rgb]{0.745,0.294,0.282}T=',num2str(round(tohfa_heat_v ek(rad,col)-273.15)),' C'],'FontSize',8) text(36,309,['\color[rgb]{0.745,0.294,0.282}T=',num2str(round(tfafv_heat_ve k(rad,col)-273.15)),' C'],'FontSize',8) text(34,448,['\color[rgb]{0.745,0.294,0.282}T=',num2str(round(tlow_heat_vek (rad,col)-273.15)),' C'],'FontSize',8) text(673,735,['\color[rgb]{0.29,0.494,0.733}m=',num2str(round(10*m_kyl_vek( rad,col))/10),' kg/s'],'FontSize',8) text(673,755,['\color[rgb]{0.29,0.494,0.733}T=',num2str(round(tin_cool273.15)),' C'],'FontSize',8) 88 text(673,646,['\color[rgb]{0.29,0.494,0.733}T=',num2str(round(tout_cool_vek (rad,col)-273.15)),' C'],'FontSize',8) %1 text(566,810,['P=',num2str(round(P_cond_vek(rad,col))/100),' Bar'],'FontSize',8) text(566,830,['T=',num2str(round(tf1-273.15)),' C'],'FontSize',8) %2 text(342,637,['m=',num2str(mass_fluid),' kg/s'],'FontSize',8) text(342,657,['P=',num2str(pressure),' Bar'],'FontSize',8) text(342,677,['T=',num2str(round(tf2_vek(rad,col)-273.15)),' C'],'FontSize',8) %3 text(247,507,['P=',num2str(round(10*pressure*p23_drop)/10),' Bar'],'FontSize',8) text(247,527,['T=',num2str(round(tf3_vek(rad,col)-273.15)),' C'],'FontSize',8) %4 text(299,28,['P=',num2str(round(10*pressure*p84_drop)/10),' Bar'],'FontSize',8) text(299,48,['T=',num2str(round(tf4_vek(rad,col)-273.15)),' C'],'FontSize',8) %5 text(637,304,['P=',num2str(round(P_cond_vek(rad,col))/100),' Bar'],'FontSize',8) text(637,324,['T=',num2str(round(tf5_vek(rad,col)-273.15)),' C'],'FontSize',8) %6 %7 text(182,330,['P=',num2str(round(10*pressure*p37_drop)/10),' Bar'],'FontSize',8) text(182,361,['T=',num2str(round(tf7_vek(rad,col)-273.15)),' C'],'FontSize',8) %8 text(73,191,['P=',num2str(round(10*pressure*p78_drop)/10),' Bar'],'FontSize',8) text(73,211,['T=',num2str(round(tf8_vek(rad,col)-273.15)),' C'],'FontSize',8) %9 text(637,552,['P=',num2str(round(P_cond_vek(rad,col))/100),' Bar'],'FontSize',8) text(637,572,['T=',num2str(round(tf9_vek(rad,col)-273.15)),' C'],'FontSize',8) %Tm text(327,271,['Tm=',num2str(round(10*Tm)/10),'C'],'Fontsize',10) hold off end end if t4==t8 if effic_reheat==0 || x_vek(rad,col)<=1 figure(2) hold on imshow('Sat_No_reheat.bmp'); %Heat & Cool text(39,82,['\color[rgb]{0.745,0.294,0.282}m=',num2str(m_heat),' kg/s'],'FontSize',8) 89 text(39,102,['\color[rgb]{0.745,0.294,0.282}T=',num2str(round(thigh_heat273.15)),' C'],'FontSize',8) text(228,235,['\color[rgb]{0.745,0.294,0.282}T=',num2str(round(tfafv_heat_v ek(rad,col)-273.15)),' C'],'FontSize',8) text(39,387,['\color[rgb]{0.745,0.294,0.282}T=',num2str(round(tlow_heat_vek (rad,col)-273.15)),' C'],'FontSize',8) text(641,652,['\color[rgb]{0.29,0.494,0.733}m=',num2str(round(10*m_kyl_vek( rad,col))/10),' kg/s'],'FontSize',8) text(641,672,['\color[rgb]{0.29,0.494,0.733}T=',num2str(round(tin_cool273.15)),' C'],'FontSize',8) text(641,578,['\color[rgb]{0.29,0.494,0.733}T=',num2str(round(tout_cool_vek (rad,col)-273.15)),' C'],'FontSize',8) %1 text(568,737,['P=',num2str(round(P_cond_vek(rad,col))/100),' Bar'],'FontSize',8) text(568,757,['T=',num2str(round(tf1-273.15)),' C'],'FontSize',8) %2 text(334,518,['m=',num2str(mass_fluid),' kg/s'],'FontSize',8) text(334,538,['P=',num2str(pressure),' Bar'],'FontSize',8) text(334,558,['T=',num2str(round(tf2_vek(rad,col)-273.15)),' C'],'FontSize',8) %4 text(305,35,['P=',num2str(round(10*pressure*p78_drop)/10),' Bar'],'FontSize',8) text(305,55,['T=',num2str(round(tf4_vek(rad,col)-273.15)),' C'],'FontSize',8) %5 text(608,351,['P=',num2str(round(P_cond_vek(rad,col))/100),' Bar'],'FontSize',8) text(608,371,['T=',num2str(round(tf5_vek(rad,col)-273.15)),' C'],'FontSize',8) %7 text(80,237,['P=',num2str(round(10*pressure*p37_drop)/10),' Bar'],'FontSize',8) text(80,257,['T=',num2str(round(tf7_vek(rad,col)-273.15)),' C'],'FontSize',8) %Tm text(327,271,['Tm=',num2str(round(10*Tm)/10),'C'],'Fontsize',10) hold off else figure(2) hold on imshow('Saturated.bmp'); %Heat & Cool text(34,81,['\color[rgb]{0.745,0.294,0.282}m=',num2str(m_heat),' kg/s'],'FontSize',8) text(34,101,['\color[rgb]{0.745,0.294,0.282}T=',num2str(round(thigh_heat273.15)),' C'],'FontSize',8) 90 text(228,235,['\color[rgb]{0.745,0.294,0.282}T=',num2str(round(tfafv_heat_v ek(rad,col)-273.15)),' C'],'FontSize',8) text(34,387,['\color[rgb]{0.745,0.294,0.282}T=',num2str(round(tlow_heat_vek (rad,col)-273.15)),' C'],'FontSize',8) text(649,660,['\color[rgb]{0.29,0.494,0.733}m=',num2str(round(10*m_kyl_vek( rad,col))/10),' kg/s'],'FontSize',8) text(649,680,['\color[rgb]{0.29,0.494,0.733}T=',num2str(round(tin_cool273.15)),' C'],'FontSize',8) text(649,570,['\color[rgb]{0.29,0.494,0.733}T=',num2str(round(tout_cool_vek (rad,col)-273.15)),' C'],'FontSize',8) %1 text(555,738,['P=',num2str(round(P_cond_vek(rad,col))/100),' Bar'],'FontSize',8) text(555,758,['T=',num2str(round(tf1-273.15)),' C'],'FontSize',8) %2 text(344,577,['m=',num2str(mass_fluid),' kg/s'],'FontSize',8) text(344,597,['P=',num2str(pressure),' Bar'],'FontSize',8) text(344,617,['T=',num2str(round(tf2_vek(rad,col)-273.15)),' C'],'FontSize',8) %3 text(266,438,['P=',num2str(round(10*pressure*p23_drop)/10),' Bar'],'FontSize',8) text(266,458,['T=',num2str(round(tf3_vek(rad,col)-273.15)),' C'],'FontSize',8) %4 text(301,35,['P=',num2str(round(10*pressure*p78_drop)/10),' Bar'],'FontSize',8) text(301,55,['T=',num2str(round(tf4_vek(rad,col)-273.15)),' C'],'FontSize',8) %5 text(613,295,['P=',num2str(round(P_cond_vek(rad,col))/100),' Bar'],'FontSize',8) text(613,315,['T=',num2str(round(tf5_vek(rad,col)-273.15)),' C'],'FontSize',8) %7 text(80,236,['P=',num2str(round(10*pressure*p37_drop)/10),' Bar'],'FontSize',8) text(80,256,['T=',num2str(round(tf7_vek(rad,col)-273.15)),' C'],'FontSize',8) %9 text(608,487,['P=',num2str(round(P_cond_vek(rad,col))/100),' Bar'],'FontSize',8) text(608,507,['T=',num2str(round(tf9_vek(rad,col)-273.15)),' C'],'FontSize',8) %Tm text(327,271,['Tm=',num2str(round(10*Tm)/10),'C'],'Fontsize',10) hold off end end savedata(1)= hf4_vek(rad,col);%h4 savedata(2)= sf4_vek(rad,col);%s4 91 savedata(3)= tf4_vek(rad,col);%t4 savedata(4)= P_pump_vek(rad,col)*p84_drop;%P4 savedata(5)= tf5_vek(rad,col);%t5 savedata(6)= hf5_vek(rad,col);%h5 savedata(7)= sf5_vek(rad,col);%s5 savedata(8)= sf5s_vek(rad,col);%s5s savedata(9)= P_cond_vek(rad,col);%P5 savedata(10)= mass_fluid; fluid = char(medie(col)); %global savedata end %%%%%%%%%%%%%%%%%%%%%%%%% Supercritical %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% if P(rad)*10^2*p34_drop_ok>refpropm('P','C',0,'',0,char(medie(col))) n=0; range1 = [tf3_ok_vek(rad,col):tf4_ok_vek(rad,col)]; t34 = range1; P_3=P_pump*p23_drop; P_4 = P_pump*p34_drop_ok; P_drop_point = (P_3-P_4)/length(h); for n=1:length(range1) s34(n) = refpropm('S','T',range1(n),'P',P_3P_drop_point,char(medie(col))); end n=0; range2 = [tf2s_ok_vek(rad,col):tf3_ok_vek(rad,col)]; t23 = range2; for n=1:length(range2) s23(n) = refpropm('S','T',range2(n),'P',P_pump,char(medie(col))); end t12s =[tf1_ok_vek(rad,col) tf2s_ok_vek(rad,col)]; s12s = [sf1_ok_vek(rad,col) sf2s_ok_vek(rad,col)]; t12 = [tf1_ok_vek(rad,col) tf2_ok_vek(rad,col)]; s12 = [sf1_ok_vek(rad,col) sf2_ok_vek(rad,col)]; t45s = [tf4_ok_vek(rad,col) tf5s_ok_vek(rad,col)]; s45s= [sf4_ok_vek(rad,col) sf5s_ok_vek(rad,col)]; t45 = [tf4_ok_vek(rad,col) tf5_ok_vek(rad,col)]; s45= [sf4_ok_vek(rad,col) sf5_ok_vek(rad,col)]; t61 = [tf6_ok_vek(rad,col) tf1_ok_vek(rad,col)]; s61 = [sf6_ok_vek(rad,col) sf1_ok_vek(rad,col)]; s96 = [sf9_ok_vek(rad,col) sf6_ok_vek(rad,col)]; t96 = [tf9_ok_vek(rad,col) tf6_ok_vek(rad,col)]; s59 = [sf5_ok_vek(rad,col) sf9_ok_vek(rad,col)]; t59 = [tf5_ok_vek(rad,col) tf9_ok_vek(rad,col)]; t53 = [tf5_ok_vek(rad,col) tf3_ok_vek(rad,col)]; s53 = [sf5_ok_vek(rad,col) sf3_ok_vek(rad,col)]; t92 = [tf9_ok_vek(rad,col) tf2_ok_vek(rad,col)]; s92 = [sf9_ok_vek(rad,col) sf2_ok_vek(rad,col)]; Tm = (hf4_ok_vek(rad,col)-hf3_ok_vek(rad,col))/(sf4_ok_vek(rad,col)sf3_ok_vek(rad,col)); plot(handles.T_s,sl,T,'r-','linesmoothing','on') plot(handles.T_s,sv,T,'r-','linesmoothing','on') 92 plot(handles.T_s,s12s,t12s,'b--','linesmoothing','on') plot(handles.T_s,s12,t12,'b-','linesmoothing','on') plot(handles.T_s,s23,t23,'b-','linesmoothing','on') plot(handles.T_s,s34,t34,'b-','linesmoothing','on') plot(handles.T_s,s45,t45,'b-','linesmoothing','on') plot(handles.T_s,s45s,t45s,'b--','linesmoothing','on') plot(handles.T_s,s59,t59,'b-','linesmoothing','on') plot(handles.T_s,s96,t96,'g-','linesmoothing','on') plot(handles.T_s,s61,t61,'b-','linesmoothing','on') plot(handles.T_s,s92,t92,'r--','linesmoothing','on') plot(handles.T_s,s53,t53,'r--','linesmoothing','on') %T-Q h = [hf3_ok_vek(rad,col):1000:hf4_ok_vek(rad,col)]; P_3=P_pump*p23_drop; P_4 = P_pump*p34_drop_ok; P_drop_point = (P_3-P_4)/length(h); theat_vek = 0; %For medie m_bast = m_ok_vek(rad,col); for l=1:1:length(h) Qf(l) = m_bast*(h(l)-hf3_ok_vek(rad,col)); tf(l) = refpropm('T','P',P_3l*P_drop_point,'H',h(l),char(medie(col))); end for o=length(h):-1:1 Qheat = Qf(length(h)-o+1); Qheat_vek(o) = Qheat; qheat = Qheat/m_heat; qheat_vek(o)= qheat; end %For heat source q2 = 0; if (get(handles.oil_heat,'Value')==get(handles.oil_heat,'Max')) theat = thigh_heat-273.15; for l=length(h):-1:1 qheat = qheat_vek(l)-q2; theat = oil_source(theat,qheat); %Se fkn fil T_Q theat_vek(l)=theat+273.15; q2 = qheat_vek(l); end end if (get(handles.water_heat,'Value')==get(handles.water_heat,'Max')) theat = thigh_heat; for l=length(h):-1:1 qheat = qheat_vek(l)-q2; theat = water_source(theat,qheat,P_heat_water); 93 theat_vek(l)=theat; q2 = qheat_vek(l); end end tdiff = theat_vek-tf; pp = min(tdiff); y =find(tdiff==pp); theat_pp = theat_vek(y); tf_pp = tf(y); Q_pp = Qf(y); tt = [theat_pp tf_pp]; en = [Q_pp Q_pp]; hold on plot(handles.T_Q,Qf,tf,'b-') plot(handles.T_Q,Qf,theat_vek,'r-') plot(handles.T_Q,en,tt,'g-') hold off pressure = P(rad); set(handles.pressure,'String',pressure); power = round(10*(W_ok_uk(rad,col)/10^3))/10; set(handles.power,'String',power); effic = round(10000*effic_ok_uk(rad,col))/100; set(handles.effic,'String',effic); substance = char(medie(col)); set(handles.substance,'String',substance); set(handles.cycle,'String','supercritical'); mass_fluid=round(100*(m_ok_vek(rad,col)))/100; set(handles.mass_fluid,'String',mass_fluid); set(handles.tout_heat,'String',round(10*(tlow_ok_vek(rad,col)273.15))/10) set(handles.cool_out,'String',round(10*(tout_cool_ok(rad,col)273.15))/10) tot_effic = round(10000*effic_tot_ok(rad,col))/100; set(handles.tot_effic,'String',tot_effic); if effic_reheat==0 || x_vek_ok(rad,col)<=1 figure(2) hold on imshow('Supercritical_no_reheat.bmp'); %Heat & Cool text(41,148,['\color[rgb]{0.745,0.294,0.282}m=',num2str(m_heat),' kg/s'],'FontSize',8) text(41,168,['\color[rgb]{0.745,0.294,0.282}T=',num2str(round(thigh_heat273.15)),' C'],'FontSize',8) text(41,328,['\color[rgb]{0.745,0.294,0.282}T=',num2str(round(tlow_ok_vek(r ad,col)-273.15)),' C'],'FontSize',8) text(533,654,['\color[rgb]{0.29,0.494,0.733}m=',num2str(round(10*m_kyl_ok_v ek(rad,col))/10),' kg/s'],'FontSize',8) text(533,674,['\color[rgb]{0.29,0.494,0.733}T=',num2str(round(tin_cool273.15)),' C'],'FontSize',8) 94 text(533,577,['\color[rgb]{0.29,0.494,0.733}T=',num2str(round(tout_cool_ok( rad,col)-273.15)),' C'],'FontSize',8) %1 text(446,739,['P=',num2str(round(P_cond_vek(rad,col))/100),' Bar'],'FontSize',8) text(446,759,['T=',num2str(round(tf1-273.15)),' C'],'FontSize',8) %2 text(243,552,['m=',num2str(round(10*mass_fluid)/10),' kg/s'],'FontSize',8) text(243,572,['P=',num2str(pressure),' Bar'],'FontSize',8) text(243,592,['T=',num2str(round(tf2_ok_vek(rad,col)-273.15)),' C'],'FontSize',8) %4 text(248,30,['P=',num2str(round(10*pressure*p34_drop_ok)/10),' Bar'],'FontSize',8) text(248,50,['T=',num2str(round(tf4_ok_vek(rad,col)-273.15)),' C'],'FontSize',8) %5 text(502,303,['P=',num2str(round(P_cond_vek(rad,col))/100),' Bar'],'FontSize',8) text(502,323,['T=',num2str(round(tf5_ok_vek(rad,col)-273.15)),' C'],'FontSize',8) %Tm text(327,271,['Tm=',num2str(round(10*Tm)/10),'C'],'Fontsize',10) hold off else figure(2) hold on imshow('Supercritical.bmp'); %Heat & Cool text(41,148,['\color[rgb]{0.745,0.294,0.282}m=',num2str(m_heat),' kg/s'],'FontSize',8) text(41,168,['\color[rgb]{0.745,0.294,0.282}T=',num2str(round(thigh_heat273.15)),' C'],'FontSize',8) text(41,328,['\color[rgb]{0.745,0.294,0.282}T=',num2str(round(tlow_ok_vek(r ad,col)-273.15)),' C'],'FontSize',8) text(533,654,['\color[rgb]{0.29,0.494,0.733}m=',num2str(round(10*m_kyl_ok_v ek(rad,col))/10),' kg/s'],'FontSize',8) text(533,674,['\color[rgb]{0.29,0.494,0.733}T=',num2str(round(tin_cool273.15)),' C'],'FontSize',8) text(533,577,['\color[rgb]{0.29,0.494,0.733}T=',num2str(round(tout_cool_ok( rad,col)-273.15)),' C'],'FontSize',8) %1 text(446,739,['P=',num2str(round(P_cond_vek(rad,col))/100),' Bar'],'FontSize',8) text(446,759,['T=',num2str(round(tf1-273.15)),' C'],'FontSize',8) %2 text(243,552,['m=',num2str(round(10*mass_fluid)/10),' kg/s'],'FontSize',8) text(243,572,['P=',num2str(pressure),' Bar'],'FontSize',8) text(243,592,['T=',num2str(round(tf2_ok_vek(rad,col)-273.15)),' C'],'FontSize',8) 95 %3 text(198,441,['P=',num2str(round(10*pressure*p23_drop_ok)/10),' Bar'],'FontSize',8) text(198,461,['T=',num2str(round(tf3_ok_vek(rad,col)-273.15)),' C'],'FontSize',8) %4 text(248,30,['P=',num2str(round(10*pressure*p34_drop_ok)/10),' Bar'],'FontSize',8) text(248,50,['T=',num2str(round(tf4_ok_vek(rad,col)-273.15)),' C'],'FontSize',8) %5 text(502,303,['P=',num2str(round(P_cond_vek(rad,col))/100),' Bar'],'FontSize',8) text(502,323,['T=',num2str(round(tf5_ok_vek(rad,col)-273.15)),' C'],'FontSize',8) %9 text(502,471,['P=',num2str(round(P_cond_vek(rad,col))/100),' Bar'],'FontSize',8) text(502,491,['T=',num2str(round(tf9_ok_vek(rad,col)-273.15)),' C'],'FontSize',8) %Tm text(327,271,['Tm=',num2str(round(10*Tm)/10),'C'],'Fontsize',10) hold off end savedata(1)= hf4_ok_vek(rad,col); savedata(2)= sf4_ok_vek(rad,col); savedata(3)= tf4_ok_vek(rad,col); savedata(4)= P_pump_vek(rad,col)*p34_drop_ok; savedata(5)= tf5_ok_vek(rad,col); savedata(6)= hf5_ok_vek(rad,col); savedata(7)= sf5_ok_vek(rad,col); savedata(8)= sf5s_ok_vek(rad,col); savedata(9)= P_cond_vek(rad,col); savedata(10)= mass_fluid; fluid = char(medie(col)); end global EXPORT_VALUES global fluid_select fluid_select = fluid; EXPORT_VALUES = savedata; set(handles.wait,'BackgroundColor','green'); set(handles.wait,'String','Done') set(handles.Turb_calc,'Visible','on') %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%SLUT BERÄKNINGAR SAMT PLOT%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % --- Executes on button press in clear. function clear_Callback(hObject, eventdata, handles) % hObject handle to clear (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) cla(handles.T_s); cla(handles.T_Q); set(handles.effic,'String','-'); set(handles.substance,'String','-'); set(handles.cycle,'String','-'); set(handles.mass_fluid,'String','-'); 96 set(handles.power,'String','-'); set(handles.pressure,'String','-'); set(handles.tout_heat,'String','-'); % --- Executes on button press in reset. function reset_Callback(hObject, eventdata, handles) % hObject handle to reset (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) set(handles.wait,'BackgroundColor','white'); set(handles.wait,'String','-'); %Nollställ kylning % minVal = get(handles.water_cool,'Min'); % set(handles.water_cool,'Value',minVal); % minVal = get(handles.air_cool,'Min'); % set(handles.air_cool,'Value',minVal); %Heat source handles.val.mass_oil=0; handles.val.temperature_heat=0; handles.val.pressure_in=0; set(handles.massflow,'String',handles.val.mass_oil) set(handles.temperature_heat,'String',handles.val.temperature_heat) if (get(handles.water_heat,'Value')==get(handles.water_heat,'Max')) set(handles.pressure_in,'String',handles.val.pressure_in) end %Cycle properties handles.val.start_pressure=0; handles.val.steps=0; handles.val.end_pressure=0; handles.val.overheat=0; set(handles.start_pressure,'String',handles.val.start_pressure) set(handles.steps,'String',handles.val.steps) set(handles.end_pressure,'String',handles.val.end_pressure) set(handles.end_pressure,'String',handles.val.end_pressure) set(handles.overheat,'String',handles.val.overheat) %Component data handles.val.effic_t=0; handles.val.effic_p=0; set(handles.effic_t,'String',handles.val.effic_t) set(handles.effic_p,'String',handles.val.effic_p) %Cooling handles.val.temp_coolt = 0; %Pinch-Points & Reheater efficency handles.val.effic_reheat=0; handles.val.pp_cond=0; handles.val.pressure_drop=0; handles.val.pp_preheater=0; handles.val.temp_rise_coolt=0; set(handles.effic_reheat,'String',handles.val.effic_reheat) set(handles.pp_kond,'String',handles.val.pp_cond) set(handles.pressure_drop,'String',handles.val.pressure_drop) set(handles.pp_preheater,'String',handles.val.pp_preheater) set(handles.temp_rise_coolt,'String',handles.val.temp_rise_coolt) 97 if (get(handles.default_val,'Value')==get(handles.default_val,'Max')) set(handles.effic_reheat,'Style','edit') set(handles.pp_kond,'Style','edit') set(handles.pressure_drop,'Style','edit') set(handles.pp_preheater,'Style','edit') set(handles.temp_rise_coolt,'Style','edit') set(findobj(handles.uipanel21,'style','edit'),'Backgroundcolor','white') end %Nollställ grafer och resultat cla(handles.T_s); cla(handles.T_Q); set(handles.effic,'String','-'); set(handles.substance,'String','-'); set(handles.cycle,'String','-'); set(handles.mass_fluid,'String','-'); set(handles.power,'String','-'); set(handles.pressure,'String','-'); set(handles.tout_heat,'String','-'); set(handles.cool_out,'String','-'); set(handles.uipanel13,'BackgroundColor',[0.94,0.94,0.94]) set(handles.uipanel18,'BackgroundColor',[0.94,0.94,0.94]) set(handles.pp_new_descrip,'Visible','off'); set(handles.pp_new,'Visible','off'); set(handles.pp_new_unit,'Visible','off'); set(handles.text88,'Visible','off'); set(handles.temp_coolt,'Visible','off'); set(findobj(handles.figure1,'style','edit'),'string','0');%Nollställ alla edit objekt. set(findobj(handles.figure1,'style','checkbox'),'Value',0) % --- Executes on button press in select. %select substance function select_Callback(hObject, eventdata, handles) % hObject handle to select (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) set(findobj(handles.uipanel13,'style','checkbox'),'Value',1) % --- Executes on button press in remove. %Deselect substance function remove_Callback(hObject, eventdata, handles) % hObject handle to remove (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) set(findobj(handles.uipanel13,'style','checkbox'),'Value',0) % --- Executes on button press in search_power. function search_power_Callback(hObject, eventdata, handles) 98 % hObject handle to search_power (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if (get(hObject,'Value')==get(hObject,'Max')) minVal = get(handles.search_effic,'Min'); set(handles.search_effic,'Value',minVal); end % Hint: get(hObject,'Value') returns toggle state of search_power % --- Executes on button press in search_effic. function search_effic_Callback(hObject, eventdata, handles) % hObject handle to search_effic (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if (get(hObject,'Value')==get(hObject,'Max')) minVal = get(handles.search_power,'Min'); set(handles.search_power,'Value',minVal); end % Hint: get(hObject,'Value') returns toggle state of search_effic function effic_reheat_Callback(hObject, eventdata, handles) % hObject handle to effic_reheat (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of effic_reheat as text % str2double(get(hObject,'String')) returns contents of effic_reheat as a double effic_reheat = str2double(get(hObject,'String')); % if isnan(effic_reheat) % set(hObject, 'String', 0); % errordlg('Input must be a number','Error','on'); % end handles.val.effic_reheat=effic_reheat; guidata(hObject,handles) % --- Executes during object creation, after setting all properties. function effic_reheat_CreateFcn(hObject, eventdata, handles) % hObject handle to effic_reheat (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function pp_kond_Callback(hObject, eventdata, handles) % hObject handle to pp_kond (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) 99 % Hints: get(hObject,'String') returns contents of pp_kond as text % str2double(get(hObject,'String')) returns contents of pp_kond as a double pp_cond = str2double(get(hObject,'String')); % if isnan(pp_kond) % set(hObject, 'String', 0); % errordlg('Input must be a number','Error','on'); % end handles.val.pp_cond=pp_cond; guidata(hObject,handles) % --- Executes during object creation, after setting all properties. function pp_kond_CreateFcn(hObject, eventdata, handles) % hObject handle to pp_kond (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function pressure_drop_Callback(hObject, eventdata, handles) % hObject handle to pressure_drop (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of pressure_drop as text % str2double(get(hObject,'String')) returns contents of pressure_drop as a double pressure_drop = str2double(get(hObject,'String')); % if isnan(pressure_drop) % set(hObject, 'String', 0); % errordlg('Input must be a number','Error','on'); % end handles.val.pressure_drop=pressure_drop; guidata(hObject,handles) % --- Executes during object creation, after setting all properties. function pressure_drop_CreateFcn(hObject, eventdata, handles) % hObject handle to pressure_drop (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function pp_preheater_Callback(hObject, eventdata, handles) % hObject handle to pp_preheater (see GCBO) 100 % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) pp_preheater =str2double(get(hObject,'String')); % if isnan(pp_preheater) % set(hObject, 'String', 0); % errordlg('Input must be a number','Error','on'); % end handles.val.pp_preheater = pp_preheater; guidata(hObject,handles) % Hints: get(hObject,'String') returns contents of pp_preheater as text % str2double(get(hObject,'String')) returns contents of pp_preheater as a double % --- Executes during object creation, after setting all properties. function pp_preheater_CreateFcn(hObject, eventdata, handles) % hObject handle to pp_preheater (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- Executes on button press in default_val. function default_val_Callback(hObject, eventdata, handles) % hObject handle to default_val (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of default_val if (get(handles.default_val,'Value')==get(handles.default_val,'Max')) set(handles.effic_reheat,'Style','text') set(handles.effic_reheat,'String','80') set(handles.pp_kond,'Style','text') set(handles.pp_kond,'String','2') set(handles.pressure_drop,'Style','text') set(handles.pressure_drop,'String','5') set(handles.pp_preheater,'Style','text') set(handles.pp_preheater,'String','10') set(handles.temp_rise_coolt,'Style','text') set(handles.temp_rise_coolt,'String','10') set(findobj(handles.uipanel21,'style','text'),'BackgroundColor',[0.94,0.94, 0.94]) end if (get(handles.default_val,'Value')==get(handles.default_val,'Min')) set(handles.effic_reheat,'Style','edit') set(handles.effic_reheat,'String','0') set(handles.pp_kond,'Style','edit') set(handles.pp_kond,'String','0') set(handles.pressure_drop,'Style','edit') set(handles.pressure_drop,'String','0') set(handles.pp_preheater,'Style','edit') set(handles.pp_preheater,'String','0') set(handles.temp_rise_coolt,'Style','edit') 101 set(handles.temp_rise_coolt,'String','0') set(findobj(handles.uipanel21,'style','edit'),'BackgroundColor','white') end function temp_rise_coolt_Callback(hObject, eventdata, handles) % hObject handle to temp_rise_coolt (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of temp_rise_coolt as text % str2double(get(hObject,'String')) returns contents of temp_rise_coolt as a double temp_rise_coolt = str2double(get(hObject,'String')); handles.val.temp_rise_coolt = temp_rise_coolt; guidata(hObject,handles) % --- Executes during object creation, after setting all properties. function temp_rise_coolt_CreateFcn(hObject, eventdata, handles) % hObject handle to temp_rise_coolt (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- Executes on button press in default_temp_in. function default_temp_in_Callback(hObject, eventdata, handles) % hObject handle to default_temp_in (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of default_temp_in if (get(handles.default_temp_in,'Value')==get(handles.default_temp_in,'Max')) set(handles.temp_coolt,'Style','text') if (get(handles.water_cool,'Value')==get(handles.water_cool,'Max')) set(handles.temp_coolt,'String','10') set(handles.temp_coolt,'BackgroundColor',[0.94 0.94 0.94]) end if (get(handles.air_cool,'Value')==get(handles.air_cool,'Max')) set(handles.temp_coolt,'String','25') set(handles.temp_coolt,'BackgroundColor',[0.94 0.94 0.94]) end end if (get(handles.default_temp_in,'Value')==get(handles.default_temp_in,'Min')) set(handles.temp_coolt,'style','edit') set(handles.temp_coolt,'String','0') set(handles.temp_coolt,'BackgroundColor','white') end 102 function temp_coolt_Callback(hObject, eventdata, handles) % hObject handle to temp_coolt (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of temp_coolt as text % str2double(get(hObject,'String')) returns contents of temp_coolt as a double temp_coolt = str2double(get(hObject,'String')); handles.val.temp_coolt = temp_coolt; guidata(hObject,handles) % --- Executes during object creation, after setting all properties. function temp_coolt_CreateFcn(hObject, eventdata, handles) % hObject handle to temp_coolt (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % -------------------------------------------------------------------function plot_T_Q_Callback(hObject, eventdata, handles) % hObject handle to plot_T_Q (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) axes2fig = figure; axes2copy = copyobj(handles.T_Q,axes2fig); set(axes2copy,'Units','Normalized',... 'Position',[.10,.10,.80,.80]) handles.axes2fig = axes2fig; handles.axes2copy = axes2copy; title('T-Q') xlabel('Q(W)') ylabel('T(K)') guidata(hObject,handles); % -------------------------------------------------------------------function plot_T_s_Callback(hObject, eventdata, handles) % hObject handle to plot_T_s (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Displays contents of axes1 at larger size in a new figure axes1fig = figure; axes1copy = copyobj(handles.T_s,axes1fig); set(axes1copy,'Units','Normalized',... 'Position',[.10,.10,.80,.80]) handles.axes1fig = axes1fig; handles.axes1copy = axes1copy; title('T-s') xlabel('s(J/kgK)') ylabel('T(K)') guidata(hObject,handles); 103 % -------------------------------------------------------------------function plot_axes1_Callback(hObject, eventdata, handles) % hObject handle to plot_axes1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % -------------------------------------------------------------------function plot_axes2_Callback(hObject, eventdata, handles) % hObject handle to plot_axes2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % --- Executes on button press in Turb_calc. function Turb_calc_Callback(hObject, eventdata, handles) % hObject handle to Turb_calc (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) run Turbine_calc 8.2 Heat source files %########################################################################## %## ## %## Enthalpy difference Oil ## %## ## %########################################################################## % %function [ h2_h1] = h_diff( T_2,T_1 ) % Insert the two temperatures and the enthalpy difference is returned. % T_2>T_1. Temperatures in degree Celsius function [ h2_h1] = h_diff( T_2,T_1 ) %Enthalpy differnce as a function of temperature A = 0.415; B = 0.0009; density_oil = 870*10^-3; T2 = T_2; T1 = T_1; h2_h1 = ((A/sqrt(density_oil))*(T2-T1)+B*((T2^2-T1^2)/2+15*(T1-T2)))*4186; end %########################################################################## %## ## %## Temperature iteration oil ## %## ## %########################################################################## % %function [ T1] = oil_source( T_kand,q ) %Input known temperature in degree Celsius and the known transfered %specific heat. 104 function [ T1] = oil_source( T_kand,q ) A = 0.415; B = 0.0009; density_oil = 870*10^-3; T2 = T_kand; RLX = 0.8; T1 = T2; err = 20; err_der=1000; rak=0; qoil = q; qtest = 1000000; while abs(err)>1 T1 = T1-RLX*(err/err_der); qtest = ((A/sqrt(density_oil))*(T2-T1)+B*((T2^2-T1^2)/2+15*(T1T2)))*4186; Cp = (A/sqrt(density_oil)+B*(T1-15))*4186; err = qoil-qtest; err_der = Cp; rak = rak+1; end end %########################################################################## %## ## %## Temperature iteration water ## %## ## %########################################################################## % %function [ T1 ] = water_source( T_kand,q,P_water ) %Input known temperature in degree Kelvin,the known transfered %specific heat in J/kg and the pressure in kPa. function [ T1 ] = water_source( T_kand,q,P_water ) T2 = T_kand; P = P_water; q_kand = q; RLX = 0.8; T1 = T2; err = 20; err_der = 1000; while abs(err)>1 T1 = T1-RLX*(err/err_der); qtest =refpropm('H','T',T2,'P',P,'water')refpropm('H','T',T1,'P',P,'water'); err = q_kand-qtest; err_der = (refpropm('C','T',T1,'P',P,'water')); end end 105 9 Appendix B 9.1 Turbine %########################################################################## %## ## %## Turbine GUI ## %## Mikael Olsson ## %## ## %########################################################################## function varargout = Turbine_calc(varargin) % TURBINE_CALC M-file for Turbine_calc.fig % TURBINE_CALC, by itself, creates a new TURBINE_CALC or raises the existing % singleton*. % % H = TURBINE_CALC returns the handle to a new TURBINE_CALC or the handle to % the existing singleton*. % % TURBINE_CALC('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in TURBINE_CALC.M with the given input arguments. % % TURBINE_CALC('Property','Value',...) creates a new TURBINE_CALC or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before Turbine_calc_OpeningFcn gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to Turbine_calc_OpeningFcn via varargin. % % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one % instance to run (singleton)". % % See also: GUIDE, GUIDATA, GUIHANDLES % Edit the above text to modify the response to help Turbine_calc % Last Modified by GUIDE v2.5 09-Jul-2012 10:09:42 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @Turbine_calc_OpeningFcn, ... 'gui_OutputFcn', @Turbine_calc_OutputFcn, ... 'gui_LayoutFcn', [] , ... 'gui_Callback', []); if nargin && ischar(varargin{1}) gui_State.gui_Callback = str2func(varargin{1}); end if nargout [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); 106 else gui_mainfcn(gui_State, varargin{:}); end % End initialization code - DO NOT EDIT % --- Executes just before Turbine_calc is made visible. function Turbine_calc_OpeningFcn(hObject, eventdata, handles, varargin) % This function has no output args, see OutputFcn. % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % varargin command line arguments to Turbine_calc (see VARARGIN) % Choose default command line output for Turbine_calc handles.output = hObject; global EXPORT_VALUES set(handles.h04,'String',EXPORT_VALUES(1)/10^3); set(handles.P04,'String',EXPORT_VALUES(4)/10^2); set(handles.s04,'String',EXPORT_VALUES(2)/10^3); set(handles.T04,'String',EXPORT_VALUES(3)); set(handles.P05,'String',EXPORT_VALUES(9)/10^2); set(handles.s05,'String',EXPORT_VALUES(7)/10^3); set(handles.mass,'String',EXPORT_VALUES(10)); set(handles.text337,'string',EXPORT_VALUES(11)); set(handles.text334,'string',EXPORT_VALUES(12)); Vratio = EXPORT_VALUES(12)/EXPORT_VALUES(11) set(handles.text340,'string',Vratio); set(handles.Angles,'visible','off'); set(handles.uipanel12,'visible','on') set(handles.Rad_Ma,'visible','off') bild = imread('stagen.bmp'); axes(handles.stage_pic) imshow(bild); axis off % Update handles structure guidata(hObject, handles); % UIWAIT makes Turbine_calc wait for user response (see UIRESUME) % uiwait(handles.figure1); % --- Outputs from this function are returned to the command line. function varargout = Turbine_calc_OutputFcn(hObject, eventdata, handles) % varargout cell array for returning output args (see VARARGOUT); % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Get default command line output from handles structure varargout{1} = handles.output; function rpm_Callback(hObject, eventdata, handles) % hObject handle to rpm (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB 107 % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of rpm as text % str2double(get(hObject,'String')) returns contents of rpm as a double rpm = str2double(get(hObject,'String')); % if ~isnan(rpm) && ~isnan(handles.radius) % omega = (rpm/60)*2*pi; % U_m = omega*radius; % set(handles.text58,'String',U_m); % end handles.val.rpm = rpm; guidata(hObject,handles) % --- Executes during object creation, after setting all properties. function rpm_CreateFcn(hObject, eventdata, handles) % hObject handle to rpm (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function radius_Callback(hObject, eventdata, handles) % hObject handle to radius (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of radius as text % str2double(get(hObject,'String')) returns contents of radius as a double radius = str2double(get(hObject,'String')); % if ~isnan(handles.rpm) && ~isnan(radius) % omega = (handles.val.rot_speed/60)*2*pi; % U_m = omega*radius; % set(handles.text58,'String',U_m); % end handles.val.radius = radius; guidata(hObject,handles) % --- Executes during object creation, after setting all properties. function radius_CreateFcn(hObject, eventdata, handles) % hObject handle to radius (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end 108 function psi_Callback(hObject, eventdata, handles) % hObject handle to psi (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of psi as text % str2double(get(hObject,'String')) returns contents of psi as a double psi = str2double(get(hObject,'String')); handles.val.psi = psi; guidata(hObject,handles) % --- Executes during object creation, after setting all properties. function psi_CreateFcn(hObject, eventdata, handles) % hObject handle to psi (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function phi_Callback(hObject, eventdata, handles) % hObject handle to phi (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of phi as text % str2double(get(hObject,'String')) returns contents of phi as a double phi = str2double(get(hObject,'String')); handles.val.phi = phi; guidata(hObject,handles) % --- Executes during object creation, after setting all properties. function phi_CreateFcn(hObject, eventdata, handles) % hObject handle to phi (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function reaction_Callback(hObject, eventdata, handles) 109 % hObject % eventdata % handles handle to reaction (see GCBO) reserved - to be defined in a future version of MATLAB structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of reaction as text % str2double(get(hObject,'String')) returns contents of reaction as a double reaction = str2double(get(hObject,'String')); handles.val.reaction = reaction; guidata(hObject,handles) % --- Executes during object creation, after setting all properties. function reaction_CreateFcn(hObject, eventdata, handles) % hObject handle to reaction (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function edit8_Callback(hObject, eventdata, handles) % hObject handle to edit8 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of edit8 as text % str2double(get(hObject,'String')) returns contents of edit8 as a double % --- Executes during object creation, after setting all properties. function edit8_CreateFcn(hObject, eventdata, handles) % hObject handle to edit8 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function edit9_Callback(hObject, eventdata, handles) % hObject handle to edit9 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of edit9 as text % str2double(get(hObject,'String')) returns contents of edit9 as a double 110 % --- Executes during object creation, after setting all properties. function edit9_CreateFcn(hObject, eventdata, handles) % hObject handle to edit9 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function edit10_Callback(hObject, eventdata, handles) % hObject handle to edit10 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of edit10 as text % str2double(get(hObject,'String')) returns contents of edit10 as a double % --- Executes during object creation, after setting all properties. function edit10_CreateFcn(hObject, eventdata, handles) % hObject handle to edit10 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- Executes on button press in calc. function calc_Callback(hObject, eventdata, handles) % hObject handle to calc (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) cla(handles.veltri_st1); cla(handles.veltri_last); set(findobj(handles.Rad_Ma,'style','text'),'string','0'); set(handles.text60,'string','Height 1') set(handles.text136,'string','Height 2') set(handles.text147,'string','Height 3') set(handles.text147,'string','Height 3') set(handles.text158,'string','Mach 1') 111 set(handles.text169,'string','Mach 2') set(handles.text180,'string','Mach 3') set(handles.text311,'string','Mach 2 rel') set(handles.text322,'string','Mach 3 rel') set(handles.text107,'string','Stage 1') set(handles.text111,'string','Stage 2') set(handles.text112,'string','Stage 3') set(handles.text113,'string','Stage 4') set(handles.text114,'string','Stage 5') set(handles.text115,'string','Stage 6') set(handles.text116,'string','Stage 7') set(handles.text117,'string','Stage 8') set(handles.text118,'string','Stage 9') set(handles.text119,'string','Stage 10') n_stage=0; Psi=0; Reac_vek=0; Cx1=0; C1=0; C2=0; C3=0; W2=0; W3=0; alfa2=0; M1=0; alfa3=0; M2=0; beta2=0; M3=0; beta3=0; M3_rel=0; station1_height=0; str_height=0; rot_height=0; s1_def = 0; h01_def = 0; P01_def = 0; T01_def = 0; P0kond_def = 0; T0kond_def = 0; s0kond_def = 0; global EXPORT_VALUES global fluid_select N = handles.val.rpm; r_m = handles.val.radius; omega = (N/60)*2*pi; U_m = r_m*omega; mass = EXPORT_VALUES(10); Reac_def = handles.val.reaction; Psi_def = handles.val.psi; Phi_def = handles.val.phi; s1_def = EXPORT_VALUES(2); h01_def = EXPORT_VALUES(1); P01_def = EXPORT_VALUES(4); T01_def = EXPORT_VALUES(3); P0kond_def = EXPORT_VALUES(9); T0kond_def = EXPORT_VALUES(5); s0kond_def = EXPORT_VALUES(7); amne = fluid_select; [n_stage W_turb effic Psi Reac_vek Cx1 C1 C2 C3 W2 W3 M1 M2 M2_rel M3 M3_rel station1_height str_height rot_height alfa2 alfa3 beta2 beta3]=... Turbine(Psi_def,Phi_def,Reac_def,N,U_m,r_m,mass,s1_def,h01_def,T01_def,P01_ def,P0kond_def,T0kond_def,s0kond_def,amne); set(handles.text99,'string',round(100*Psi(n_stage))/100); set(handles.text102,'string',round(100*Reac_vek(n_stage))/100); %%Performance 112 set(handles.text302,'string',n_stage); set(handles.text306,'string',W_turb); set(handles.text308,'string',effic); %%Flow Angles set(handles.text268,'string',round(100*alfa2(1))/100); set(handles.text272,'string',round(100*alfa2(n_stage))/100); set(handles.text271,'string',round(100*alfa3(1))/100); set(handles.text273,'string',round(100*alfa3(n_stage))/100); set(handles.text275,'string',round(100*beta2(1))/100); set(handles.text276,'string',round(100*beta2(n_stage))/100); set(handles.text278,'string',round(100*beta3(1))/100); set(handles.text279,'string',round(100*beta3(n_stage))/100); %%RAD_MA if n_stage==1 set(handles.R11,'String',round(10^4*station1_height(1))/10^4); set(handles.R21,'String',round(10^4*str_height(1))/10^4); set(handles.R31,'String',round(10^4*rot_height(1))/10^4); set(handles.Ma11,'String',round(10^2*M1(1))/10^2); set(handles.Ma21,'String',round(10^2*M2(1))/10^2); set(handles.Ma31,'String',round(10^2*M3(1))/10^2); set(handles.text312,'String',round(10^2*M2_rel(1))/10^2); set(handles.text323,'String',round(10^2*M3_rel(1))/10^2); end if n_stage==2 set(handles.R11,'String',round(10^4*station1_height(1))/10^4); set(handles.R12,'String',round(10^4*station1_height(2))/10^4); set(handles.R21,'String',round(10^4*str_height(1))/10^4); set(handles.R22,'String',round(10^4*str_height(2))/10^4); set(handles.R31,'String',round(10^4*rot_height(1))/10^4); set(handles.R32,'String',round(10^4*rot_height(2))/10^4); set(handles.Ma11,'String',round(10^2*M1(1))/10^2); set(handles.Ma12,'String',round(10^2*M1(2))/10^2); set(handles.Ma21,'String',round(10^2*M2(1))/10^2); set(handles.Ma22,'String',round(10^2*M2(2))/10^2); set(handles.Ma31,'String',round(10^2*M3(1))/10^2); set(handles.Ma32,'String',round(10^2*M3(2))/10^2); set(handles.text312,'String',round(10^2*M2_rel(1))/10^2); set(handles.text313,'String',round(10^2*M2_rel(2))/10^2); set(handles.text323,'String',round(10^2*M3_rel(1))/10^2); set(handles.text324,'String',round(10^2*M3_rel(2))/10^2); end if n_stage==3 set(handles.R11,'String',round(10^4*station1_height(1))/10^4); set(handles.R12,'String',round(10^4*station1_height(2))/10^4); set(handles.R13,'String',round(10^4*station1_height(3))/10^4); set(handles.R21,'String',round(10^4*str_height(1))/10^4); set(handles.R22,'String',round(10^4*str_height(2))/10^4); set(handles.R23,'String',round(10^4*str_height(3))/10^4); set(handles.R31,'String',round(10^4*rot_height(1))/10^4); set(handles.R32,'String',round(10^4*rot_height(2))/10^4); set(handles.R33,'String',round(10^4*rot_height(3))/10^4); 113 set(handles.Ma11,'String',round(10^2*M1(1))/10^2); set(handles.Ma12,'String',round(10^2*M1(2))/10^2); set(handles.Ma13,'String',round(10^2*M1(3))/10^2); set(handles.Ma21,'String',round(10^2*M2(1))/10^2); set(handles.Ma22,'String',round(10^2*M2(2))/10^2); set(handles.Ma23,'String',round(10^2*M2(3))/10^2); set(handles.Ma31,'String',round(10^2*M3(1))/10^2); set(handles.Ma32,'String',round(10^2*M3(2))/10^2); set(handles.Ma33,'String',round(10^2*M3(3))/10^2); set(handles.text312,'String',round(10^2*M2_rel(1))/10^2); set(handles.text313,'String',round(10^2*M2_rel(2))/10^2); set(handles.text314,'String',round(10^2*M2_rel(3))/10^2); set(handles.text323,'String',round(10^2*M3_rel(1))/10^2); set(handles.text324,'String',round(10^2*M3_rel(2))/10^2); set(handles.text325,'String',round(10^2*M3_rel(3))/10^2); end if n_stage==4 set(handles.R11,'String',round(10^4*station1_height(1))/10^4); set(handles.R12,'String',round(10^4*station1_height(2))/10^4); set(handles.R13,'String',round(10^4*station1_height(3))/10^4); set(handles.R14,'String',round(10^4*station1_height(4))/10^4); set(handles.R21,'String',round(10^4*str_height(1))/10^4); set(handles.R22,'String',round(10^4*str_height(2))/10^4); set(handles.R23,'String',round(10^4*str_height(3))/10^4); set(handles.R24,'String',round(10^4*str_height(4))/10^4); set(handles.R31,'String',round(10^4*rot_height(1))/10^4); set(handles.R32,'String',round(10^4*rot_height(2))/10^4); set(handles.R33,'String',round(10^4*rot_height(3))/10^4); set(handles.R34,'String',round(10^4*rot_height(4))/10^4); set(handles.Ma11,'String',round(10^2*M1(1))/10^2); set(handles.Ma12,'String',round(10^2*M1(2))/10^2); set(handles.Ma13,'String',round(10^2*M1(3))/10^2); set(handles.Ma14,'String',round(10^2*M1(4))/10^2); set(handles.Ma21,'String',round(10^2*M2(1))/10^2); set(handles.Ma22,'String',round(10^2*M2(2))/10^2); set(handles.Ma23,'String',round(10^2*M2(3))/10^2); set(handles.Ma24,'String',round(10^2*M2(4))/10^2); set(handles.Ma31,'String',round(10^2*M3(1))/10^2); set(handles.Ma32,'String',round(10^2*M3(2))/10^2); set(handles.Ma33,'String',round(10^2*M3(3))/10^2); set(handles.Ma34,'String',round(10^2*M3(4))/10^2); set(handles.text312,'String',round(10^2*M2_rel(1))/10^2); set(handles.text313,'String',round(10^2*M2_rel(2))/10^2); set(handles.text314,'String',round(10^2*M2_rel(3))/10^2); set(handles.text315,'String',round(10^2*M2_rel(4))/10^2); set(handles.text323,'String',round(10^2*M3_rel(1))/10^2); set(handles.text324,'String',round(10^2*M3_rel(2))/10^2); set(handles.text325,'String',round(10^2*M3_rel(3))/10^2); set(handles.text326,'String',round(10^2*M3_rel(4))/10^2); end if n_stage==5 set(handles.R11,'String',round(10^4*station1_height(1))/10^4); set(handles.R12,'String',round(10^4*station1_height(2))/10^4); set(handles.R13,'String',round(10^4*station1_height(3))/10^4); set(handles.R14,'String',round(10^4*station1_height(4))/10^4); set(handles.R15,'String',round(10^4*station1_height(5))/10^4); set(handles.R21,'String',round(10^4*str_height(1))/10^4); set(handles.R22,'String',round(10^4*str_height(2))/10^4); 114 set(handles.R23,'String',round(10^4*str_height(3))/10^4); set(handles.R24,'String',round(10^4*str_height(4))/10^4); set(handles.R25,'String',round(10^4*str_height(5))/10^4); set(handles.R31,'String',round(10^4*rot_height(1))/10^4); set(handles.R32,'String',round(10^4*rot_height(2))/10^4); set(handles.R33,'String',round(10^4*rot_height(3))/10^4); set(handles.R34,'String',round(10^4*rot_height(4))/10^4); set(handles.R35,'String',round(10^4*rot_height(5))/10^4); set(handles.Ma11,'String',round(10^2*M1(1))/10^2); set(handles.Ma12,'String',round(10^2*M1(2))/10^2); set(handles.Ma13,'String',round(10^2*M1(3))/10^2); set(handles.Ma14,'String',round(10^2*M1(4))/10^2); set(handles.Ma15,'String',round(10^2*M1(5))/10^2); set(handles.Ma21,'String',round(10^2*M2(1))/10^2); set(handles.Ma22,'String',round(10^2*M2(2))/10^2); set(handles.Ma23,'String',round(10^2*M2(3))/10^2); set(handles.Ma24,'String',round(10^2*M2(4))/10^2); set(handles.Ma25,'String',round(10^2*M2(5))/10^2); set(handles.Ma31,'String',round(10^2*M3(1))/10^2); set(handles.Ma32,'String',round(10^2*M3(2))/10^2); set(handles.Ma33,'String',round(10^2*M3(3))/10^2); set(handles.Ma34,'String',round(10^2*M3(4))/10^2); set(handles.Ma35,'String',round(10^2*M3(5))/10^2); set(handles.text312,'String',round(10^2*M2_rel(1))/10^2); set(handles.text313,'String',round(10^2*M2_rel(2))/10^2); set(handles.text314,'String',round(10^2*M2_rel(3))/10^2); set(handles.text315,'String',round(10^2*M2_rel(4))/10^2); set(handles.text316,'String',round(10^2*M2_rel(5))/10^2); set(handles.text323,'String',round(10^2*M3_rel(1))/10^2); set(handles.text324,'String',round(10^2*M3_rel(2))/10^2); set(handles.text325,'String',round(10^2*M3_rel(3))/10^2); set(handles.text326,'String',round(10^2*M3_rel(4))/10^2); set(handles.text327,'String',round(10^2*M3_rel(5))/10^2); end if n_stage==6 set(handles.R11,'String',round(10^4*station1_height(1))/10^4); set(handles.R12,'String',round(10^4*station1_height(2))/10^4); set(handles.R13,'String',round(10^4*station1_height(3))/10^4); set(handles.R14,'String',round(10^4*station1_height(4))/10^4); set(handles.R15,'String',round(10^4*station1_height(5))/10^4); set(handles.R16,'String',round(10^4*station1_height(6))/10^4); set(handles.R21,'String',round(10^4*str_height(1))/10^4); set(handles.R22,'String',round(10^4*str_height(2))/10^4); set(handles.R23,'String',round(10^4*str_height(3))/10^4); set(handles.R24,'String',round(10^4*str_height(4))/10^4); set(handles.R25,'String',round(10^4*str_height(5))/10^4); set(handles.R26,'String',round(10^4*str_height(6))/10^4); set(handles.R31,'String',round(10^4*rot_height(1))/10^4); set(handles.R32,'String',round(10^4*rot_height(2))/10^4); set(handles.R33,'String',round(10^4*rot_height(3))/10^4); set(handles.R34,'String',round(10^4*rot_height(4))/10^4); set(handles.R35,'String',round(10^4*rot_height(5))/10^4); set(handles.R36,'String',round(10^4*rot_height(6))/10^4); set(handles.Ma11,'String',round(10^2*M1(1))/10^2); set(handles.Ma12,'String',round(10^2*M1(2))/10^2); set(handles.Ma13,'String',round(10^2*M1(3))/10^2); set(handles.Ma14,'String',round(10^2*M1(4))/10^2); set(handles.Ma15,'String',round(10^2*M1(5))/10^2); 115 set(handles.Ma16,'String',round(10^2*M1(6))/10^2); set(handles.Ma21,'String',round(10^2*M2(1))/10^2); set(handles.Ma22,'String',round(10^2*M2(2))/10^2); set(handles.Ma23,'String',round(10^2*M2(3))/10^2); set(handles.Ma24,'String',round(10^2*M2(4))/10^2); set(handles.Ma25,'String',round(10^2*M2(5))/10^2); set(handles.Ma26,'String',round(10^2*M2(6))/10^2); set(handles.Ma31,'String',round(10^2*M3(1))/10^2); set(handles.Ma32,'String',round(10^2*M3(2))/10^2); set(handles.Ma33,'String',round(10^2*M3(3))/10^2); set(handles.Ma34,'String',round(10^2*M3(4))/10^2); set(handles.Ma35,'String',round(10^2*M3(5))/10^2); set(handles.Ma36,'String',round(10^2*M3(6))/10^2); set(handles.text312,'String',round(10^2*M2_rel(1))/10^2); set(handles.text313,'String',round(10^2*M2_rel(2))/10^2); set(handles.text314,'String',round(10^2*M2_rel(3))/10^2); set(handles.text315,'String',round(10^2*M2_rel(4))/10^2); set(handles.text316,'String',round(10^2*M2_rel(5))/10^2); set(handles.text317,'String',round(10^2*M2_rel(6))/10^2); set(handles.text323,'String',round(10^2*M3_rel(1))/10^2); set(handles.text324,'String',round(10^2*M3_rel(2))/10^2); set(handles.text325,'String',round(10^2*M3_rel(3))/10^2); set(handles.text326,'String',round(10^2*M3_rel(4))/10^2); set(handles.text327,'String',round(10^2*M3_rel(5))/10^2); set(handles.text328,'String',round(10^2*M3_rel(6))/10^2); end if n_stage==7 set(handles.R11,'String',round(10^4*station1_height(1))/10^4); set(handles.R12,'String',round(10^4*station1_height(2))/10^4); set(handles.R13,'String',round(10^4*station1_height(3))/10^4); set(handles.R14,'String',round(10^4*station1_height(4))/10^4); set(handles.R15,'String',round(10^4*station1_height(5))/10^4); set(handles.R16,'String',round(10^4*station1_height(6))/10^4); set(handles.R17,'String',round(10^4*station1_height(7))/10^4); set(handles.R21,'String',round(10^4*str_height(1))/10^4); set(handles.R22,'String',round(10^4*str_height(2))/10^4); set(handles.R23,'String',round(10^4*str_height(3))/10^4); set(handles.R24,'String',round(10^4*str_height(4))/10^4); set(handles.R25,'String',round(10^4*str_height(5))/10^4); set(handles.R26,'String',round(10^4*str_height(6))/10^4); set(handles.R27,'String',round(10^4*str_height(7))/10^4); set(handles.R31,'String',round(10^4*rot_height(1))/10^4); set(handles.R32,'String',round(10^4*rot_height(2))/10^4); set(handles.R33,'String',round(10^4*rot_height(3))/10^4); set(handles.R34,'String',round(10^4*rot_height(4))/10^4); set(handles.R35,'String',round(10^4*rot_height(5))/10^4); set(handles.R36,'String',round(10^4*rot_height(6))/10^4); set(handles.R37,'String',round(10^4*rot_height(7))/10^4); set(handles.Ma11,'String',round(10^2*M1(1))/10^2); set(handles.Ma12,'String',round(10^2*M1(2))/10^2); set(handles.Ma13,'String',round(10^2*M1(3))/10^2); set(handles.Ma14,'String',round(10^2*M1(4))/10^2); set(handles.Ma15,'String',round(10^2*M1(5))/10^2); set(handles.Ma16,'String',round(10^2*M1(6))/10^2); set(handles.Ma17,'String',round(10^2*M1(7))/10^2); set(handles.Ma21,'String',round(10^2*M2(1))/10^2); set(handles.Ma22,'String',round(10^2*M2(2))/10^2); set(handles.Ma23,'String',round(10^2*M2(3))/10^2); set(handles.Ma24,'String',round(10^2*M2(4))/10^2); 116 set(handles.Ma25,'String',round(10^2*M2(5))/10^2); set(handles.Ma26,'String',round(10^2*M2(6))/10^2); set(handles.Ma27,'String',round(10^2*M2(7))/10^2); set(handles.Ma31,'String',round(10^2*M3(1))/10^2); set(handles.Ma32,'String',round(10^2*M3(2))/10^2); set(handles.Ma33,'String',round(10^2*M3(3))/10^2); set(handles.Ma34,'String',round(10^2*M3(4))/10^2); set(handles.Ma35,'String',round(10^2*M3(5))/10^2); set(handles.Ma36,'String',round(10^2*M3(6))/10^2); set(handles.Ma37,'String',round(10^2*M3(7))/10^2); set(handles.text312,'String',round(10^2*M2_rel(1))/10^2); set(handles.text313,'String',round(10^2*M2_rel(2))/10^2); set(handles.text314,'String',round(10^2*M2_rel(3))/10^2); set(handles.text315,'String',round(10^2*M2_rel(4))/10^2); set(handles.text316,'String',round(10^2*M2_rel(5))/10^2); set(handles.text317,'String',round(10^2*M2_rel(6))/10^2); set(handles.text318,'String',round(10^2*M2_rel(7))/10^2); set(handles.text323,'String',round(10^2*M3_rel(1))/10^2); set(handles.text324,'String',round(10^2*M3_rel(2))/10^2); set(handles.text325,'String',round(10^2*M3_rel(3))/10^2); set(handles.text326,'String',round(10^2*M3_rel(4))/10^2); set(handles.text327,'String',round(10^2*M3_rel(5))/10^2); set(handles.text328,'String',round(10^2*M3_rel(6))/10^2); set(handles.text329,'String',round(10^2*M3_rel(7))/10^2); end if n_stage==8 set(handles.R11,'String',round(10^4*station1_height(1))/10^4); set(handles.R12,'String',round(10^4*station1_height(2))/10^4); set(handles.R13,'String',round(10^4*station1_height(3))/10^4); set(handles.R14,'String',round(10^4*station1_height(4))/10^4); set(handles.R15,'String',round(10^4*station1_height(5))/10^4); set(handles.R16,'String',round(10^4*station1_height(6))/10^4); set(handles.R17,'String',round(10^4*station1_height(7))/10^4); set(handles.R18,'String',round(10^4*station1_height(8))/10^4); set(handles.R21,'String',round(10^4*str_height(1))/10^4); set(handles.R22,'String',round(10^4*str_height(2))/10^4); set(handles.R23,'String',round(10^4*str_height(3))/10^4); set(handles.R24,'String',round(10^4*str_height(4))/10^4); set(handles.R25,'String',round(10^4*str_height(5))/10^4); set(handles.R26,'String',round(10^4*str_height(6))/10^4); set(handles.R27,'String',round(10^4*str_height(7))/10^4); set(handles.R28,'String',round(10^4*str_height(8))/10^4); set(handles.R31,'String',round(10^4*rot_height(1))/10^4); set(handles.R32,'String',round(10^4*rot_height(2))/10^4); set(handles.R33,'String',round(10^4*rot_height(3))/10^4); set(handles.R34,'String',round(10^4*rot_height(4))/10^4); set(handles.R35,'String',round(10^4*rot_height(5))/10^4); set(handles.R36,'String',round(10^4*rot_height(6))/10^4); set(handles.R37,'String',round(10^4*rot_height(7))/10^4); set(handles.R38,'String',round(10^4*rot_height(8))/10^4); set(handles.Ma11,'String',round(10^2*M1(1))/10^2); set(handles.Ma12,'String',round(10^2*M1(2))/10^2); set(handles.Ma13,'String',round(10^2*M1(3))/10^2); set(handles.Ma14,'String',round(10^2*M1(4))/10^2); set(handles.Ma15,'String',round(10^2*M1(5))/10^2); set(handles.Ma16,'String',round(10^2*M1(6))/10^2); set(handles.Ma17,'String',round(10^2*M1(7))/10^2); set(handles.Ma18,'String',round(10^2*M1(8))/10^2); set(handles.Ma21,'String',round(10^2*M2(1))/10^2); 117 set(handles.Ma22,'String',round(10^2*M2(2))/10^2); set(handles.Ma23,'String',round(10^2*M2(3))/10^2); set(handles.Ma24,'String',round(10^2*M2(4))/10^2); set(handles.Ma25,'String',round(10^2*M2(5))/10^2); set(handles.Ma26,'String',round(10^2*M2(6))/10^2); set(handles.Ma27,'String',round(10^2*M2(7))/10^2); set(handles.Ma28,'String',round(10^2*M2(8))/10^2); set(handles.Ma31,'String',round(10^2*M3(1))/10^2); set(handles.Ma32,'String',round(10^2*M3(2))/10^2); set(handles.Ma33,'String',round(10^2*M3(3))/10^2); set(handles.Ma34,'String',round(10^2*M3(4))/10^2); set(handles.Ma35,'String',round(10^2*M3(5))/10^2); set(handles.Ma36,'String',round(10^2*M3(6))/10^2); set(handles.Ma37,'String',round(10^2*M3(7))/10^2); set(handles.Ma38,'String',round(10^2*M3(8))/10^2); set(handles.text312,'String',round(10^2*M2_rel(1))/10^2); set(handles.text313,'String',round(10^2*M2_rel(2))/10^2); set(handles.text314,'String',round(10^2*M2_rel(3))/10^2); set(handles.text315,'String',round(10^2*M2_rel(4))/10^2); set(handles.text316,'String',round(10^2*M2_rel(5))/10^2); set(handles.text317,'String',round(10^2*M2_rel(6))/10^2); set(handles.text318,'String',round(10^2*M2_rel(7))/10^2); set(handles.text319,'String',round(10^2*M2_rel(8))/10^2); set(handles.text323,'String',round(10^2*M3_rel(1))/10^2); set(handles.text324,'String',round(10^2*M3_rel(2))/10^2); set(handles.text325,'String',round(10^2*M3_rel(3))/10^2); set(handles.text326,'String',round(10^2*M3_rel(4))/10^2); set(handles.text327,'String',round(10^2*M3_rel(5))/10^2); set(handles.text328,'String',round(10^2*M3_rel(6))/10^2); set(handles.text329,'String',round(10^2*M3_rel(7))/10^2); set(handles.text330,'String',round(10^2*M3_rel(8))/10^2); end if n_stage==9 set(handles.R11,'String',round(10^4*station1_height(1))/10^4); set(handles.R12,'String',round(10^4*station1_height(2))/10^4); set(handles.R13,'String',round(10^4*station1_height(3))/10^4); set(handles.R14,'String',round(10^4*station1_height(4))/10^4); set(handles.R15,'String',round(10^4*station1_height(5))/10^4); set(handles.R16,'String',round(10^4*station1_height(6))/10^4); set(handles.R17,'String',round(10^4*station1_height(7))/10^4); set(handles.R18,'String',round(10^4*station1_height(8))/10^4); set(handles.R19,'String',round(10^4*station1_height(9))/10^4); set(handles.R21,'String',round(10^4*str_height(1))/10^4); set(handles.R22,'String',round(10^4*str_height(2))/10^4); set(handles.R23,'String',round(10^4*str_height(3))/10^4); set(handles.R24,'String',round(10^4*str_height(4))/10^4); set(handles.R25,'String',round(10^4*str_height(5))/10^4); set(handles.R26,'String',round(10^4*str_height(6))/10^4); set(handles.R27,'String',round(10^4*str_height(7))/10^4); set(handles.R28,'String',round(10^4*str_height(8))/10^4); set(handles.R29,'String',round(10^4*str_height(9))/10^4); set(handles.R31,'String',round(10^4*rot_height(1))/10^4); set(handles.R32,'String',round(10^4*rot_height(2))/10^4); set(handles.R33,'String',round(10^4*rot_height(3))/10^4); set(handles.R34,'String',round(10^4*rot_height(4))/10^4); set(handles.R35,'String',round(10^4*rot_height(5))/10^4); set(handles.R36,'String',round(10^4*rot_height(6))/10^4); set(handles.R37,'String',round(10^4*rot_height(7))/10^4); set(handles.R38,'String',round(10^4*rot_height(8))/10^4); set(handles.R39,'String',round(10^4*rot_height(9))/10^4); 118 set(handles.Ma11,'String',round(10^2*M1(1))/10^2); set(handles.Ma12,'String',round(10^2*M1(2))/10^2); set(handles.Ma13,'String',round(10^2*M1(3))/10^2); set(handles.Ma14,'String',round(10^2*M1(4))/10^2); set(handles.Ma15,'String',round(10^2*M1(5))/10^2); set(handles.Ma16,'String',round(10^2*M1(6))/10^2); set(handles.Ma17,'String',round(10^2*M1(7))/10^2); set(handles.Ma18,'String',round(10^2*M1(8))/10^2); set(handles.Ma19,'String',round(10^2*M1(9))/10^2); set(handles.Ma21,'String',round(10^2*M2(1))/10^2); set(handles.Ma22,'String',round(10^2*M2(2))/10^2); set(handles.Ma23,'String',round(10^2*M2(3))/10^2); set(handles.Ma24,'String',round(10^2*M2(4))/10^2); set(handles.Ma25,'String',round(10^2*M2(5))/10^2); set(handles.Ma26,'String',round(10^2*M2(6))/10^2); set(handles.Ma27,'String',round(10^2*M2(7))/10^2); set(handles.Ma28,'String',round(10^2*M2(8))/10^2); set(handles.Ma29,'String',round(10^2*M2(9))/10^2); set(handles.Ma31,'String',round(10^2*M3(1))/10^2); set(handles.Ma32,'String',round(10^2*M3(2))/10^2); set(handles.Ma33,'String',round(10^2*M3(3))/10^2); set(handles.Ma34,'String',round(10^2*M3(4))/10^2); set(handles.Ma35,'String',round(10^2*M3(5))/10^2); set(handles.Ma36,'String',round(10^2*M3(6))/10^2); set(handles.Ma37,'String',round(10^2*M3(7))/10^2); set(handles.Ma38,'String',round(10^2*M3(8))/10^2); set(handles.Ma39,'String',round(10^2*M3(9))/10^2); set(handles.text312,'String',round(10^2*M2_rel(1))/10^2); set(handles.text313,'String',round(10^2*M2_rel(2))/10^2); set(handles.text314,'String',round(10^2*M2_rel(3))/10^2); set(handles.text315,'String',round(10^2*M2_rel(4))/10^2); set(handles.text316,'String',round(10^2*M2_rel(5))/10^2); set(handles.text317,'String',round(10^2*M2_rel(6))/10^2); set(handles.text318,'String',round(10^2*M2_rel(7))/10^2); set(handles.text319,'String',round(10^2*M2_rel(8))/10^2); set(handles.text320,'String',round(10^2*M2_rel(9))/10^2); set(handles.text323,'String',round(10^2*M3_rel(1))/10^2); set(handles.text324,'String',round(10^2*M3_rel(2))/10^2); set(handles.text325,'String',round(10^2*M3_rel(3))/10^2); set(handles.text326,'String',round(10^2*M3_rel(4))/10^2); set(handles.text327,'String',round(10^2*M3_rel(5))/10^2); set(handles.text328,'String',round(10^2*M3_rel(6))/10^2); set(handles.text329,'String',round(10^2*M3_rel(7))/10^2); set(handles.text330,'String',round(10^2*M3_rel(8))/10^2); set(handles.text331,'String',round(10^2*M3_rel(9))/10^2); end if n_stage==10 set(handles.R11,'String',round(10^4*station1_height(1))/10^4); set(handles.R12,'String',round(10^4*station1_height(2))/10^4); set(handles.R13,'String',round(10^4*station1_height(3))/10^4); set(handles.R14,'String',round(10^4*station1_height(4))/10^4); set(handles.R15,'String',round(10^4*station1_height(5))/10^4); set(handles.R16,'String',round(10^4*station1_height(6))/10^4); set(handles.R17,'String',round(10^4*station1_height(7))/10^4); set(handles.R18,'String',round(10^4*station1_height(8))/10^4); set(handles.R19,'String',round(10^4*station1_height(9))/10^4); set(handles.R110,'String',round(10^4*station1_height(10))/10^4); set(handles.R21,'String',round(10^4*str_height(1))/10^4); set(handles.R22,'String',round(10^4*str_height(2))/10^4); 119 set(handles.R23,'String',round(10^4*str_height(3))/10^4); set(handles.R24,'String',round(10^4*str_height(4))/10^4); set(handles.R25,'String',round(10^4*str_height(5))/10^4); set(handles.R26,'String',round(10^4*str_height(6))/10^4); set(handles.R27,'String',round(10^4*str_height(7))/10^4); set(handles.R28,'String',round(10^4*str_height(8))/10^4); set(handles.R29,'String',round(10^4*str_height(9))/10^4); set(handles.R210,'String',round(10^4*str_height(10))/10^4); set(handles.R31,'String',round(10^4*rot_height(1))/10^4); set(handles.R32,'String',round(10^4*rot_height(2))/10^4); set(handles.R33,'String',round(10^4*rot_height(3))/10^4); set(handles.R34,'String',round(10^4*rot_height(4))/10^4); set(handles.R35,'String',round(10^4*rot_height(5))/10^4); set(handles.R36,'String',round(10^4*rot_height(6))/10^4); set(handles.R37,'String',round(10^4*rot_height(7))/10^4); set(handles.R38,'String',round(10^4*rot_height(8))/10^4); set(handles.R39,'String',round(10^4*rot_height(9))/10^4); set(handles.R310,'String',round(10^4*rot_height(10))/10^4); set(handles.Ma11,'String',round(10^2*M1(1))/10^2); set(handles.Ma12,'String',round(10^2*M1(2))/10^2); set(handles.Ma13,'String',round(10^2*M1(3))/10^2); set(handles.Ma14,'String',round(10^2*M1(4))/10^2); set(handles.Ma15,'String',round(10^2*M1(5))/10^2); set(handles.Ma16,'String',round(10^2*M1(6))/10^2); set(handles.Ma17,'String',round(10^2*M1(7))/10^2); set(handles.Ma18,'String',round(10^2*M1(8))/10^2); set(handles.Ma19,'String',round(10^2*M1(9))/10^2); set(handles.Ma110,'String',round(10^2*M1(10))/10^2); set(handles.Ma21,'String',round(10^2*M2(1))/10^2); set(handles.Ma22,'String',round(10^2*M2(2))/10^2); set(handles.Ma23,'String',round(10^2*M2(3))/10^2); set(handles.Ma24,'String',round(10^2*M2(4))/10^2); set(handles.Ma25,'String',round(10^2*M2(5))/10^2); set(handles.Ma26,'String',round(10^2*M2(6))/10^2); set(handles.Ma27,'String',round(10^2*M2(7))/10^2); set(handles.Ma28,'String',round(10^2*M2(8))/10^2); set(handles.Ma29,'String',round(10^2*M2(9))/10^2); set(handles.Ma210,'String',round(10^2*M2(10))/10^2); set(handles.Ma31,'String',round(10^2*M3(1))/10^2); set(handles.Ma32,'String',round(10^2*M3(2))/10^2); set(handles.Ma33,'String',round(10^2*M3(3))/10^2); set(handles.Ma34,'String',round(10^2*M3(4))/10^2); set(handles.Ma35,'String',round(10^2*M3(5))/10^2); set(handles.Ma36,'String',round(10^2*M3(6))/10^2); set(handles.Ma37,'String',round(10^2*M3(7))/10^2); set(handles.Ma38,'String',round(10^2*M3(8))/10^2); set(handles.Ma39,'String',round(10^2*M3(9))/10^2); set(handles.Ma310,'String',round(10^2*M3(10))/10^2); set(handles.text312,'String',round(10^2*M2_rel(1))/10^2); set(handles.text313,'String',round(10^2*M2_rel(2))/10^2); set(handles.text314,'String',round(10^2*M2_rel(3))/10^2); set(handles.text315,'String',round(10^2*M2_rel(4))/10^2); set(handles.text316,'String',round(10^2*M2_rel(5))/10^2); set(handles.text317,'String',round(10^2*M2_rel(6))/10^2); set(handles.text318,'String',round(10^2*M2_rel(7))/10^2); set(handles.text319,'String',round(10^2*M2_rel(8))/10^2); set(handles.text320,'String',round(10^2*M2_rel(9))/10^2); set(handles.text321,'String',round(10^2*M2_rel(10))/10^2); set(handles.text323,'String',round(10^2*M3_rel(1))/10^2); 120 set(handles.text324,'String',round(10^2*M3_rel(2))/10^2); set(handles.text325,'String',round(10^2*M3_rel(3))/10^2); set(handles.text326,'String',round(10^2*M3_rel(4))/10^2); set(handles.text327,'String',round(10^2*M3_rel(5))/10^2); set(handles.text328,'String',round(10^2*M3_rel(6))/10^2); set(handles.text329,'String',round(10^2*M3_rel(7))/10^2); set(handles.text330,'String',round(10^2*M3_rel(8))/10^2); set(handles.text331,'String',round(10^2*M3_rel(9))/10^2); set(handles.text332,'String',round(10^2*M3_rel(10))/10^2); end %Veltri First stage %AXIAL hastighet j=1; Y1 = [0 -Cx1]; X1 = [C2(j)*sind(alfa2(j)) C2(j)*sind(alfa2(j))]; %Absolut stat2 Y2 = [0 -C2(j)*cosd(alfa2(j))]; X2 = [C2(j)*sind(alfa2(j)) 0]; %Relativ stat2 Y3 = [0 -W2(j)*cosd(beta2(j))]; X3 = [U_m+W2(j)*sind(beta2(j)) U_m]; %U_M X4 = [U_m 0]; Y4 = [-C2(j)*cosd(alfa2(j)) -C2(j)*cosd(alfa2(j))]; %Absolut stat3 Y5 = [0 -C3(j)*cosd(alfa3(j))]; X5 = [C2(j)*sind(alfa2(j)) C2(j)*sind(alfa2(j))+C3(j)*sind(-alfa3(j))]; %Relativ stat3 Y6 = [0 -W3(j)*cosd(beta3(j))]; X6 = [C2(j)*sind(alfa2(j)) C2(j)*sind(alfa2(j))+W3(j)*sind(-beta3(j))]; %U_m X7 = [C2(j)*sind(alfa2(j))+C3(j)*sind(-alfa3(j)) C2(j)*sind(alfa2(j))+W3(j)*sind(-beta3(j))]; Y7 = [-W3(j)*cosd(beta3(j)) -W3(j)*cosd(beta3(j))]; %Veltri last stage j=n_stage; Y8 = [0 -Cx1]; X8 = [C2(j)*sind(alfa2(j)) C2(j)*sind(alfa2(j))]; %Absolut stat2 Y9 = [0 -C2(j)*cosd(alfa2(j))]; X9 = [C2(j)*sind(alfa2(j)) 0]; 121 %Relativ stat2 Y10 = [0 -W2(j)*cosd(beta2(j))]; X10 = [U_m+W2(j)*sind(beta2(j)) U_m]; %U_M X11 = [U_m 0]; Y11 = [-C2(j)*cosd(alfa2(j)) -C2(j)*cosd(alfa2(j))]; %Absolut stat3 Y12 = [0 -C3(j)*cosd(alfa3(j))]; X12 = [C2(j)*sind(alfa2(j)) C2(j)*sind(alfa2(j))+C3(j)*sind(-alfa3(j))]; %Relativ stat3 Y13 = [0 -W3(j)*cosd(beta3(j))]; X13 = [C2(j)*sind(alfa2(j)) C2(j)*sind(alfa2(j))+W3(j)*sind(-beta3(j))]; %U_m X14 = [C2(j)*sind(alfa2(j))+C3(j)*sind(-alfa3(j)) C2(j)*sind(alfa2(j))+W3(j)*sind(-beta3(j))]; Y14 = [-W3(j)*cosd(beta3(j)) -W3(j)*cosd(beta3(j))]; %plot veltri axes(handles.veltri_st1) title('For all but the last stage') xlabel('m/s') ylabel('m/s') hold on plot(handles.veltri_st1,X1,Y1,'g-','Linewidth',1.5,'linesmoothing','on') plot(handles.veltri_st1,X2,Y2,'r-','Linewidth',1.5,'linesmoothing','on') plot(handles.veltri_st1,X3,Y3,'b-','Linewidth',1.5,'linesmoothing','on') plot(handles.veltri_st1,X4,Y4,'k-','Linewidth',1.5,'linesmoothing','on') plot(handles.veltri_st1,X5,Y5,'r--','Linewidth',1.5,'linesmoothing','on') plot(handles.veltri_st1,X6,Y6,'b--','Linewidth',1.5,'linesmoothing','on') plot(handles.veltri_st1,X7,Y7,'k-','Linewidth',1.5,'linesmoothing','on') hold off axes(handles.veltri_last) title('Last stage') xlabel('m/s') ylabel('m/s') hold on plot(handles.veltri_last,X8,Y8,'g-','Linewidth',1.5,'linesmoothing','on') plot(handles.veltri_last,X9,Y9,'r-','Linewidth',1.5,'linesmoothing','on') plot(handles.veltri_last,X10,Y10,'b-','Linewidth',1.5,'linesmoothing','on') plot(handles.veltri_last,X11,Y11,'k-','Linewidth',1.5,'linesmoothing','on') plot(handles.veltri_last,X12,Y12,'r-','Linewidth',1.5,'linesmoothing','on') plot(handles.veltri_last,X13,Y13,'b-','Linewidth',1.5,'linesmoothing','on') plot(handles.veltri_last,X14,Y14,'k-','Linewidth',1.5,'linesmoothing','on') hold off % --- Executes on button press in pushbutton2. function pushbutton2_Callback(hObject, eventdata, handles) % hObject handle to pushbutton2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB 122 % handles structure with handles and user data set(handles.Angles,'visible','off'); set(handles.Rad_Ma,'visible','on'); set(handles.uipanel12,'visible','off') % --- Executes on button press in pushbutton3. function pushbutton3_Callback(hObject, eventdata, % hObject handle to pushbutton3 (see GCBO) % eventdata reserved - to be defined in a future % handles structure with handles and user data set(handles.Angles,'visible','on'); set(handles.Rad_Ma,'visible','off'); set(handles.uipanel12,'visible','off') (see GUIDATA) handles) version of MATLAB (see GUIDATA) % --- Executes on button press in update. function update_Callback(hObject, eventdata, handles) % hObject handle to update (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) global EXPORT_VALUES set(handles.h04,'String',EXPORT_VALUES(1)/10^3); set(handles.P04,'String',EXPORT_VALUES(4)/10^2); set(handles.s04,'String',EXPORT_VALUES(2)/10^3); set(handles.T04,'String',EXPORT_VALUES(3)); set(handles.P05,'String',EXPORT_VALUES(9)/10^2); set(handles.s05,'String',EXPORT_VALUES(7)/10^3); set(handles.mass,'String',EXPORT_VALUES(10)); set(handles.text337,'string',EXPORT_VALUES(11)); set(handles.text334,'string',EXPORT_VALUES(12)); Vratio = EXPORT_VALUES(12)/EXPORT_VALUES(11) set(handles.text340,'string',Vratio); % --- Executes on button press in performance. function performance_Callback(hObject, eventdata, handles) % hObject handle to performance (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) set(handles.Angles,'visible','off'); set(handles.uipanel12,'visible','on') set(handles.Rad_Ma,'visible','off') 9.2 Turbine calculation %########################################################################## %## ## %## Turbine Calculation ## %## Mikael Olsson ## %## ## %########################################################################## function [n_stage Psi Reac_vek Cx1 C1 C2 C3 W2 W3 M1 M2 M3 M3_rel station1_height str_height rot_height alfa2 alfa3 beta2 beta3]=... Turbine(Psi_def,Phi_def,Reac_def,N,U_m,r_m,mass,s1_def,h01_def,T01_def,P01_ def,P0kond_def,T0kond_def,s0kond_def,amne); %i=1; Phi = Phi_def 123 n_stage= 1; Psi(n_stage)=zeros; Cx1 = Phi*U_m; AVR=1; Nue=1; s1(1) = s1_def; h01(1) = h01_def; T01(1) = T01_def; P01(1) = P01_def; alfa1(1) = 0; a01 = refpropm('a','h',h01,'s',s1,char(amne)); M01 = Cx1/a01; P0kond = T0kond = s0kond = h0kond = s0kond_s P0kond_def; T0kond_def; s0kond_def; refpropm('H','T',T0kond,'s',s0kond,char(amne)); = s1_def; P2_diffuser = P0kond; C1(1) = Cx1; h1(1) = h01(1)-C1(1)^2/2; if n_stage ==1 n_stage = n_stage; single = 1; else n_stage=n_stage-1; single = 0; end Psi(n_stage)=100; while Psi(n_stage)>Psi_def %Psi = 2; if single ==1 n_stage = n_stage; single = 0; else n_stage = n_stage+1; single = 0; end alfa1=0; h1 = 0; h01= 0; s1 = 0; C1 = 0; W1 = 0; s1(1) = s1_def; h01(1) = h01_def; T01(1) = T01_def; P01(1) = P01_def; alfa1(1) = 0; C1(1) = Cx1; h1(1) = h01(1)-(C1(1)^2)/2; Reac=Reac_def; 124 for i=1:n_stage Psi(i)=Psi_def; if i<n_stage error=0; [alfa2(i) alfa3(i) beta2(i) beta3(i) Reac]=ORC_Veltri(Phi,Psi(i),Reac,AVR,Nue,2); [I2(i) C2(i) C3(i) W2(i) W3(i) verk_tt(i) P1(i) P01(i) P2(i) P02(i) P02_rel(i) P3(i) P03(i) P03_rel(i) a3(i) T1(i) T01(i) h3(i) h03(i) h03ss(i) h3ss(i) s2(i) s3(i) kappa3(i) Cp1(i) Cp3(i) M1(i) M2(i) M2_rel(i) M3(i) M3_rel(i) Ytot_str(i) Ytot_rot(i) HONB_str(i) HONB_rot(i) SONC_str(i) SONC_rot(i)... r_tip_str(i) r_tip_rot(i) r_hub_str(i) r_hub_rot(i) r1tip(i) r1hub(i) V_flow1(i) V_flow2(i) V_flow3(i) fail_str fail_rot b_str(i) b_rot(i) num_blades_str(i)]= Calc(alfa2(i),alfa3(i),beta2(i),beta3(i),AVR,mass,alfa1(i),h1(i),h01(i),s1( i),C1(i),Cx1,U_m,r_m,s0kond_s,char(amne)); Reac_vek(i) = Reac; elseif i==n_stage error = 1; n = 0; while abs(error)>1/10^2 [alfa2(i) alfa3(i) beta2(i) beta3(i) Reac]=ORC_Veltri(Phi,Psi(i),Reac,AVR,Nue,1); [I2(i) C2(i) C3(i) W2(i) W3(i) verk_tt(i) P1(i) P01(i) P2(i) P02(i) P02_rel(i) P3(i) P03(i) P03_rel(i) a3(i) T1(i) T01(i) h3(i) h03(i) h03ss(i) h3ss(i) s2(i) s3(i) kappa3(i) Cp1(i) Cp3(i) M1(i) M2(i) M2_rel(i) M3(i) M3_rel(i) Ytot_str(i) Ytot_rot(i) HONB_str(i) HONB_rot(i) SONC_str(i) SONC_rot(i)... r_tip_str(i) r_tip_rot(i) r_hub_str(i) r_hub_rot(i) r1tip(i) r1hub(i) V_flow1(i) V_flow2(i) V_flow3(i) fail_str fail_rot b_str(i) b_rot(i) num_blades_str(i)]= Calc(alfa2(i),alfa3(i),beta2(i),beta3(i),AVR,mass,alfa1(i),h1(i),h01(i),s1( i),C1(i),Cx1,U_m,r_m,s0kond_s,char(amne)); Reac_vek(i) = Reac; Cp = (Cp1(i)+Cp3(i))/2; kappa = kappa3(i); cp = 0.6; %diffuser koeff. M1_diffuser=M3(i); P1_diffuser = P2_diffuser/(1+cp*((1+((kappa1)/2)*M1_diffuser^2)^(kappa/(kappa-1))-1)) error = (P3(i)-P1_diffuser)/10^2; RLX = 0.30; dPsi_dP3 = -(1/U_m^2)*((kappa1)/kappa*Cp*verk_tt(i)*T01(i)*(P01(i)/10^2)^((1kappa)/kappa)*(P03(i)/10^2)^(-1/kappa)); Psi(i) = Psi(i)-RLX*error/dPsi_dP3; if n>=10 && Psi(i)>3 break 125 end if fail_str==1 || fail_rot==1 break end n = n+1; aa(n)=error; disp(Psi(i)) end if fail_str==1 || fail_rot==1 break end end Ns(i)=sqrt(Phi)/(Psi(i))^(3/4) NS(i)=(N/60)*sqrt(V_flow3(i))/(Psi(i)*U_m^2)^(3/4) VH(i)= sqrt(V_flow3(i))/(Psi(i)*U_m^2)^(1/4) VR(i)= V_flow3(i)/V_flow1(i); w_stage(i) = (h01(i)-h03(i))/10^3; PWR_stage(i) = mass*w_stage(i); if (i+1)<=n_stage alfa1(i+1)=-alfa3(i); h1(i+1) = h3(i); h01(i+1)= h03(i); s1(i+1) = s3(i); C1(i+1) = C3(i); W1(i+1) = W3(i); end Ygreen_str(i) = (P01(i)-P02(i))/(P02(i)-P2(i)); Ygreen_rot(i) = (P02_rel(i)-P03_rel(i))/(P03_rel(i)-P3(i)); end end for j=1:n_stage if M2(j)>1.4 warndlg('M2 greater than 1.4','Mach warning') end if M3_rel(j)>1.4 warndlg('M3_rel greater than 1.4','Mach warning') end end str_height = r_tip_str-r_hub_str; rot_height = r_tip_rot-r_hub_rot; station1_height = r1tip- r1hub; W_turb=0; 126 for i=1:n_stage W_turb = (W_turb+PWR_stage(i)) end effic = (h01(1)-h03(n_stage))/(h01(1)-h3ss(n_stage)) 9.3 Stage calculation %########################################################################## %## ## %## Stage Calculation ## %## Mikael Olsson ## %## ## %########################################################################## function [I2 C2 C3 W2 W3 verk_tt P1 P01 P2 P02 P02_rel P3 P03 P03_rel a3 T1 T01 h3 h03 h03ss h3ss s2 s3 kappa3 Cp1 Cp3 M1 M2 M2_rel M3 M3_rel Ytot_str Ytot_rot HONB_str HONB_rot SONC_str SONC_rot... r_tip_str r_tip_rot r_hub_str r_hub_rot r1tip r1hub V_flow1 V_flow2 V_flow3 fail_str fail_rot b_str b_rot num_blades_str]=Calc(alfa2,alfa3,beta2,beta3,AVR,mass,alfa1,h1,h01,s1,C1,Cx 1,U_m,r_m,s0kond_s,amne) [a1 rau1 P1 T1 Cp1 kappa]= refpropm('ADPTCK','H',h1,'s',s1,char(amne)); [P01 T01] =refpropm('PT','H',h1+C1^2/2,'s',s1,char(amne)); M1 = C1/a1; V_flow1 = mass/rau1; A1 = mass/(rau1*Cx1); %Annulus kappa1 = kappa; r1tip = (A1/(4*pi*r_m))+r_m; r1hub = 2*r_m-r1tip; C2 = Cx1/cosd(alfa2); W2 = Cx1/cosd(beta2); error = 1; ds_old = 0; h02=h01; h2 = h02-C2^2/2; raknare_str = 0; disp('------------------------') disp(h2) if h2<0 errordlg('Static enthalpy station 2 negative, C2 to high. Decrease axial speed or alfa2','Error','on') end while abs(error)>0.1 ds_str = ds_old+0.9*error; s2=s1+ds_str; if h2<0 keyboard end kappa = refpropm('K','H',h2,'s',s2,char(amne)); P2 = refpropm('P','H',h2,'s',s2,char(amne)); P02_rel = refpropm('P','H',h2+W2^2/2,'s',s2,char(amne)); [P02 T02] = refpropm('PT','H',h02,'s',s2,char(amne)); 127 [T2 rau2 a2 viskositet] = refpropm('TDAV','H',h2,'s',s2,char(amne)); V_flow2 = mass/rau2; A2 = mass/(rau2*Cx1); r_tip_str = (A2/(4*pi*r_m))+r_m; r_hub_str = 2*r_m-r_tip_str; M2 = C2/a2; NorR = 1; %Stator Ang_in = alfa1; Ang_in_b = Ang_in; Desinc = 0; Ang_out = alfa2; Ma_in = M1; Ma_out = M2; Ps_in = P1;%kPa Ps_out = P2;%kPa kappa2 = kappa; Ang_stagger = stagger1(alfa1,alfa2); TONC = TONC1(alfa1,alfa2); [SONC_str SONB Z] = ZweiStaSBC1(alfa1,alfa2,1,Ma_out,AVR,TONC,Ang_stagger); %model ZweiStaSBC1 HTRAT = r_hub_str/r_tip_str; if SONC_str<0 keyboard end fail_str = 0; if HTRAT<0 fail_str = 1; %keyboard errordlg('Negative hub tip ratio for stator, either increase mean radius or increase Phi','Error','on') return end HONB_str = lonb1(HTRAT,'str');% = modell lonb1 b_str = (r_tip_str-r_hub_str)/HONB_str;%Axial chord c_str = b_str/cosd(Ang_stagger); %blade chord Re_str = C2*c_str*rau2/viskositet; TEONO = 0.01; HONC = (r_tip_str-r_hub_str)/c_str;% CLONH = 0.01; Nseal = 5; TRmRAT = r_tip_str/r_m; DLEONC = 0.2; [Ytot_str,Yp_str,YTE_str,Ys_str,Yclr_str,Ypi_str,YsONYs_DES_str,SONC2_str]= AMDCKOMK(NorR,Ang_in,Ang_in_b,Desinc,Ang_out,AVR,Ma_in,Ma_out,Ps_in,Ps_out, Re_str,kappa,SONC_str,TONC,HTRAT,TEONO,HONC,HONB_str,CLONH,Nseal,TRmRAT,DLE ONC,Ang_stagger,0); 128 Molar = refpropm('M','H',h2,'s',s2,char(amne)); R=1000*(8.314472/Molar); ds_old = ds_str; ds_new = -R*log(1-Ytot_str*(P02-P2)/P01); %gibbs: s2-s1=-R*ln(1(deltaP/P1), deltaP = Ytot*(P02-P2) error = ds_new-ds_old; raknare_str = raknare_str+1; error_mth(raknare_str)=error; if raknare_str>100 disp('stator iteration has failed') end fail_str=0; end num_blades_str = r_m*2*pi/(SONC_str*c_str) if beta3<0 beta3_banan = -beta3; alfa3_banan = -alfa3; else beta3_banan = -beta3; end I2 C3 W3 h3 = = = = h2+W2^2/2-U_m^2/2; Cx1/cosd(alfa3); Cx1/cosd(beta3); I2-W3^2/2+U_m^2/2; %Rothalpy const. error = 10; %ds_ny-ds_gammal ds_old = 0; raknare_rot = 0; Ytot_rot = 0; while abs(error)>0.1 ds_rot = ds_old+0.9*error; s3 = s2+ds_rot; h03 = h3+C3^2/2; fel =0; [P03 T03]=refpropm('PT','H',h03,'s',s3,char(amne)); h03_rel=h3+W3^2/2; [P03_rel T03_rel]=refpropm('PT','H',h03_rel,'s',s3,char(amne)); h03ss_rel = refpropm('H','P',P03_rel,'s',s0kond_s,char(amne)); [P3 Molar] = refpropm('PM','H',h3,'s',s3,char(amne)); T3 = refpropm('T','H',h3,'s',s3,char(amne)); h3ss = refpropm('H','P',P3,'s',s0kond_s,char(amne)); h03ss = refpropm('H','P',P03,'s',s0kond_s,char(amne)); 129 rau3 = refpropm('D','H',h3,'s',s3,char(amne)); a3 = refpropm('A','H',h3,'s',s3,char(amne)); viskositet = refpropm('V','H',h3,'s',s3,char(amne)); V_flow3 = mass/rau3; A3 = mass/(rau3*Cx1); r_tip_rot = A3/(4*pi*r_m)+r_m; r_hub_rot = 2*r_m-r_tip_rot; M2_rel = W2/a2; M3_rel = W3/a3; M3 = C3/a3; NorR = 2; %Rotor Ang_in = beta2; Ang_in_b = Ang_in; Desinc = 0; Ang_out = beta3_banan; Ma_in = M2_rel; Ma_out = M3_rel; Ps_in = P2;%kPa Ps_out = P3;%kPa kappa = refpropm('K','H',h3,'s',s3,char(amne)); kappa3 = kappa; Ang_stagger = stagger1(beta2,beta3_banan); TONC = TONC1(beta2,beta3_banan); [SONC_rot SONB Z] = ZweiStaSBC1(beta2,beta3_banan,1,Ma_out,AVR,TONC,Ang_stagger); HTRAT = r_hub_rot/r_tip_rot; fail_rot = 0; if SONC_rot<0 keyboard end if HTRAT<0 fail_rot = 1; errordlg('Negative hub tip ratio for rotor, either increase mean radius or increase Phi','Error','on') return end HONB_rot = lonb1(HTRAT,'rtr');% = modell lonb1 b_rot = (r_tip_rot-r_hub_rot)/HONB_rot;%Axial chord c_rot = b_rot/cosd(Ang_stagger); %blade chord Re_rot = W3*c_rot*rau3/viskositet; TEONO = 0.01; HONC = (r_tip_rot-r_hub_rot)/c_rot;% CLONH = 0.01; Nseal = 5;%???? TRmRAT = r_tip_rot/r_m; DLEONC = 0.2;%???? 0.065 kappa = (kappa2+kappa3)/2; if Ytot_rot<0 fel =1; disp(s3-s2) disp(Ytot_rot) disp(Yp_rot) end 130 [Ytot_rot,Yp_rot,YTE_rot,Ys_rot,Yclr_rot,Ypi_rot,YsONYs_DES_rot,SONC2_rot]= AMDCKOMK(NorR,Ang_in,Ang_in_b,Desinc,Ang_out,AVR,Ma_in,Ma_out,Ps_in,Ps_out, Re_rot,kappa,SONC_rot,TONC,HTRAT,TEONO,HONC,HONB_rot,CLONH,Nseal,TRmRAT,DLE ONC,Ang_stagger,fel); Cp3 = refpropm('C','H',h3,'s',s3,char(amne)); Cv = refpropm('O','H',h3,'s',s3,char(amne)); R=1000*(8.314472/Molar); ds_old = ds_rot; ds_new = -R*log(1-Ytot_rot*(P03_rel-P3)/P02_rel); error = ds_new-ds_old; %verk_tt(i) = (h1-h3)/(h1-h03ss); verk_tt = (h01-h03)/(h01-h03ss); %verk_ts(i) = (h01(i)-h03(i))/(h01(i)-h3ss(i)); raknare_rot = raknare_rot+1; s_koll(raknare_rot) = ds_rot; error_koll(raknare_rot)=error; if raknare_rot>100 disp('rotor iteration has failed') end fail_rot=0; end Ygreen_str = (P01-P02)/(P02-P2); Ygreen_rot = (P02_rel-P03_rel)/(P03_rel-P3); fail=0; 131 10 Appendix C 10.1 How to connect REFPROP to MATLAB 1. Firstly make sure that refprop is installed on the computer that’s to be used. If not install it (preferably in C:\Program Files for reasons found in point 3) 2. Go to this address (as of june 2012): http://www.boulder.nist.gov/div838/theory/refprop/Frequently_asked_questions.htm#Updates and download the zip file ML2010A.zip containing m files for REFPROP connection to Matlab. Unpack it where you want but it must be in Matlabs path. Either unpack in the Matlab working folder or add the chosen folder to path later in Matlab. 3. If REFPROP has been installed in another path than C:\Program Files\REFPROP changes needs to be made to the downloaded files. How to do this is found in the REFPROP FAQ. It’s recommended however to install in the program files directory if possible. This has to do with that the m files is set to search the fluids in that folder and changing the path require some programming skills. 4. Make sure that the folder with the unpacked files is in the Matlab working directory and then type: “help refpropm” in the command window. If properly added the window now should show information about what values refprop returns an also some examples of how to use it. 5. If point 4 do not work check installation of refprop. Is the folder correct? Has the REFPROP m files been added to the Matlab path? 132