#*------------------------------------------------------------------- * EMSO Model Library (EML) Copyright (C) 2004 - 2007 ALSOC. * * This LIBRARY is free software; you can distribute it and/or modify * it under the therms of the ALSOC FREE LICENSE as available at * http://www.enq.ufrgs.br/alsoc. * * EMSO Copyright (C) 2004 - 2007 ALSOC, original code * from http://www.rps.eng.br Copyright (C) 2002-2004. * All rights reserved. * * EMSO is distributed under the therms of the ALSOC LICENSE as * available at http://www.enq.ufrgs.br/alsoc. * *-------------------------------------------------------------------- * FlowSheet showing how to 'emulate' an 'if' conditional with * hyperbolic functions. *-------------------------------------------------------------------- * Author: Paula Bettio Staudt and Rafael de Pelegrini Soares * $Id: sample_if_tanh.mso 217 2007-03-16 01:11:56Z arge $ *--------------------------------------------------------------------*# FlowSheet SampleIF VARIABLES A; xif; xelse; PARAMETERS B as Real(Default = 10); EQUATIONS #* if (time>3) * A = 10; * else * A = 5; *# A = 10*xif + 5*xelse; xif = (1 + tanh(B * (time/'s' - 3)))/2; xelse = (1 - tanh(B * (time/'s' - 3)))/2; SET B = 100; OPTIONS TimeStep = 0.01; TimeEnd = 6; end