#*--------------------------------------------------------------------- * This file is property of the author and cannot be used, copyed * or modified without permission. * * Copyright (C) 2004 the author *---------------------------------------------------------------------- * Author: Rafael de Pelegrini Soares * $Id: electrical.mso 1 2006-06-20 17:33:53Z rafael $ *--------------------------------------------------------------------*# using "types"; Model wire #* Model for a electrical wire. * This model holds a current and voltage. *# VARIABLES i as current(Lower=-100); V as voltage; end Model electrical_basic #* 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 #* 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 #* Electrical resistor *# PARAMETERS R as resistance; EQUATIONS inlet.V - outlet.V = R * outlet.i; end Model Capacitor as electrical #* 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 #* Electrical indutor *# PARAMETERS L as indutance; EQUATIONS inlet.V - outlet.V = L * diff(inlet.i); end Model Supply as electrical_basic #* Electrical supply *# PARAMETERS V as voltage; V0 as voltage(Default = 0); EQUATIONS outlet.V = V0; inlet.V - outlet.V = V; end