-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into emf_subnetworks
- Loading branch information
Showing
4 changed files
with
165 additions
and
10 deletions.
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
68 changes: 68 additions & 0 deletions
68
glsk/glsk-document-cse/src/test/java/com/powsybl/glsk/cse/ZonalGlsksTest.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,68 @@ | ||
/* | ||
* 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/. | ||
* SPDX-License-Identifier: MPL-2.0 | ||
*/ | ||
package com.powsybl.glsk.cse; | ||
|
||
import com.powsybl.glsk.api.GlskDocument; | ||
import com.powsybl.glsk.api.io.GlskDocumentImporters; | ||
import com.powsybl.glsk.commons.GlskException; | ||
import com.powsybl.iidm.network.Network; | ||
import com.powsybl.sensitivity.SensitivityVariableSet; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
/** | ||
* @author Sebastien Murgey {@literal <sebastien.murgey at rte-france.com>} | ||
*/ | ||
class ZonalGlsksTest { | ||
private static final double EPSILON = 1e-3; | ||
|
||
@Test | ||
void checkZonalGlskFromManualGskBlocks() { | ||
Network network = Network.read("testCase.xiidm", getClass().getResourceAsStream("/testCase.xiidm")); | ||
CseGlskDocument cseGlskDocument = CseGlskDocument.importGlsk(getClass().getResourceAsStream("/testGlskOnlyLinear.xml"), false, true); | ||
SensitivityVariableSet manualGlskSensi = cseGlskDocument.getZonalGlsks(network).getData("FR_MANUAL"); | ||
|
||
assertNotNull(manualGlskSensi); | ||
assertEquals(0.7, manualGlskSensi.getVariable("FFR1AA1 _generator").getWeight(), EPSILON); | ||
assertEquals(0.3, manualGlskSensi.getVariable("FFR3AA1 _generator").getWeight(), EPSILON); | ||
} | ||
|
||
@Test | ||
void checkZonalGlskFromProportionalGskBlocks() { | ||
Network network = Network.read("testCase.xiidm", getClass().getResourceAsStream("/testCase.xiidm")); | ||
GlskDocument cseGlskDocument = GlskDocumentImporters.importGlsk(getClass().getResourceAsStream("/testGlskOnlyLinear.xml")); | ||
SensitivityVariableSet glskSensi = cseGlskDocument.getZonalGlsks(network).getData("FR_PROPGSK"); | ||
|
||
assertNotNull(glskSensi); | ||
assertEquals(0.286, glskSensi.getVariable("FFR1AA1 _generator").getWeight(), EPSILON); | ||
assertEquals(0.286, glskSensi.getVariable("FFR2AA1 _generator").getWeight(), EPSILON); | ||
assertEquals(0.428, glskSensi.getVariable("FFR3AA1 _generator").getWeight(), EPSILON); | ||
} | ||
|
||
@Test | ||
void checkZonalGlskFromProportionalGlskBlocks() { | ||
Network network = Network.read("testCase.xiidm", getClass().getResourceAsStream("/testCase.xiidm")); | ||
CseGlskDocument cseGlskDocument = CseGlskDocument.importGlsk(getClass().getResourceAsStream("/testGlskOnlyLinear.xml"), false, true); | ||
SensitivityVariableSet glskSensi = cseGlskDocument.getZonalGlsks(network).getData("FR_PROPGLSK"); | ||
|
||
assertNotNull(glskSensi); | ||
assertEquals(0.2, glskSensi.getVariable("FFR1AA1 _generator").getWeight(), EPSILON); | ||
assertEquals(0.2, glskSensi.getVariable("FFR2AA1 _generator").getWeight(), EPSILON); | ||
assertEquals(0.3, glskSensi.getVariable("FFR3AA1 _generator").getWeight(), EPSILON); | ||
assertEquals(0.067, glskSensi.getVariable("FFR1AA1 _load").getWeight(), EPSILON); | ||
assertEquals(0.233, glskSensi.getVariable("FFR2AA1 _load").getWeight(), EPSILON); | ||
} | ||
|
||
@Test | ||
void checkZonalGlskFailsWithNonLinearGlskBlocks() { | ||
Network network = Network.read("testCase.xiidm", getClass().getResourceAsStream("/testCase.xiidm")); | ||
CseGlskDocument cseGlskDocument = CseGlskDocument.importGlsk(getClass().getResourceAsStream("/testGlsk.xml"), false, true); | ||
assertThrows(GlskException.class, () -> cseGlskDocument.getZonalGlsks(network)); | ||
} | ||
} |
79 changes: 79 additions & 0 deletions
79
glsk/glsk-document-cse/src/test/resources/testGlskOnlyLinear.xml
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,79 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<GSKDocument DtdVersion="5" DtdRelease="0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="gsk-document.xsd"> | ||
<DocumentIdentification v="testGlsk"/> | ||
<DocumentVersion v="1"/> | ||
<DocumentType v="Z02"/> | ||
<ProcessType v="Z02"/> | ||
<SenderIdentification v="10VCSEEH4MMD-NDO" codingScheme="A01"/> | ||
<SenderRole v="A36"/> | ||
<ReceiverIdentification v="10X1001A1001A345" codingScheme="A01"/> | ||
<ReceiverRole v="A04"/> | ||
<CreationDateTime v="2020-09-15T17:59:09Z"/> | ||
<GSKTimeInterval v="2020-09-16T22:00Z/2020-09-16T23:00Z"/> | ||
<Domain v="10YDOM-1001A061T" codingScheme="A01"/> | ||
<TimeSeries> | ||
<TimeSeriesIdentification v="1"/> | ||
<BusinessType v="Z02"/> | ||
<Area v="FR_MANUAL" codingScheme="A01"/> | ||
<Name v="FR_MANUAL"/> | ||
<TimeInterval v="2020-09-16T22:00Z/2020-09-16T22:59Z"/> | ||
<ManualGSKBlock> | ||
<Factor v="1"/> | ||
<Node> | ||
<Name v="FFR1AA1 "/> | ||
<Factor v="70"/> | ||
</Node> | ||
<Node> | ||
<Name v="FFR3AA1 "/> | ||
<Factor v="30"/> | ||
</Node> | ||
</ManualGSKBlock> | ||
</TimeSeries> | ||
<TimeSeries> | ||
<TimeSeriesIdentification v="1"/> | ||
<BusinessType v="Z02"/> | ||
<Area v="FR_PROPGSK" codingScheme="A01"/> | ||
<Name v="FR_PROPGSK"/> | ||
<TimeInterval v="2020-09-16T22:00Z/2020-09-16T22:59Z"/> | ||
<PropGSKBlock> | ||
<Factor v="1"/> | ||
<Node> | ||
<Name v="FFR1AA1 "/> | ||
</Node> | ||
<Node> | ||
<Name v="FFR2AA1 "/> | ||
</Node> | ||
<Node> | ||
<Name v="FFR3AA1 "/> | ||
</Node> | ||
</PropGSKBlock> | ||
</TimeSeries> | ||
<TimeSeries> | ||
<TimeSeriesIdentification v="1"/> | ||
<BusinessType v="Z02"/> | ||
<Area v="FR_PROPGLSK" codingScheme="A01"/> | ||
<Name v="FR_PROPGLSK"/> | ||
<TimeInterval v="2020-09-16T22:00Z/2020-09-16T22:59Z"/> | ||
<PropGSKBlock> | ||
<Factor v="0.7"/> | ||
<Node> | ||
<Name v="FFR1AA1 "/> | ||
</Node> | ||
<Node> | ||
<Name v="FFR2AA1 "/> | ||
</Node> | ||
<Node> | ||
<Name v="FFR3AA1 "/> | ||
</Node> | ||
</PropGSKBlock> | ||
<PropLSKBlock> | ||
<Factor v="0.3"/> | ||
<Node> | ||
<Name v="FFR1AA1 "/> | ||
</Node> | ||
<Node> | ||
<Name v="FFR2AA1 "/> | ||
</Node> | ||
</PropLSKBlock> | ||
</TimeSeries> | ||
</GSKDocument> |