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 | * Author: Rafael de Pelegrini Soares |
---|
17 | * $Id: electrical.mso 352 2007-08-30 05:39:11Z arge $ |
---|
18 | *--------------------------------------------------------------------*# |
---|
19 | |
---|
20 | using "types"; |
---|
21 | |
---|
22 | Model wire |
---|
23 | ATTRIBUTES |
---|
24 | Pallete = false; |
---|
25 | Brief = "Wire."; |
---|
26 | Info = |
---|
27 | "This model holds a current and voltage."; |
---|
28 | |
---|
29 | VARIABLES |
---|
30 | i as current(Lower=-100); |
---|
31 | V as voltage; |
---|
32 | end |
---|
33 | |
---|
34 | |
---|
35 | Model Resistor |
---|
36 | ATTRIBUTES |
---|
37 | Pallete = true; |
---|
38 | Icon = "icon/Resistor"; |
---|
39 | Brief = "Electrical Resistor."; |
---|
40 | |
---|
41 | PARAMETERS |
---|
42 | R as resistance; |
---|
43 | |
---|
44 | VARIABLES |
---|
45 | in inlet as wire (Brief = "Inlet", PosX=0.3831, PosY=0, Symbol="_{in}"); |
---|
46 | out outlet as wire (Brief = "Outlet", PosX=0.3529, PosY=1, Symbol="_{out}"); |
---|
47 | |
---|
48 | EQUATIONS |
---|
49 | inlet.V - outlet.V = R * outlet.i; |
---|
50 | outlet.i = inlet.i; |
---|
51 | end |
---|
52 | |
---|
53 | Model Capacitor |
---|
54 | ATTRIBUTES |
---|
55 | Pallete = true; |
---|
56 | Icon = "icon/Capacitor"; |
---|
57 | Brief = "Electrical Capacitor."; |
---|
58 | |
---|
59 | PARAMETERS |
---|
60 | C as capacitance; |
---|
61 | |
---|
62 | VARIABLES |
---|
63 | q as charge; |
---|
64 | in inlet as wire (Brief = "Inlet", PosX=0.3978, PosY=0, Symbol="_{in}"); |
---|
65 | out outlet as wire (Brief = "Outlet", PosX=0.3965, PosY=1, Symbol="_{out}"); |
---|
66 | |
---|
67 | EQUATIONS |
---|
68 | diff(q) = inlet.i; |
---|
69 | inlet.V - outlet.V = (1/C) * q; |
---|
70 | outlet.i = inlet.i; |
---|
71 | end |
---|
72 | |
---|
73 | Model Indutor |
---|
74 | ATTRIBUTES |
---|
75 | Pallete = true; |
---|
76 | Icon = "icon/Indutor"; |
---|
77 | Brief = "Electrical Indutor."; |
---|
78 | |
---|
79 | PARAMETERS |
---|
80 | L as indutance; |
---|
81 | |
---|
82 | VARIABLES |
---|
83 | in inlet as wire (Brief = "Inlet", PosX=0.4638, PosY=0, Symbol="_{in}"); |
---|
84 | out outlet as wire (Brief = "Outlet", PosX=0.4638, PosY=1, Symbol="_{out}"); |
---|
85 | |
---|
86 | EQUATIONS |
---|
87 | inlet.V - outlet.V = L * diff(inlet.i); |
---|
88 | outlet.i = inlet.i; |
---|
89 | end |
---|
90 | |
---|
91 | Model Supply |
---|
92 | ATTRIBUTES |
---|
93 | Pallete = true; |
---|
94 | Icon = "icon/Supply"; |
---|
95 | Brief = "Electrical Supply."; |
---|
96 | |
---|
97 | PARAMETERS |
---|
98 | V as voltage; |
---|
99 | V0 as voltage(Default = 0); |
---|
100 | |
---|
101 | VARIABLES |
---|
102 | in inlet as wire (Brief = "Inlet", PosX=0.3923, PosY=0, Symbol="_{in}"); |
---|
103 | out outlet as wire (Brief = "Outlet", PosX=0.3984, PosY=1, Symbol="_{out}"); |
---|
104 | |
---|
105 | EQUATIONS |
---|
106 | outlet.V = V0; |
---|
107 | inlet.V - outlet.V = V; |
---|
108 | end |
---|