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 303 2007-07-04 23:00:17Z 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 | Model electrical_basic |
---|
35 | ATTRIBUTES |
---|
36 | Pallete = false; |
---|
37 | Brief = "Basic model for electrical devices with one input and one output wire."; |
---|
38 | |
---|
39 | VARIABLES |
---|
40 | in inlet as wire; |
---|
41 | out outlet as wire; |
---|
42 | end |
---|
43 | |
---|
44 | Model electrical as electrical_basic |
---|
45 | ATTRIBUTES |
---|
46 | Pallete = false; |
---|
47 | Brief = "Basic electrical device"; |
---|
48 | Info = |
---|
49 | "Model for an electrical device in which the inlet current |
---|
50 | is equal to the outlet one |
---|
51 | "; |
---|
52 | |
---|
53 | EQUATIONS |
---|
54 | outlet.i = inlet.i; |
---|
55 | end |
---|
56 | |
---|
57 | Model Resistor as electrical |
---|
58 | ATTRIBUTES |
---|
59 | Pallete = true; |
---|
60 | Icon = "icon/Resistor"; |
---|
61 | Brief = "Electrical Resistor."; |
---|
62 | |
---|
63 | PARAMETERS |
---|
64 | R as resistance; |
---|
65 | EQUATIONS |
---|
66 | inlet.V - outlet.V = R * outlet.i; |
---|
67 | end |
---|
68 | |
---|
69 | Model Capacitor as electrical |
---|
70 | ATTRIBUTES |
---|
71 | Pallete = true; |
---|
72 | Icon = "icon/Capacitor"; |
---|
73 | Brief = "Electrical Capacitor."; |
---|
74 | |
---|
75 | PARAMETERS |
---|
76 | C as capacitance; |
---|
77 | VARIABLES |
---|
78 | q as charge; |
---|
79 | EQUATIONS |
---|
80 | diff(q) = inlet.i; |
---|
81 | inlet.V - outlet.V = (1/C) * q; |
---|
82 | end |
---|
83 | |
---|
84 | Model Indutor as electrical |
---|
85 | ATTRIBUTES |
---|
86 | Pallete = true; |
---|
87 | Icon = "icon/Indutor"; |
---|
88 | Brief = "Electrical Indutor."; |
---|
89 | |
---|
90 | PARAMETERS |
---|
91 | L as indutance; |
---|
92 | EQUATIONS |
---|
93 | inlet.V - outlet.V = L * diff(inlet.i); |
---|
94 | end |
---|
95 | |
---|
96 | Model Supply as electrical_basic |
---|
97 | ATTRIBUTES |
---|
98 | Pallete = true; |
---|
99 | Icon = "icon/Supply"; |
---|
100 | Brief = "Electrical Supply."; |
---|
101 | |
---|
102 | PARAMETERS |
---|
103 | V as voltage; |
---|
104 | V0 as voltage(Default = 0); |
---|
105 | EQUATIONS |
---|
106 | outlet.V = V0; |
---|
107 | inlet.V - outlet.V = V; |
---|
108 | end |
---|