From ada0356ef23abc4cac7f57ff166e5a8ec93c3713 Mon Sep 17 00:00:00 2001 From: David Kleiven Date: Mon, 7 Oct 2024 15:54:23 +0200 Subject: [PATCH] feat: add query for extracting remaining capacity per station group --- ...emaining_capacity_per_station_group.sparql | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/cimsparql/sparql/remaining_capacity_per_station_group.sparql diff --git a/src/cimsparql/sparql/remaining_capacity_per_station_group.sparql b/src/cimsparql/sparql/remaining_capacity_per_station_group.sparql new file mode 100644 index 00000000..61e9cadf --- /dev/null +++ b/src/cimsparql/sparql/remaining_capacity_per_station_group.sparql @@ -0,0 +1,27 @@ +# Name: Remaining capacity per station group +PREFIX xsd: +PREFIX SN: +PREFIX cim: + +select ?station_group (sum(?capacity_up) as ?capacity_up) (sum(?capacity_down) as ?capacity_down) (sample(?balance_responsible_name) as ?balance_responsible_name) (sample(?balance_responsible_mrid) as ?balance_responsible_mrid) where { + ?_eq_subject ?eq_repo . + service ?eq_repo { + ?s SN:ScheduleResource.marketCode ?station_group; + cim:IdentifiedObject.name ?name; + SN:ScheduleResource.BalanceResponsible ?balance_responsible ; + ^SN:GeneratingUnit.ScheduleResource ?generating_unit . + ?balance_responsible cim:IdentifiedObject.name ?balance_responsible_name; + cim:IdentifiedObject.mRID ?balance_responsible_mrid . + ?generating_unit cim:GeneratingUnit.maxOperatingP ?maxP; + cim:GeneratingUnit.minOperatingP ?minP; + ^cim:SynchronousMachine.GeneratingUnit/^cim:Terminal.ConductingEquipment ?terminal + } + + ?flow cim:SvPowerFlow.Terminal ?terminal; + cim:SvPowerFlow.p ?terminal_flow . + bind(xsd:double(str(?maxP)) + xsd:double(str(?terminal_flow)) as ?calculated_capacity_up) + bind(if(?calculated_capacity_up > 0.0, ?calculated_capacity_up, 0.0) as ?capacity_up) + + bind(xsd:double(str(?minP)) - xsd:double(str(?terminal_flow)) as ?calculated_capacity_down) + bind(if(?calculated_capacity_down > 0.0, ?calculated_capacity_down, 0.0) as ?capacity_down) +} group by (?station_group)