flexmeasures.data.services.scheduling_result
Classes
- class flexmeasures.data.services.scheduling_result.SchedulingJobResult(unresolved_targets: dict = <factory>, resolved_targets: dict = <factory>)
Results from a scheduling job, to be stored in the job’s metadata.
JSON serializable to enable storage in RQ job metadata and retrieval via the API.
Note:
soc-targetsare modelled as hard constraints in the scheduler, meaning the scheduler will not allow any deviation from them by definition. Therefore, unmetsoc-targetsare not reported here.- classmethod from_dict(d: dict) SchedulingJobResult
Deserialize from a dict.
- resolved_targets: dict
Tightest met
soc-minimaand/orsoc-maximaconstraint per sensor.The outer dict is keyed by state-of-charge sensor ID string (
str(sensor.id)). Each value is a dict with constraint-type keys ("soc-minima"and/or"soc-maxima"), each mapping to:"datetime": ISO 8601 UTC timestamp of the constraint slot with the smallest positive margin (i.e. the tightest constraint that was still met)."margin": Non-negative headroom in kWh, formatted as e.g."40.0 kWh". Forsoc-minimathis is how far above the minimum the SoC was; forsoc-maximathis is how far below the maximum the SoC was.
An empty dict means no constraints of that type were defined (or no state-of-charge sensor is set).
Example:
{ "42": { "soc-maxima": {"datetime": "2024-01-01T12:00:00+00:00", "margin": "40.0 kWh"}, }, }
Devices with no resolved targets are absent from the outer dict.
- unresolved_targets: dict
First unmet
soc-minimaand/orsoc-maximatargets, per sensor.The outer dict is keyed by state-of-charge sensor ID string (
str(sensor.id)). Each value is a dict with constraint-type keys ("soc-minima"and/or"soc-maxima"), each mapping to:"datetime": ISO 8601 UTC timestamp of the first violated constraint."unmet": Always-positive magnitude of the violation in kWh, formatted as e.g."260.0 kWh". Forsoc-minimathis is the shortage (SoC fell short by this amount); forsoc-maximathis is the excess (SoC exceeded the target by this amount).
An empty dict means all targets have been met (or no state-of-charge sensor is set).
Example:
{ "42": { "soc-minima": {"datetime": "2024-01-01T10:00:00+00:00", "unmet": "260.0 kWh"}, }, }
Devices with no violations are absent from the outer dict.