FIX: setting voltage of pivot (zero per definition)

This commit is contained in:
Patrick Haßel 2025-02-03 12:21:51 +01:00
parent 7f82cc6e57
commit feb7ea9161

View File

@ -16,6 +16,7 @@ export class Calculation {
private potentials: number[] = [];
constructor(
readonly pivot: Junction,
readonly parts: Part[],
readonly junctionsWithoutPivot: Junction[],
readonly wires: Wire[]) {
@ -31,6 +32,9 @@ export class Calculation {
junction.maxCircuitVoltage = maxCircuitVoltage;
junction.voltage = this.getPotential(junctionsWithoutPivot.indexOf(junction));
});
pivot.minCircuitVoltage = minCircuitVoltage;
pivot.maxCircuitVoltage = maxCircuitVoltage;
pivot.voltage = 0;
}
private matrixInit(size: number) {
@ -152,6 +156,6 @@ export class Calculation {
}
const junctionCountIncludingPivot = foundJunctions.length + 1;
console.debug(` => Circuit #${circuitNumber} (${foundParts.length} parts, ${junctionCountIncludingPivot} junctions, ${foundWires.length} wires)`);
return new Calculation(foundParts, foundJunctions, foundWires);
return new Calculation(pivot, foundParts, foundJunctions, foundWires);
}
}