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

Class RenewableModule

src/pymgrid/modules/renewable_module.py:8–118  ·  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 renewable production. forecaster : callable, float, "oracle", or None, default

Source from the content-addressed store, hash-verified

6
7
8class RenewableModule(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 renewable production.
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 provided_energy_name: str, default "renewable_used"
47 Name of the energy provided by this module, to be used in logging.
48
49 normalized_action_bounds : tuple of int or float, default (0, 1).
50 Bounds of normalized actions.
51 Change to (-1, 1) for e.g. an RL policy with a Tanh output activation.
52
53 raise_errors : bool, default False
54 Whether to raise errors if bounds are exceeded in an action.
55 If False, actions are clipped to the limit possible.
56
57 """
58 module_type = ('renewable', 'flex')
59 yaml_tag = u"!RenewableModule"
60 yaml_loader = yaml.SafeLoader
61 yaml_dumper = yaml.SafeDumper
62
63 state_components = np.array(["renewable"], dtype=object)
64
65 def __init__(self,

Calls

no outgoing calls