/// <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); } }
/// <inheritdoc /> public void Update(IBiasingSimulationState state, CircuitContext context, IDiagnosticHandler diagnostics) { double x = 0, y = 0; if (state.TryGetValue(context.Nodes.Shorts[X], out var xValue)) { x = xValue.Value; } if (state.TryGetValue(context.Nodes.Shorts[Y], out var yValue)) { y = yValue.Value; } Location = new(x, y); }