Skip to content

Commit

Permalink
Simplify implementation by using default one
Browse files Browse the repository at this point in the history
Signed-off-by: Sébastien Murgey <sebastien.murgey@rte-france.com>
  • Loading branch information
murgeyseb committed Sep 8, 2023
1 parent f285232 commit 59afa3d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import com.powsybl.glsk.api.GlskDocument;
import com.powsybl.glsk.api.GlskPoint;
import com.powsybl.glsk.api.util.converters.GlskPointLinearGlskConverter;
import com.powsybl.glsk.api.util.converters.GlskPointScalableConverter;
import com.powsybl.glsk.commons.CountryEICode;
import com.powsybl.glsk.commons.GlskException;
Expand Down Expand Up @@ -171,22 +170,6 @@ public List<GlskPoint> getGlskPoints(String zone) {
return cseGlskPoints.getOrDefault(zone, Collections.emptyList());
}

@Override
public ZonalData<SensitivityVariableSet> getZonalGlsks(Network network) {
Map<String, SensitivityVariableSet> zonalData = new HashMap<>();
for (Map.Entry<String, List<GlskPoint>> entry : cseGlskPoints.entrySet()) {
String area = entry.getKey();
// There is always only one GlskPoint for a zone
GlskPoint zonalGlskPoint = entry.getValue().get(0);
try {
zonalData.put(area, GlskPointLinearGlskConverter.convert(network, zonalGlskPoint));
} catch (GlskException e) {
throw new NotImplementedException("Non linear GLSK cannot be converted to linear GLSK", e);
}
}
return new ZonalDataImpl<>(zonalData);
}

@Override
public ZonalData<SensitivityVariableSet> getZonalGlsks(Network network, Instant instant) {
throw new NotImplementedException(DATA_CHRONOLOGY_NOT_HANDLED);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

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.apache.commons.lang3.NotImplementedException;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;
Expand Down Expand Up @@ -63,6 +63,6 @@ void checkZonalGlskFromProportionalGlskBlocks() {
void checkZonalGlskFailsWithNonLinearGlskBlocks() {
Network network = Network.read("testCase.xiidm", getClass().getResourceAsStream("/testCase.xiidm"));
CseGlskDocument cseGlskDocument = CseGlskDocument.importGlsk(getClass().getResourceAsStream("/testGlsk.xml"), false, true);
assertThrows(NotImplementedException.class, () -> cseGlskDocument.getZonalGlsks(network));
assertThrows(GlskException.class, () -> cseGlskDocument.getZonalGlsks(network));
}
}

0 comments on commit 59afa3d

Please sign in to comment.