Skip to content

Commit

Permalink
feat: add query for extracting remaining capacity per station group
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkleiven committed Oct 7, 2024
1 parent d1fb91c commit ada0356
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/cimsparql/sparql/remaining_capacity_per_station_group.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Name: Remaining capacity per station group
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX SN: <http://www.statnett.no/CIM-schema-cim15-extension#>
PREFIX cim: <http://iec.ch/TC57/2013/CIM-schema-cim16#>

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 <http://entsoe.eu/CIM/EquipmentCore/3/1> ?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)

0 comments on commit ada0356

Please sign in to comment.