[73] | 1 | #*------------------------------------------------------------------- |
---|
| 2 | * EMSO Model Library (EML) Copyright (C) 2004 - 2007 ALSOC. |
---|
[1] | 3 | * |
---|
[73] | 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 | * |
---|
[1] | 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 |
---|
[281] | 23 | ATTRIBUTES |
---|
| 24 | Pallete = false; |
---|
| 25 | Brief = "Wire."; |
---|
| 26 | Info = |
---|
| 27 | "This model holds a current and voltage."; |
---|
| 28 | |
---|
[1] | 29 | VARIABLES |
---|
| 30 | i as current(Lower=-100); |
---|
| 31 | V as voltage; |
---|
| 32 | end |
---|
| 33 | |
---|
| 34 | |
---|
[325] | 35 | Model Resistor |
---|
[281] | 36 | ATTRIBUTES |
---|
| 37 | Pallete = true; |
---|
[303] | 38 | Icon = "icon/Resistor"; |
---|
[281] | 39 | Brief = "Electrical Resistor."; |
---|
| 40 | |
---|
[1] | 41 | PARAMETERS |
---|
| 42 | R as resistance; |
---|
[325] | 43 | |
---|
| 44 | VARIABLES |
---|
[352] | 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}"); |
---|
[325] | 47 | |
---|
[1] | 48 | EQUATIONS |
---|
| 49 | inlet.V - outlet.V = R * outlet.i; |
---|
[325] | 50 | outlet.i = inlet.i; |
---|
[1] | 51 | end |
---|
| 52 | |
---|
[325] | 53 | Model Capacitor |
---|
[281] | 54 | ATTRIBUTES |
---|
| 55 | Pallete = true; |
---|
[303] | 56 | Icon = "icon/Capacitor"; |
---|
[281] | 57 | Brief = "Electrical Capacitor."; |
---|
| 58 | |
---|
[1] | 59 | PARAMETERS |
---|
| 60 | C as capacitance; |
---|
[325] | 61 | |
---|
[1] | 62 | VARIABLES |
---|
| 63 | q as charge; |
---|
[352] | 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}"); |
---|
[325] | 66 | |
---|
[1] | 67 | EQUATIONS |
---|
| 68 | diff(q) = inlet.i; |
---|
| 69 | inlet.V - outlet.V = (1/C) * q; |
---|
[325] | 70 | outlet.i = inlet.i; |
---|
[1] | 71 | end |
---|
| 72 | |
---|
[325] | 73 | Model Indutor |
---|
[281] | 74 | ATTRIBUTES |
---|
| 75 | Pallete = true; |
---|
[303] | 76 | Icon = "icon/Indutor"; |
---|
[281] | 77 | Brief = "Electrical Indutor."; |
---|
| 78 | |
---|
[1] | 79 | PARAMETERS |
---|
| 80 | L as indutance; |
---|
[325] | 81 | |
---|
| 82 | VARIABLES |
---|
[352] | 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}"); |
---|
[325] | 85 | |
---|
[1] | 86 | EQUATIONS |
---|
| 87 | inlet.V - outlet.V = L * diff(inlet.i); |
---|
[325] | 88 | outlet.i = inlet.i; |
---|
[1] | 89 | end |
---|
| 90 | |
---|
[325] | 91 | Model Supply |
---|
[281] | 92 | ATTRIBUTES |
---|
| 93 | Pallete = true; |
---|
[303] | 94 | Icon = "icon/Supply"; |
---|
[281] | 95 | Brief = "Electrical Supply."; |
---|
| 96 | |
---|
[1] | 97 | PARAMETERS |
---|
| 98 | V as voltage; |
---|
| 99 | V0 as voltage(Default = 0); |
---|
[325] | 100 | |
---|
| 101 | VARIABLES |
---|
[352] | 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}"); |
---|
[325] | 104 | |
---|
[1] | 105 | EQUATIONS |
---|
| 106 | outlet.V = V0; |
---|
| 107 | inlet.V - outlet.V = V; |
---|
| 108 | end |
---|