Exemplo n.º 1
0
        /// <summary>
        /// Setup behavior
        /// </summary>
        /// <param name="context">Provider</param>
        public override void Bind(Simulation simulation, BindingContext context)
        {
            base.Bind(simulation, context);

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

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

            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;
            _qNode           = _load.QNode;

            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);
            QqPtr   = solver.GetMatrixElement(_qNode, _qNode);
            QdpPtr  = solver.GetMatrixElement(_qNode, _drainNodePrime);
            QspPtr  = solver.GetMatrixElement(_qNode, _sourceNodePrime);
            QgPtr   = solver.GetMatrixElement(_qNode, _gateNode);
            QbPtr   = solver.GetMatrixElement(_qNode, _bulkNode);
            DPqPtr  = solver.GetMatrixElement(_drainNodePrime, _qNode);
            SPqPtr  = solver.GetMatrixElement(_sourceNodePrime, _qNode);
            GqPtr   = solver.GetMatrixElement(_gateNode, _qNode);
            BqPtr   = solver.GetMatrixElement(_bulkNode, _qNode);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Bind behavior.
        /// </summary>
        /// <param name="simulation">The simulation.</param>
        /// <param name="context">Data provider</param>
        public override void Bind(Simulation simulation, BindingContext context)
        {
            base.Bind(simulation, context);

            // Get behaviors
            Bias1 = context.GetBehavior <BiasingBehavior>("inductor1");
            Bias2 = context.GetBehavior <BiasingBehavior>("inductor2");

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

            Branch1Branch2Ptr = solver.GetMatrixElement(Bias1.BranchEq, Bias2.BranchEq);
            Branch2Branch1Ptr = solver.GetMatrixElement(Bias2.BranchEq, Bias1.BranchEq);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Bind behavior.
        /// </summary>
        /// <param name="simulation">The simulation.</param>
        /// <param name="context">The context.</param>
        public override void Bind(Simulation simulation, BindingContext context)
        {
            base.Bind(simulation, context);

            // Get parameters
            BaseParameters = context.GetParameterSet <BaseParameters>();

            // Get behaviors
            VoltageLoad = context.GetBehavior <VoltageSourceBehaviors.BiasingBehavior>("control");

            if (context is ComponentBindingContext cc)
            {
                PosNode = cc.Pins[0];
                NegNode = cc.Pins[1];
            }

            _state = ((BaseSimulation)simulation).RealState;
            var solver    = _state.Solver;
            var variables = simulation.Variables;

            // 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);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Bind behavior.
        /// </summary>
        /// <param name="simulation">The simulation.</param>
        /// <param name="context">Data provider</param>
        public override void Bind(Simulation simulation, BindingContext context)
        {
            base.Bind(simulation, context);
            context.ThrowIfNull(nameof(context));

            // Get parameters
            BaseParameters = context.GetParameterSet <BaseParameters>();

            // Get behaviors (0 = CCCS behaviors, 1 = VSRC behaviors)
            VoltageLoad = context.GetBehavior <VoltageSourceBehaviors.BiasingBehavior>("control");

            // Connect
            if (context is ComponentBindingContext cc)
            {
                PosNode = cc.Pins[0];
                NegNode = cc.Pins[1];
            }

            _state = ((BaseSimulation)simulation).RealState.ThrowIfNull("state");
            var solver = _state.Solver;

            ControlBranchEq     = VoltageLoad.BranchEq;
            PosControlBranchPtr = solver.GetMatrixElement(PosNode, ControlBranchEq);
            NegControlBranchPtr = solver.GetMatrixElement(NegNode, ControlBranchEq);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Binds the behavior.
        /// </summary>
        /// <param name="simulation">The simulation.</param>
        /// <param name="context">The context.</param>
        public override void Bind(Simulation simulation, BindingContext context)
        {
            // Get node connections
            if (context is ComponentBindingContext cc)
            {
                PosNode = cc.Pins[0];
                NegNode = cc.Pins[1];
            }

            // First we copy the branch equation from the biasing behavior
            int branchEq = context.GetBehavior <BiasingBehavior>().BranchEq;

            PosIndex = 0;
            NegIndex = branchEq;

            // Do other behavioral stuff
            base.Bind(simulation, context);

            // Get matrix pointers
            var solver = State.Solver;

            PosBranchPtr = solver.GetMatrixElement(PosNode, branchEq);
            NegBranchPtr = solver.GetMatrixElement(NegNode, branchEq);
            BranchPosPtr = solver.GetMatrixElement(branchEq, PosNode);
            BranchNegPtr = solver.GetMatrixElement(branchEq, NegNode);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Bind behavior.
        /// </summary>
        /// <param name="simulation">The simulation.</param>
        /// <param name="context">Data provider</param>
        public override void Bind(Simulation simulation, BindingContext context)
        {
            base.Bind(simulation, context);

            // Get behaviors
            Load1 = context.GetBehavior <InductorBehaviors.TransientBehavior>("inductor1");
            Load2 = context.GetBehavior <InductorBehaviors.TransientBehavior>("inductor2");

            // Register events for modifying the flux through the inductors
            Load1.UpdateFlux += UpdateFlux1;
            Load2.UpdateFlux += UpdateFlux2;

            _state = ((BaseSimulation)simulation).RealState;
            var solver = _state.Solver;

            Branch1Branch2 = solver.GetMatrixElement(Load1.BranchEq, Load2.BranchEq);
            Branch2Branch1 = solver.GetMatrixElement(Load2.BranchEq, Load1.BranchEq);
        }
        /// <summary>
        /// Setup the behavior
        /// </summary>
        public override void Bind(Simulation simulation, BindingContext context)
        {
            base.Bind(simulation, context);

            // Get behaviors
            ModelTemperature = context.GetBehavior <ModelTemperatureBehavior>("model");

            // Get parameter sets
            BaseParameters  = context.GetParameterSet <BaseParameters>();
            ModelParameters = context.GetParameterSet <ModelBaseParameters>("model");
        }
Exemplo n.º 8
0
        /// <summary>
        /// Setup the behavior.
        /// </summary>
        /// <param name="simulation">The simulation.</param>
        /// <param name="context">The binding context.</param>
        public override void Bind(Simulation simulation, BindingContext context)
        {
            base.Bind(simulation, context);

            // Get behaviors
            BiasingBehavior = context.GetBehavior <BehavioralBiasingBehavior>();

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

            BuildFunctionMethod(solver);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Setup the behavior
        /// </summary>
        public override void Bind(Simulation simulation, BindingContext context)
        {
            base.Bind(simulation, context);
            _load = context.GetBehavior <BiasingBehavior>();
            _load.TranBehavior = this;

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

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

            // Get parameters
            _bp = context.GetParameterSet <BaseParameters>();

            // Get behaviors
            _tran = context.GetBehavior <TransientBehavior>();

            _method = ((TimeSimulation)simulation).Method;
        }
Exemplo n.º 11
0
        /// <summary>
        /// Setup behavior
        /// </summary>
        /// <param name="context"></param>
        public override void Bind(Simulation simulation, BindingContext context)
        {
            base.Bind(simulation, context);

            // Get parameter sets
            _bp  = context.GetParameterSet <BaseParameters>();
            _mbp = context.GetParameterSet <ModelBaseParameters>();

            // 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];
            }
            _drainNodePrime  = _load.DrainNodePrime;
            _sourceNodePrime = _load.SourceNodePrime;
        }
Exemplo n.º 12
0
        /// <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.º 13
0
        /// <summary>
        /// Bind the behavior.
        /// </summary>
        /// <param name="simulation">The simulation.</param>
        /// <param name="context">The context.</param>
        public override void Bind(Simulation simulation, BindingContext context)
        {
            base.Bind(simulation, context);

            // Get base configuration
            BaseConfiguration = simulation.Configurations.Get <BaseConfiguration>();

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

            // Get behaviors
            ModelTemperature = context.GetBehavior <ModelTemperatureBehavior>("model");

            State = ((BaseSimulation)simulation).RealState;
        }
Exemplo n.º 14
0
 /// <summary>
 /// Bind the behavior. for the specified simulation.
 /// </summary>
 /// <param name="simulation">The simulation.</param>
 /// <param name="context">The context.</param>
 public override void Bind(Simulation simulation, BindingContext context)
 {
     // Get behaviors
     _loadBehavior = context.GetBehavior <VoltageSourceBehaviors.BiasingBehavior>("control");
 }