-
Notifications
You must be signed in to change notification settings - Fork 43
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
CGMES: remove extension for Control Areas, use IIDM Area #3149
Open
zamarrenolm
wants to merge
21
commits into
main
Choose a base branch
from
remove_cgmes_control_areas_extension
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
9bc3e5c
CGMES: remove extension for Control Areas, use iidm Area
zamarrenolm f164ae5
add energy identification code EIC as alias
zamarrenolm 8831363
do not delete existing cgmes extension
zamarrenolm 38c02c9
copy the cgmes control area type to the iidm area type
zamarrenolm df99a96
use iidm area for cgmes export of control areas, adjust unit tests
zamarrenolm 9387a35
always set pTolerance; adjust unit tests
zamarrenolm 5019069
Merge branch 'main' into remove_cgmes_control_areas_extension
zamarrenolm c67ca0c
Merge branch 'main' into remove_cgmes_control_areas_extension
zamarrenolm 69026ac
EIC code and target for default control area created for export
zamarrenolm e946c3f
Merge branch 'main' into remove_cgmes_control_areas_extension
zamarrenolm 20cd5e5
p tolerance positive, by default 1% of net interchange
zamarrenolm ee15e39
refactor writing of tie flows in equipment export
zamarrenolm 0af40d1
determine if a boundary should be ac or dc based on the reference data
zamarrenolm f51309f
move control area conversion to specific class
zamarrenolm 53cb10d
int for size of list
zamarrenolm 81b63e3
import tie flow sets the ac/dc type
zamarrenolm f2a31ac
Merge branch 'main' into remove_cgmes_control_areas_extension
zamarrenolm c081ba2
remove legacy extension, adapt unit tests
zamarrenolm cc60a53
remove local directory
zamarrenolm 4f9d471
explicit creation of default control area of type interchange
zamarrenolm d264397
control area net interchange tolerance is optional, no default value …
zamarrenolm 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 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 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 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
47 changes: 47 additions & 0 deletions
47
...conversion/src/main/java/com/powsybl/cgmes/conversion/elements/ControlAreaConversion.java
This file contains 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,47 @@ | ||
/** | ||
Copyright (c) 2024, 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.cgmes.conversion.elements; | ||
|
||
import com.powsybl.cgmes.conversion.Context; | ||
import com.powsybl.cgmes.model.CgmesNames; | ||
import com.powsybl.iidm.network.Area; | ||
import com.powsybl.triplestore.api.PropertyBag; | ||
|
||
/** | ||
* @author Luma Zamarreño {@literal <zamarrenolm at aia.es>} | ||
*/ | ||
public class ControlAreaConversion extends AbstractIdentifiedObjectConversion { | ||
|
||
public ControlAreaConversion(PropertyBag area, Context context) { | ||
super(CgmesNames.CONTROL_AREA, area, context); | ||
} | ||
|
||
@Override | ||
public boolean valid() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public void convert() { | ||
String controlAreaId = p.getId(CgmesNames.CONTROL_AREA); | ||
String type = p.getLocal("controlAreaType"); | ||
Area area = context.network().newArea() | ||
.setAreaType(type) // Copy the type defined by CGMES | ||
.setId(controlAreaId) | ||
.setName(p.getLocal("name")) | ||
.setInterchangeTarget(p.asDouble("netInterchange", Double.NaN)) | ||
.add(); | ||
if (p.containsKey(CgmesNames.P_TOLERANCE)) { | ||
String pTolerance = p.get(CgmesNames.P_TOLERANCE); | ||
area.setProperty(CgmesNames.P_TOLERANCE, pTolerance); | ||
} | ||
if (p.containsKey(CgmesNames.ENERGY_IDENT_CODE_EIC)) { | ||
area.addAlias(p.get(CgmesNames.ENERGY_IDENT_CODE_EIC), CgmesNames.ENERGY_IDENT_CODE_EIC); | ||
} | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
...mes-conversion/src/main/java/com/powsybl/cgmes/conversion/elements/TieFlowConversion.java
This file contains 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,63 @@ | ||
/** | ||
Copyright (c) 2024, 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.cgmes.conversion.elements; | ||
|
||
import com.powsybl.cgmes.conversion.Context; | ||
import com.powsybl.cgmes.conversion.RegulatingTerminalMapper; | ||
import com.powsybl.cgmes.model.CgmesNames; | ||
import com.powsybl.cgmes.model.CgmesTerminal; | ||
import com.powsybl.iidm.network.Area; | ||
import com.powsybl.iidm.network.Boundary; | ||
import com.powsybl.triplestore.api.PropertyBag; | ||
|
||
/** | ||
* @author Luma Zamarreño {@literal <zamarrenolm at aia.es>} | ||
*/ | ||
public class TieFlowConversion extends AbstractIdentifiedObjectConversion { | ||
|
||
public TieFlowConversion(PropertyBag tieFlow, Context context) { | ||
super(CgmesNames.TIE_FLOW, tieFlow, context); | ||
} | ||
|
||
@Override | ||
public boolean valid() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public void convert() { | ||
String controlAreaId = p.getId(CgmesNames.CONTROL_AREA); | ||
Area area = context.network().getArea(controlAreaId); | ||
if (area == null) { | ||
context.ignored("Tie Flow", String.format("Tie Flow %s refers to a non-existing control area", p.getId("TieFlow"))); | ||
return; | ||
} | ||
String terminalId = p.getId("terminal"); | ||
boolean isAc = isConsideredAcTieFlow(terminalId); | ||
Boundary boundary = context.terminalMapping().findBoundary(terminalId, context.cgmes()); | ||
if (boundary != null) { | ||
area.newAreaBoundary() | ||
.setAc(isAc) | ||
.setBoundary(boundary) | ||
.add(); | ||
return; | ||
} | ||
RegulatingTerminalMapper.mapForTieFlow(terminalId, context) | ||
.ifPresent(t -> area.newAreaBoundary() | ||
.setAc(isAc) | ||
.setTerminal(t) | ||
.add()); | ||
} | ||
|
||
private boolean isConsideredAcTieFlow(String terminalId) { | ||
CgmesTerminal cgmesTerminal = context.cgmes().terminal(terminalId); | ||
String node = cgmesTerminal.topologicalNode() == null ? cgmesTerminal.connectivityNode() : cgmesTerminal.topologicalNode(); | ||
boolean isDc = context.boundary().isHvdc(node); | ||
return !isDc; | ||
} | ||
} |
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest you create a TieFlowConversion.java class in com.powsybl.cgmes.conversion.elements package and move that piece of code there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code moved. Had to make public a class in conversion, related to the mapping of terminals of tie flows