26 lines
1.0 KiB
Python
26 lines
1.0 KiB
Python
"""Explicit identity/provenance for the OBSERVATION-ONLY Symcon receiver.
|
|
This is not a dispatch permit and does not make a shadow plan executable locally.
|
|
"""
|
|
from copy import deepcopy
|
|
|
|
|
|
def control_context(operation):
|
|
assets = {}
|
|
for b in operation['batteries']:
|
|
rearm = b.get('rearmSocPercent')
|
|
assets[b['id']] = {
|
|
'capacityKwh': b['capacityKwh'],
|
|
'minSocPercent': b['minSocPercent'],
|
|
'maxSocPercent': b['maxSocPercent'],
|
|
'physicalMinSocPercent': b.get('physicalMinSocPercent', 0.0),
|
|
'rearmSocPercent': b['minSocPercent'] if rearm is None else rearm,
|
|
'gridCharging': b['gridCharging'],
|
|
}
|
|
return {'batteries': assets, 'limits': deepcopy(operation['limits'])}
|
|
|
|
|
|
def provenance(inputs):
|
|
# Capture BEFORE optimization. Never attach a newer operation to an older plan.
|
|
return {'inputRefs': {kind: inputs[kind]['eventId'] for kind in ('operation', 'forecast', 'tariffs')},
|
|
'controlContext': control_context(inputs['operation'])}
|