source: branches/newlanguage/sample/miscellaneous/sample_if.mso @ 125

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

Updated some models for the new language proposal

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.2 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* FlowSheet showing how to use the 'if' conditional.
17*--------------------------------------------------------------------
18* Author: Rafael de Pelegrini Soares
19* $Id: sample_if.mso 125 2007-01-22 19:57:16Z rafael $
20*--------------------------------------------------------------------*#
21
22FlowSheet TestIF
23        VARIABLES
24        y as Real(Lower = -2);
25        x as Real;
26        z as Real;
27
28        EQUATIONS
29        if x < 1 then
30                diff(y) = 1 / "s";
31                z = 3;
32        else
33                diff(y) = - 1 / "s";
34                if y < 1 then
35                        z = x + y;
36                else
37                        z = 10;
38                end             
39        end
40       
41        diff(x) = y / "s";
42
43        INITIAL
44        x = 0;
45        y = 0;
46       
47        OPTIONS
48        TimeStep = 0.1;
49        TimeEnd = 10.0;
50        TimeUnit = "s";
51end
52
Note: See TracBrowser for help on using the repository browser.