edisgo.io.pypsa_io ================== .. py:module:: edisgo.io.pypsa_io .. autoapi-nested-parse:: This module provides tools to convert eDisGo representation of the network topology to PyPSA data model. Call :func:`to_pypsa` to retrieve the PyPSA network container. Functions --------- .. autoapisummary:: edisgo.io.pypsa_io.to_pypsa edisgo.io.pypsa_io.set_seed edisgo.io.pypsa_io.process_pfa_results Module Contents --------------- .. py:function:: to_pypsa(edisgo_object, mode=None, timesteps=None, **kwargs) Convert grid to :pypsa:`PyPSA.Network` representation. You can choose between translation of the MV and all underlying LV grids (mode=None (default)), the MV network only (mode='mv' or mode='mvlv') or a single LV network (mode='lv'). :param edisgo_object: EDisGo object containing grid topology and time series information. :type edisgo_object: :class:`~.EDisGo` :param mode: Determines network levels that are translated to :pypsa:`PyPSA.Network`. See `mode` parameter in :attr:`~.edisgo.EDisGo.to_pypsa` for more information. :type mode: str :param timesteps: See `timesteps` parameter in :attr:`~.edisgo.EDisGo.to_pypsa` for more information. :type timesteps: :pandas:`pandas.DatetimeIndex` or :pandas:`pandas.Timestamp` :param See other parameters in :attr:`~.edisgo.EDisGo.to_pypsa` for more: :param information.: :returns: :pypsa:`PyPSA.Network` representation. :rtype: :pypsa:`PyPSA.Network` .. py:function:: set_seed(edisgo_obj, pypsa_network) Set initial guess for the Newton-Raphson algorithm. In `PyPSA `_ an initial guess for the Newton-Raphson algorithm used in the power flow analysis can be provided to speed up calculations. For PQ buses, which besides the slack bus, is the only bus type in edisgo, voltage magnitude and angle need to be guessed. If the power flow was already conducted for the required time steps and buses, the voltage magnitude and angle results from previously conducted power flows stored in :attr:`~.network.results.Results.pfa_v_mag_pu_seed` and :attr:`~.network.results.Results.pfa_v_ang_seed` are used as the initial guess. Always the latest power flow calculation is used and only results from power flow analyses including the MV level are considered, as analysing single LV grids is currently not in the focus of edisgo and does not require as much speeding up, as analysing single LV grids is usually already quite quick. If for some buses or time steps no power flow results are available, default values are used. For the voltage magnitude the default value is 1 and for the voltage angle 0. :param edisgo_obj: :type edisgo_obj: :class:`~.EDisGo` :param pypsa_network: Pypsa network in which seed is set. :type pypsa_network: :pypsa:`pypsa.Network` .. py:function:: process_pfa_results(edisgo, pypsa, timesteps, dtype='float') Passing power flow results from PyPSA to :class:`~.network.results.Results`. :param edisgo: :type edisgo: :class:`~.EDisGo` :param pypsa: The PyPSA network to retrieve results from. :type pypsa: :pypsa:`pypsa.Network` :param timesteps: Time steps for which latest power flow analysis was conducted and for which to retrieve pypsa results. :type timesteps: :pandas:`pandas.DatetimeIndex` or :pandas:`pandas.Timestamp` .. rubric:: Notes P and Q are returned from the line ending/transformer side with highest apparent power S, exemplary written as .. math:: S_{max} = max(\sqrt{P_0^2 + Q_0^2}, \sqrt{P_1^2 + Q_1^2}) \ P = P_0 P_1(S_{max}) \ Q = Q_0 Q_1(S_{max}) .. seealso:: :class:`~.network.results.Results`, :py:obj:`analysis`