Skip to content

test with 10 TS #1320

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,16 @@
import com.powsybl.openrao.searchtreerao.marmot.results.InterTemporalRaoResultImpl;
import org.junit.jupiter.api.Test;

import java.io.FileOutputStream;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.zip.ZipOutputStream;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
Expand Down Expand Up @@ -160,4 +165,63 @@ void testWithPreventiveTopologicalAction() throws IOException {
assertEquals(20.0, interTemporalRaoResult.getCost(crac2.getPreventiveInstant(), timestamp2));
assertTrue(interTemporalRaoResult.isActivated(crac2.getPreventiveState(), crac2.getNetworkAction("closeBeFr2")));
}

@Test
void test10TS() throws IOException {
Network network1 = Network.read("/network/4Nodes_1_PST.uct", MarmotTest.class.getResourceAsStream("/network/4Nodes_1_PST.uct"));
Network network2 = Network.read("/network/4Nodes_1_PST.uct", MarmotTest.class.getResourceAsStream("/network/4Nodes_1_PST.uct"));
Network network3 = Network.read("/network/4Nodes_1_PST.uct", MarmotTest.class.getResourceAsStream("/network/4Nodes_1_PST.uct"));
Network network4 = Network.read("/network/4Nodes_1_PST.uct", MarmotTest.class.getResourceAsStream("/network/4Nodes_1_PST.uct"));
Network network5 = Network.read("/network/4Nodes_1_PST.uct", MarmotTest.class.getResourceAsStream("/network/4Nodes_1_PST.uct"));
Network network6 = Network.read("/network/4Nodes_1_PST.uct", MarmotTest.class.getResourceAsStream("/network/4Nodes_1_PST.uct"));
Network network7 = Network.read("/network/4Nodes_1_PST.uct", MarmotTest.class.getResourceAsStream("/network/4Nodes_1_PST.uct"));
Network network8 = Network.read("/network/4Nodes_1_PST.uct", MarmotTest.class.getResourceAsStream("/network/4Nodes_1_PST.uct"));
Network network9 = Network.read("/network/4Nodes_1_PST.uct", MarmotTest.class.getResourceAsStream("/network/4Nodes_1_PST.uct"));
Network network10 = Network.read("/network/4Nodes_1_PST.uct", MarmotTest.class.getResourceAsStream("/network/4Nodes_1_PST.uct"));

Crac crac1 = Crac.read("/crac/crac-202503251030.json", MarmotTest.class.getResourceAsStream("/crac/crac-202503251030.json"), network1);
Crac crac2 = Crac.read("/crac/crac-202503251130.json", MarmotTest.class.getResourceAsStream("/crac/crac-202503251130.json"), network2);
Crac crac3 = Crac.read("/crac/crac-202503251230.json", MarmotTest.class.getResourceAsStream("/crac/crac-202503251230.json"), network3);
Crac crac4 = Crac.read("/crac/crac-202503251330.json", MarmotTest.class.getResourceAsStream("/crac/crac-202503251330.json"), network4);
Crac crac5 = Crac.read("/crac/crac-202503251430.json", MarmotTest.class.getResourceAsStream("/crac/crac-202503251430.json"), network5);
Crac crac6 = Crac.read("/crac/crac-202503251530.json", MarmotTest.class.getResourceAsStream("/crac/crac-202503251530.json"), network6);
Crac crac7 = Crac.read("/crac/crac-202503251630.json", MarmotTest.class.getResourceAsStream("/crac/crac-202503251630.json"), network7);
Crac crac8 = Crac.read("/crac/crac-202503251730.json", MarmotTest.class.getResourceAsStream("/crac/crac-202503251730.json"), network8);
Crac crac9 = Crac.read("/crac/crac-202503251830.json", MarmotTest.class.getResourceAsStream("/crac/crac-202503251830.json"), network9);
Crac crac10 = Crac.read("/crac/crac-202503251930.json", MarmotTest.class.getResourceAsStream("/crac/crac-202503251930.json"), network10);

RaoParameters raoParameters = JsonRaoParameters.read(MarmotTest.class.getResourceAsStream("/parameters/RaoParameters_minCost_megawatt_dc.json"));

OffsetDateTime timestamp1 = OffsetDateTime.of(2025, 3, 25, 10, 30, 0, 0, ZoneOffset.UTC);
OffsetDateTime timestamp2 = OffsetDateTime.of(2025, 3, 25, 11, 30, 0, 0, ZoneOffset.UTC);
OffsetDateTime timestamp3 = OffsetDateTime.of(2025, 3, 25, 12, 30, 0, 0, ZoneOffset.UTC);
OffsetDateTime timestamp4 = OffsetDateTime.of(2025, 3, 25, 13, 30, 0, 0, ZoneOffset.UTC);
OffsetDateTime timestamp5 = OffsetDateTime.of(2025, 3, 25, 14, 30, 0, 0, ZoneOffset.UTC);
OffsetDateTime timestamp6 = OffsetDateTime.of(2025, 3, 25, 15, 30, 0, 0, ZoneOffset.UTC);
OffsetDateTime timestamp7 = OffsetDateTime.of(2025, 3, 25, 16, 30, 0, 0, ZoneOffset.UTC);
OffsetDateTime timestamp8 = OffsetDateTime.of(2025, 3, 25, 17, 30, 0, 0, ZoneOffset.UTC);
OffsetDateTime timestamp9 = OffsetDateTime.of(2025, 3, 25, 18, 30, 0, 0, ZoneOffset.UTC);
OffsetDateTime timestamp10 = OffsetDateTime.of(2025, 3, 25, 19, 30, 0, 0, ZoneOffset.UTC);

Map<OffsetDateTime, RaoInput> inputPerTimestamp = new HashMap<>();
inputPerTimestamp.put(timestamp1, RaoInput.build(network1, crac1).build());
inputPerTimestamp.put(timestamp2, RaoInput.build(network2, crac2).build());
inputPerTimestamp.put(timestamp3, RaoInput.build(network3, crac3).build());
inputPerTimestamp.put(timestamp4, RaoInput.build(network4, crac4).build());
inputPerTimestamp.put(timestamp5, RaoInput.build(network5, crac5).build());
inputPerTimestamp.put(timestamp6, RaoInput.build(network6, crac6).build());
inputPerTimestamp.put(timestamp7, RaoInput.build(network7, crac7).build());
inputPerTimestamp.put(timestamp8, RaoInput.build(network8, crac8).build());
inputPerTimestamp.put(timestamp9, RaoInput.build(network9, crac9).build());
inputPerTimestamp.put(timestamp10, RaoInput.build(network10, crac10).build());

InterTemporalRaoInput input = new InterTemporalRaoInput(
new TemporalDataImpl<>(inputPerTimestamp),
Set.of(GeneratorConstraints.create().withGeneratorId("FFR1AA1 _generator").withLeadTime(0.0).withLagTime(0.0).withPMin(0.0).withPMax(5000.0).withUpwardPowerGradient(500.0).withDownwardPowerGradient(-500.0).build())
);

InterTemporalRaoResultImpl interTemporalRaoResult = (InterTemporalRaoResultImpl) new Marmot().run(input, raoParameters).join();

assertEquals(625070.0, interTemporalRaoResult.getGlobalFunctionalCost(InstantKind.PREVENTIVE));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
{
"type": "CRAC",
"version": "2.7",
"info": "Generated by PowSyBl OpenRAO https://powsybl.readthedocs.io/projects/openrao/",
"id": "crac-202503251030",
"name": "crac-202503251030",
"timestamp": "2025-03-25T10:30:00Z",
"instants": [
{
"id": "preventive",
"kind": "PREVENTIVE"
},
{
"id": "outage",
"kind": "OUTAGE"
},
{
"id": "curative",
"kind": "CURATIVE"
}
],
"networkElementsNamePerId": {},
"contingencies": [
{
"id": "Contingency FR2 FR3 1",
"networkElementsIds": [
"FFR2AA1 FFR3AA1 1"
]
}
],
"flowCnecs": [
{
"id": "fr1Fr4Preventive",
"name": "fr1Fr4Preventive",
"networkElementId": "FFR1AA1 FFR4AA1 1",
"operator": "FR",
"instant": "preventive",
"contingencyId": null,
"optimized": true,
"monitored": false,
"iMax": [
NaN
],
"nominalV": [
400.0
],
"thresholds": [
{
"unit": "megawatt",
"min": -1000.0,
"max": 1000.0,
"side": 1
},
{
"unit": "megawatt",
"min": -1000.0,
"max": 1000.0,
"side": 2
}
]
},
{
"id": "fr1Fr4Outage",
"name": "fr1Fr4Outage",
"networkElementId": "FFR1AA1 FFR4AA1 1",
"operator": "FR",
"instant": "outage",
"contingencyId": "Contingency FR2 FR3 1",
"optimized": true,
"monitored": false,
"iMax": [
NaN
],
"nominalV": [
400.0
],
"thresholds": [
{
"unit": "megawatt",
"min": -2000.0,
"max": 2000.0,
"side": 1
},
{
"unit": "megawatt",
"min": -2000.0,
"max": 2000.0,
"side": 2
}
]
}
],
"injectionRangeActions": [
{
"id": "redispatchingAction",
"name": "redispatchingAction",
"operator": "FR",
"activationCost": 10.0,
"variationCosts": {
"up": 50.0,
"down": 50.0
},
"onInstantUsageRules": [
{
"instant": "preventive",
"usageMethod": "available"
}
],
"networkElementIdsAndKeys": {
"FFR1AA1 _generator": -1.0,
"FFR3AA1 _generator": 1.0
},
"initialSetpoint": 5000.0,
"ranges": [
{
"min": -5000.0,
"max": 5000.0
}
]
}
],
"pstRangeActions": [
{
"id": "PST_FR1_FR3",
"name": "PST_FR1_FR3",
"operator": "FR",
"onInstantUsageRules": [
{
"instant": "preventive",
"usageMethod": "available"
}
],
"networkElementId": "FFR1AA1 FFR3AA1 1",
"ranges": [
{
"min": -16,
"max": 16,
"rangeType": "absolute"
}
]
}
],
"networkActions": [
{
"id": "closeFr2Fr3-2",
"name": "closeFr2Fr3-2",
"operator": "FR",
"onInstantUsageRules": [
{
"instant": "preventive",
"usageMethod": "available"
}
],
"terminalsConnectionActions": [
{
"networkElementId": "FFR2AA1 FFR3AA1 2",
"actionType": "close"
}
]
}
]
}
Loading
Loading