예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Biasing"/> class.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="context"/> is <c>null</c>.</exception>
        public Biasing(IComponentBindingContext context)
            : base(context)
        {
            context.Nodes.CheckNodes(4);

            // Get configurations
            BaseConfiguration = context.GetSimulationParameterSet <BiasingParameters>();

            // Get states
            Iteration      = context.GetState <IIterationSimulationState>();
            CollectorPrime = BiasingState.GetSharedVariable(context.Nodes[0]);
            BasePrime      = BiasingState.GetSharedVariable(context.Nodes[1]);
            EmitterPrime   = BiasingState.GetSharedVariable(context.Nodes[2]);
            _collectorNode = BiasingState.Map[CollectorPrime];
            _baseNode      = BiasingState.Map[BasePrime];
            _emitterNode   = BiasingState.Map[EmitterPrime];

            // Add a series collector node if necessary
            if (ModelParameters.CollectorResistance > 0)
            {
                CollectorPrime = BiasingState.CreatePrivateVariable(Name.Combine("col"), Units.Volt);
            }
            _collectorPrimeNode = BiasingState.Map[CollectorPrime];

            // Add a series base node if necessary
            if (ModelParameters.BaseResist > 0)
            {
                BasePrime = BiasingState.CreatePrivateVariable(Name.Combine("base"), Units.Volt);
            }
            _basePrimeNode = BiasingState.Map[BasePrime];

            // Add a series emitter node if necessary
            if (ModelParameters.EmitterResistance > 0)
            {
                EmitterPrime = BiasingState.CreatePrivateVariable(Name.Combine("emit"), Units.Volt);
            }
            _emitterPrimeNode = BiasingState.Map[EmitterPrime];

            // Get solver pointers
            _elements = new ElementSet <double>(BiasingState.Solver, new[] {
                new MatrixLocation(_collectorNode, _collectorNode),
                new MatrixLocation(_baseNode, _baseNode),
                new MatrixLocation(_emitterNode, _emitterNode),
                new MatrixLocation(_collectorPrimeNode, _collectorPrimeNode),
                new MatrixLocation(_basePrimeNode, _basePrimeNode),
                new MatrixLocation(_emitterPrimeNode, _emitterPrimeNode),
                new MatrixLocation(_collectorNode, _collectorPrimeNode),
                new MatrixLocation(_baseNode, _basePrimeNode),
                new MatrixLocation(_emitterNode, _emitterPrimeNode),
                new MatrixLocation(_collectorPrimeNode, _collectorNode),
                new MatrixLocation(_collectorPrimeNode, _basePrimeNode),
                new MatrixLocation(_collectorPrimeNode, _emitterPrimeNode),
                new MatrixLocation(_basePrimeNode, _baseNode),
                new MatrixLocation(_basePrimeNode, _collectorPrimeNode),
                new MatrixLocation(_basePrimeNode, _emitterPrimeNode),
                new MatrixLocation(_emitterPrimeNode, _emitterNode),
                new MatrixLocation(_emitterPrimeNode, _collectorPrimeNode),
                new MatrixLocation(_emitterPrimeNode, _basePrimeNode)
            }, new[] { _collectorPrimeNode, _basePrimeNode, _emitterPrimeNode });
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Biasing"/> class.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="context"/> is <c>null</c>.</exception>
        public Biasing(IComponentBindingContext context)
            : base(context)
        {
            context.ThrowIfNull(nameof(context));
            context.Nodes.CheckNodes(4);

            // Get parameters
            Parameters = context.GetParameterSet <Parameters>();
            Parameters.CalculateDefaults();
            BiasingState = context.GetState <IBiasingSimulationState>();
            _pos1        = BiasingState.Map[BiasingState.GetSharedVariable(context.Nodes[0])];
            _neg1        = BiasingState.Map[BiasingState.GetSharedVariable(context.Nodes[1])];
            _pos2        = BiasingState.Map[BiasingState.GetSharedVariable(context.Nodes[2])];
            _neg2        = BiasingState.Map[BiasingState.GetSharedVariable(context.Nodes[3])];

            Internal1 = BiasingState.CreatePrivateVariable(Name.Combine("int1"), Units.Volt);
            _int1     = BiasingState.Map[Internal1];
            Internal2 = BiasingState.CreatePrivateVariable(Name.Combine("int2"), Units.Volt);
            _int2     = BiasingState.Map[Internal2];
            Branch1   = BiasingState.CreatePrivateVariable(Name.Combine("branch1"), Units.Ampere);
            _br1      = BiasingState.Map[Branch1];
            Branch2   = BiasingState.CreatePrivateVariable(Name.Combine("branch2"), Units.Ampere);
            _br2      = BiasingState.Map[Branch2];

            BiasingElements = new ElementSet <double>(BiasingState.Solver,
                                                      new MatrixLocation(_pos1, _pos1),
                                                      new MatrixLocation(_pos1, _int1),
                                                      new MatrixLocation(_int1, _pos1),
                                                      new MatrixLocation(_int1, _int1),
                                                      new MatrixLocation(_int1, _br1),
                                                      new MatrixLocation(_br1, _int1),
                                                      new MatrixLocation(_neg1, _br1),
                                                      new MatrixLocation(_br1, _neg1),
                                                      new MatrixLocation(_pos2, _pos2),
                                                      new MatrixLocation(_pos2, _int2),
                                                      new MatrixLocation(_int2, _pos2),
                                                      new MatrixLocation(_int2, _int2),
                                                      new MatrixLocation(_int2, _br2),
                                                      new MatrixLocation(_br2, _int2),
                                                      new MatrixLocation(_neg2, _br2),
                                                      new MatrixLocation(_br2, _neg2),

                                                      // These are only used to calculate the biasing point
                                                      new MatrixLocation(_br1, _pos1),
                                                      new MatrixLocation(_br1, _pos2),
                                                      new MatrixLocation(_br1, _neg2),
                                                      new MatrixLocation(_br2, _br1),
                                                      new MatrixLocation(_br2, _br2));
        }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Biasing"/> class.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="context"/> is <c>null</c>.</exception>
        public Biasing(IComponentBindingContext context)
            : base(context)
        {
            context.Nodes.CheckNodes(3);

            BiasingParameters = context.GetSimulationParameterSet <BiasingParameters>();
            _iteration        = context.GetState <IIterationSimulationState>();
            context.TryGetState(out _time);
            context.TryGetState(out _method);

            DrainPrime  = BiasingState.GetSharedVariable(context.Nodes[0]);
            _drainNode  = BiasingState.Map[DrainPrime];
            _gateNode   = BiasingState.Map[BiasingState.GetSharedVariable(context.Nodes[1])];
            SourcePrime = BiasingState.GetSharedVariable(context.Nodes[2]);
            _sourceNode = BiasingState.Map[SourcePrime];

            if (ModelParameters.DrainResistance > 0)
            {
                DrainPrime = BiasingState.CreatePrivateVariable(Name.Combine("drain"), Units.Volt);
            }
            _drainPrimeNode = BiasingState.Map[DrainPrime];

            if (ModelParameters.SourceResistance > 0)
            {
                SourcePrime = BiasingState.CreatePrivateVariable(Name.Combine("source"), Units.Volt);
            }
            _sourcePrimeNode = BiasingState.Map[SourcePrime];

            _elements = new ElementSet <double>(BiasingState.Solver, new[] {
                new MatrixLocation(_drainNode, _drainPrimeNode),
                new MatrixLocation(_gateNode, _drainPrimeNode),
                new MatrixLocation(_gateNode, _sourcePrimeNode),
                new MatrixLocation(_sourceNode, _sourcePrimeNode),
                new MatrixLocation(_drainPrimeNode, _drainNode),
                new MatrixLocation(_drainPrimeNode, _gateNode),
                new MatrixLocation(_drainPrimeNode, _sourcePrimeNode),
                new MatrixLocation(_sourcePrimeNode, _gateNode),
                new MatrixLocation(_sourcePrimeNode, _sourceNode),
                new MatrixLocation(_sourcePrimeNode, _drainPrimeNode),
                new MatrixLocation(_drainNode, _drainNode),
                new MatrixLocation(_gateNode, _gateNode),
                new MatrixLocation(_sourceNode, _sourceNode),
                new MatrixLocation(_drainPrimeNode, _drainPrimeNode),
                new MatrixLocation(_sourcePrimeNode, _sourcePrimeNode)
            }, new[] { _gateNode, _drainPrimeNode, _sourcePrimeNode });
        }