Skip to content

Commit

Permalink
Attach the model to the shunt in the constructor
Browse files Browse the repository at this point in the history
Signed-off-by: RALAMBOTIANA MIORA <miora.ralambotiana@rte-france.com>
  • Loading branch information
miovd committed Mar 24, 2020
1 parent 106bab2 commit eb35f46
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ public ShuntCompensatorImpl add() {
id, getName(), isFictitious(), model,
currentSectionCount, regulatingTerminal == null ? terminal : regulatingTerminal,
voltageRegulatorOn, targetV, targetDeadband);
model.setShuntCompensator(shunt);
shunt.addTerminal(terminal);
voltageLevel.attach(terminal, false);
getNetwork().getIndex().checkAndAdd(shunt);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class ShuntCompensatorImpl extends AbstractConnectable<ShuntCompensator> impleme
double targetV, double targetDeadband) {
super(id, name, fictitious);
this.network = network;
this.model = model;
this.model = attach(model);
this.regulatingTerminal = regulatingTerminal;
int variantArraySize = network.get().getVariantManager().getVariantArraySize();
this.currentSectionCount = new TIntArrayList(variantArraySize);
Expand All @@ -59,6 +59,11 @@ class ShuntCompensatorImpl extends AbstractConnectable<ShuntCompensator> impleme
}
}

private ShuntCompensatorModelWrapper attach(ShuntCompensatorModelWrapper model) {
model.setShuntCompensator(this);
return model;
}

@Override
public ConnectableType getType() {
return ConnectableType.SHUNT_COMPENSATOR;
Expand Down

0 comments on commit eb35f46

Please sign in to comment.