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 | |
---|

15 | using "types"; |
---|

16 | |
---|

17 | Model Trig_Fcns |
---|

18 | |
---|

19 | ATTRIBUTES |
---|

20 | Pallete=true; |
---|

21 | Icon="icon/Trig_Fcns"; |
---|

22 | Info="== 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 | |
---|

29 | PARAMETERS |
---|

30 | Select_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 | |
---|

33 | VARIABLES |
---|

34 | in In as Real(Brief="Input signal",PosX=0,PosY=0.5); |
---|

35 | out Out as Real(Brief="Output signal",Protected=true,PosX=1,PosY=0.5); |
---|

36 | |
---|

37 | EQUATIONS |
---|

38 | |
---|

39 | switch 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 | |
---|

77 | end |
---|

78 | |
---|

79 | end |
---|