private static boolean isBusValid(PossibleTopology.Bus bus) { int feederCount = 0; int branchCount = 0; for (PossibleTopology.Equipment eq : bus.getEquipments()) { switch (eq.getType()) { case LINE: case TWO_WINDINGS_TRANSFORMER: case THREE_WINDINGS_TRANSFORMER: branchCount++; feederCount++; break; case DANGLING_LINE: case LOAD: case GENERATOR: case SHUNT_COMPENSATOR: feederCount++; break; case BUSBAR_SECTION: // must not happen in a bus/breaker topology default: throw new AssertionError(); } } return Networks.isBusValid(branchCount); }
public static void printBalanceSummary(String title, Network network, Logger logger) { ConnectedPower balanceMainCC = new ConnectedPower(); ConnectedPower balanceOtherCC = new ConnectedPower(); addBuses(network, balanceMainCC, balanceOtherCC); addLoads(network, balanceMainCC, balanceOtherCC); addDanglingLines(network, balanceMainCC, balanceOtherCC); addGenerators(network, balanceMainCC, balanceOtherCC); addShuntCompensators(network, balanceMainCC, balanceOtherCC); logOtherCC(logger, title, () -> writeInTable(balanceMainCC, balanceOtherCC), balanceOtherCC); }
public void build(Network network) { // build a unique topology for each of the substation reflecting history Map<String, UniqueTopology> uniqueTopos = build(); // remove from the reference network equipments not in the history, i.e always disconnected in the history cleanNetwork(network, uniqueTopos); // apply unique topology to the network for (VoltageLevel vl : network.getVoltageLevels()) { UniqueTopology uniqueTopo = uniqueTopos.get(vl.getId()); // uniqueTopo.print(System.out); uniqueTopo.apply(network); } Networks.printBalanceSummary("unique topo", network, LOGGER); new UniqueTopologyChecker(network, topoHisto, uniqueTopos, dict).check(); }
private EurostagContext before(Path workingDir) throws IOException { if (config.isDebug()) { Networks.dumpStateId(workingDir, network);
private static void addShuntCompensators(Network network, ConnectedPower balanceMainCC, ConnectedPower balanceOtherCC) { for (ShuntCompensator sc : network.getShuntCompensators()) { Terminal.BusBreakerView view = sc.getTerminal().getBusBreakerView(); double q = sc.getCurrentB() * Math.pow(sc.getTerminal().getVoltageLevel().getNominalV(), 2); if (view.getBus() != null) { addConnectedShunt(view, q, sc.getId(), balanceMainCC, balanceOtherCC); } else { addDisonnectedShunt(view, q, sc.getId(), balanceMainCC, balanceOtherCC); } } }
private boolean runStartingPointInit(WorkflowContext context, WorkflowStartContext startContext, int sampleId) { LOGGER.debug("Workflow {}, sample {}: starting point initialization started", id, sampleId); // call starting point initialization module to fill control // variables and to setup the topology try { OptimizerResult result = context.getOptimizer().run(); String finalStatus = result.getMetrics().get("final_status"); LOGGER.debug("Workflow {}, sample {}: starting point initialization terminated (status={}, feasible={})", id, sampleId, finalStatus, result.isFeasible()); changeTaskStatus(startContext, sampleId, STARTING_POINT_INITIALIZATION, result.isFeasible() ? SUCCEED : FAILED, result.isFeasible() ? null : finalStatus); metricsDb.store(id, "sample-" + sampleId, STARTING_POINT_INITIALIZATION.name(), result.getMetrics()); Networks.printBalanceSummary("sample " + sampleId, context.getNetwork(), LOGGER); // check that we have a good starting point return result.isFeasible(); } catch (Exception e) { LOGGER.error(e.toString(), e); return false; } }
private Command before(SimulationState state, Set<String> contingencyIds, Path workingDir, List<Contingency> contingencies) throws IOException { Networks.dumpStateId(workingDir, state.getName());
network.getStateManager().setWorkingState(StateManagerConstants.INITIAL_STATE_ID); Networks.printBalanceSummary("snapshot", network, LOGGER); Networks.printBalanceSummary("base case", network, LOGGER);
private Command createCommand(SimulationState state, Set<String> contingencyIds, Path workingDir, List<Contingency> contingencies) throws IOException { Networks.dumpStateId(workingDir, state.getName());
protected boolean isBusValid(Set<ConfiguredBus> busSet) { int feederCount = 0; int branchCount = 0; for (TerminalExt terminal : FluentIterable.from(busSet).transformAndConcat(ConfiguredBus::getConnectedTerminals)) { AbstractConnectable connectable = terminal.getConnectable(); switch (connectable.getType()) { case LINE: case TWO_WINDINGS_TRANSFORMER: case THREE_WINDINGS_TRANSFORMER: case HVDC_CONVERTER_STATION: branchCount++; feederCount++; break; case DANGLING_LINE: case LOAD: case GENERATOR: case SHUNT_COMPENSATOR: case STATIC_VAR_COMPENSATOR: feederCount++; break; case BUSBAR_SECTION: // must not happend in a bus/breaker topology default: throw new AssertionError(); } } return Networks.isBusValid(branchCount); }