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

Last change on this file since 1 was 1, checked in by Rafael de Pelegrini Soares, 16 years ago

Initial import of the library

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.5 KB
Line 
1#*---------------------------------------------------------------------
2* This file is property of the author and cannot be used, copyed
3* or modified without permission.
4*
5* Copyright (C) 2004  the author
6*----------------------------------------------------------------------
7* Author: Rafael de Pelegrini Soares
8* $Id: electrical.mso 1 2006-06-20 17:33:53Z rafael $
9*--------------------------------------------------------------------*#
10
11using "types";
12
13Model wire
14        #* Model for a electrical wire.
15        * This model holds a current and voltage.
16        *#
17        VARIABLES
18        i as current(Lower=-100);
19        V as voltage;
20end
21
22Model electrical_basic
23        #* Basic model for electrical devices with one
24        * input and one output wire.
25        *#
26        VARIABLES
27in      inlet  as wire;
28out     outlet as wire;
29end
30
31Model electrical as electrical_basic
32        #* Model for an electrical device in which the
33        * inlet current is equal to the outlet one.
34        *#
35        EQUATIONS
36        outlet.i = inlet.i;
37end
38
39Model Resistor as electrical
40        #* Electrical resistor *#
41        PARAMETERS
42        R as resistance;
43        EQUATIONS
44        inlet.V - outlet.V = R * outlet.i;
45end
46
47Model Capacitor as electrical
48        #* Electrical capacitor *#
49        PARAMETERS
50        C as capacitance;
51        VARIABLES
52        q as charge;
53        EQUATIONS
54        diff(q) = inlet.i;
55        inlet.V - outlet.V = (1/C) * q;
56end
57
58Model Indutor as electrical
59        #* Electrical indutor *#
60        PARAMETERS
61        L as indutance;
62        EQUATIONS
63        inlet.V - outlet.V = L * diff(inlet.i);
64end
65
66Model Supply as electrical_basic
67        #* Electrical supply *#
68        PARAMETERS
69        V  as voltage;
70        V0 as voltage(Default = 0);
71        EQUATIONS
72        outlet.V = V0;
73        inlet.V - outlet.V = V;
74end
Note: See TracBrowser for help on using the repository browser.