Skip to content

Commit 80c97a9

Browse files
committed
Add comments in LfAcDcNetwork.java
Signed-off-by: b.perreyon <baptiste.perreyon@supergrid-institute.com>
1 parent ef2f9cc commit 80c97a9

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/main/java/com/powsybl/openloadflow/network/LfAcDcNetwork.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ public LfAcDcNetwork(List<LfNetwork> acNetworks, List<LfNetwork> dcNetworks) {
3030
this.acNetworks = List.copyOf(acNetworks);
3131
this.dcNetworks = List.copyOf(dcNetworks);
3232

33+
// Add LfElements in the LfAcDcNetwork. Their number is therefore updated to match the global LfAcDcNetwork object.
34+
// However their getNetwork() method still returns the original LfNetwork they belong to.
35+
// Having all elements in the LfAcDcNetwork allows to simulate load flow the whole connected network
36+
// The attributes acNetworks and dcNetworks also allow to access a "child" etwork individually.
3337
for (LfNetwork network : acNetworks) {
3438
network.getBuses().forEach(this::addBus);
3539
network.getBranches().forEach(this::addBranch);
@@ -40,11 +44,13 @@ public LfAcDcNetwork(List<LfNetwork> acNetworks, List<LfNetwork> dcNetworks) {
4044
network.getDcBuses().forEach(this::addDcBus);
4145
network.getDcLines().forEach(this::addDcLine);
4246
}
43-
4447
}
4548

4649
@Override
4750
public void addListener(LfNetworkListener listener) {
51+
// LfElements getNetwork() method returns the original LfNetwork they belong to.
52+
// Therefore, any listener attached to the LfAcDcNetwork should be attached to the "children" LfNetworks in order
53+
// to be triggered when accessing the original LfNetwork listeners through an LfElement via the method getNetwork()
4854
super.addListener(listener);
4955
for (LfNetwork acNetwork : acNetworks) {
5056
acNetwork.addListener(listener);

0 commit comments

Comments
 (0)