Skip to content

Commit

Permalink
Update open rao to 6.2.1 (#936)
Browse files Browse the repository at this point in the history
Signed-off-by: Philippe Edwards <[email protected]>
  • Loading branch information
phiedw authored Jan 29, 2025
1 parent 1d563ca commit 1d6c71d
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<properties>
<java.version>17</java.version>
<powsybl-dependencies.version>2024.4.0</powsybl-dependencies.version>
<powsybl-open-rao.version>6.0.1</powsybl-open-rao.version>
<powsybl-open-rao.version>6.2.1</powsybl-open-rao.version>
<powsybl-open-reac.version>0.10.0</powsybl-open-reac.version>
</properties>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@
import com.powsybl.glsk.api.io.GlskDocumentImporters;
import com.powsybl.glsk.commons.ZonalData;
import com.powsybl.iidm.network.Network;
import com.powsybl.openrao.commons.Unit;
import com.powsybl.openrao.data.cracapi.Crac;
import com.powsybl.openrao.data.raoresultapi.RaoResult;
import com.powsybl.openrao.data.raoresultjson.RaoResultJsonExporter;
import com.powsybl.openrao.data.crac.api.Crac;
import com.powsybl.openrao.data.raoresult.api.RaoResult;
import com.powsybl.openrao.raoapi.json.JsonRaoParameters;
import com.powsybl.openrao.raoapi.parameters.RaoParameters;
import com.powsybl.python.commons.Directives;
Expand All @@ -31,7 +29,7 @@

import java.io.*;
import java.nio.ByteBuffer;
import java.util.Set;
import java.util.Properties;

import static com.powsybl.python.commons.Util.binaryBufferToBytes;
import static com.powsybl.python.commons.Util.doCatch;
Expand Down Expand Up @@ -127,8 +125,10 @@ public static PyPowsyblApiHeader.ArrayPointer<CCharPointer> serializeRaoResultsT
RaoResult raoResult = ObjectHandles.getGlobal().get(raoResultHandle);
Crac crac = ObjectHandles.getGlobal().get(cracHandle);
try (ByteArrayOutputStream output = new ByteArrayOutputStream()) {
new RaoResultJsonExporter().exportData(
raoResult, crac, Set.of(Unit.MEGAWATT), output);
Properties properties = new Properties();
properties.setProperty("rao-result.export.json.flows-in-amperes", "true");
properties.setProperty("rao-result.export.json.flows-in-megawatts", "true");
raoResult.write("JSON", crac, properties, output);
return Util.createByteArray(output.toByteArray());
} catch (IOException e) {
throw new PowsyblException("Could not serialize rao results : " + e.getMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import com.powsybl.commons.PowsyblException;
import com.powsybl.glsk.commons.ZonalData;
import com.powsybl.iidm.network.Network;
import com.powsybl.openrao.data.cracapi.Crac;
import com.powsybl.openrao.data.raoresultapi.RaoResult;
import com.powsybl.openrao.data.crac.api.Crac;
import com.powsybl.openrao.data.raoresult.api.RaoResult;
import com.powsybl.openrao.raoapi.Rao;
import com.powsybl.openrao.raoapi.RaoInput;
import com.powsybl.openrao.raoapi.parameters.RaoParameters;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"resources":{
"includes":[
{"pattern":".*\\.json"}
]}
}
2 changes: 1 addition & 1 deletion tests/test_rao.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def test_rao_from_buffers():
json_result = result.to_json()

assert json_result["computationStatus"] == "default"
assert list(json_result.keys()) == ['type', 'version', 'info', 'computationStatus', 'optimizationStepsExecuted', 'costResults',
assert list(json_result.keys()) == ['type', 'version', 'info', 'computationStatus', 'executionDetails', 'costResults',
'computationStatusMap', 'flowCnecResults', 'angleCnecResults', 'voltageCnecResults',
'networkActionResults', 'rangeActionResults']

Expand Down

0 comments on commit 1d6c71d

Please sign in to comment.