source: trunk/Block-Oriented EML/Basic Blocks/SineWave.mso @ 975

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

Adding Block-Oriented library by Jonathan Ospino Pinedo

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 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: SineWave.mso  2012$
13*---------------------------------------------------------------------*#
14
15using "types";
16 
17Model SinusoidalWave
18       
19        ATTRIBUTES
20
21        Pallete=true;
22        Icon="icon/SineWave2";
23        Info="== Sine wave signal source ==.";
24       
25        PARAMETERS
26       
27        Wave_type as Switcher(Valid=["Sine","Cosine"],Default="Sine");
28        A as Real(Brief="Amplitude",Default=1);
29        w as Real(Brief="angular frequency",Default=1);
30        THETA as Real(Brief="Shift angle",Default=0);
31       
32
33        VARIABLES
34
35        out Out as Real(Brief="Output of the constant block",Protected=true,PosX=1,PosY=0.5);
36
37       
38        EQUATIONS
39
40        switch Wave_type
41                case "Sine":
42                Out=A*sin((w*time/'s'+THETA)*'rad');
43                case "Cosine":
44                Out=A*cos((w*time/'s'+THETA)*'rad');
45                end
46               
47end
Note: See TracBrowser for help on using the repository browser.