-
Notifications
You must be signed in to change notification settings - Fork 2
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
Cse valid/glsk merged #92
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
3a7e1b6
Change CSE GLSK import from DOM parsing to Jaxb unmarshalling
vbochetRTE 990e85f
Implement CSE GLSK import for export corner
vbochetRTE 96094e5
Variable naming and code improvement
vbochetRTE f0dde73
Update XSD for GLSK files to match functional specifications
vbochetRTE c70aea1
Fix inversion between timeseries and timeseriesexport for inarea and …
vbochetRTE 2689b5a
Add tests for block and node wrappers & for merged GLSK files import
vbochetRTE f63a550
Fix gsk-document.xsd import for schema validation
vbochetRTE 2738b6c
Adapt GlskDocumentImporter for CSE Import EC and CSE Valid EC
vbochetRTE 5feca81
Rename some variables
vbochetRTE 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
67 changes: 67 additions & 0 deletions
67
glsk/glsk-document-cse/src/main/java/com/powsybl/glsk/cse/BlockWrapper.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,67 @@ | ||
/* | ||
* Copyright (c) 2023, 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.glsk.cse; | ||
|
||
import xsd.etso_core_cmpts.QuantityType; | ||
|
||
import java.math.BigDecimal; | ||
import java.math.BigInteger; | ||
import java.util.List; | ||
import java.util.Optional; | ||
import java.util.stream.Collectors; | ||
|
||
/** | ||
* @author Vincent BOCHET {@literal <vincent.bochet at rte-france.com>} | ||
*/ | ||
public final class BlockWrapper { | ||
private final Object block; | ||
|
||
public BlockWrapper(Object block) { | ||
this.block = block; | ||
} | ||
|
||
public Object getBlock() { | ||
return block; | ||
} | ||
|
||
public Optional<BigInteger> getOrder() { | ||
try { | ||
BigInteger order = (BigInteger) block.getClass().getDeclaredField("order").get(block); | ||
return Optional.ofNullable(order); | ||
} catch (NoSuchFieldException | IllegalAccessException e) { | ||
return Optional.empty(); | ||
} | ||
} | ||
|
||
public Optional<BigDecimal> getMaximumShift() { | ||
try { | ||
QuantityType maximumShift = (QuantityType) block.getClass().getDeclaredField("maximumShift").get(block); | ||
return Optional.ofNullable(maximumShift).map(QuantityType::getV); | ||
} catch (NoSuchFieldException | IllegalAccessException e) { | ||
return Optional.empty(); | ||
} | ||
} | ||
|
||
public Optional<BigDecimal> getFactor() { | ||
try { | ||
QuantityType factor = (QuantityType) block.getClass().getDeclaredField("factor").get(block); | ||
return Optional.ofNullable(factor).map(QuantityType::getV); | ||
} catch (NoSuchFieldException | IllegalAccessException e) { | ||
return Optional.empty(); | ||
} | ||
} | ||
|
||
public Optional<List<NodeWrapper>> getNodeList() { | ||
try { | ||
List<Object> objectList = (List<Object>) block.getClass().getDeclaredField("node").get(block); | ||
return Optional.ofNullable(objectList) | ||
.map(list -> list.stream().map(NodeWrapper::new).collect(Collectors.toList())); | ||
} catch (NoSuchFieldException | IllegalAccessException e) { | ||
return Optional.empty(); | ||
} | ||
} | ||
} |
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
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.
why is Italy a special case?
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.
For Export Corner developments, the CalculationDirections (representing which countries have activated Export Corner excahnges or not) should contain only directions from a country to Italy or vice-versa. E.g.: {InArea: France, OutArea: Italy} if France has activated Export Corner exchanges, or {InArea: Italy, OutArea: France} if France has not activated Export Corner exchanges.
There is no sense to put {InArea: Italy, OutArea: Italy} because no exchange is made from Italy to itself.
But we need to handle Italy because we need to retrieve its TimeSeries. As the rules for Italy (concerning TimeSeries retrieval) are the same as the rules for countries having activated Export Corner exchanges, I decided to put it in the
countriesInArea
List.