Beispiel #1
0
        /// <summary>Allows devices to register any additional variables.</summary>
        /// <param name="adapter">The equation system builder.</param>
        public override void RegisterAdditionalVariables(IEquationSystemAdapter adapter)
        {
            base.RegisterAdditionalVariables(adapter);

            bprimeNode = Parameters.BaseResistance > 0 ? adapter.AddVariable() : Base;
            cprimeNode = Parameters.CollectorResistance > 0 ? adapter.AddVariable() : Collector;
            eprimeNode = Parameters.EmitterCapacitance > 0 ? adapter.AddVariable() : Emitter;
        }
        /// <summary>Performs necessary initialization of the device, like mapping to the equation system.</summary>
        /// <param name="adapter">The equation system builder.</param>
        /// <param name="context">Context of current simulation.</param>
        public override void Initialize(IEquationSystemAdapter adapter, ISimulationContext context)
        {
            for (var i = 1; i < nodeMap.Length; i++)
            {
                nodeMap[i] = -1;
            }

            for (var i = 0; i < DefinitionDevice.TerminalNodes.Length; i++)
            {
                nodeMap[DefinitionDevice.TerminalNodes[i]] = DefinitionDevice.ConnectedNodes[i];
            }

            for (var i = 1; i < nodeMap.Length; i++)
            {
                nodeMap[i] = nodeMap[i] < 0 ? adapter.AddVariable() : nodeMap[i];
            }

            var decorator = new RedirectingEquationEditor(nodeMap, adapter);

            foreach (var model in devices)
            {
                model.Initialize(decorator, context);
            }
        }
Beispiel #3
0
 /// <summary>
 ///   Registers the branch variable for the voltage source device
 /// </summary>
 /// <param name="adapter"></param>
 public void RegisterVariable(IEquationSystemAdapter adapter)
 {
     BranchVariable = adapter.AddVariable();
 }
 /// <summary>Adds a new variable to the equation system and returns the index of the variable;</summary>
 /// <returns></returns>
 public int AddVariable()
 {
     return(decoreated.AddVariable());
 }