source: trunk/sample/miscellaneous/sample_if_tanh.mso @ 117

Last change on this file since 117 was 83, checked in by Paula Bettio Staudt, 17 years ago

Updated miscelaneous sample files header

  • 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 'emulate' an 'if' conditional with
17* hyperbolic functions.
18*--------------------------------------------------------------------
19* Author: Paula Bettio Staudt and Rafael de Pelegrini Soares
20* $Id: sample_if_tanh.mso 83 2006-12-08 20:29:34Z paula $
21*--------------------------------------------------------------------*#
22
23FlowSheet SampleIF
24        VARIABLES
25        A; xif; xelse;
26       
27        PARAMETERS
28        B as Real(Default = 10);
29       
30        EQUATIONS
31        #* if (time>3)
32        *     A = 10;
33        *  else
34        *     A = 5;
35        *#
36        A = 10*xif + 5*xelse;
37
38        xif = (1 + tanh(B * (time - 3)))/2;
39        xelse = (1 - tanh(B * (time - 3)))/2;
40       
41        SET
42        B = 100;
43       
44        OPTIONS
45        time = [0:0.01:6];
46end
Note: See TracBrowser for help on using the repository browser.