source: mso/eml/electrical/electrical.mso @ 78

Last change on this file since 78 was 73, checked in by Paula Bettio Staudt, 16 years ago

Updated electrical file header

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.0 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 Copyright (C) 2004 - 2007 ALSOC, original code
9* from http://www.rps.eng.br Copyright (C) 2002-2004.
10* All rights reserved.
11*
12* EMSO is distributed under the therms of the ALSOC LICENSE as
13* available at http://www.enq.ufrgs.br/alsoc.
14*
15*---------------------------------------------------------------------
16*
17* Model of eletrical devices:
18*       
19*       - wire: this model holds a current and voltage.
20*
21*       - electrical_basic: basic model for electrical devices with one
22*                               input and one output wire.
23*
24*       - electrical: model for an electrical device in which the
25*                               inlet current is equal to the outlet one.
26*
27*       - Resistor: electrical resistor
28*
29*       - Capacitor:electrical capacitor
30*
31*       - Indutor: electrical indutor
32*
33*       - Supply: electrical supply
34*
35*----------------------------------------------------------------------
36* Author: Rafael de Pelegrini Soares
37* $Id: electrical.mso 73 2006-12-08 18:37:50Z paula $
38*--------------------------------------------------------------------*#
39
40using "types";
41
42Model wire
43        VARIABLES
44        i as current(Lower=-100);
45        V as voltage;
46end
47
48Model electrical_basic
49        VARIABLES
50in      inlet  as wire;
51out     outlet as wire;
52end
53
54Model electrical as electrical_basic
55        EQUATIONS
56        outlet.i = inlet.i;
57end
58
59Model Resistor as electrical
60        PARAMETERS
61        R as resistance;
62        EQUATIONS
63        inlet.V - outlet.V = R * outlet.i;
64end
65
66Model Capacitor as electrical
67        PARAMETERS
68        C as capacitance;
69        VARIABLES
70        q as charge;
71        EQUATIONS
72        diff(q) = inlet.i;
73        inlet.V - outlet.V = (1/C) * q;
74end
75
76Model Indutor as electrical
77        PARAMETERS
78        L as indutance;
79        EQUATIONS
80        inlet.V - outlet.V = L * diff(inlet.i);
81end
82
83Model Supply as electrical_basic
84        PARAMETERS
85        V  as voltage;
86        V0 as voltage(Default = 0);
87        EQUATIONS
88        outlet.V = V0;
89        inlet.V - outlet.V = V;
90end
Note: See TracBrowser for help on using the repository browser.