-
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 export. Handle CGM export dependencies #2927
Conversation
When exporting a CGM, we need a Network with Subnetworks, and we expect the "profiles" to be exported to be "SSH,SV". We have to export an updated SSH for every Subnetwork (for every IGM) and a single SV for the main Network (that represents the CGM). We could have the parameter explicit, defined as the rest of configuration values in the context.isExportCommongGridModelSolution = network.getSubnetworks().size() > 1
&& parts.contains("SSH")
&& parts.contains("SV"); It would be nice to refactor the current contents of the CgmesExport::export function, splitting the code in separate methods to:
Then, when exporting the SSH instance files, we should consider whether we are exporting a CGM solution: if (context.isExportCommongGridModelSolution) {
for (Network sn : network.getSubnetworks()) {
exportUpdatedSSHForIGM(sn, ds, context, baseName, parts, masUri);
}
} else {
exportSSH(network, ds, context, baseName, parts);
} The method that outputs the updated SSH for an IGM should look like the following: void exportUpdatedSSHForIGM(Subnetwork subnetwork, ...) {
CgmesMetadataModel updatedSSHModel = new CgmesMetadataModel(CgmesSubset.STEADY_STATE_HYPOTHESIS, modelingAuthoritySet);
subnetwork
.getExtension(CgmesMetadataModels.class)
.getModelForPart(CgmesSubset.STEADY_STATE_HYPOTHESIS)
.ifPresent(ssh -> context.prepareExportedModelFrom(updatedSSHModel, ssh));
SteadyStateHypothesisExport.write(subnetwork, writer, context, updatedSSHModel);
context.igmUpdatedSshModels.add(updatedSSHModel.getId());
} The non-null check for result of |
d7b9d82
to
a902a87
Compare
Signed-off-by: Luma <zamarrenolm@aia.es>
Signed-off-by: Luma <zamarrenolm@aia.es>
Signed-off-by: Romain Courtier <romain.courtier@rte-france.com>
Signed-off-by: Romain Courtier <romain.courtier@rte-france.com>
c81b1d8
to
4dae10f
Compare
Signed-off-by: Romain Courtier <romain.courtier@rte-france.com>
Signed-off-by: Romain Courtier <romain.courtier@rte-france.com>
To build the filename template for exported SSH we should look into QoCDC rule FilenameMD. We should use a sourcing actor reference that is composed of |
* @return A model with all necessary metadata information for the export. | ||
*/ | ||
public static CgmesMetadataModel initializeModelForExport( | ||
Network network, CgmesSubset subset, CgmesExportContext context, Boolean mainNetwork, Boolean modelUpdate) { |
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 not use primitive boolean
's here? the conditions below will be more concise and readable
*/ | ||
private void updateDependenciesCGM(Collection<IgmModelsForCgm> igmModels, CgmesMetadataModel updatedCgmSvModel) { | ||
// Each updated SSH model supersedes the original one | ||
igmModels.forEach(m -> m.updatedSsh.clearDependencies()); |
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 think we must keep the dependencies of the original SSH. If we clear the dependencies, we lose the SSH dependent on the EQ. This dependency has been correctly prepared in the method initializeModelForExport
, but is removed if we clear the dependencies here.
Signed-off-by: Luma <zamarrenolm@aia.es>
Signed-off-by: Luma <zamarrenolm@aia.es>
Signed-off-by: Luma <zamarrenolm@aia.es>
Signed-off-by: Luma <zamarrenolm@aia.es>
Signed-off-by: Luma <zamarrenolm@aia.es>
Signed-off-by: Luma <zamarrenolm@aia.es>
Signed-off-by: Luma <zamarrenolm@aia.es>
Done. I added documentation for the new parameters and a brief explanation of the two main use-cases for export: IGM and CGM. |
Signed-off-by: Luma <zamarrenolm@aia.es>
Signed-off-by: Luma <zamarrenolm@aia.es>
@@ -261,6 +519,8 @@ public String getFormat() { | |||
public static final String EXPORT_POWER_FLOWS_FOR_SWITCHES = "iidm.export.cgmes.export-power-flows-for-switches"; | |||
public static final String NAMING_STRATEGY = "iidm.export.cgmes.naming-strategy"; | |||
public static final String PROFILES = "iidm.export.cgmes.profiles"; | |||
public static final String CGM_EXPORT = "iidm.export.cgmes.cgm_export"; | |||
public static final String MODEL_UPDATE = "iidm.export.cgmes.model_update"; |
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.
This parameter key is not used anymore (unless in some unit tests).
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.
removed the obsolete parameter name and its uses in unit tests
level of the PowSyBl network. | ||
|
||
## CGM (Common Grid Model) export | ||
|
||
When exporting a CGM, we need an IIDM network (CGM) that contains multiple subnetworks (one for each IGM). |
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 disagree with this part: if we want to export a CGM with EQ and TP files, we can do it too. We have 2 methods to export CGM, a quick one that you are describing and a more complex one manipulating extensions and exporting profile by profile. Both must be explained and illustrated here.
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.
Added documentation for the two ways of exporting CGM: quick and manual. Included code to illustrate both ways of generating the required files. Also added a unit test for the "manual" option, showing how metadata can be defined by the user by setting information in the related extension.
Signed-off-by: Luma <zamarrenolm@aia.es>
Signed-off-by: Luma <zamarrenolm@aia.es>
Signed-off-by: Luma <zamarrenolm@aia.es>
Signed-off-by: Luma <zamarrenolm@aia.es>
Signed-off-by: Luma <zamarrenolm@aia.es>
Signed-off-by: Luma <zamarrenolm@aia.es>
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.
Small changes in doc.
Network cgmNetwork = Network.read(CgmesConformity1Catalog.microGridBaseCaseAssembled().dataSource()); | ||
|
||
Properties exportParams = new Properties(); | ||
exportParams.put(CgmesExport.PROFILES, List.of("SV", "SSH")); |
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.
What happens here if I put "EQ", "TP", "SSH" and "SV" ?
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.
Indeed, after a small test, changing this list does not change anything. We always export SV and SSH, even if I only put SV.
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.
clarified the documentation to explicitly state that CGM quick export ignores the profiles
parameter and always exports SSH IGMs and CGM SV. Removed the parameter from the code example in the docs and from the main unit test showing its use.
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.
Have you pushed?
exportParams.put(CgmesExport.NAMING_STRATEGY, "cgmes"); | ||
// We do not want a quick CGM export | ||
exportParams.put(CgmesExport.CGM_EXPORT, false); | ||
exportParams.put(CgmesExport.UPDATE_DEPENDENCIES, false); |
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.
Are you sure update dependencies parameter is used for CGM export?
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.
yes, the update dependencies parameter is considered for both for CGM quick export and in manual network export. For CGM quick export dependencies are updated in CgmesExport::updateDependenciesCGM
. For manual network export they are handled in CgmesExport::updateDependenciesIGM
.
Signed-off-by: Luma <zamarrenolm@aia.es>
…H, SV Signed-off-by: Luma <zamarrenolm@aia.es>
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.
Thanks a lot, looks good!
Quality Gate passedIssues Measures |
Signed-off-by: Luma <zamarrenolm@aia.es> Co-authored-by: Romain Courtier <romain.courtier@rte-france.com>
Please check if the PR fulfills these requirements
Does this PR already have an issue describing the problem?
What kind of change does this PR introduce?
Feature.
What is the current behavior?
CGMES export only considers IGM (Individual Grid Model) dependencies when exporting.
What is the new behavior (if this is a feature change)?
CGMES export will consider the dependencies required for CGM (Common Grid Model) export.
A Merging Agent using PowSyBl will export first an updated SSH for each IGM,
that should contain a
Supersedes
reference to the IGM’s original SSH CIMXML file.Then, the Merging Agent should export a single SV for the whole CGM. This SV file must contain a
DependentOn
reference to each IGM’s updated SSH. The power flow of a CGM is calculated without topology processing. No new TP CIMXML files are created. This means that the CGM SV file must contain aDependentOn
reference to each IGM’s original TP.Does this PR introduce a breaking change or deprecate an API?
If yes, please check if the following requirements are fulfilled
What changes might users need to make in their application due to this PR? (migration steps)
Other information:
This change is based on #2898