/[ascend]/trunk/models/johnpye/fprops/valve.a4c
ViewVC logotype

Contents of /trunk/models/johnpye/fprops/valve.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2406 - (show annotations) (download) (as text)
Tue Mar 1 06:13:45 2011 UTC (11 years, 4 months ago) by jpye
File MIME type: text/x-ascend
File size: 2421 byte(s)
regularised expressions noted.
1 (*
2 ASCEND modelling environment
3 Copyright (c) 2011 Carnegie Mellon University
4
5 Models for various valves.
6 Inspired by code by 'valve.mso' by Estefane Horn and NĂºbia do Carmo Ferreira
7 from the EMSO EML/ALSOC project. http://www.enq.ufrgs.br/alsoc.
8
9 Apparent limitations with dimensions in ASCEND mean I have added
10 'valve_coefficient_sq' (the square of a valve coefficient) to
11 models/johnpye/thermo_types.a4c, for use in this model.
12
13 Update: to solve the units-of-measurement problem, see http://is.gd/C73iky
14 *)
15
16 REQUIRE "johnpye/fprops/rankine_fprops.a4c";
17 REQUIRE "johnpye/thermo_types.a4c";
18
19 MODEL valve REFINES stream_equipment;
20 NOTES 'description' SELF
21 {Assumed: steady state, liquid phase, isenthalpic}
22 END NOTES;
23
24 types IS_A set OF symbol_constant;
25 types :== ['linear','parabolic','equal','quick','hyperbolic'];
26
27 type IS_A symbol_constant;
28
29 Vdot "volumetric flow rate" IS_A volume_rate;
30 C_v2 "valve coefficient" IS_A valve_coefficient_sq;
31 x "opening fraction" IS_A fraction;
32 SG "specific gravity" IS_A factor;
33
34 pr "pressure ratio" IS_A factor;
35 dp IS_A delta_pressure;
36 y "valve response" IS_A fraction;
37
38 SELECT(type)
39 CASE 'linear':
40 y = x;
41 CASE 'parabolic':
42 y = x^2;
43 CASE 'equal':
44 y = x^2 / sqrt(2. - x^4);
45 CASE 'quick':
46 y = 10.*x / sqrt(1 + 99.* x^2);
47 (* regularised? see http://is.gd/deKZ5j *)
48 CASE 'hyperbolic':
49 y = 0.1*x/sqrt(1 - 0.99*x^2);
50 (* regularised? http://is.gd/deKZ5j *)
51 OTHERWISE:
52 (* assume linear if we are given nonsense *)
53 y = x;
54 END SELECT;
55
56 inlet.p + dp = outlet.p;
57 inlet.h = outlet.h;
58
59 (* pressure ratio *)
60 outlet.p = inlet.p * pr;
61
62 (* specific gravity *)
63 v_ref IS_A specific_volume;
64 v_ref * 999.02 {kg/m^3} = 1; (* 999.02 is water at NTP...? *)
65 SG * inlet.v = v_ref;
66
67 (* FIXME what if dp <= 0, in other words reversed- or no-flow? *)
68 Vdot = y * sqrt(C_v2) * sqrt(-dp/SG);
69
70 (* volumetric flow rate (should we be using the liquid density instead? *)
71 (* FIXME should we take an average density across the valve? *)
72 Vdot = inlet.mdot * inlet.v;
73 END valve;
74
75 MODEL valve_test REFINES valve;
76 cd.component :== 'water';
77 type :== 'equal';
78 METHODS
79 METHOD on_load;
80 FIX inlet.p, inlet.T;
81 inlet.p := 30 {bar};
82 inlet.T := 400 {K} + 273.15 {K};
83
84 FIX outlet.p;
85 outlet.p := 10 {bar};
86
87 FIX x;
88 x := 0.5;
89
90 FIX C_v2;
91 C_v2 := 0.25 * 0.25 {gal^2/min^2/psi};
92
93 (* first guesses *)
94 inlet.h := 4000 {kJ/kg};
95 END on_load;
96 END valve_test;

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22