source: branches/gui/sample/miscellaneous/sample_arrays2.mso

Last change on this file was 924, checked in by Rafael de Pelegrini Soares, 12 years ago

Added max/min to arrays sample

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.3 KB
RevLine 
[83]1#*-------------------------------------------------------------------
2* EMSO Model Library (EML) Copyright (C) 2004 - 2007 ALSOC.
[1]3*
[83]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*
[1]15*----------------------------------------------------------------------
16* Author: Rafael de Pelegrini Soares
17* $Id: sample_arrays2.mso 924 2010-03-03 23:38:45Z rafael $
18*--------------------------------------------------------------------*#
19
20
21Model Arrays
22        PARAMETERS
23        Dimension  as Integer(Brief="Integer dimension", Default=3);
24        Scalar as Real(Default=1);
25
26        VARIABLES
27        Var1(Dimension,Dimension) as Real(Default=1);
28        Var2(Dimension,Dimension) as Real(Default=1);
[924]29        Var2Max(Dimension) as Real;
30        Var2Min(Dimension) as Real;
[1]31
32        EQUATIONS
33
[703]34        diff(Var1)*'s' = Var2;
35
36        for i in [1 : Dimension] do
37                for j in [1 : Dimension] do
38                        exp(Scalar)*Var2(i, j) = j*sin(i*time*'rad/s');
39                end
[1]40        end
[924]41        Var2Max = max(Var2);
42        Var2Min = min(Var2);
[1]43end
44
45FlowSheet SampleArrays
46
47        DEVICES
48        dev1 as Arrays;
49
50        INITIAL
51        dev1.Var1 = -1;
52
53        OPTIONS
[176]54        TimeStep = 0.1;
55        TimeEnd = 2*3.1415;
[1]56end
Note: See TracBrowser for help on using the repository browser.