source: branches/gui/eml/pressure_changers/turbine.mso @ 604

Last change on this file since 604 was 604, checked in by gerson bicca, 14 years ago

added expander model

  • Property svn:keywords set to Id
File size: 7.4 KB
Line 
1#*-------------------------------------------------------------------
2* EMSO Model Library (EML) Copyright (C) 2004 - 2007 ALSOC.
3*
4* This LIBRARY is free software; you can distribute it and/or modify
5* it under the therms of the ALSOC FREE LICENSE as available at
6* http://www.enq.ufrgs.br/alsoc.
7*
8* EMSO Copyright (C) 2004 - 2007 ALSOC, original code
9* from http://www.rps.eng.br Copyright (C) 2002-2004.
10* All rights reserved.
11*
12* EMSO is distributed under the therms of the ALSOC LICENSE as
13* available at http://www.enq.ufrgs.br/alsoc.
14*
15*----------------------------------------------------------------------
16* Authors: Rafael de Pelegrini Soares
17*          Andrey Copat, Estefane S. Horn, Marcos L. Alencastro
18* $Id: turbine.mso 604 2008-08-22 02:30:04Z bicca $
19*--------------------------------------------------------------------*#
20
21using "streams";
22
23#Needs to be reformulated
24
25Model HidraulicTurbine
26        ATTRIBUTES
27        Pallete         = true;
28        Icon            = "icon/HidraulicTurbine";
29        Brief           = "Testing Model of a Hidraulic Turbine.";
30       
31        PARAMETERS
32outer NComp     as Integer                      (Brief = "Number of chemical components", Lower = 1);
33outer PP                as Plugin                       (Brief = "External Physical Properties", Type="PP");
34        Mw(NComp)       as molweight            (Brief = "Molar Weight");
35       
36        VARIABLES
37        Eff     as efficiency           (Brief = "Turbine efficiency");
38        Meff    as efficiency           (Brief = "Brake efficiency");
39        Beta    as positive             (Brief = "Volumetric expansivity", Unit = '1/K');
40        Head    as head                         (Brief = "Head Developed");
41        FPower  as power                        (Brief = "Fluid Power");
42        BPower  as power                        (Brief = "Brake Power");
43        Pratio  as positive                     (Brief = "Pressure Ratio");
44        Pdrop   as press_delta          (Brief = "Pressure Drop", DisplayUnit = 'kPa', Symbol ="\Delta P");
45        Mwm     as molweight            (Brief = "Mixture Molar Weight");
46        rho             as dens_mass            (Brief = "Specific Mass");
47        Cp              as cp_mol                       (Brief = "Heat Capacity");
48in              Inlet           as stream               (Brief = "Inlet stream", PosX=0.05, PosY=0.0, Symbol="_{in}");
49out     Outlet          as stream       (Brief = "Outlet stream", PosX=0.65, PosY=1, Symbol="_{out}");
50out WorkOut             as power                (Brief = "Work Outlet", PosX=1, PosY=0.46);
51
52        SET
53        Mw = PP.MolecularWeight();     
54       
55        EQUATIONS
56        #Mixtures Properties
57        "Calculate Mwm for Inlet Mixture"
58        Mwm = sum(Mw*Inlet.z);
59
60        "Calculate rho using a External Physical Properties Routine"
61        rho = PP.LiquidDensity(Inlet.T,Inlet.P,Inlet.z);
62       
63        "Calculate Outlet Vapour Fraction"
64        Outlet.v = PP.VapourFraction(Outlet.T, Outlet.P, Outlet.z);
65       
66        "Calculate Cp Using a External Physical Properties Routine"
67        Cp = PP.LiquidCp(Inlet.T,Inlet.P,Inlet.z);
68       
69        "Pressure Ratio"
70        Outlet.P = Inlet.P * Pratio;
71
72        "Pressure Drop"
73        Outlet.P  = Inlet.P - Pdrop;
74
75        "Calculate Fluid Power"
76        FPower * rho = -Pdrop * Inlet.F * Mwm;
77
78        "Calculate Brake Power"
79        BPower = FPower * Eff;
80       
81        BPower = WorkOut;
82       
83        "Calculate Outlet Temperature"
84        (Outlet.T - Inlet.T) * rho * Cp = (Outlet.h - Inlet.h) * rho
85        + Pdrop * Mwm * (1-Beta*Inlet.T);
86       
87        "Calculate Outlet Enthalpy"
88        (Outlet.h - Inlet.h) * rho =  -Pdrop * Mwm;
89       
90        "Molar Balance"
91        Outlet.F = Inlet.F;
92       
93        "Calculate Outlet Composition"
94        Outlet.z = Inlet.z;
95
96        "Calculate Head"
97        Head = Outlet.h - Inlet.h;
98end
99
100Model HidraulicTurbineGenerator as HidraulicTurbine
101        ATTRIBUTES
102        Pallete         = true;
103        Icon            = "icon/HidraulicTurbine";
104        Brief           = "Model of a Hidraulic Turbine.";
105        Info            =
106"== Assumptions ==
107* Steady State;
108* Only Liquid;
109* Adiabatic;
110* Isentropic.
111       
112== Specify ==
113* the inlet stream;
114* the Pressure Increase (Pdiff) OR the outlet pressure (Outlet.P);
115* the Turbine efficiency (Eff);
116* the Brake efficiency (Meff);
117* the Volumetric expansivity (Beta).
118";
119       
120        VARIABLES
121        EPower  as power                        (Brief = "Eletrical Potency");
122       
123        EQUATIONS
124        "Calculate Eletric Power"
125        EPower = BPower * Meff;
126end
127
128Model expander
129       
130ATTRIBUTES
131        Pallete         = true;
132        Icon            = "icon/HidraulicTurbine";
133        Brief           = "Model of an expansor.";
134        Info            =
135"To be documented";
136       
137PARAMETERS
138
139outer PP                as Plugin               (Brief = "External Physical Properties", Type="PP");
140outer NComp     as Integer              (Brief = "Number of chemical components", Lower = 1);
141        Rgas            as positive     (Brief = "Constant of Gases", Unit= 'kJ/kmol/K', Default = 8.31451,Hidden=true);
142        Mw(NComp)       as molweight    (Brief = "Molar Weight");
143
144VARIABLES
145
146        IseCoeff        as positive     (Brief = "Isentropic Coefficient", Lower=0.2);
147        Pratio          as positive             (Brief = "Pressure Ratio", Symbol ="P_{ratio}");       
148        Pdrop           as press_delta  (Brief = "Pressure Drop", DisplayUnit = 'kPa', Symbol ="\Delta P");
149        Pdecrease       as press_delta  (Brief = "Pressure Decrease", DisplayUnit = 'kPa', Symbol ="P_{decr}");
150
151        Head                            as energy_mass  (Brief = "Head");
152        HeadIsentropic          as energy_mass  (Brief = "Isentropic Head");
153        Tisentropic                     as temperature  (Brief = "Isentropic Temperature");
154       
155        IsentropicEff   as efficiency   (Brief = "Isentropic efficiency");
156        MechanicalEff   as efficiency   (Brief = "Mechanical efficiency");
157       
158        FluidPower      as power                (Brief = "Fluid Power");
159        BrakePower      as power                (Brief = "Brake Power");
160        PowerLoss       as power                (Brief = "Power Losses");
161        Mwm                     as molweight    (Brief = "Mixture Molar Weight");
162        rho                     as dens_mass    (Brief = "Mass Density");
163        Zfac_in         as fraction     (Brief = "Compressibility factor at inlet");
164        Zfac_out        as fraction     (Brief = "Compressibility factor at outlet");
165
166in      Inlet           as stream       (Brief = "Inlet stream", PosX=0.05, PosY=0.0, Symbol="_{in}");
167out     Outlet          as streamPH     (Brief = "Outlet stream", PosX=0.65, PosY=1, Symbol="_{out}");
168
169out     WorkOut         as power        (Brief = "Work Outlet", PosX=1, PosY=0.46);
170
171SET
172
173        Mw = PP.MolecularWeight();
174
175        Rgas    = 8.31451*'kJ/kmol/K';
176
177EQUATIONS
178
179"Overall Molar Balance"
180        Outlet.F = Inlet.F;
181
182"Component Molar Balance"
183        Outlet.z = Inlet.z;
184
185"Average Molecular Weight"
186        Mwm = sum(Mw*Inlet.z);
187
188"Pressure Ratio"
189        Outlet.P = Inlet.P * Pratio;
190
191"Pressure Drop"
192        Outlet.P  = Inlet.P - Pdrop;
193
194"Pressure Decrease"
195        Outlet.P  = Inlet.P - Pdecrease;
196
197"Mass Density"
198        rho = PP.VapourDensity(Inlet.T, Inlet.P, Inlet.z);
199       
200"Compressibility factor at Inlet Conditions"
201        Zfac_in = PP.VapourCompressibilityFactor(Inlet.T,Inlet.P,Inlet.z);
202       
203"Compressibility factor at Outlet Conditions"
204        Zfac_out = PP.VapourCompressibilityFactor(Outlet.T,Outlet.P,Outlet.z);
205
206"Isentropic Head"
207        HeadIsentropic*Mwm = (PP.VapourEnthalpy(Tisentropic,Outlet.P,Outlet.z)-Inlet.h);
208
209"Isentropic Outlet Temperature"
210        PP.VapourEntropy(Tisentropic, Outlet.P, Outlet.z) = PP.VapourEntropy(Inlet.T, Inlet.P, Inlet.z);
211
212
213if IsentropicEff equal 1
214
215        then
216"Discharge Temperature"
217        Outlet.T = Tisentropic;
218
219"Head"
220        Head = HeadIsentropic;
221
222"Isentropic Coefficient"
223        IseCoeff= 1;
224
225        else
226"Isentropic Coefficient"
227        #HeadIsentropic = (0.5*Zfac_in+0.5*Zfac_out)*(1/Mwm)*(IseCoeff/(IseCoeff-1.001))*Rgas*Inlet.T*((Outlet.P/Inlet.P)^((IseCoeff-1.001)/IseCoeff) - 1);
228        Head = (0.5*Zfac_in+0.5*Zfac_out)*(1/Mwm)*(IseCoeff/(IseCoeff-1.001))*Rgas*Inlet.T*((Outlet.P/Inlet.P)^((IseCoeff-1.001)/IseCoeff) - 1);
229
230"Discharge Temperature"
231        Outlet.T = Inlet.T*((Outlet.P/Inlet.P)^((IseCoeff-1.001)/IseCoeff));
232
233"Head"
234        Head*Mwm = (PP.VapourEnthalpy(Outlet.T,Outlet.P,Outlet.z)-Inlet.h);
235
236end
237
238"Fluid Power"
239        FluidPower*IsentropicEff = Head*sum(Mw*Inlet.z)*Inlet.F;
240        #FluidPower = Head*sum(Mw*Inlet.z)*Inlet.F;
241
242"Brake Power"
243        BrakePower = WorkOut;
244
245"Brake Power"
246        BrakePower = (FluidPower/MechanicalEff)-PowerLoss;
247
248"Power Loss"
249        PowerLoss = BrakePower - FluidPower;
250
251end
Note: See TracBrowser for help on using the repository browser.