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

Last change on this file since 138 was 138, checked in by Argimiro Resende Secchi, 15 years ago

Adjust the measurement units of some examples.

  • 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 138 2007-01-26 17:21:01Z 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        time = [0:0.01:6];
46end
Note: See TracBrowser for help on using the repository browser.