/// <summary>
        /// Setup the behavior
        /// </summary>
        public override void Bind(Simulation simulation, BindingContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }
            _load = context.GetBehavior <BiasingBehavior>();
            _load.TranBehavior = this;

            var method = ((TimeSimulation)simulation).Method;

            Qb = method.CreateDerivative();
            Qg = method.CreateDerivative();
            Qd = method.CreateDerivative();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Set up the behavior.
        /// </summary>
        /// <param name="simulation">The simulation.</param>
        /// <param name="context">The provider.</param>
        /// <exception cref="ArgumentNullException">provider</exception>
        public override void Bind(Simulation simulation, BindingContext context)
        {
            base.Bind(simulation, context);

            // Get parameters
            _mbp = context.GetParameterSet <ModelBaseParameters>("model");
            _bp  = context.GetParameterSet <BaseParameters>();

            // Get behaviors
            _temp = context.GetBehavior <TemperatureBehavior>();
            _load = context.GetBehavior <BiasingBehavior>();

            if (context is ComponentBindingContext cc)
            {
                _drainNode  = cc.Pins[0];
                _gateNode   = cc.Pins[1];
                _sourceNode = cc.Pins[2];
                _bulkNode   = cc.Pins[3];
            }

            _state = ((FrequencySimulation)simulation).ComplexState;
            var solver = _state.Solver;

            _drainNodePrime  = _load.DrainNodePrime;
            _sourceNodePrime = _load.SourceNodePrime;
            DdPtr            = solver.GetMatrixElement(_drainNode, _drainNode);
            GgPtr            = solver.GetMatrixElement(_gateNode, _gateNode);
            SsPtr            = solver.GetMatrixElement(_sourceNode, _sourceNode);
            BbPtr            = solver.GetMatrixElement(_bulkNode, _bulkNode);
            DPdpPtr          = solver.GetMatrixElement(_drainNodePrime, _drainNodePrime);
            SPspPtr          = solver.GetMatrixElement(_sourceNodePrime, _sourceNodePrime);
            DdpPtr           = solver.GetMatrixElement(_drainNode, _drainNodePrime);
            GbPtr            = solver.GetMatrixElement(_gateNode, _bulkNode);
            GdpPtr           = solver.GetMatrixElement(_gateNode, _drainNodePrime);
            GspPtr           = solver.GetMatrixElement(_gateNode, _sourceNodePrime);
            SspPtr           = solver.GetMatrixElement(_sourceNode, _sourceNodePrime);
            BdpPtr           = solver.GetMatrixElement(_bulkNode, _drainNodePrime);
            BspPtr           = solver.GetMatrixElement(_bulkNode, _sourceNodePrime);
            DPspPtr          = solver.GetMatrixElement(_drainNodePrime, _sourceNodePrime);
            DPdPtr           = solver.GetMatrixElement(_drainNodePrime, _drainNode);
            BgPtr            = solver.GetMatrixElement(_bulkNode, _gateNode);
            DPgPtr           = solver.GetMatrixElement(_drainNodePrime, _gateNode);
            SPgPtr           = solver.GetMatrixElement(_sourceNodePrime, _gateNode);
            SPsPtr           = solver.GetMatrixElement(_sourceNodePrime, _sourceNode);
            DPbPtr           = solver.GetMatrixElement(_drainNodePrime, _bulkNode);
            SPbPtr           = solver.GetMatrixElement(_sourceNodePrime, _bulkNode);
            SPdpPtr          = solver.GetMatrixElement(_sourceNodePrime, _drainNodePrime);
        }