source: trunk/Block-Oriented EML/Basic Blocks/MathFcns.mso @ 1002

Last change on this file since 1002 was 944, checked in by Argimiro Resende Secchi, 10 years ago

Adding Block-Oriented library by Jonathan Ospino Pinedo

File size: 1.6 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 is distributed under the terms of the ALSOC LICENSE as
9* available at http://www.enq.ufrgs.br/alsoc.
10*-----------------------------------------------------------------------
11* Author: Jonathan Ospino P.
12* $Id: Math_Fcns.mso  2012$
13*---------------------------------------------------------------------*#
14
15using "types";
16
17Model Math_Fcns
18
19ATTRIBUTES
20Pallete=true;
21Icon="icon/Math_Fcns";
22Info="== Math functions block ==
23
24          It computes the functions abs(x), sign(x), ln(x), log10(x), x^N, or Nth-Root(x),
25          where x is the input signal.
26          The resulting value is assigned to the output variable";
27
28PARAMETERS
29Select_function as Switcher(Valid=["|x|","sign(x)","e^x","ln(x)","log10(x)","x^n","Nth-Root(x)"],Default="|x|");
30n as Real(Brief="Only to be used in the x^n computation",Default=2);
31N as positive(Brief="Only to be used in Nth-Root(x) computation",Default=2);
32
33VARIABLES
34in In as Real(Brief="Input signal",PosX=0,PosY=0.5);
35out Out as Real(Brief="Output signal",Protected=true,PosX=1,PosY=0.5);
36
37EQUATIONS
38
39switch Select_function
40        case "|x|":
41        Out=abs(In);
42        case "sign(x)":
43        Out=sign(In);
44        case "e^x":
45        Out=exp(In);
46        case "ln(x)":
47        Out=ln(In);
48        case "log10(x)":
49        Out=log(In);
50        case "x^n":
51        Out=In^n;
52        case "Nth-Root(x)":
53        Out=In^(1/N);
54end
55
56end
Note: See TracBrowser for help on using the repository browser.