Analysis, results, plots and I/O

Once the grid and its time series are set up, you analyse the grid, reinforce it, inspect the results, visualise them and save your work.

Power flow analysis

analyze() runs a static, non-linear AC power flow with PyPSA and writes the results (active, reactive and apparent power as well as currents on lines and voltages at buses) to the Results object. The identification of overloading and voltage problems happens in reinforce() (via flex_opt.check_tech_constraints), not in analyze:

edisgo.analyze()                 # all time steps, MV and LV
edisgo.analyze(timesteps=ts)     # a subset of the time index
edisgo.analyze(mode="mv")        # only the MV grid

By default all time steps in edisgo.timeseries.timeindex are analysed. The troubleshooting_mode argument helps with convergence problems. The method is explained in Power flow analysis.

Grid reinforcement

reinforce() solves overloading and voltage problems by applying the reinforcement measures described in Grid reinforcement:

edisgo.reinforce()                       # reinforce everything
edisgo.reinforce(mode="mvlv")            # MV + stations
# only compute needs, keep the original topology unchanged: the costs and
# equipment changes are in the *returned* Results object, not in edisgo.results
results = edisgo.reinforce(copy_grid=True)
edisgo.reinforce(catch_convergence_problems=True)

Results

Results live in the Results object:

edisgo.results.v_res                  # bus voltages from the power flow (p.u.)
edisgo.results.s_res                  # apparent power on lines/transformers (MVA)
edisgo.results.i_res                  # currents (kA)
edisgo.results.pfa_p                  # active power flow on lines/transformers (MW)
edisgo.results.pfa_q                  # reactive power flow on lines/transformers (Mvar)
edisgo.results.equipment_changes      # lines/transformers added, changed or removed
edisgo.results.grid_expansion_costs   # cost per expanded line/transformer (kEUR)
edisgo.results.unresolved_issues      # issues reinforcement could not solve in max. iterations

How costs are computed is described in Grid-expansion costs.

Plots

eDisGo ships a range of plots — static (matplotlib) and interactive (plotly/dash). A few common ones:

edisgo.plot_mv_grid_topology()          # MV topology on a map
edisgo.plot_mv_grid()                   # general MV plot (all mv_grid_topology options)
edisgo.plot_mv_grid_expansion_costs()   # expansion costs on a map
edisgo.plot_mv_line_loading()           # line loading
edisgo.plot_mv_voltages()               # node voltages
edisgo.plot_mv_storage_integration()    # positions of integrated storage units
edisgo.histogram_voltage()              # voltage histogram
edisgo.histogram_relative_line_load()   # line-loading histogram

The interactive plots are module-level functions in edisgo.tools.plots, not methods of the EDisGo object:

from edisgo.tools.plots import plot_plotly, plot_dash

plot_plotly(edisgo)                          # interactive single-grid plot
plot_dash({"scenario A": edisgo_a,           # interactive comparison dashboard
           "scenario B": edisgo_b})

To inspect the voltage profile along a feeder, plot_voltage_over_dist() plots the LV voltage over the distance to the MV/LV transformer for one LV grid, and plot_voltage_over_dist_mv() does the same for the MV grid relative to the HV/MV station. Both can compare two EDisGo objects: plot_voltage_over_dist compares against itself by default, while plot_voltage_over_dist_mv requires a second object as its other argument.

See the eDisGo plot example with plotly notebook and the EDisGo API for all plotting options.

Saving, loading and conversion

Save the whole object (topology, time series, results) to a CSV directory (optionally as a ZIP archive) or to a pickle:

edisgo.save("path/to/dir", save_topology=True, save_timeseries=True, save_results=True)
edisgo.save_edisgo_to_pickle()

Reload with import_edisgo_from_files() (CSV directory / ZIP) or import_edisgo_from_pickle().

Note

save_edisgo_to_json() does not serialise the full EDisGo object — it exports the grid in PowerModels network-data format (via to_powermodels()) for the Julia OPF, and cannot be reloaded as an EDisGo object.

The grid can also be converted to other representations:

edisgo.to_pypsa()        # PyPSA Network (power flow / LOPF)
edisgo.to_powermodels()  # PowerModels.jl input (optimisation)
edisgo.to_graph()        # networkx Graph

Memory use on large grids can be reduced with reduce_memory() and spatial_complexity_reduction() (see Complexity reduction).