source: trunk/sample/miscellaneous/sample_linear.mso @ 538

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

Added a simple linear system

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.5 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 with simple linear system
17*--------------------------------------------------------------------
18* Author: Rafael de Pelegrini Soares
19* $Id: sample_linear.mso 538 2008-06-16 14:10:06Z rafael $
20*--------------------------------------------------------------------*#
21
22using "types";
23
24FlowSheet linear
25        PARAMETERS
26        nx              as Integer(Default=2);
27        ny              as Integer(Default=2);
28        nu              as Integer(Default=2);
29       
30        A(nx,nx) as Real;
31        B(nx,nu) as Real;
32        C(ny,nx) as Real;
33        D(ny,nu) as Real;
34       
35        VARIABLES
36        x(nx)   as Real (Brief="State Variables");
37        y(ny)   as Real (Brief="Output Variables");
38        u(nu)   as Real (Brief="Control Variables");
39       
40        EQUATIONS
41       
42        diff(x)*'s' = sumt(A*x) + sumt(B*u);
43        y           = sumt(C*x) + sumt(D*u);
44       
45        SPECIFY
46        u = sin(time*'rad/s');
47       
48        SET
49       
50        A = 0.5;
51        B = 0.75;
52        C = 0.85;
53        D = 0.95;
54       
55        INITIAL
56        x = 0;
57 
58        OPTIONS
59        TimeStep = 0.5;
60        TimeEnd = 10;
61        TimeUnit = 's';
62        SparseAlgebra = true;
63        Linearize = true;
64end
Note: See TracBrowser for help on using the repository browser.