-
Notifications
You must be signed in to change notification settings - Fork 6
Migration powsybl dependencies 2025.0.1 #517
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
Merged
Merged
Changes from all commits
Commits
Show all changes
52 commits
Select commit
Hold shift + click to select a range
e4be6ad
WIP upgrade to powsybl-dependencies 2025.0.0
e746596
WIP
3b85627
Fix bad UT removal
78375ba
adapt to powsybl upgrade
EtienneLt 6a701ee
fix commentary
EtienneLt d2a8d2b
Merge branch 'main' into upgrade_to_powsybl_dependencies_2025.0.0
EtienneLt 9ff0b50
implement battery shortcircuit extension
EtienneLt 01b6e49
test
EtienneLt 127452c
implement area
EtienneLt 6d2b94b
fix rest client for area
EtienneLt a384108
fix sonar
EtienneLt b559c76
remove useless attribute
EtienneLt d23343d
remove cmes area attributes
EtienneLt d6e2461
fix
EtienneLt ce21ef2
fix setResource
EtienneLt 0e536e3
Merge branch 'main' into upgrade_to_powsybl_dependencies_2025.0.0
EtienneLt 6db6f48
review first part
EtienneLt b2dfa84
review part 2
EtienneLt 1074b3f
refactor short circuit extension
EtienneLt 0725696
sonar fix
EtienneLt 2f4353e
try fixing
EtienneLt 101b745
fix blancks
EtienneLt cc323d4
fix blancks 2
EtienneLt bd97e88
review
EtienneLt 59d780c
review
EtienneLt ff804bb
Merge branch 'main' into upgrade_to_powsybl_dependencies_2025.0.0
Mathieu-Deharbe b3bb00d
remove old commentary
EtienneLt 08d6123
Merge branch 'main' into upgrade_to_powsybl_dependencies_2025.0.0
antoinebhs f5bd8c0
Add assertj-core as dependency to fix test in NetworkTest (cf. breaki…
rolnico 2b94616
typo
EtienneLt 5517519
Revert Add assertj-core as dependency to fix test in NetworkTest (cf.…
rolnico e44c428
remove override of tests as fixed
EtienneLt 87018b9
Use extrapolateReactiveLimitsSlope from powsybl-core instead of dupli…
rolnico f1eb227
remove else
rolnico 959b1e6
remove notification in ConnectDisconnectUtil since notifaction has be…
rolnico 54ceaeb
fix issue in ReactiveCapabilityCurveAttributes
rolnico 2ca3739
rename key in logs
EtienneLt 90d717b
use builder for ReactiveCapabilityCurveAttributes
EtienneLt 05f80c2
try fixing
EtienneLt 0a4e8d2
fix comparator
EtienneLt 7849485
add constructor + setPoints method to ReactiveCapabilityCurveAttribut…
rolnico 3264284
Bump to 2025.0.1
73b2656
Merge branch 'main' into upgrade_to_powsybl_dependencies_2025.0.0
f582c42
add bundle for reports
EtienneLt 9e6b7e9
review
EtienneLt 8449475
try to fix bundle for reports
EtienneLt ea71a33
try to fix bundle for reports
EtienneLt 1ce3960
move bundle to fix
EtienneLt 4e6c1ee
fix
EtienneLt e8d84e9
fix get attribute when variant does not exist
EtienneLt 0c36dcf
revert as it is fixed in another pr
EtienneLt 3d5fe0c
Merge branch 'main' into upgrade_to_powsybl_dependencies_2025.0.0
antoinebhs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
network-store-iidm-impl/src/main/java/com/powsybl/network/store/iidm/impl/AreaAdderImpl.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/** | ||
* Copyright (c) 2025, 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/. | ||
*/ | ||
package com.powsybl.network.store.iidm.impl; | ||
|
||
import com.powsybl.iidm.network.*; | ||
import com.powsybl.network.store.model.AreaAttributes; | ||
import com.powsybl.network.store.model.Resource; | ||
import com.powsybl.network.store.model.ResourceType; | ||
|
||
import java.util.*; | ||
|
||
/** | ||
* @author Etienne Lesot <etienne.lesot at rte-france.com> | ||
*/ | ||
public class AreaAdderImpl extends AbstractIdentifiableAdder<AreaAdderImpl> implements AreaAdder { | ||
|
||
private String areaType; | ||
private final Map<Terminal, Boolean> terminalAreaBoundaries; | ||
private final Map<Boundary, Boolean> boundaryAreaBoundaries; | ||
private final Set<String> voltageLevelIds; | ||
private double interchangeTarget; | ||
|
||
AreaAdderImpl(NetworkObjectIndex index) { | ||
super(index); | ||
terminalAreaBoundaries = new HashMap<>(); | ||
boundaryAreaBoundaries = new HashMap<>(); | ||
voltageLevelIds = new HashSet<>(); | ||
interchangeTarget = Double.NaN; | ||
} | ||
|
||
@Override | ||
public AreaAdderImpl setAreaType(String areaType) { | ||
this.areaType = areaType; | ||
return this; | ||
} | ||
|
||
@Override | ||
public AreaAdder setInterchangeTarget(double v) { | ||
interchangeTarget = v; | ||
return this; | ||
} | ||
|
||
@Override | ||
public AreaAdder addVoltageLevel(VoltageLevel voltageLevel) { | ||
voltageLevelIds.add(voltageLevel.getId()); | ||
return this; | ||
} | ||
|
||
@Override | ||
public AreaAdder addAreaBoundary(Terminal terminal, boolean ac) { | ||
terminalAreaBoundaries.put(terminal, ac); | ||
return this; | ||
} | ||
|
||
@Override | ||
public AreaAdder addAreaBoundary(Boundary boundary, boolean ac) { | ||
boundaryAreaBoundaries.put(boundary, ac); | ||
return this; | ||
} | ||
|
||
@Override | ||
public Area add() { | ||
String id = checkAndGetUniqueId(); | ||
Resource<AreaAttributes> resource = Resource.areaBuilder() | ||
.id(id) | ||
.variantNum(index.getWorkingVariantNum()) | ||
.attributes(AreaAttributes.builder() | ||
.name(getName()) | ||
.fictitious(isFictitious()) | ||
.areaType(areaType) | ||
.interchangeTarget(interchangeTarget) | ||
.voltageLevelIds(new LinkedHashSet<>()) | ||
.areaBoundaries(new ArrayList<>()) | ||
.build()) | ||
.build(); | ||
AreaImpl area = getIndex().createArea(resource); | ||
terminalAreaBoundaries.forEach((terminal, ac) -> area.newAreaBoundary().setTerminal(terminal).setAc(ac).add()); | ||
boundaryAreaBoundaries.forEach((boundary, ac) -> area.newAreaBoundary().setBoundary(boundary).setAc(ac).add()); | ||
voltageLevelIds.forEach(voltageLevelId -> index.getVoltageLevel(voltageLevelId) | ||
.ifPresent(voltageLevel -> voltageLevel.addArea(area))); | ||
return area; | ||
} | ||
|
||
@Override | ||
protected String getTypeDescription() { | ||
return ResourceType.AREA.getDescription(); | ||
} | ||
|
||
} |
78 changes: 78 additions & 0 deletions
78
...re-iidm-impl/src/main/java/com/powsybl/network/store/iidm/impl/AreaBoundaryAdderImpl.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/** | ||
* Copyright (c) 2025, 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/. | ||
*/ | ||
package com.powsybl.network.store.iidm.impl; | ||
Mathieu-Deharbe marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
import com.powsybl.commons.PowsyblException; | ||
import com.powsybl.iidm.network.Area; | ||
import com.powsybl.iidm.network.AreaBoundaryAdder; | ||
import com.powsybl.iidm.network.Boundary; | ||
import com.powsybl.iidm.network.Terminal; | ||
import com.powsybl.network.store.model.AreaBoundaryAttributes; | ||
import com.powsybl.network.store.model.TerminalRefAttributes; | ||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* @author Etienne Lesot <etienne.lesot at rte-france.com> | ||
*/ | ||
public class AreaBoundaryAdderImpl implements AreaBoundaryAdder { | ||
AreaImpl area; | ||
antoinebhs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Boundary boundary; | ||
|
||
Terminal terminal; | ||
|
||
Boolean ac; | ||
|
||
NetworkObjectIndex index; | ||
|
||
AreaBoundaryAdderImpl(AreaImpl area, NetworkObjectIndex index) { | ||
this.area = Objects.requireNonNull(area); | ||
this.index = Objects.requireNonNull(index); | ||
} | ||
|
||
@Override | ||
public AreaBoundaryAdder setBoundary(Boundary boundary) { | ||
this.boundary = boundary; | ||
antoinebhs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
this.terminal = null; | ||
return this; | ||
} | ||
|
||
@Override | ||
public AreaBoundaryAdder setTerminal(Terminal terminal) { | ||
this.terminal = terminal; | ||
this.boundary = null; | ||
return this; | ||
} | ||
|
||
@Override | ||
public AreaBoundaryAdder setAc(boolean ac) { | ||
this.ac = ac; | ||
return this; | ||
} | ||
|
||
@Override | ||
public Area add() { | ||
if (ac == null) { | ||
throw new PowsyblException("AreaBoundary AC flag is not set."); | ||
} | ||
// we remove before adding, to forbid duplicates and allow updating ac to true/false | ||
AreaBoundaryAttributes areaBoundaryAttributes; | ||
if (boundary != null) { | ||
areaBoundaryAttributes = new AreaBoundaryAttributes(null, ac, area.getId(), boundary.getDanglingLine().getId()); | ||
area.removeAreaBoundary(boundary); | ||
} else if (terminal != null) { | ||
TerminalRefAttributes terminalRefAttributes = TerminalRefUtils.getTerminalRefAttributes(terminal); | ||
areaBoundaryAttributes = new AreaBoundaryAttributes(terminalRefAttributes, ac, area.getId(), null); | ||
area.removeAreaBoundary(terminal); | ||
} else { | ||
throw new PowsyblException("No AreaBoundary element (terminal or boundary) is set."); | ||
} | ||
area.addAreaBoundary(new AreaBoundaryImpl(areaBoundaryAttributes, index)); | ||
return area; | ||
} | ||
} |
71 changes: 71 additions & 0 deletions
71
...k-store-iidm-impl/src/main/java/com/powsybl/network/store/iidm/impl/AreaBoundaryImpl.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/** | ||
* Copyright (c) 2025, 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/. | ||
*/ | ||
package com.powsybl.network.store.iidm.impl; | ||
|
||
import com.powsybl.iidm.network.Area; | ||
import com.powsybl.iidm.network.AreaBoundary; | ||
import com.powsybl.iidm.network.Boundary; | ||
import com.powsybl.iidm.network.Terminal; | ||
import com.powsybl.iidm.network.util.DanglingLineBoundaryImpl; | ||
import com.powsybl.network.store.model.AreaBoundaryAttributes; | ||
import com.powsybl.network.store.model.TerminalRefAttributes; | ||
|
||
import java.util.Optional; | ||
|
||
/** | ||
* @author Etienne Lesot <etienne.lesot at rte-france.com> | ||
*/ | ||
public class AreaBoundaryImpl implements AreaBoundary { | ||
|
||
private final NetworkObjectIndex index; | ||
|
||
private final AreaBoundaryAttributes areaBoundaryAttributes; | ||
|
||
protected AreaBoundaryImpl(AreaBoundaryAttributes areaBoundaryAttributes, NetworkObjectIndex index) { | ||
this.index = index; | ||
this.areaBoundaryAttributes = areaBoundaryAttributes; | ||
} | ||
|
||
@Override | ||
public Area getArea() { | ||
return this.index.getArea(areaBoundaryAttributes.getAreaId()).orElse(null); | ||
} | ||
|
||
@Override | ||
public Optional<Terminal> getTerminal() { | ||
return Optional.ofNullable(getRefTerminal()); | ||
} | ||
|
||
private Terminal getRefTerminal() { | ||
TerminalRefAttributes terminalRefAttributes = areaBoundaryAttributes.getTerminal(); | ||
return TerminalRefUtils.getTerminal(index, terminalRefAttributes); | ||
} | ||
|
||
@Override | ||
public Optional<Boundary> getBoundary() { | ||
if (areaBoundaryAttributes.getBoundaryDanglingLineId() == null) { | ||
return Optional.empty(); | ||
} | ||
Optional<DanglingLineImpl> danglingLine = index.getDanglingLine(areaBoundaryAttributes.getBoundaryDanglingLineId()); | ||
return danglingLine.map(DanglingLineBoundaryImpl::new); | ||
} | ||
|
||
@Override | ||
public boolean isAc() { | ||
return areaBoundaryAttributes.getAc(); | ||
} | ||
|
||
@Override | ||
public double getP() { | ||
return getBoundary().map(Boundary::getP).orElseGet(() -> getRefTerminal().getP()); | ||
} | ||
|
||
@Override | ||
public double getQ() { | ||
return getBoundary().map(Boundary::getQ).orElseGet(() -> getRefTerminal().getQ()); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.