source: mso/sample/miscellaneous/sample_arrays2.mso @ 1

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

Initial import of the library

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.0 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) 2002-2005  the author
6*----------------------------------------------------------------------
7* Author: Rafael de Pelegrini Soares
8* $Id: sample_arrays2.mso 1 2006-06-20 17:33:53Z rafael $
9*--------------------------------------------------------------------*#
10
11
12Model Arrays
13        PARAMETERS
14        Dimension  as Integer(Brief="Integer dimension", Default=3);
15        Scalar as Real(Default=1);
16
17        VARIABLES
18        Var1(Dimension,Dimension) as Real(Default=1);
19        Var2(Dimension,Dimension) as Real(Default=1);
20
21        EQUATIONS
22
23        diff(Var1(1,1)) = Var2(1,2);
24       
25        for i in [2 : Dimension-1]
26                diff(Var1(1,i)) = Var2(1,i-1)+Var2(1,i+1);
27        end
28
29        diff(Var1(1,Dimension)) = Var2(1,Dimension);
30        diff(Var1(2:Dimension,:)) = Scalar*Var2(2:Dimension,:);
31
32        exp(Scalar)*Var2 = sin(time);
33end
34
35FlowSheet SampleArrays
36
37        DEVICES
38        dev1 as Arrays;
39
40        INITIAL
41        dev1.Var1 = -1;
42
43        OPTIONS
44        time = [0:0.1:2*3.1415];
45        outputLevel = "high";
46end
Note: See TracBrowser for help on using the repository browser.