Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename getVarConnectionsWithX(X x) into getVarConnectionsWith(X x) #226

Merged
merged 3 commits into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ public String getLib() {

@Override
public void createMacroConnections(DynaWaltzContext context) {
createMacroConnections(load, LoadWithTransformers.class, this::getVarConnectionsWithLoadWithTransformers, context);
createMacroConnections(load, LoadWithTransformers.class, this::getVarConnectionsWith, context);
}

private List<VarConnection> getVarConnectionsWithLoadWithTransformers(LoadWithTransformers connected) {
private List<VarConnection> getVarConnectionsWith(LoadWithTransformers connected) {
return connected.getTapChangerVarConnections(side);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,24 +70,24 @@ public String getLib() {
@Override
public void createMacroConnections(DynaWaltzContext context) {
for (TwoWindingsTransformer transformer : transformers) {
createMacroConnections(transformer, TapChangerModel.class, this::getVarConnectionsWithTapChanger, context);
createMacroConnections(transformer, TapChangerModel.class, this::getVarConnectionsWith, context);
}
for (Load load : loadsWithTransformer) {
createMacroConnections(load, TapChangerModel.class, this::getVarConnectionsWithTapChanger, context);
createMacroConnections(load, TapChangerModel.class, this::getVarConnectionsWith, context);
}
for (String id : tapChangerAutomatonIds) {
createPureDynamicMacroConnections(id, TapChangerModel.class, this::getVarConnectionsWithTapChanger, context);
createPureDynamicMacroConnections(id, TapChangerModel.class, this::getVarConnectionsWith, context);
}
for (Bus bus : uMeasurements) {
createMacroConnections(bus.getId(), BusModel.class, this::getVarConnectionsWithBus, context);
createMacroConnections(bus.getId(), BusModel.class, this::getVarConnectionsWith, context);
}
}

private List<VarConnection> getVarConnectionsWithTapChanger(TapChangerModel connected) {
private List<VarConnection> getVarConnectionsWith(TapChangerModel connected) {
return connected.getTapChangerBlockerVarConnections();
}

private List<VarConnection> getVarConnectionsWithBus(BusModel connected) {
private List<VarConnection> getVarConnectionsWith(BusModel connected) {
return connected.getUImpinVarName()
.map(uImpinVarName -> List.of(new VarConnection("tapChangerBlocking_UMonitored", uImpinVarName)))
.orElse(Collections.emptyList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ public String getLib() {

@Override
public void createMacroConnections(DynaWaltzContext context) {
createMacroConnections(generator, GeneratorModel.class, this::getVarConnectionsWithGenerator, context);
createMacroConnections(generator, GeneratorModel.class, this::getVarConnectionsWith, context);
}

protected List<VarConnection> getVarConnectionsWithGenerator(GeneratorModel connected) {
protected List<VarConnection> getVarConnectionsWith(GeneratorModel connected) {
return Arrays.asList(
new VarConnection("underVoltageAutomaton_UMonitoredPu", connected.getUPuVarName()),
new VarConnection("underVoltageAutomaton_switchOffSignal", connected.getSwitchOffSignalAutomatonVarName())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ protected AbstractPhaseShifterAutomaton(String dynamicModelId, TwoWindingsTransf

@Override
public void createMacroConnections(DynaWaltzContext context) {
createMacroConnections(transformer, TransformerModel.class, this::getVarConnectionsWithTransformer, context);
createMacroConnections(transformer, TransformerModel.class, this::getVarConnectionsWith, context);
}

protected abstract List<VarConnection> getVarConnectionsWithTransformer(TransformerModel connected);
protected abstract List<VarConnection> getVarConnectionsWith(TransformerModel connected);
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public String getLib() {
return "PhaseShifterI";
}

protected List<VarConnection> getVarConnectionsWithTransformer(TransformerModel connected) {
protected List<VarConnection> getVarConnectionsWith(TransformerModel connected) {
return Arrays.asList(
new VarConnection("phaseShifter_tap", connected.getStepVarName()),
new VarConnection("phaseShifter_iMonitored", connected.getIMonitoredVarName()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public String getLib() {
return "PhaseShifterP";
}

protected List<VarConnection> getVarConnectionsWithTransformer(TransformerModel connected) {
protected List<VarConnection> getVarConnectionsWith(TransformerModel connected) {
return Arrays.asList(
new VarConnection("phaseShifter_tap", connected.getStepVarName()),
new VarConnection("phaseShifter_PMonitored", connected.getPMonitoredVarName()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,19 @@ public String getName() {
return EventActivePowerVariation.class.getSimpleName();
}

private List<VarConnection> getVarConnectionsWithDefaultControllableEquipment(ControllableEquipment connected) {
private List<VarConnection> getVarConnectionsWithDefault(ControllableEquipment connected) {
return List.of(new VarConnection("event_state1", connected.getDeltaPVarName()));
}

private List<VarConnection> getVarConnectionsWithControllableEquipment(ControllableEquipment connected) {
private List<VarConnection> getVarConnectionsWith(ControllableEquipment connected) {
return List.of(new VarConnection("step_step_value", connected.getDeltaPVarName()));
}

@Override
public void createMacroConnections(DynaWaltzContext context) {
createMacroConnections(getEquipment(),
ControllableEquipment.class,
context.isWithoutBlackBoxDynamicModel(getEquipment()) ? this::getVarConnectionsWithDefaultControllableEquipment : this::getVarConnectionsWithControllableEquipment,
context.isWithoutBlackBoxDynamicModel(getEquipment()) ? this::getVarConnectionsWithDefault : this::getVarConnectionsWith,
context);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ public EventInjectionDisconnection(ShuntCompensator equipment, double startTime)
this(equipment, startTime, true);
}

private List<VarConnection> getVarConnectionsWithInjectionModel(InjectionModel connected) {
private List<VarConnection> getVarConnectionsWith(InjectionModel connected) {
return List.of(new VarConnection(DISCONNECTION_VAR_CONNECT, connected.getSwitchOffSignalEventVarName()));
}

@Override
public void createMacroConnections(DynaWaltzContext context) {
createMacroConnections(getEquipment(), InjectionModel.class, this::getVarConnectionsWithInjectionModel, context);
createMacroConnections(getEquipment(), InjectionModel.class, this::getVarConnectionsWith, context);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ public String getLib() {
return "EventQuadripoleDisconnection";
}

private List<VarConnection> getVarConnectionsWithQuadripoleEquipment(QuadripoleModel connected) {
private List<VarConnection> getVarConnectionsWith(QuadripoleModel connected) {
return List.of(new VarConnection("event_state1_value", connected.getStateValueVarName()));
}

@Override
public void createMacroConnections(DynaWaltzContext context) {
createMacroConnections(getEquipment(), QuadripoleModel.class, this::getVarConnectionsWithQuadripoleEquipment, context);
createMacroConnections(getEquipment(), QuadripoleModel.class, this::getVarConnectionsWith, context);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ public String getLib() {

@Override
public void createMacroConnections(DynaWaltzContext context) {
createMacroConnections(getEquipment(), BusModel.class, this::getVarConnectionsWithBus, context);
createMacroConnections(getEquipment(), BusModel.class, this::getVarConnectionsWith, context);
}

private List<VarConnection> getVarConnectionsWithBus(BusModel connected) {
private List<VarConnection> getVarConnectionsWith(BusModel connected) {
return List.of(new VarConnection("fault_terminal", connected.getTerminalVarName()));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ public void writeParameters(XMLStreamWriter writer, DynaWaltzContext context) th
writer.writeEndElement();
}

private List<VarConnection> getVarConnectionsWithSynchronizedGenerator(SynchronizedGeneratorModel connected) {
private List<VarConnection> getVarConnectionsWith(SynchronizedGeneratorModel connected) {
return connected.getOmegaRefVarConnections();
}

private List<VarConnection> getVarConnectionsWithBus(BusModel connected) {
private List<VarConnection> getVarConnectionsWith(BusModel connected) {
return connected.getNumCCVarName()
.map(numCCVarName -> List.of(new VarConnection("numcc_node_@INDEX@", numCCVarName)))
.orElse(Collections.emptyList());
Expand All @@ -86,8 +86,8 @@ private List<VarConnection> getVarConnectionsWithBus(BusModel connected) {
public void createMacroConnections(DynaWaltzContext context) throws PowsyblException {
int index = 0;
for (SynchronizedGeneratorModel gen : synchronizedGenerators) {
createMacroConnections(gen, getVarConnectionsWithSynchronizedGenerator(gen), context, MacroConnectAttribute.ofIndex1(index));
createMacroConnections(gen.getConnectableBusId(), BusModel.class, this::getVarConnectionsWithBus, context, MacroConnectAttribute.ofIndex1(index));
createMacroConnections(gen, getVarConnectionsWith(gen), context, MacroConnectAttribute.ofIndex1(index));
createMacroConnections(gen.getConnectableBusId(), BusModel.class, this::getVarConnectionsWith, context, MacroConnectAttribute.ofIndex1(index));
index++;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ public void writeParameters(XMLStreamWriter writer, DynaWaltzContext context) th
writer.writeEndElement();
}

private List<VarConnection> getVarConnectionsWithSynchronizedGenerator(SynchronizedGeneratorModel connected) {
private List<VarConnection> getVarConnectionsWith(SynchronizedGeneratorModel connected) {
return connected.getSetPointVarConnections();
}

@Override
public void createMacroConnections(DynaWaltzContext context) throws PowsyblException {
for (SynchronizedGeneratorModel gen : synchronizedGenerators) {
createMacroConnections(gen, getVarConnectionsWithSynchronizedGenerator(gen), context);
createMacroConnections(gen, getVarConnectionsWith(gen), context);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ public List<VarMapping> getVarsMapping() {

@Override
public void createMacroConnections(DynaWaltzContext context) {
createMacroConnections(BusUtils.getConnectableBusStaticId(equipment), BusModel.class, this::getVarConnectionsWithBus, context);
createMacroConnections(BusUtils.getConnectableBusStaticId(equipment), BusModel.class, this::getVarConnectionsWith, context);
}

private List<VarConnection> getVarConnectionsWithBus(BusModel connected) {
private List<VarConnection> getVarConnectionsWith(BusModel connected) {
List<VarConnection> varConnections = new ArrayList<>(2);
varConnections.add(new VarConnection(getTerminalVarName(), connected.getTerminalVarName()));
connected.getSwitchOffSignalVarName()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public String getLib() {
return "Line";
}

private List<VarConnection> getVarConnectionsWithBus(BusModel connected, Side side) {
private List<VarConnection> getVarConnectionsWith(BusModel connected, Side side) {
return List.of(new VarConnection(getTerminalVarName(side), connected.getTerminalVarName()));
}

Expand All @@ -44,7 +44,7 @@ private String getTerminalVarName(Side side) {
public void createMacroConnections(DynaWaltzContext context) {
equipment.getTerminals().forEach(t -> {
String busStaticId = BusUtils.getConnectableBusStaticId(t);
createMacroConnections(busStaticId, BusModel.class, this::getVarConnectionsWithBus, context, SideConverter.convert(equipment.getSide(t)));
createMacroConnections(busStaticId, BusModel.class, this::getVarConnectionsWith, context, SideConverter.convert(equipment.getSide(t)));
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ protected String getTerminalVarName() {

@Override
public void createMacroConnections(DynaWaltzContext context) {
createMacroConnections(BusUtils.getConnectableBusStaticId(equipment), BusModel.class, this::getVarConnectionsWithBus, context);
createMacroConnections(BusUtils.getConnectableBusStaticId(equipment), BusModel.class, this::getVarConnectionsWith, context);
}

abstract List<VarConnection> getVarConnectionsWithBus(BusModel connected);
abstract List<VarConnection> getVarConnectionsWith(BusModel connected);

@Override
public String getSwitchOffSignalEventVarName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public List<VarMapping> getVarsMapping() {
}

@Override
protected List<VarConnection> getVarConnectionsWithBus(BusModel connected) {
protected List<VarConnection> getVarConnectionsWith(BusModel connected) {
List<VarConnection> varConnections = new ArrayList<>(2);
varConnections.add(new VarConnection(getTerminalVarName(), connected.getTerminalVarName()));
connected.getSwitchOffSignalVarName()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public List<VarMapping> getVarsMapping() {
}

@Override
protected List<VarConnection> getVarConnectionsWithBus(BusModel connected) {
protected List<VarConnection> getVarConnectionsWith(BusModel connected) {
List<VarConnection> varConnections = new ArrayList<>(3);
varConnections.add(new VarConnection(getTerminalVarName(), connected.getTerminalVarName()));
connected.getSwitchOffSignalVarName()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public String getLib() {
}

@Override
protected List<VarConnection> getVarConnectionsWithBus(BusModel connected) {
List<VarConnection> varConnections = super.getVarConnectionsWithBus(connected);
protected List<VarConnection> getVarConnectionsWith(BusModel connected) {
List<VarConnection> varConnections = super.getVarConnectionsWith(connected);
connected.getSwitchOffSignalVarName()
.map(switchOff -> new VarConnection("tapChanger_switchOffSignal1", switchOff))
.ifPresent(varConnections::add);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public String getLib() {
}

@Override
protected List<VarConnection> getVarConnectionsWithBus(BusModel connected) {
protected List<VarConnection> getVarConnectionsWith(BusModel connected) {
List<VarConnection> varConnections = new ArrayList<>(3);
varConnections.add(new VarConnection(getTransformerVar(HIGH_VOLTAGE, "terminal"), connected.getTerminalVarName()));
connected.getSwitchOffSignalVarName()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public String getLib() {
}

@Override
protected List<VarConnection> getVarConnectionsWithBus(BusModel connected) {
List<VarConnection> varConnections = super.getVarConnectionsWithBus(connected);
protected List<VarConnection> getVarConnectionsWith(BusModel connected) {
List<VarConnection> varConnections = super.getVarConnectionsWith(connected);
connected.getSwitchOffSignalVarName()
.ifPresent(switchOff -> {
varConnections.add(new VarConnection(getSwitchOffSignal(HIGH_VOLTAGE), switchOff));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* Copyright (c) 2023, RTE (http://www.rte-france.com/)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* SPDX-License-Identifier: MPL-2.0
*/
package com.powsybl.dynawaltz.models.svcs;

import com.powsybl.dynawaltz.models.InjectionModel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public String getLib() {
return transformerLib;
}

private List<VarConnection> getVarConnectionsWithBus(BusModel connected, Side side) {
private List<VarConnection> getVarConnectionsWith(BusModel connected, Side side) {
return List.of(new VarConnection(getTerminalVarName(side), connected.getTerminalVarName()));
}

Expand All @@ -50,7 +50,7 @@ private String getTerminalVarName(Side side) {
public void createMacroConnections(DynaWaltzContext context) {
equipment.getTerminals().forEach(t -> {
String busStaticId = BusUtils.getConnectableBusStaticId(t);
createMacroConnections(busStaticId, BusModel.class, this::getVarConnectionsWithBus, context, SideConverter.convert(equipment.getSide(t)));
createMacroConnections(busStaticId, BusModel.class, this::getVarConnectionsWith, context, SideConverter.convert(equipment.getSide(t)));
});
}

Expand Down