예제 #1
0
        /// <summary>
        /// Allocate elements in the Y-matrix and Rhs-vector to populate during loading. Additional
        /// equations can also be allocated here.
        /// </summary>
        /// <param name="variables">The variable set.</param>
        /// <param name="solver">The solver.</param>
        public void GetEquationPointers(VariableSet variables, Solver <double> solver)
        {
            variables.ThrowIfNull(nameof(variables));
            solver.ThrowIfNull(nameof(solver));

            SourcePrimeNode = ModelParameters.SourceResistance > 0 ? variables.Create(Name.Combine("source")).Index : SourceNode;
            DrainPrimeNode  = ModelParameters.DrainResistance > 0 ? variables.Create(Name.Combine("drain")).Index : DrainNode;

            GateNodePtr               = solver.GetRhsElement(GateNode);
            DrainPrimeNodePtr         = solver.GetRhsElement(DrainPrimeNode);
            SourcePrimeNodePtr        = solver.GetRhsElement(SourcePrimeNode);
            DrainDrainPrimePtr        = solver.GetMatrixElement(DrainNode, DrainPrimeNode);
            GateDrainPrimePtr         = solver.GetMatrixElement(GateNode, DrainPrimeNode);
            GateSourcePrimePtr        = solver.GetMatrixElement(GateNode, SourcePrimeNode);
            SourceSourcePrimePtr      = solver.GetMatrixElement(SourceNode, SourcePrimeNode);
            DrainPrimeDrainPtr        = solver.GetMatrixElement(DrainPrimeNode, DrainNode);
            DrainPrimeGatePtr         = solver.GetMatrixElement(DrainPrimeNode, GateNode);
            DrainPrimeSourcePrimePtr  = solver.GetMatrixElement(DrainPrimeNode, SourcePrimeNode);
            SourcePrimeGatePtr        = solver.GetMatrixElement(SourcePrimeNode, GateNode);
            SourcePrimeSourcePtr      = solver.GetMatrixElement(SourcePrimeNode, SourceNode);
            SourcePrimeDrainPrimePtr  = solver.GetMatrixElement(SourcePrimeNode, DrainPrimeNode);
            DrainDrainPtr             = solver.GetMatrixElement(DrainNode, DrainNode);
            GateGatePtr               = solver.GetMatrixElement(GateNode, GateNode);
            SourceSourcePtr           = solver.GetMatrixElement(SourceNode, SourceNode);
            DrainPrimeDrainPrimePtr   = solver.GetMatrixElement(DrainPrimeNode, DrainPrimeNode);
            SourcePrimeSourcePrimePtr = solver.GetMatrixElement(SourcePrimeNode, SourcePrimeNode);
        }
예제 #2
0
        /// <summary>
        /// Gets matrix pointers
        /// </summary>
        /// <param name="variables">Nodes</param>
        /// <param name="solver">Solver</param>
        public override void GetEquationPointers(VariableSet variables, Solver <double> solver)
        {
            if (variables == null)
            {
                throw new ArgumentNullException(nameof(variables));
            }
            if (solver == null)
            {
                throw new ArgumentNullException(nameof(solver));
            }

            // Add series drain node if necessary
            if (_mbp.DrainResistance > 0 || _mbp.SheetResistance > 0 && _bp.DrainSquares > 0)
            {
                DrainNodePrime = variables.Create(Name.Combine("drain")).Index;
            }
            else
            {
                DrainNodePrime = _drainNode;
            }

            // Add series source node if necessary
            if (_mbp.SourceResistance > 0 || _mbp.SheetResistance > 0 && _bp.SourceSquares > 0)
            {
                SourceNodePrime = variables.Create(Name.Combine("source")).Index;
            }
            else
            {
                SourceNodePrime = _sourceNode;
            }

            // Get matrix pointers
            DrainDrainPtr             = solver.GetMatrixElement(_drainNode, _drainNode);
            GateGatePtr               = solver.GetMatrixElement(_gateNode, _gateNode);
            SourceSourcePtr           = solver.GetMatrixElement(_sourceNode, _sourceNode);
            BulkBulkPtr               = solver.GetMatrixElement(_bulkNode, _bulkNode);
            DrainPrimeDrainPrimePtr   = solver.GetMatrixElement(DrainNodePrime, DrainNodePrime);
            SourcePrimeSourcePrimePtr = solver.GetMatrixElement(SourceNodePrime, SourceNodePrime);
            DrainDrainPrimePtr        = solver.GetMatrixElement(_drainNode, DrainNodePrime);
            GateBulkPtr               = solver.GetMatrixElement(_gateNode, _bulkNode);
            GateDrainPrimePtr         = solver.GetMatrixElement(_gateNode, DrainNodePrime);
            GateSourcePrimePtr        = solver.GetMatrixElement(_gateNode, SourceNodePrime);
            SourceSourcePrimePtr      = solver.GetMatrixElement(_sourceNode, SourceNodePrime);
            BulkDrainPrimePtr         = solver.GetMatrixElement(_bulkNode, DrainNodePrime);
            BulkSourcePrimePtr        = solver.GetMatrixElement(_bulkNode, SourceNodePrime);
            DrainPrimeSourcePrimePtr  = solver.GetMatrixElement(DrainNodePrime, SourceNodePrime);
            DrainPrimeDrainPtr        = solver.GetMatrixElement(DrainNodePrime, _drainNode);
            BulkGatePtr               = solver.GetMatrixElement(_bulkNode, _gateNode);
            DrainPrimeGatePtr         = solver.GetMatrixElement(DrainNodePrime, _gateNode);
            SourcePrimeGatePtr        = solver.GetMatrixElement(SourceNodePrime, _gateNode);
            SourcePrimeSourcePtr      = solver.GetMatrixElement(SourceNodePrime, _sourceNode);
            DrainPrimeBulkPtr         = solver.GetMatrixElement(DrainNodePrime, _bulkNode);
            SourcePrimeBulkPtr        = solver.GetMatrixElement(SourceNodePrime, _bulkNode);
            SourcePrimeDrainPrimePtr  = solver.GetMatrixElement(SourceNodePrime, DrainNodePrime);

            // Get rhs pointers
            BulkPtr        = solver.GetRhsElement(_bulkNode);
            DrainPrimePtr  = solver.GetRhsElement(DrainNodePrime);
            SourcePrimePtr = solver.GetRhsElement(SourceNodePrime);
        }
예제 #3
0
        /// <summary>
        /// Allocate elements in the Y-matrix and Rhs-vector to populate during loading. Additional
        /// equations can also be allocated here.
        /// </summary>
        /// <param name="variables">The variable set.</param>
        /// <param name="solver">The solver.</param>
        public void GetEquationPointers(VariableSet variables, Solver <double> solver)
        {
            // Allocate branch equations first
            Internal1 = variables.Create(Name.Combine("int1")).Index;
            Internal2 = variables.Create(Name.Combine("int2")).Index;
            BranchEq1 = variables.Create(Name.Combine("branch1"), VariableType.Current).Index;
            BranchEq2 = variables.Create(Name.Combine("branch2"), VariableType.Current).Index;

            Pos1Pos1Ptr = solver.GetMatrixElement(Pos1, Pos1);
            Pos1Int1Ptr = solver.GetMatrixElement(Pos1, Internal1);
            Int1Pos1Ptr = solver.GetMatrixElement(Internal1, Pos1);
            Int1Int1Ptr = solver.GetMatrixElement(Internal1, Internal1);
            Int1Ibr1Ptr = solver.GetMatrixElement(Internal1, BranchEq1);
            Ibr1Int1Ptr = solver.GetMatrixElement(BranchEq1, Internal1);
            Neg1Ibr1Ptr = solver.GetMatrixElement(Neg1, BranchEq1);
            Ibr1Neg1Ptr = solver.GetMatrixElement(BranchEq1, Neg1);

            Pos2Pos2Ptr = solver.GetMatrixElement(Pos2, Pos2);
            Pos2Int2Ptr = solver.GetMatrixElement(Pos2, Internal2);
            Int2Pos2Ptr = solver.GetMatrixElement(Internal2, Pos2);
            Int2Int2Ptr = solver.GetMatrixElement(Internal2, Internal2);
            Int2Ibr2Ptr = solver.GetMatrixElement(Internal2, BranchEq2);
            Ibr2Int2Ptr = solver.GetMatrixElement(BranchEq2, Internal2);
            Neg2Ibr2Ptr = solver.GetMatrixElement(Neg2, BranchEq2);
            Ibr2Neg2Ptr = solver.GetMatrixElement(BranchEq2, Neg2);

            // These pointers are only used to calculate the DC operating point
            Ibr1Pos1Ptr = solver.GetMatrixElement(BranchEq1, Pos1);
            Ibr1Pos2Ptr = solver.GetMatrixElement(BranchEq1, Pos2);
            Ibr1Neg2Ptr = solver.GetMatrixElement(BranchEq1, Neg2);
            Ibr2Ibr1Ptr = solver.GetMatrixElement(BranchEq2, BranchEq1);
            Ibr2Ibr2Ptr = solver.GetMatrixElement(BranchEq2, BranchEq2);
        }
예제 #4
0
        /// <summary>
        /// Gets matrix pointers
        /// </summary>
        /// <param name="variables">Nodes</param>
        /// <param name="solver">Solver</param>
        public void GetEquationPointers(VariableSet variables, Solver <double> solver)
        {
            variables.ThrowIfNull(nameof(variables));
            solver.ThrowIfNull(nameof(solver));

            // Add series drain node if necessary
            if (ModelParameters.DrainResistance > 0 || ModelParameters.SheetResistance > 0 && BaseParameters.DrainSquares > 0)
            {
                DrainNodePrime = variables.Create(Name.Combine("drain")).Index;
            }
            else
            {
                DrainNodePrime = DrainNode;
            }

            // Add series source node if necessary
            if (ModelParameters.SourceResistance > 0 || ModelParameters.SheetResistance > 0 && BaseParameters.SourceSquares > 0)
            {
                SourceNodePrime = variables.Create(Name.Combine("source")).Index;
            }
            else
            {
                SourceNodePrime = SourceNode;
            }

            // Get matrix pointers
            DrainDrainPtr             = solver.GetMatrixElement(DrainNode, DrainNode);
            GateGatePtr               = solver.GetMatrixElement(GateNode, GateNode);
            SourceSourcePtr           = solver.GetMatrixElement(SourceNode, SourceNode);
            BulkBulkPtr               = solver.GetMatrixElement(BulkNode, BulkNode);
            DrainPrimeDrainPrimePtr   = solver.GetMatrixElement(DrainNodePrime, DrainNodePrime);
            SourcePrimeSourcePrimePtr = solver.GetMatrixElement(SourceNodePrime, SourceNodePrime);
            DrainDrainPrimePtr        = solver.GetMatrixElement(DrainNode, DrainNodePrime);
            GateBulkPtr               = solver.GetMatrixElement(GateNode, BulkNode);
            GateDrainPrimePtr         = solver.GetMatrixElement(GateNode, DrainNodePrime);
            GateSourcePrimePtr        = solver.GetMatrixElement(GateNode, SourceNodePrime);
            SourceSourcePrimePtr      = solver.GetMatrixElement(SourceNode, SourceNodePrime);
            BulkDrainPrimePtr         = solver.GetMatrixElement(BulkNode, DrainNodePrime);
            BulkSourcePrimePtr        = solver.GetMatrixElement(BulkNode, SourceNodePrime);
            DrainPrimeSourcePrimePtr  = solver.GetMatrixElement(DrainNodePrime, SourceNodePrime);
            DrainPrimeDrainPtr        = solver.GetMatrixElement(DrainNodePrime, DrainNode);
            BulkGatePtr               = solver.GetMatrixElement(BulkNode, GateNode);
            DrainPrimeGatePtr         = solver.GetMatrixElement(DrainNodePrime, GateNode);
            SourcePrimeGatePtr        = solver.GetMatrixElement(SourceNodePrime, GateNode);
            SourcePrimeSourcePtr      = solver.GetMatrixElement(SourceNodePrime, SourceNode);
            DrainPrimeBulkPtr         = solver.GetMatrixElement(DrainNodePrime, BulkNode);
            SourcePrimeBulkPtr        = solver.GetMatrixElement(SourceNodePrime, BulkNode);
            SourcePrimeDrainPrimePtr  = solver.GetMatrixElement(SourceNodePrime, DrainNodePrime);

            // Get rhs pointers
            BulkPtr        = solver.GetRhsElement(BulkNode);
            DrainPrimePtr  = solver.GetRhsElement(DrainNodePrime);
            SourcePrimePtr = solver.GetRhsElement(SourceNodePrime);
        }
예제 #5
0
        /// <summary>
        /// Gets matrix pointers
        /// </summary>
        /// <param name="variables">Variables</param>
        /// <param name="solver">Solver</param>
        public override void GetEquationPointers(VariableSet variables, Solver <double> solver)
        {
            if (variables == null)
            {
                throw new ArgumentNullException(nameof(variables));
            }
            if (solver == null)
            {
                throw new ArgumentNullException(nameof(solver));
            }

            // Add a series collector node if necessary
            CollectorPrimeNode = _mbp.CollectorResistance.Value > 0 ? variables.Create(new SubIdentifier(Name, "col")).Index : _collectorNode;

            // Add a series base node if necessary
            BasePrimeNode = _mbp.BaseResist.Value > 0 ? variables.Create(new SubIdentifier(Name, "base")).Index : _baseNode;

            // Add a series emitter node if necessary
            EmitterPrimeNode = _mbp.EmitterResistance.Value > 0 ? variables.Create(new SubIdentifier(Name, "emit")).Index : _emitterNode;

            // Get solver pointers
            CollectorCollectorPrimePtr    = solver.GetMatrixElement(_collectorNode, CollectorPrimeNode);
            BaseBasePrimePtr              = solver.GetMatrixElement(_baseNode, BasePrimeNode);
            EmitterEmitterPrimePtr        = solver.GetMatrixElement(_emitterNode, EmitterPrimeNode);
            CollectorPrimeCollectorPtr    = solver.GetMatrixElement(CollectorPrimeNode, _collectorNode);
            CollectorPrimeBasePrimePtr    = solver.GetMatrixElement(CollectorPrimeNode, BasePrimeNode);
            CollectorPrimeEmitterPrimePtr = solver.GetMatrixElement(CollectorPrimeNode, EmitterPrimeNode);
            BasePrimeBasePtr              = solver.GetMatrixElement(BasePrimeNode, _baseNode);
            BasePrimeCollectorPrimePtr    = solver.GetMatrixElement(BasePrimeNode, CollectorPrimeNode);
            BasePrimeEmitterPrimePtr      = solver.GetMatrixElement(BasePrimeNode, EmitterPrimeNode);
            EmitterPrimeEmitterPtr        = solver.GetMatrixElement(EmitterPrimeNode, _emitterNode);
            EmitterPrimeCollectorPrimePtr = solver.GetMatrixElement(EmitterPrimeNode, CollectorPrimeNode);
            EmitterPrimeBasePrimePtr      = solver.GetMatrixElement(EmitterPrimeNode, BasePrimeNode);
            CollectorCollectorPtr         = solver.GetMatrixElement(_collectorNode, _collectorNode);
            BaseBasePtr       = solver.GetMatrixElement(_baseNode, _baseNode);
            EmitterEmitterPtr = solver.GetMatrixElement(_emitterNode, _emitterNode);
            CollectorPrimeCollectorPrimePtr = solver.GetMatrixElement(CollectorPrimeNode, CollectorPrimeNode);
            BasePrimeBasePrimePtr           = solver.GetMatrixElement(BasePrimeNode, BasePrimeNode);
            EmitterPrimeEmitterPrimePtr     = solver.GetMatrixElement(EmitterPrimeNode, EmitterPrimeNode);
            SubstrateSubstratePtr           = solver.GetMatrixElement(_substrateNode, _substrateNode);
            CollectorPrimeSubstratePtr      = solver.GetMatrixElement(CollectorPrimeNode, _substrateNode);
            SubstrateCollectorPrimePtr      = solver.GetMatrixElement(_substrateNode, CollectorPrimeNode);
            BaseCollectorPrimePtr           = solver.GetMatrixElement(_baseNode, CollectorPrimeNode);
            CollectorPrimeBasePtr           = solver.GetMatrixElement(CollectorPrimeNode, _baseNode);

            // Get RHS pointers
            CollectorPrimePtr = solver.GetRhsElement(CollectorPrimeNode);
            BasePrimePtr      = solver.GetRhsElement(BasePrimeNode);
            EmitterPrimePtr   = solver.GetRhsElement(EmitterPrimeNode);
        }
예제 #6
0
        /// <summary>
        /// Gets matrix pointers
        /// </summary>
        /// <param name="variables">Variables</param>
        /// <param name="solver">Solver</param>
        public void GetEquationPointers(VariableSet variables, Solver <double> solver)
        {
            if (variables == null)
            {
                throw new ArgumentNullException(nameof(variables));
            }
            if (solver == null)
            {
                throw new ArgumentNullException(nameof(solver));
            }

            // Add a series collector node if necessary
            CollectorPrimeNode = ModelParameters.CollectorResistance.Value > 0 ? variables.Create(Name.Combine("col")).Index : CollectorNode;

            // Add a series base node if necessary
            BasePrimeNode = ModelParameters.BaseResist.Value > 0 ? variables.Create(Name.Combine("base")).Index : BaseNode;

            // Add a series emitter node if necessary
            EmitterPrimeNode = ModelParameters.EmitterResistance.Value > 0 ? variables.Create(Name.Combine("emit")).Index : EmitterNode;

            // Get solver pointers
            CollectorCollectorPrimePtr    = solver.GetMatrixElement(CollectorNode, CollectorPrimeNode);
            BaseBasePrimePtr              = solver.GetMatrixElement(BaseNode, BasePrimeNode);
            EmitterEmitterPrimePtr        = solver.GetMatrixElement(EmitterNode, EmitterPrimeNode);
            CollectorPrimeCollectorPtr    = solver.GetMatrixElement(CollectorPrimeNode, CollectorNode);
            CollectorPrimeBasePrimePtr    = solver.GetMatrixElement(CollectorPrimeNode, BasePrimeNode);
            CollectorPrimeEmitterPrimePtr = solver.GetMatrixElement(CollectorPrimeNode, EmitterPrimeNode);
            BasePrimeBasePtr              = solver.GetMatrixElement(BasePrimeNode, BaseNode);
            BasePrimeCollectorPrimePtr    = solver.GetMatrixElement(BasePrimeNode, CollectorPrimeNode);
            BasePrimeEmitterPrimePtr      = solver.GetMatrixElement(BasePrimeNode, EmitterPrimeNode);
            EmitterPrimeEmitterPtr        = solver.GetMatrixElement(EmitterPrimeNode, EmitterNode);
            EmitterPrimeCollectorPrimePtr = solver.GetMatrixElement(EmitterPrimeNode, CollectorPrimeNode);
            EmitterPrimeBasePrimePtr      = solver.GetMatrixElement(EmitterPrimeNode, BasePrimeNode);
            CollectorCollectorPtr         = solver.GetMatrixElement(CollectorNode, CollectorNode);
            BaseBasePtr       = solver.GetMatrixElement(BaseNode, BaseNode);
            EmitterEmitterPtr = solver.GetMatrixElement(EmitterNode, EmitterNode);
            CollectorPrimeCollectorPrimePtr = solver.GetMatrixElement(CollectorPrimeNode, CollectorPrimeNode);
            BasePrimeBasePrimePtr           = solver.GetMatrixElement(BasePrimeNode, BasePrimeNode);
            EmitterPrimeEmitterPrimePtr     = solver.GetMatrixElement(EmitterPrimeNode, EmitterPrimeNode);
            SubstrateSubstratePtr           = solver.GetMatrixElement(SubstrateNode, SubstrateNode);
            CollectorPrimeSubstratePtr      = solver.GetMatrixElement(CollectorPrimeNode, SubstrateNode);
            SubstrateCollectorPrimePtr      = solver.GetMatrixElement(SubstrateNode, CollectorPrimeNode);
            BaseCollectorPrimePtr           = solver.GetMatrixElement(BaseNode, CollectorPrimeNode);
            CollectorPrimeBasePtr           = solver.GetMatrixElement(CollectorPrimeNode, BaseNode);

            // Get RHS pointers
            CollectorPrimePtr = solver.GetRhsElement(CollectorPrimeNode);
            BasePrimePtr      = solver.GetRhsElement(BasePrimeNode);
            EmitterPrimePtr   = solver.GetRhsElement(EmitterPrimeNode);
        }
예제 #7
0
        /// <summary>
        /// Get equation pointers
        /// </summary>
        /// <param name="variables">Variables</param>
        /// <param name="solver">Solver</param>
        public override void GetEquationPointers(VariableSet variables, Solver <double> solver)
        {
            if (variables == null)
            {
                throw new ArgumentNullException(nameof(variables));
            }
            if (solver == null)
            {
                throw new ArgumentNullException(nameof(solver));
            }

            // Create
            PosPrimeNode = _mbp.Resistance > 0 ? variables.Create(Name.Combine("pos")).Index : _posNode;

            // Get matrix elements
            PosPosPrimePtr      = solver.GetMatrixElement(_posNode, PosPrimeNode);
            NegPosPrimePtr      = solver.GetMatrixElement(_negNode, PosPrimeNode);
            PosPrimePosPtr      = solver.GetMatrixElement(PosPrimeNode, _posNode);
            PosPrimeNegPtr      = solver.GetMatrixElement(PosPrimeNode, _negNode);
            PosPosPtr           = solver.GetMatrixElement(_posNode, _posNode);
            NegNegPtr           = solver.GetMatrixElement(_negNode, _negNode);
            PosPrimePosPrimePtr = solver.GetMatrixElement(PosPrimeNode, PosPrimeNode);

            // Get RHS elements
            NegPtr      = solver.GetRhsElement(_negNode);
            PosPrimePtr = solver.GetRhsElement(PosPrimeNode);
        }
예제 #8
0
        /// <summary>
        /// Gets matrix pointers
        /// </summary>
        /// <param name="variables">Variables</param>
        /// <param name="solver">Solver</param>
        public void GetEquationPointers(VariableSet variables, Solver <double> solver)
        {
            variables.ThrowIfNull(nameof(variables));
            solver.ThrowIfNull(nameof(solver));

            BranchEq            = variables.Create(Name.Combine("branch"), VariableType.Current).Index;
            PosBranchPtr        = solver.GetMatrixElement(PosNode, BranchEq);
            NegBranchPtr        = solver.GetMatrixElement(NegNode, BranchEq);
            BranchPosPtr        = solver.GetMatrixElement(BranchEq, PosNode);
            BranchNegPtr        = solver.GetMatrixElement(BranchEq, NegNode);
            BranchControlPosPtr = solver.GetMatrixElement(BranchEq, ContPosNode);
            BranchControlNegPtr = solver.GetMatrixElement(BranchEq, ContNegNode);
        }
예제 #9
0
        /// <summary>
        /// Gets matrix pointers
        /// </summary>
        /// <param name="variables">Variables</param>
        /// <param name="solver">Solver</param>
        public override void GetEquationPointers(VariableSet variables, Solver <double> solver)
        {
            if (variables == null)
            {
                throw new ArgumentNullException(nameof(variables));
            }
            if (solver == null)
            {
                throw new ArgumentNullException(nameof(solver));
            }

            BranchEq            = variables.Create(new SubIdentifier(Name, "branch"), VariableType.Current).Index;
            PosBranchPtr        = solver.GetMatrixElement(_posNode, BranchEq);
            NegBranchPtr        = solver.GetMatrixElement(_negNode, BranchEq);
            BranchPosPtr        = solver.GetMatrixElement(BranchEq, _posNode);
            BranchNegPtr        = solver.GetMatrixElement(BranchEq, _negNode);
            BranchControlPosPtr = solver.GetMatrixElement(BranchEq, _contPosourceNode);
            BranchControlNegPtr = solver.GetMatrixElement(BranchEq, _contNegateNode);
        }
예제 #10
0
        /// <summary>
        /// Gets matrix pointers
        /// </summary>
        /// <param name="variables">Variables</param>
        /// <param name="solver">Solver</param>
        public override void GetEquationPointers(VariableSet variables, Solver <double> solver)
        {
            if (variables == null)
            {
                throw new ArgumentNullException(nameof(variables));
            }
            if (solver == null)
            {
                throw new ArgumentNullException(nameof(solver));
            }

            // Create current equation
            BranchEq = variables.Create(Name.Combine("branch"), VariableType.Current).Index;

            // Get matrix pointers
            PosBranchPtr = solver.GetMatrixElement(_posNode, BranchEq);
            NegBranchPtr = solver.GetMatrixElement(_negNode, BranchEq);
            BranchNegPtr = solver.GetMatrixElement(BranchEq, _negNode);
            BranchPosPtr = solver.GetMatrixElement(BranchEq, _posNode);
        }
예제 #11
0
        /// <summary>
        /// Get equation pointers
        /// </summary>
        /// <param name="variables">Variables</param>
        /// <param name="solver">Solver</param>
        public void GetEquationPointers(VariableSet variables, Solver <double> solver)
        {
            variables.ThrowIfNull(nameof(variables));
            solver.ThrowIfNull(nameof(solver));

            // Create
            PosPrimeNode = ModelParameters.Resistance > 0 ? variables.Create(Name.Combine("pos")).Index : PosNode;

            // Get matrix elements
            PosPosPrimePtr      = solver.GetMatrixElement(PosNode, PosPrimeNode);
            NegPosPrimePtr      = solver.GetMatrixElement(NegNode, PosPrimeNode);
            PosPrimePosPtr      = solver.GetMatrixElement(PosPrimeNode, PosNode);
            PosPrimeNegPtr      = solver.GetMatrixElement(PosPrimeNode, NegNode);
            PosPosPtr           = solver.GetMatrixElement(PosNode, PosNode);
            NegNegPtr           = solver.GetMatrixElement(NegNode, NegNode);
            PosPrimePosPrimePtr = solver.GetMatrixElement(PosPrimeNode, PosPrimeNode);

            // Get RHS elements
            NegPtr      = solver.GetRhsElement(NegNode);
            PosPrimePtr = solver.GetRhsElement(PosPrimeNode);
        }
예제 #12
0
        /// <summary>
        /// Gets matrix pointers
        /// </summary>
        /// <param name="variables">Variables</param>
        /// <param name="solver">Solver</param>
        public void GetEquationPointers(VariableSet variables, Solver <double> solver)
        {
            if (variables == null)
            {
                throw new ArgumentNullException(nameof(variables));
            }
            if (solver == null)
            {
                throw new ArgumentNullException(nameof(solver));
            }

            // Create/get nodes
            ContBranchEq = VoltageLoad.BranchEq;
            BranchEq     = variables.Create(Name.Combine("branch"), VariableType.Current).Index;

            // Get matrix pointers
            PosBranchPtr           = solver.GetMatrixElement(PosNode, BranchEq);
            NegBranchPtr           = solver.GetMatrixElement(NegNode, BranchEq);
            BranchPosPtr           = solver.GetMatrixElement(BranchEq, PosNode);
            BranchNegPtr           = solver.GetMatrixElement(BranchEq, NegNode);
            BranchControlBranchPtr = solver.GetMatrixElement(BranchEq, ContBranchEq);
        }
예제 #13
0
        /// <summary>
        /// Gets matrix pointers
        /// </summary>
        /// <param name="variables">Variables</param>
        /// <param name="solver">Solver</param>
        public void GetEquationPointers(VariableSet variables, Solver <double> solver)
        {
            if (variables == null)
            {
                throw new ArgumentNullException(nameof(variables));
            }
            if (solver == null)
            {
                throw new ArgumentNullException(nameof(solver));
            }

            BranchEq = variables.Create(Name.Combine("branch"), VariableType.Current).Index;

            // Get matrix elements
            PosBranchPtr = solver.GetMatrixElement(PosNode, BranchEq);
            BranchPosPtr = solver.GetMatrixElement(BranchEq, PosNode);
            NegBranchPtr = solver.GetMatrixElement(NegNode, BranchEq);
            BranchNegPtr = solver.GetMatrixElement(BranchEq, NegNode);

            // Get rhs elements
            BranchPtr = solver.GetRhsElement(BranchEq);
        }