Skip to content

Commit

Permalink
Move LineModel::getDeactivateCurrentLimitsVarName in DefaultLineModel
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
  • Loading branch information
flo-dup committed Mar 14, 2023
1 parent 0c96f5c commit 4286a9e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
import com.powsybl.dynawaltz.models.AbstractPureDynamicBlackBoxModel;
import com.powsybl.dynawaltz.models.Model;
import com.powsybl.dynawaltz.models.VarConnection;
import com.powsybl.dynawaltz.models.lines.DefaultLineModel;
import com.powsybl.dynawaltz.models.lines.LineModel;
import com.powsybl.dynawaltz.models.utils.LineSideUtils;
import com.powsybl.iidm.network.Branch;

import java.util.Arrays;
import java.util.List;
import java.util.Objects;

Expand Down Expand Up @@ -54,11 +54,15 @@ public List<VarConnection> getVarConnectionsWith(Model connected) {
throw new PowsyblException("CurrentLimitAutomaton can only connect to LineModel");
}
LineModel connectedLineModel = (LineModel) connected;
return Arrays.asList(
new VarConnection("currentLimitAutomaton_IMonitored", connectedLineModel.getIVarName(side)),
new VarConnection("currentLimitAutomaton_order", connectedLineModel.getStateVarName()),
new VarConnection("currentLimitAutomaton_AutomatonExists", connectedLineModel.getDesactivateCurrentLimitsVarName())
);
VarConnection iConnection = new VarConnection("currentLimitAutomaton_IMonitored", connectedLineModel.getIVarName(side));
VarConnection stateConnection = new VarConnection("currentLimitAutomaton_order", connectedLineModel.getStateVarName());

if (connectedLineModel instanceof DefaultLineModel) {
VarConnection deactivationConnection = new VarConnection("currentLimitAutomaton_AutomatonExists", ((DefaultLineModel) connectedLineModel).getDesactivateCurrentLimitsVarName());
return List.of(iConnection, stateConnection, deactivationConnection);
} else {
return List.of(iConnection, stateConnection);
}
}

public String getLineStaticId() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public String getStateValueVarName() {
return "@NAME@_state_value";
}

@Override
public String getDesactivateCurrentLimitsVarName() {
return "@NAME@_desactivate_currentLimits";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,5 @@ public interface LineModel extends Model {

String getStateVarName();

String getDesactivateCurrentLimitsVarName();

String getStateValueVarName();
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,6 @@ public String getStateVarName() {
return "line_state";
}

@Override
public String getDesactivateCurrentLimitsVarName() {
return "line_desactivate_currentLimits";
}

@Override
public String getStateValueVarName() {
return getStateVarName() + "_value";
Expand Down

0 comments on commit 4286a9e

Please sign in to comment.