source: trunk/Block-Oriented EML/Basic Blocks/TrigFcns.mso @ 1009

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

Adding Block-Oriented library by Jonathan Ospino Pinedo

File size: 1.9 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
12* $Id: TrigFcns.mso  2012$
13*---------------------------------------------------------------------*#
14
15using "types";
16
17Model Trig_Fcns
18
19ATTRIBUTES
20Pallete=true;
21Icon="icon/Trig_Fcns";
22Info="== Trigonometric functions block ==
23
24          It computes the trigonometric functions sin(x), cos(x), tan(x), cot(x),
25          sec(x), csc(x), asin(x), acos(x), atan(x), acot(x), asec(x), acsc(x), sinh(x),
26          cosh(x), tanh(x), coth(x), sech(x), and csch (x) of the
27          input signal, x. The resulting value is assigned to the output variable";
28
29PARAMETERS
30Select_a_function as Switcher(Valid=["sin(x)","cos(x)","tan(x)","cot(x)","sec(x)","csc(x)","asin(x)","acos(x)","atan(x)","acot(x)","asec(x)","acsc(x)"],Default="sin(x)");
31
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_a_function
40       
41        case "sin(x)":
42        Out=sin(In*'rad');
43       
44        case "cos(x)":
45        Out=cos(In*'rad');
46       
47        case "tan(x)":
48        Out=sin(In*'rad')/cos(In*'rad');
49       
50        case "cot(x)":
51        Out=cos(In*'rad')/sin(In*'rad');
52       
53        case "sec(x)":
54        Out=1/cos(In*'rad');
55       
56        case "csc(x)":
57        Out=1/sin(In*'rad');
58       
59        case "asin(x)":
60        Out=asin(In);
61       
62        case "acos(x)":
63        Out=acos(In);
64       
65        case "atan(x)":
66        Out=atan(In);
67       
68        case "acot(x)":
69        Out=1/atan(In);
70       
71        case "asec(x)":
72        Out=1/acos(In);
73       
74        case "acsc(x)":
75        Out=1/asin(In);
76
77end
78
79end
Note: See TracBrowser for help on using the repository browser.