commonpower.extensions.cost_allocation.NativeShapleySimulator
- class NativeShapleySimulator(sys: System, community_controller: OptimalController, horizon: timedelta = datetime.timedelta(days=1), dt: timedelta = datetime.timedelta(seconds=3600), n_sample_coalitions: int = 100, seed: int | None = None)[source]
Bases:
BaseShapleySimulatorThis simulator simulates the (possibly) imperfect knowledge system and computes Shapley values based on the realized costs.
Simulator that simulates one (possibly) imperfect knowledge system and computes Shapley values. The given system is a template representing the entire energy community (grand coalition). For the simulation of coalitions, the template system is cloned and rearranged accordingly.
- Parameters:
sys (System) – (Template) system to simulate. Must contain exactly one top-level EnergyCommunity node.
community_controller (OptimalController) – (Template) controller for the community.
horizon (timedelta, optional) – Forecast horizon. Defaults to timedelta(days=1).
dt (timedelta, optional) – Sample time aka frequency. Defaults to timedelta(minutes=60).
n_sample_coalitions (int, optional) – Number of coalitions to sample. Defaults to 100.
seed (int, optional) – Seed for the coalition sampling. Defaults to None.
Methods
Simulate the system and compute a simulation result, including the realized cost, Shapley values, and stand-alone costs.
- simulate(sim_steps: int, fixed_start: datetime) ShapleySimulationResult[source]
Simulate the system and compute a simulation result, including the realized cost, Shapley values, and stand-alone costs.
- Parameters:
sim_steps (int) – Number of simulation steps.
fixed_start (datetime) – Start time of the simulation.
- Returns:
ShapleySimulationResult – Result of the simulation.