コード例 #1
0
        /// <inheritdoc />
        public void Register(CircuitContext context, IDiagnosticHandler diagnostics)
        {
            var highest = context.Nodes.Shorts[Highest];
            var lowest  = context.Nodes.Shorts[Lowest];

            if (highest != lowest)
            {
                AddMinimum(context.Circuit, Name, lowest, highest, Minimum);
            }
        }
コード例 #2
0
        /// <inheritdoc />
        public void Register(CircuitContext context, IDiagnosticHandler diagnostics)
        {
            var lowest  = context.Nodes.Shorts[Lowest];
            var highest = context.Nodes.Shorts[Highest];

            if (lowest != highest)
            {
                AddOffset(context.Circuit, $"constraint.{Name}", lowest, highest, Offset);
            }
        }
コード例 #3
0
            /// <inheritdoc />
            public void Update(IBiasingSimulationState state, CircuitContext context, IDiagnosticHandler diagnostics)
            {
                var    map = context.Nodes.Shorts;
                double x, y;

                if (state.TryGetValue(map[X], out var value))
                {
                    x = value.Value;
                }
                else
                {
                    diagnostics?.Post(new DiagnosticMessage(SeverityLevel.Error, "U001", $"Could not find variable '{X}'."));
                    x = 0.0;
                }
                if (state.TryGetValue(map[Y], out value))
                {
                    y = value.Value;
                }
                else
                {
                    diagnostics?.Post(new DiagnosticMessage(SeverityLevel.Error, "U001", $"Could not find variable '{X}'."));
                    y = 0.0;
                }
                Location = new(x, y);

                if (state.TryGetValue(map[_pins.Right], out value))
                {
                    x = value.Value;
                }
                else
                {
                    diagnostics?.Post(new DiagnosticMessage(SeverityLevel.Error, "U001", $"Could not find variable '{X}'."));
                    x = 0.0;
                }
                if (state.TryGetValue(map[_pins.Bottom], out value))
                {
                    y = value.Value;
                }
                else
                {
                    diagnostics?.Post(new DiagnosticMessage(SeverityLevel.Error, "U001", $"Could not find variable '{X}'."));
                    y = 0.0;
                }
                EndLocation = new(x, y);

                // Update all pin locations as well
                // We ignore pin 0, because that is a dummy pin
                for (int i = 1; i < _pins.Count; i++)
                {
                    _pins[i].Update(state, context, diagnostics);
                }
            }
コード例 #4
0
 /// <inheritdoc />
 public void Update(IBiasingSimulationState state, CircuitContext context, IDiagnosticHandler diagnostics)
 {
 }
コード例 #5
0
 /// <inheritdoc />
 public void Register(CircuitContext context, IDiagnosticHandler diagnostics)
 {
     _pins.Register(context, diagnostics);
 }