#*------------------------------------------------------------------- * 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. * *--------------------------------------------------------------------- * * Model of eletrical devices: * * - wire: this model holds a current and voltage. * * - electrical_basic: basic model for electrical devices with one * input and one output wire. * * - electrical: model for an electrical device in which the * inlet current is equal to the outlet one. * * - Resistor: electrical resistor * * - Capacitor:electrical capacitor * * - Indutor: electrical indutor * * - Supply: electrical supply * *---------------------------------------------------------------------- * Author: Rafael de Pelegrini Soares * \$Id: electrical.mso 73 2006-12-08 18:37:50Z paula \$ *--------------------------------------------------------------------*# using "types"; Model wire VARIABLES i as current(Lower=-100); V as voltage; end Model electrical_basic VARIABLES in inlet as wire; out outlet as wire; end Model electrical as electrical_basic EQUATIONS outlet.i = inlet.i; end Model Resistor as electrical PARAMETERS R as resistance; EQUATIONS inlet.V - outlet.V = R * outlet.i; end Model Capacitor as electrical 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 PARAMETERS L as indutance; EQUATIONS inlet.V - outlet.V = L * diff(inlet.i); end Model Supply as electrical_basic PARAMETERS V as voltage; V0 as voltage(Default = 0); EQUATIONS outlet.V = V0; inlet.V - outlet.V = V; end