/// <summary>
        /// Initializes a new instance of the <see cref="Biasing"/> class.
        /// </summary>
        /// <param name="context">The binding context.</param>
        public Time(IComponentBindingContext context)
            : base(context)
        {
            context.ThrowIfNull(nameof(context));
            context.Nodes.CheckNodes(4);

            var _biasing = context.GetState <IBiasingSimulationState>();

            _variables = new TwoPort <double>(_biasing, context);
            Branch     = _biasing.CreatePrivateVariable(Name.Combine("branch"), Units.Ampere);
            var pos     = _biasing.Map[_variables.Right.Positive];
            var neg     = _biasing.Map[_variables.Right.Negative];
            var contPos = _biasing.Map[_variables.Left.Positive];
            var contNeg = _biasing.Map[_variables.Left.Negative];
            var br      = _biasing.Map[Branch];

            _elements = new ElementSet <double>(_biasing.Solver,
                                                new[] {
                new MatrixLocation(pos, br),
                new MatrixLocation(neg, br),
                new MatrixLocation(br, pos),
                new MatrixLocation(br, neg),
                new MatrixLocation(br, contPos),
                new MatrixLocation(br, contNeg)
            }, new[] { br });
        }
예제 #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);

            Parameters = context.GetParameterSet <Parameters>();
            var state = context.GetState <IBiasingSimulationState>();

            Variables = new TwoPort <double>(state, context);
            int posNode     = state.Map[Variables.Right.Positive];
            int negNode     = state.Map[Variables.Right.Negative];
            int contPosNode = state.Map[Variables.Left.Positive];
            int contNegNode = state.Map[Variables.Left.Negative];

            Branch = state.CreatePrivateVariable(Name.Combine("branch"), Units.Ampere);
            int branchEq = state.Map[Branch];

            BiasingElements = new ElementSet <double>(state.Solver, new[] {
                new MatrixLocation(posNode, branchEq),
                new MatrixLocation(negNode, branchEq),
                new MatrixLocation(branchEq, posNode),
                new MatrixLocation(branchEq, negNode),
                new MatrixLocation(branchEq, contPosNode),
                new MatrixLocation(branchEq, contNegNode)
            });
        }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Frequency"/> class.
        /// </summary>
        /// <param name="context">The binding context.</param>
        public Frequency(IComponentBindingContext context)
            : base(context)
        {
            context.ThrowIfNull(nameof(context));
            context.Nodes.CheckNodes(LaplaceVoltageControlledVoltageSource.PinCount);

            var bstate = context.GetState <IBiasingSimulationState>();

            _dblVariables = new TwoPort <double>(bstate, context);
            var pos     = bstate.Map[_dblVariables.Right.Positive];
            var neg     = bstate.Map[_dblVariables.Right.Negative];
            var contPos = bstate.Map[_dblVariables.Left.Positive];
            var contNeg = bstate.Map[_dblVariables.Left.Negative];

            _dblElements = new ElementSet <double>(bstate.Solver, new[] {
                new MatrixLocation(pos, contPos),
                new MatrixLocation(pos, contNeg),
                new MatrixLocation(neg, contPos),
                new MatrixLocation(neg, contNeg)
            });

            var cstate = context.GetState <IComplexSimulationState>();

            _cplxVariables = new TwoPort <Complex>(cstate, context);
            pos            = cstate.Map[_cplxVariables.Right.Positive];
            neg            = cstate.Map[_cplxVariables.Right.Negative];
            contPos        = cstate.Map[_cplxVariables.Left.Positive];
            contNeg        = cstate.Map[_cplxVariables.Left.Negative];
            _cplxElements  = new ElementSet <Complex>(cstate.Solver, new[] {
                new MatrixLocation(pos, contPos),
                new MatrixLocation(pos, contNeg),
                new MatrixLocation(neg, contPos),
                new MatrixLocation(neg, contNeg)
            });
        }
예제 #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FrequencyBehavior"/> class.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="context"/> is <c>null</c>.</exception>
        public FrequencyBehavior(IComponentBindingContext context)
            : base(context)
        {
            _complex   = context.GetState <IComplexSimulationState>();
            _variables = new TwoPort <Complex>(_complex, context);

            var pos     = _complex.Map[_variables.Right.Positive];
            var neg     = _complex.Map[_variables.Right.Negative];
            var contPos = _complex.Map[_variables.Left.Positive];
            var contNeg = _complex.Map[_variables.Left.Negative];

            _elements = new ElementSet <Complex>(_complex.Solver,
                                                 new MatrixLocation(pos, contPos),
                                                 new MatrixLocation(pos, contNeg),
                                                 new MatrixLocation(neg, contPos),
                                                 new MatrixLocation(neg, contNeg));
        }
예제 #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Frequency"/> class.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="context"/> is <c>null</c>.</exception>
        public Frequency(IComponentBindingContext context)
            : base(context)
        {
            _complex   = context.GetState <IComplexSimulationState>();
            _variables = new TwoPort <Complex>(_complex, context);
            Branch     = _complex.CreatePrivateVariable(Name.Combine("branch"), Units.Ampere);
            var pos     = _complex.Map[_variables.Right.Positive];
            var neg     = _complex.Map[_variables.Right.Negative];
            var contPos = _complex.Map[_variables.Left.Positive];
            var contNeg = _complex.Map[_variables.Left.Negative];
            var br      = _complex.Map[Branch];

            _elements = new ElementSet <Complex>(_complex.Solver,
                                                 new MatrixLocation(pos, br),
                                                 new MatrixLocation(neg, br),
                                                 new MatrixLocation(br, pos),
                                                 new MatrixLocation(br, neg),
                                                 new MatrixLocation(br, contPos),
                                                 new MatrixLocation(br, contNeg));
        }
예제 #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Biasing"/> class.
        /// </summary>
        /// <param name="context">The binding context.</param>
        public Frequency(IComponentBindingContext context)
            : base(context)
        {
            context.ThrowIfNull(nameof(context));
            context.Nodes.CheckNodes(4);

            var state = context.GetState <IBiasingSimulationState>();

            _dblVariables = new TwoPort <double>(state, context);
            _dblBranch    = state.CreatePrivateVariable(Name.Combine("branch"), Units.Ampere);
            var pos     = state.Map[_dblVariables.Right.Positive];
            var neg     = state.Map[_dblVariables.Right.Negative];
            var contPos = state.Map[_dblVariables.Left.Positive];
            var contNeg = state.Map[_dblVariables.Left.Negative];
            var br      = state.Map[_dblBranch];

            _dblElements = new ElementSet <double>(state.Solver,
                                                   new MatrixLocation(pos, br),
                                                   new MatrixLocation(neg, br),
                                                   new MatrixLocation(br, pos),
                                                   new MatrixLocation(br, neg),
                                                   new MatrixLocation(br, contPos),
                                                   new MatrixLocation(br, contNeg));

            var cstate = context.GetState <IComplexSimulationState>();

            _cplxVariables = new TwoPort <Complex>(cstate, context);
            _cplxBranch    = cstate.CreatePrivateVariable(Name.Combine("branch"), Units.Ampere);
            pos            = cstate.Map[_cplxVariables.Right.Positive];
            neg            = cstate.Map[_cplxVariables.Right.Negative];
            contPos        = cstate.Map[_cplxVariables.Left.Positive];
            contNeg        = cstate.Map[_cplxVariables.Left.Negative];
            br             = cstate.Map[_cplxBranch];
            _cplxElements  = new ElementSet <Complex>(cstate.Solver,
                                                      new MatrixLocation(pos, br),
                                                      new MatrixLocation(neg, br),
                                                      new MatrixLocation(br, pos),
                                                      new MatrixLocation(br, neg),
                                                      new MatrixLocation(br, contPos),
                                                      new MatrixLocation(br, contNeg));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="Time"/> class.
        /// </summary>
        /// <param name="context"></param>
        public Time(IComponentBindingContext context)
            : base(context)
        {
            context.ThrowIfNull(nameof(context));
            context.Nodes.CheckNodes(LaplaceVoltageControlledVoltageSource.PinCount);

            var state = context.GetState <IBiasingSimulationState>();

            _variables = new TwoPort <double>(state, context);
            var pos     = state.Map[_variables.Right.Positive];
            var neg     = state.Map[_variables.Right.Negative];
            var contPos = state.Map[_variables.Left.Positive];
            var contNeg = state.Map[_variables.Left.Negative];

            _elements = new ElementSet <double>(state.Solver, new[] {
                new MatrixLocation(pos, contPos),
                new MatrixLocation(pos, contNeg),
                new MatrixLocation(neg, contPos),
                new MatrixLocation(neg, contNeg)
            }, new[] { pos, neg });
        }
예제 #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BiasingBehavior"/> class.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="context"/> is <c>null</c>.</exception>
        public BiasingBehavior(IComponentBindingContext context)
            : base(context)
        {
            context.ThrowIfNull(nameof(context));
            context.Nodes.CheckNodes(4);

            _biasing   = context.GetState <IBiasingSimulationState>();
            Parameters = context.GetParameterSet <Parameters>();
            _variables = new TwoPort <double>(_biasing, context);

            var pos     = _biasing.Map[_variables.Right.Positive];
            var neg     = _biasing.Map[_variables.Right.Negative];
            var contPos = _biasing.Map[_variables.Left.Positive];
            var contNeg = _biasing.Map[_variables.Left.Negative];

            _elements = new ElementSet <double>(_biasing.Solver, new[] {
                new MatrixLocation(pos, contPos),
                new MatrixLocation(pos, contNeg),
                new MatrixLocation(neg, contPos),
                new MatrixLocation(neg, contNeg)
            });
        }
예제 #9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Frequency"/> class.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="context"/> is <c>null</c>.</exception>
        public Frequency(IComponentBindingContext context)
            : base(context)
        {
            _complex = context.GetState <IComplexSimulationState>();

            _variables = new TwoPort <Complex>(_complex, context);
            int posNode     = _complex.Map[_variables.Right.Positive];
            int negNode     = _complex.Map[_variables.Right.Negative];
            int contPosNode = _complex.Map[_variables.Left.Positive];
            int contNegNode = _complex.Map[_variables.Left.Negative];

            Branch = _complex.CreatePrivateVariable(Name.Combine("branch"), Units.Ampere);
            int branchEq = _complex.Map[Branch];

            _elements = new ElementSet <Complex>(_complex.Solver, new[] {
                new MatrixLocation(posNode, branchEq),
                new MatrixLocation(negNode, branchEq),
                new MatrixLocation(branchEq, posNode),
                new MatrixLocation(branchEq, negNode),
                new MatrixLocation(branchEq, contPosNode),
                new MatrixLocation(branchEq, contNegNode)
            });
        }