Skip to content

microgrid.cli.inputs

A dataset (microgrid.cli.dataset) as the engine's inputs: each entry by its name, in the engine's units. The step from what was read to Inputs; the reader returns series only.

NO_DC_FORECAST module-attribute

NO_DC_FORECAST: Final = 'none: no forecast'

The source a DC-bus load's forecast names when none was given (no_dc_forecast).

ASSUMED_DC_LOAD module-attribute

ASSUMED_DC_LOAD: Final = 'dc_load_forecast'

The client's own cause (kept beside the engine's, never in place of one) where it valued a plant's DC-bus loads on no_dc_forecast: the engine was given a forecast, so it names nothing; the command does.

inputs

inputs(
    dataset: Dataset, *, has_dc_loads: bool = False
) -> Inputs

The engine's inputs, by their names (microgrid.cli.dataset), each in the engine's units: the SOC a fraction, power kW, prices per kWh. Raises DatasetError for an entry of the wrong kind or a unit that is not its quantity's (no unit is a fraction for the SOC, and none at all for a forecast).

currency

currency(dataset: Dataset) -> str | None

The currency the dataset's prices are in: what their units name before the / (EUR of EUR/MWh); None where none names one. Raises DatasetError where two name different ones: a currency is never converted, so a dataset's prices must all be in one.

recorded_prices

recorded_prices(dataset: Dataset) -> Dataset

dataset with its recorded prices (import_price, export_price) per kWh, as its forecast prices are read (a per-MWh price converted; no unit: per kWh). Raises DatasetError for a unit that is not a price's, or prices in more than one currency (currency).

no_dc_forecast

no_dc_forecast(
    now: datetime,
    horizon: timedelta,
    step: timedelta = SLOT,
) -> Forecast[float]

A DC-bus load's forecast where no source gives one: 0 from the slot of step under way at now (the engine's EngineConfig.slot) to the horizon's end and a slot beyond, as one interval, so it holds every slot of the valuation whatever their length; issued at now (so it never makes the load forecast's as_of older than the house's). The plant model then holds the battery for a session only from the SOC it reads (the hold rule; nothing here forecasts a load: R-9). A client that values on it says so: ASSUMED_DC_LOAD.

prices_in_force

prices_in_force(
    prices: Series[Forecast[Price]],
) -> tuple[Series[float], Series[float]]

The import and the export price in force over time, as a client that received prices' issues knew them (what a ledger is charged at where no price was recorded as it took effect: a dataset with price forecasts alone). At each moment, the value of the issue received last by then, where it covers that moment, as the engine reads prices (the issue received last, alone); none where it does not. An issue counts from when it was received, never before: nothing is read ahead.