source: mso/tutorial/tanks.mso @ 15

Last change on this file since 15 was 15, checked in by Rafael de Pelegrini Soares, 16 years ago

Fixed problem with the tanks tutorial

File size: 1.4 KB
Line 
1#*---------------------------------------------------------------------
2* This file is property of the author and cannot be used, copyed
3* or modified without permission.
4*
5* Copyright (C) 2004  the author
6*----------------------------------------------------------------------
7* File name: eml_template.mso
8* Author: Rafael de Pelegrini Soares
9* $Id: tanks.mso 1 2004-12-16 13:10:43Z rafael $
10*--------------------------------------------------------------------*#
11
12using "types";
13
14Model tank_simplified
15        PARAMETERS
16        k as Real (Brief="Valve Constant", Unit = "m^2.5/h", Default=4);
17        A as area (Brief="Tank area", Default=2);
18
19        VARIABLES
20        h    as length(Brief="Tank level");
21in      Fin  as flow_vol(Brief="Input flow");
22out     Fout as flow_vol(Brief="Output flow");
23
24        EQUATIONS
25        "Mass balance"
26        diff(A*h) = Fin - Fout;
27       
28        "Valve equation"
29        Fout = k*sqrt(h);               
30end
31
32
33Model tank_cylindrical
34        PARAMETERS
35        k as Real (Brief="Valve Constant", Unit = "m^2.5/h", Default=4);
36        r as length(Brief="Tank radius");
37        L as length(Brief="Tank length");
38       
39        VARIABLES
40        A as area (Brief="Tank area", Default=2);
41        h    as length(Brief="Tank level");
42in      Fin  as flow_vol(Brief="Input flow");
43out     Fout as flow_vol(Brief="Output flow");
44
45        EQUATIONS
46        "Mass balance"
47        diff(A*h) = Fin - Fout;
48       
49        "Cylindrical Area"
50        A = r^2 * (asin(1) - asin((r-h)/r) ) +
51                (h-r)*sqrt(h*(2*r - h));
52       
53        "Valve equation"
54        Fout = k*sqrt(h);
55end
Note: See TracBrowser for help on using the repository browser.