#*------------------------------------------------------------------- * EMSO Model Library (EML) Copyright (C) 2004 - 2007 ALSOC. * * This LIBRARY is free software; you can distribute it and/or modify * it under the therms of the ALSOC FREE LICENSE as available at * http://www.enq.ufrgs.br/alsoc. * * EMSO Copyright (C) 2004 - 2007 ALSOC, original code * from http://www.rps.eng.br Copyright (C) 2002-2004. * All rights reserved. * * EMSO is distributed under the therms of the ALSOC LICENSE as * available at http://www.enq.ufrgs.br/alsoc. * *---------------------------------------------------------------------- * Author: Rafael de Pelegrini Soares * $Id: electrical.mso 303 2007-07-04 23:00:17Z arge $ *--------------------------------------------------------------------*# using "types"; Model wire ATTRIBUTES Pallete = false; Brief = "Wire."; Info = "This model holds a current and voltage."; VARIABLES i as current(Lower=-100); V as voltage; end Model electrical_basic ATTRIBUTES Pallete = false; Brief = "Basic model for electrical devices with one input and one output wire."; VARIABLES in inlet as wire; out outlet as wire; end Model electrical as electrical_basic ATTRIBUTES Pallete = false; Brief = "Basic electrical device"; Info = "Model for an electrical device in which the inlet current is equal to the outlet one "; EQUATIONS outlet.i = inlet.i; end Model Resistor as electrical ATTRIBUTES Pallete = true; Icon = "icon/Resistor"; Brief = "Electrical Resistor."; PARAMETERS R as resistance; EQUATIONS inlet.V - outlet.V = R * outlet.i; end Model Capacitor as electrical ATTRIBUTES Pallete = true; Icon = "icon/Capacitor"; Brief = "Electrical Capacitor."; PARAMETERS C as capacitance; VARIABLES q as charge; EQUATIONS diff(q) = inlet.i; inlet.V - outlet.V = (1/C) * q; end Model Indutor as electrical ATTRIBUTES Pallete = true; Icon = "icon/Indutor"; Brief = "Electrical Indutor."; PARAMETERS L as indutance; EQUATIONS inlet.V - outlet.V = L * diff(inlet.i); end Model Supply as electrical_basic ATTRIBUTES Pallete = true; Icon = "icon/Supply"; Brief = "Electrical Supply."; PARAMETERS V as voltage; V0 as voltage(Default = 0); EQUATIONS outlet.V = V0; inlet.V - outlet.V = V; end