|
@@ -97,6 +97,7 @@ public class HolegPowerFlow {
|
|
// Notify main thread that we are done
|
|
// Notify main thread that we are done
|
|
semaphore.release();
|
|
semaphore.release();
|
|
});
|
|
});
|
|
|
|
+ jobs[jobID].setName("Solver Job " + Long.toHexString(jobs[jobID].getId()));
|
|
}
|
|
}
|
|
|
|
|
|
// Check if we should have stopped
|
|
// Check if we should have stopped
|
|
@@ -276,12 +277,14 @@ public class HolegPowerFlow {
|
|
// Convert from grid to power flow objects
|
|
// Convert from grid to power flow objects
|
|
for (GridNode node : grid.getNodes())
|
|
for (GridNode node : grid.getNodes())
|
|
createGridNode(buses, node);
|
|
createGridNode(buses, node);
|
|
- for (GridEdge edge : grid.getEdges())
|
|
|
|
- createGridLine(grid, lines, edge);
|
|
|
|
|
|
|
|
// Scale voltages and scale power
|
|
// Scale voltages and scale power
|
|
double scaleVoltage = 1.0 / 230.0;
|
|
double scaleVoltage = 1.0 / 230.0;
|
|
double scalePower = scalePower(buses);
|
|
double scalePower = scalePower(buses);
|
|
|
|
+ double scaleResistance = 1.0 / ((scaleVoltage * scaleVoltage) / scalePower);
|
|
|
|
+
|
|
|
|
+ for (GridEdge edge : grid.getEdges())
|
|
|
|
+ createGridLine(grid, lines, edge, scaleResistance);
|
|
|
|
|
|
// Find position for slack node
|
|
// Find position for slack node
|
|
addSlackNode(buses, lines, tryCount, settings);
|
|
addSlackNode(buses, lines, tryCount, settings);
|
|
@@ -319,19 +322,24 @@ public class HolegPowerFlow {
|
|
buses.add(bus);
|
|
buses.add(bus);
|
|
}
|
|
}
|
|
|
|
|
|
- private void createGridLine(Grid grid, List<Line> lines, GridEdge edge) {
|
|
|
|
|
|
+ private void createGridLine(Grid grid, List<Line> lines, GridEdge edge, double scaleResistance) {
|
|
Line line = new Line();
|
|
Line line = new Line();
|
|
line.tag = edge;
|
|
line.tag = edge;
|
|
if (ComplexNumber.isNullOrZero(edge.getOverrideImpedance())) {
|
|
if (ComplexNumber.isNullOrZero(edge.getOverrideImpedance())) {
|
|
// Calculate values for line based on sample datasheet
|
|
// Calculate values for line based on sample datasheet
|
|
- line.R = 0.000194 * edge.getLengthKilometers();
|
|
|
|
- line.X = 0.000592 * edge.getLengthKilometers();
|
|
|
|
- line.B_2 = 0.000528;
|
|
|
|
|
|
+ line.R = 0.00642 * edge.getLengthKilometers() * scaleResistance;
|
|
|
|
+ line.X = 0.0083 * edge.getLengthKilometers() * scaleResistance;
|
|
|
|
+ line.B_2 = (0.0001 * edge.getLengthKilometers()) / scaleResistance;
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
line.R = edge.getOverrideImpedance().real;
|
|
line.R = edge.getOverrideImpedance().real;
|
|
line.X = edge.getOverrideImpedance().imaginary;
|
|
line.X = edge.getOverrideImpedance().imaginary;
|
|
line.B_2 = edge.getOverrideShuntSusceptance();
|
|
line.B_2 = edge.getOverrideShuntSusceptance();
|
|
|
|
+ if (!edge.getOverrideInPerUnit()) {
|
|
|
|
+ line.R *= scaleResistance;
|
|
|
|
+ line.X *= scaleResistance;
|
|
|
|
+ line.B_2 *= scaleResistance;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
line.a = 1;
|
|
line.a = 1;
|
|
|
|
|