MCPcopy Create free account
hub / github.com/ahalev/python-microgrid / LoadModule

Class LoadModule

src/pymgrid/modules/load_module.py:8–121  ·  view source on GitHub ↗

A renewable energy module. The classic examples of renewables are photovoltaics (PV) and wind turbines. Parameters ---------- time_series : array-like, shape (n_steps, ) Time series of load demand. forecaster : callable, float, "oracle", or None, default None.

Source from the content-addressed store, hash-verified

6
7
8class LoadModule(BaseTimeSeriesMicrogridModule):
9 """
10 A renewable energy module.
11
12 The classic examples of renewables are photovoltaics (PV) and wind turbines.
13
14 Parameters
15 ----------
16 time_series : array-like, shape (n_steps, )
17 Time series of load demand.
18
19 forecaster : callable, float, "oracle", or None, default None.
20 Function that gives a forecast n-steps ahead.
21
22 * If ``callable``, must take as arguments ``(val_c: float, val_{c+n}: float, n: int)``, where
23
24 * ``val_c`` is the current value in the time series: ``self.time_series[self.current_step]``
25
26 * ``val_{c+n}`` is the value in the time series n steps in the future
27
28 * n is the number of steps in the future at which we are forecasting.
29
30 The output ``forecast = forecaster(val_c, val_{c+n}, n)`` must have the same sign
31 as the inputs ``val_c`` and ``val_{c+n}``.
32
33 * If ``float``, serves as a standard deviation for a mean-zero gaussian noise function
34 that is added to the true value.
35
36 * If ``"oracle"``, gives a perfect forecast.
37
38 * If ``None``, no forecast.
39
40 forecast_horizon : int.
41 Number of steps in the future to forecast. If forecaster is None, ignored and 0 is returned.
42
43 forecaster_increase_uncertainty : bool, default False
44 Whether to increase uncertainty for farther-out dates if using a GaussianNoiseForecaster. Ignored otherwise.
45
46 normalized_action_bounds : tuple of int or float, default (0, 1).
47 Bounds of normalized actions.
48 Change to (-1, 1) for e.g. an RL policy with a Tanh output activation.
49
50 raise_errors : bool, default False
51 Whether to raise errors if bounds are exceeded in an action.
52 If False, actions are clipped to the limit possible.
53
54 """
55 module_type = ('load', 'fixed')
56 yaml_tag = u"!LoadModule"
57 yaml_dumper = yaml.SafeDumper
58 yaml_loader = yaml.SafeLoader
59
60 state_components = np.array(["load"], dtype=object)
61
62 def __init__(self,
63 time_series,
64 forecaster=None,
65 forecast_horizon=DEFAULT_HORIZON,

Calls

no outgoing calls