An electrical grid module. By default, ``GridModule`` is a *fixed* module; it can be transformed to a flex module with ``GridModule.as_flex``. ``GridModule`` is the only built-in module that can be both a fixed and flex module. Parameters ---------- max_import : float
| 6 | |
| 7 | |
| 8 | class GridModule(BaseTimeSeriesMicrogridModule): |
| 9 | """ |
| 10 | An electrical grid module. |
| 11 | |
| 12 | By default, ``GridModule`` is a *fixed* module; it can be transformed to a flex module with ``GridModule.as_flex``. |
| 13 | ``GridModule`` is the only built-in module that can be both a fixed and flex module. |
| 14 | |
| 15 | Parameters |
| 16 | ---------- |
| 17 | max_import : float |
| 18 | Maximum import at any time step. |
| 19 | |
| 20 | max_export : float |
| 21 | Maximum export at any time step. |
| 22 | |
| 23 | time_series : array-like, shape (n_features, n_steps), n_features = {3, 4} |
| 24 | If n_features=3, time series of ``(import_price, export_price, co2_per_kwH)`` in each column, respectively. |
| 25 | Grid is assumed to have no outages. |
| 26 | If n_features=4, time series of ``(import_price, export_price, co2_per_kwH, grid_status)`` |
| 27 | in each column, respectively. ``time_series[:, -1]`` -- the grid status -- must be binary. |
| 28 | |
| 29 | forecaster : callable, float, "oracle", or None, default None. |
| 30 | Function that gives a forecast n-steps ahead. |
| 31 | |
| 32 | * If ``callable``, must take as arguments ``(val_c: float, val_{c+n}: float, n: int)``, where |
| 33 | |
| 34 | * ``val_c`` is the current value in the time series: ``self.time_series[self.current_step]`` |
| 35 | |
| 36 | * ``val_{c+n}`` is the value in the time series n steps in the future |
| 37 | |
| 38 | * n is the number of steps in the future at which we are forecasting. |
| 39 | |
| 40 | The output ``forecast = forecaster(val_c, val_{c+n}, n)`` must have the same sign |
| 41 | as the inputs ``val_c`` and ``val_{c+n}``. |
| 42 | |
| 43 | * If ``float``, serves as a standard deviation for a mean-zero gaussian noise function |
| 44 | that is added to the true value. |
| 45 | |
| 46 | * If ``"oracle"``, gives a perfect forecast. |
| 47 | |
| 48 | * If ``None``, no forecast. |
| 49 | |
| 50 | forecast_horizon : int. |
| 51 | Number of steps in the future to forecast. If forecaster is None, ignored and 0 is returned. |
| 52 | |
| 53 | forecaster_increase_uncertainty : bool, default False |
| 54 | Whether to increase uncertainty for farther-out dates if using a GaussianNoiseForecaster. Ignored otherwise. |
| 55 | |
| 56 | cost_per_unit_co2 : float, default 0.0 |
| 57 | Marginal cost of grid co2 production. |
| 58 | |
| 59 | normalized_action_bounds : tuple of int or float, default (0, 1). |
| 60 | Bounds of normalized actions. |
| 61 | Change to (-1, 1) for e.g. an RL policy with a Tanh output activation. |
| 62 | |
| 63 | raise_errors : bool, default False |
| 64 | Whether to raise errors if bounds are exceeded in an action. |
| 65 | If False, actions are clipped to the limit possible. |
no outgoing calls
no test coverage detected