Description of implemented models
Introduction
Some generation models are already implemented within chronix2grid as examples for other model implementation. This chapter describes the methods they include and how to set their configuration
General inputs
In params.json there are some settings concerning the whole generation process
dt the time resolution of the final chronics that will be modeled.
planned_std standard deviation of noise for the forecasted chronics (e.g. load_p_forecasted.csv.bz2 which correspond to non-exact planned chronics.
Methods based on Generative Adversarial Networks (GAN)
Realistic chronics can be generated thanks to GAN trained on a wide chronics history.
It has been implemented for solar and wind generation in Chronix2Grid via an optional backend chronix2grid.generation.renewable.RenewableBackend.RenewableBackendGAN
RenewableBackendGAN handles previously trained neural networks that rely on tensorflow. These networks can be trained apart from chronix2grid with the source code on a public github repository that reproduces the results of a research paper. You will also have to serialize them thanks to tensorflow.train.Saver objects (see this tutorial)
Configuration
A json parameters and some tensorflow models are required. An example is available in input_data/generation/case118_l2rpn_neurips_1x_GAN. Inputs should be provided in the following structure:
- neural_network/
paramsGAN.json
- solar/
name_solar_model.data-00000-of-00001
name_solar_model.meta
name_solar_model.index
checkpoint
- wind/
name_wind_model.data-00000-of-00001
name_wind_model.meta
name_wind_model.index
checkpoint
File paramsGAN.json enables to indicate the shape of inputs in the underlying model used in training.
Each has a suffix (_wind or _solar) corresponding to the 2 separated networks.
model_name
batch_size, n_gens, n_timestep - The 3 dimensions of each training batch - batch_size x number of generators in training - number of modeled consecutive timesteps
n_events - number of events labels used in training
dim_inputs, mu, sigma - size of gaussian input vector, mean and standard deviation
Generation process
According to the Chronixgrid chosen time horizon, the backend reads the trains networks and generates as many independent prediction batches as necessary. To perform this, it generates as many random inputs (gaussian noise and event labels). Then it picks as many generators chronics as needed in the grid. An error is returned if there is not enough generators returned by the network.
Warning
The current trained network have been taken directly with the configuration of the paper with no additional tuning.
That implies in particular that GAN generation is only compatible with 2 hour time steps
The 2-days batch imply that no seasonality across year is taken into account. It could be the case by changing the training tuning in two possible ways
Growing the size of timesteps in one batch
Using event labels to model apropriate seasons
Economic dispatch generation (hydro, nuclear and thermic generators)
In the economic dispatch step, an Optimal Power Flow (OPF) is computed on the grid. Standard inputs for the dispatch step are the following:
In patterns/hydro_french.csv: a hydro guide curve pattern that represents the seasonality of the minimum and maximum hydraulic stocks
- In case/params_opf.json
step_opf_min - time resolution of the OPF in minutes. It can be 5, 10, 15, 20, 30 or multiples of 60 and has to be superior or equal to dt (generation time resolution). In case it is strictly above, interpolation is done after dispatch resolution
mode_opf - frequency at which we wan’t to solve the OPF
dispatch_by_carrier - if True, dispatch results will be returned for the whole carrier. If False, it will be returned by generator
- ramp_mode is essentially designed for debug purpose: when your OPF diverges, you may want to relax some constraints to know the reasons why the problem is unfeasible or leads to divergence
If hard, all the ramp constraints will be taken into account.
If medium, thermal ramp-constraints are skipped
If easy, thermal and hydro ramp-constraints are skipped
If none, thermal, hydro and nuclear ramp-constraints are skipped
reactive_comp - Factor applied to consumption to compensate reactive part not modelled by linear opf
pyomo - whether pypsa should use pyomo or not (boolean)
solver_name - name of solver, that you should have installed in your environment and added in your environment variables.
losses_pct - if D mode is deactivate, losses are estimated as a percentage of load.
hydro_ramp_reduction_factor - optional factor which will divide max ramp up and down to all hydro generators
slack_p_max_reduction - before dispatch, reduce Pmax of slack generator temporary to anticipate loss correction that will be a posteriori
slack_ramp_max_reduction - before dispatch, reduce ramp max (up and down) of slack generator temporary to anticipate loss correction that will be a posteriori
The object chronix2grid.generation.dispatch.EconomicDispatch:Dispatch
is an abstract class that facilitates the configuration.
It is agnostic to the technology used for dispatch computation, so some methods have to be implemented in inheriting classes.
We currently enable to solve a simplified OPF that minimizes costs with respect towards the following constraints:
Match the net load - i.e. load minus solar and wind prod plus total loss
Features of each generator: Pmin, Pmax, Ramps up and down (min et max)
Hydro production should not go out of the hydro pattern guide curves
An inheriting class PypsaDispatchBackend.PypsaEconomicDispatch.PypsaDispatcher
has been implemented to perform OPF thanks to
PyPSA package. Don’t forget to install pypsa manually to be able to run it.
Correction a posterori with simulated loss
After computing the solution of the dispatch, it is possible to use a simulator of the grid to compute realistic loss a posteriori, on the basis og these chronics. We use grid2op to achieve this simulation.
It is optional and set in case/params_opf.json
loss_grid2op_simulation - boolean to specify if we wan’t to compute the simulation. If not provided, the user is warned that we assume it is False.
idxSlack and genSlack - id and name of the slack generator, on which the loss will be deduced from the production by convention
early_stopping_mode - after the simulation, the modification of the slack generator production can lead to violation of one or several constraints on this generator (Pmax, Pmin, max and min ramp-up, max and min ramp_down). If early_stopping_mode is true, an error is returned and the generation is aborted. If false, a warning that quantifies the violation is returned.
agent_type - represents the type of grid2op agent. Can be reco for RecoPowerLineAgent or do-nothing for DoNothingAgent. Currently, there is only the DoNothingAgent handled
At the end of this step, the files prod_p.csv.bz2 prod_p_forecasted.csv.bz2 are edited to modify the slack generator production chronic.
Note
If no loss_grid2op_simulation is provided, chronix2grid follows considering it is False