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

Last change on this file since 289 was 217, checked in by Argimiro Resende Secchi, 17 years ago

Remove some warnings from samples.

  • 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 217 2007-03-16 01:11:56Z arge $
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/'s' - 3)))/2;
39        xelse = (1 - tanh(B * (time/'s' - 3)))/2;
40       
41        SET
42        B = 100;
43       
44        OPTIONS
45        TimeStep = 0.01;
46        TimeEnd = 6;
47end
Note: See TracBrowser for help on using the repository browser.