Non-linear power flow after LOPF

Note

You can download this example as a Jupyter notebook or start it in interactive mode.

Non-linear power flow after LOPF#

In this example, the dispatch of generators is optimised using the linear OPF, then a non-linear power flow is run on the resulting dispatch.

Data sources#

Grid: based on SciGRID Version 0.2 which is based on OpenStreetMap.

Load size and location: based on Landkreise (NUTS 3) GDP and population.

Load time series: from ENTSO-E hourly data, scaled up uniformly by factor 1.12 (a simplification of the methodology in Schumacher, Hirth (2015)).

Conventional power plant capacities and locations: BNetzA list.

Wind and solar capacities and locations: EEG Stammdaten, based on http://www.energymap.info/download.html, which represents capacities at the end of 2014. Units without PLZ are removed.

Wind and solar time series: REatlas, Andresen et al, “Validation of Danish wind time series from a new global renewable energy atlas for energy system analysis,” Energy 93 (2015) 1074 - 1088.

Where SciGRID nodes have been split into 220kV and 380kV substations, all load and generation is attached to the 220kV substation.

Warnings#

The data behind the notebook is no longer supported. See PyPSA/pypsa-eur for a newer model that covers the whole of Europe.

This dataset is ONLY intended to demonstrate the capabilities of PyPSA and is NOT (yet) accurate enough to be used for research purposes.

Known problems include:

  1. Rough approximations have been made for missing grid data, e.g. 220kV-380kV transformers and connections between close sub-stations missing from OSM.

  2. There appears to be some unexpected congestion in parts of the network, which may mean for example that the load attachment method (by Voronoi cell overlap with Landkreise) isn’t working, particularly in regions with a high density of substations.

  3. Attaching power plants to the nearest high voltage substation may not reflect reality.

  4. There is no proper n-1 security in the calculations - this can either be simulated with a blanket e.g. 70% reduction in thermal limits (as done here) or a proper security constrained OPF (see e.g. http://pypsa.readthedocs.io/en/latest/examples/scigrid-sclopf.html).

  5. The borders and neighbouring countries are not represented.

  6. Hydroelectric power stations are not modelled accurately.

  7. The marginal costs are illustrative, not accurate.

  8. Only the first day of 2011 is in the github dataset, which is not representative. The full year of 2011 can be downloaded at http://www.pypsa.org/examples/scigrid-with-load-gen-trafos-2011.zip.

  9. The ENTSO-E total load for Germany may not be scaled correctly; it is scaled up uniformly by factor 1.12 (a simplification of the methodology in Schumacher, Hirth (2015), which suggests monthly factors).

  10. Biomass from the EEG Stammdaten are not read in at the moment.

  11. Power plant start up costs, ramping limits/costs, minimum loading rates are not considered.

[1]:
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

import pypsa
ERROR 1: PROJ: proj_create_from_database: Open of /home/docs/checkouts/readthedocs.org/user_builds/pypsa/conda/latest/share/proj failed
[2]:
network = pypsa.examples.scigrid_de(from_master=True)
WARNING:pypsa.io:Importing network from PyPSA version v0.17.1 while current version is v0.28.1. Read the release notes at https://pypsa.readthedocs.io/en/latest/release_notes.html to prepare your network for import.
INFO:pypsa.io:Imported network scigrid-de.nc has buses, generators, lines, loads, storage_units, transformers

Plot the distribution of the load and of generating tech

[3]:
fig, ax = plt.subplots(
    1, 1, subplot_kw={"projection": ccrs.EqualEarth()}, figsize=(8, 8)
)

load_distribution = (
    network.loads_t.p_set.loc[network.snapshots[0]].groupby(network.loads.bus).sum()
)
network.plot(bus_sizes=1e-5 * load_distribution, ax=ax, title="Load distribution");
/home/docs/checkouts/readthedocs.org/user_builds/pypsa/conda/latest/lib/python3.12/site-packages/IPython/core/pylabtools.py:77: DeprecationWarning: backend2gui is deprecated since IPython 8.24, backends are managed in matplotlib and can be externally registered.
  warnings.warn(
/home/docs/checkouts/readthedocs.org/user_builds/pypsa/conda/latest/lib/python3.12/site-packages/IPython/core/pylabtools.py:77: DeprecationWarning: backend2gui is deprecated since IPython 8.24, backends are managed in matplotlib and can be externally registered.
  warnings.warn(
/home/docs/checkouts/readthedocs.org/user_builds/pypsa/conda/latest/lib/python3.12/site-packages/IPython/core/pylabtools.py:77: DeprecationWarning: backend2gui is deprecated since IPython 8.24, backends are managed in matplotlib and can be externally registered.
  warnings.warn(
/home/docs/checkouts/readthedocs.org/user_builds/pypsa/conda/latest/lib/python3.12/site-packages/cartopy/mpl/feature_artist.py:144: UserWarning: facecolor will have no effect as it has been defined as "never".
  warnings.warn('facecolor will have no effect as it has been '
../_images/examples_scigrid-lopf-then-pf_4_1.png
[4]:
network.generators.groupby("carrier")["p_nom"].sum()
[4]:
carrier
Brown Coal       20879.500000
Gas              23913.130000
Geothermal          31.700000
Hard Coal        25312.600000
Multiple           152.700000
Nuclear          12068.000000
Oil               2710.200000
Other             3027.800000
Run of River      3999.100000
Solar            37041.524779
Storage Hydro     1445.000000
Waste             1645.900000
Wind Offshore     2973.500000
Wind Onshore     37339.895329
Name: p_nom, dtype: float64
[5]:
network.storage_units.groupby("carrier")["p_nom"].sum()
[5]:
carrier
Pumped Hydro    9179.5
Name: p_nom, dtype: float64
[6]:
techs = ["Gas", "Brown Coal", "Hard Coal", "Wind Offshore", "Wind Onshore", "Solar"]

n_graphs = len(techs)
n_cols = 3
if n_graphs % n_cols == 0:
    n_rows = n_graphs // n_cols
else:
    n_rows = n_graphs // n_cols + 1


fig, axes = plt.subplots(
    nrows=n_rows, ncols=n_cols, subplot_kw={"projection": ccrs.EqualEarth()}
)
size = 6
fig.set_size_inches(size * n_cols, size * n_rows)

for i, tech in enumerate(techs):
    i_row = i // n_cols
    i_col = i % n_cols

    ax = axes[i_row, i_col]
    gens = network.generators[network.generators.carrier == tech]
    gen_distribution = (
        gens.groupby("bus").sum()["p_nom"].reindex(network.buses.index, fill_value=0.0)
    )
    network.plot(ax=ax, bus_sizes=2e-5 * gen_distribution)
    ax.set_title(tech)
fig.tight_layout()
/home/docs/checkouts/readthedocs.org/user_builds/pypsa/conda/latest/lib/python3.12/site-packages/cartopy/mpl/feature_artist.py:144: UserWarning: facecolor will have no effect as it has been defined as "never".
  warnings.warn('facecolor will have no effect as it has been '
/home/docs/checkouts/readthedocs.org/user_builds/pypsa/conda/latest/lib/python3.12/site-packages/cartopy/mpl/feature_artist.py:144: UserWarning: facecolor will have no effect as it has been defined as "never".
  warnings.warn('facecolor will have no effect as it has been '
/home/docs/checkouts/readthedocs.org/user_builds/pypsa/conda/latest/lib/python3.12/site-packages/cartopy/mpl/feature_artist.py:144: UserWarning: facecolor will have no effect as it has been defined as "never".
  warnings.warn('facecolor will have no effect as it has been '
/home/docs/checkouts/readthedocs.org/user_builds/pypsa/conda/latest/lib/python3.12/site-packages/cartopy/mpl/feature_artist.py:144: UserWarning: facecolor will have no effect as it has been defined as "never".
  warnings.warn('facecolor will have no effect as it has been '
/home/docs/checkouts/readthedocs.org/user_builds/pypsa/conda/latest/lib/python3.12/site-packages/cartopy/mpl/feature_artist.py:144: UserWarning: facecolor will have no effect as it has been defined as "never".
  warnings.warn('facecolor will have no effect as it has been '
/home/docs/checkouts/readthedocs.org/user_builds/pypsa/conda/latest/lib/python3.12/site-packages/cartopy/mpl/feature_artist.py:144: UserWarning: facecolor will have no effect as it has been defined as "never".
  warnings.warn('facecolor will have no effect as it has been '
../_images/examples_scigrid-lopf-then-pf_7_1.png

Run Linear Optimal Power Flow on the first day of 2011.

To approximate n-1 security and allow room for reactive power flows, don’t allow any line to be loaded above 70% of their thermal rating

[7]:
contingency_factor = 0.7
network.lines.s_max_pu = contingency_factor

There are some infeasibilities without small extensions

[8]:
network.lines.loc[["316", "527", "602"], "s_nom"] = 1715

We performing a linear OPF for one day, 4 snapshots at a time.

[9]:
group_size = 4
network.storage_units.state_of_charge_initial = 0.0

for i in range(int(24 / group_size)):
    # set the initial state of charge based on previous round
    if i:
        network.storage_units.state_of_charge_initial = (
            network.storage_units_t.state_of_charge.loc[
                network.snapshots[group_size * i - 1]
            ]
        )
    network.optimize(
        network.snapshots[group_size * i : group_size * i + group_size],
    )
WARNING:pypsa.consistency:The following buses have carriers which are not defined:
Index(['1', '2', '3', '4', '5', '6', '7', '8', '9', '10',
       ...
       '382_220kV', '384_220kV', '385_220kV', '391_220kV', '403_220kV',
       '404_220kV', '413_220kV', '421_220kV', '450_220kV', '458_220kV'],
      dtype='object', name='Bus', length=585)
WARNING:pypsa.consistency:The following storage_units have carriers which are not defined:
Index(['100_220kV Pumped Hydro', '114 Pumped Hydro', '121 Pumped Hydro',
       '140 Pumped Hydro', '141 Pumped Hydro', '158 Pumped Hydro',
       '166 Pumped Hydro', '205 Pumped Hydro', '228 Pumped Hydro',
       '235 Pumped Hydro', '25 Pumped Hydro', '266 Pumped Hydro',
       '268 Pumped Hydro', '279_220kV Pumped Hydro', '293 Pumped Hydro',
       '320 Pumped Hydro', '32_220kV Pumped Hydro', '333 Pumped Hydro',
       '342 Pumped Hydro', '343 Pumped Hydro', '362_220kV Pumped Hydro',
       '368 Pumped Hydro', '374 Pumped Hydro', '379 Pumped Hydro',
       '389 Pumped Hydro', '397 Pumped Hydro', '423 Pumped Hydro',
       '424 Pumped Hydro', '479 Pumped Hydro', '481 Pumped Hydro',
       '493 Pumped Hydro', '51 Pumped Hydro', '63 Pumped Hydro',
       '66 Pumped Hydro', '72 Pumped Hydro', '78_220kV Pumped Hydro',
       '8 Pumped Hydro', '98 Pumped Hydro'],
      dtype='object', name='StorageUnit')
WARNING:pypsa.consistency:The following generators have carriers which are not defined:
Index(['1 Gas', '1 Hard Coal', '102 Gas', '108 Run of River', '108 Waste',
       '111 Gas', '112 Gas', '112 Run of River', '114 Hard Coal',
       '115 Brown Coal',
       ...
       '382_220kV Solar', '384_220kV Solar', '385_220kV Solar',
       '391_220kV Solar', '403_220kV Solar', '404_220kV Solar',
       '413_220kV Solar', '421_220kV Solar', '450_220kV Solar',
       '458_220kV Solar'],
      dtype='object', name='Generator', length=1423)
WARNING:pypsa.consistency:The following transformers have zero r, which could break the linear load flow:
Index(['2', '5', '10', '12', '13', '15', '18', '20', '22', '24', '26', '30',
       '32', '37', '42', '46', '52', '56', '61', '68', '69', '74', '78', '86',
       '87', '94', '95', '96', '99', '100', '104', '105', '106', '107', '117',
       '120', '123', '124', '125', '128', '129', '138', '143', '156', '157',
       '159', '160', '165', '184', '191', '195', '201', '220', '231', '232',
       '233', '236', '247', '248', '250', '251', '252', '261', '263', '264',
       '267', '272', '279', '281', '282', '292', '303', '307', '308', '312',
       '315', '317', '322', '332', '334', '336', '338', '351', '353', '360',
       '362', '382', '384', '385', '391', '403', '404', '413', '421', '450',
       '458'],
      dtype='object', name='Transformer')
WARNING:pypsa.consistency:The following lines have carriers which are not defined:
Index(['1', '2', '3', '4', '5', '6', '7', '8', '9', '10',
       ...
       '850', '851', '852', '853', '854', '855', '856', '857', '858', '859'],
      dtype='object', name='Line', length=852)
WARNING:pypsa.consistency:The following buses have carriers which are not defined:
Index(['1', '2', '3', '4', '5', '6', '7', '8', '9', '10',
       ...
       '382_220kV', '384_220kV', '385_220kV', '391_220kV', '403_220kV',
       '404_220kV', '413_220kV', '421_220kV', '450_220kV', '458_220kV'],
      dtype='object', name='Bus', length=585)
WARNING:pypsa.consistency:The following storage_units have carriers which are not defined:
Index(['100_220kV Pumped Hydro', '114 Pumped Hydro', '121 Pumped Hydro',
       '140 Pumped Hydro', '141 Pumped Hydro', '158 Pumped Hydro',
       '166 Pumped Hydro', '205 Pumped Hydro', '228 Pumped Hydro',
       '235 Pumped Hydro', '25 Pumped Hydro', '266 Pumped Hydro',
       '268 Pumped Hydro', '279_220kV Pumped Hydro', '293 Pumped Hydro',
       '320 Pumped Hydro', '32_220kV Pumped Hydro', '333 Pumped Hydro',
       '342 Pumped Hydro', '343 Pumped Hydro', '362_220kV Pumped Hydro',
       '368 Pumped Hydro', '374 Pumped Hydro', '379 Pumped Hydro',
       '389 Pumped Hydro', '397 Pumped Hydro', '423 Pumped Hydro',
       '424 Pumped Hydro', '479 Pumped Hydro', '481 Pumped Hydro',
       '493 Pumped Hydro', '51 Pumped Hydro', '63 Pumped Hydro',
       '66 Pumped Hydro', '72 Pumped Hydro', '78_220kV Pumped Hydro',
       '8 Pumped Hydro', '98 Pumped Hydro'],
      dtype='object', name='StorageUnit')
WARNING:pypsa.consistency:The following generators have carriers which are not defined:
Index(['1 Gas', '1 Hard Coal', '102 Gas', '108 Run of River', '108 Waste',
       '111 Gas', '112 Gas', '112 Run of River', '114 Hard Coal',
       '115 Brown Coal',
       ...
       '382_220kV Solar', '384_220kV Solar', '385_220kV Solar',
       '391_220kV Solar', '403_220kV Solar', '404_220kV Solar',
       '413_220kV Solar', '421_220kV Solar', '450_220kV Solar',
       '458_220kV Solar'],
      dtype='object', name='Generator', length=1423)
WARNING:pypsa.consistency:The following transformers have zero r, which could break the linear load flow:
Index(['2', '5', '10', '12', '13', '15', '18', '20', '22', '24', '26', '30',
       '32', '37', '42', '46', '52', '56', '61', '68', '69', '74', '78', '86',
       '87', '94', '95', '96', '99', '100', '104', '105', '106', '107', '117',
       '120', '123', '124', '125', '128', '129', '138', '143', '156', '157',
       '159', '160', '165', '184', '191', '195', '201', '220', '231', '232',
       '233', '236', '247', '248', '250', '251', '252', '261', '263', '264',
       '267', '272', '279', '281', '282', '292', '303', '307', '308', '312',
       '315', '317', '322', '332', '334', '336', '338', '351', '353', '360',
       '362', '382', '384', '385', '391', '403', '404', '413', '421', '450',
       '458'],
      dtype='object', name='Transformer')
WARNING:pypsa.consistency:The following lines have carriers which are not defined:
Index(['1', '2', '3', '4', '5', '6', '7', '8', '9', '10',
       ...
       '850', '851', '852', '853', '854', '855', '856', '857', '858', '859'],
      dtype='object', name='Line', length=852)
INFO:linopy.model: Solve problem using Highs solver
INFO:linopy.io: Writing time: 0.2s
INFO:linopy.solvers:Log file at /tmp/highs.log
Running HiGHS 1.7.1 (git hash: 0c240d8): Copyright (c) 2024 HiGHS under MIT licence terms
Coefficient ranges:
  Matrix [1e-02, 2e+02]
  Cost   [3e+00, 1e+02]
  Bound  [0e+00, 0e+00]
  RHS    [7e-08, 6e+03]
Presolving model
3039 rows, 6674 cols, 17939 nonzeros  0s
2275 rows, 5894 cols, 16874 nonzeros  0s
2072 rows, 5097 cols, 16081 nonzeros  0s
Presolve : Reductions: rows 2072(-21756); columns 5097(-4843); elements 16081(-27437)
Solving the presolved LP
Using EKK dual simplex solver - serial
  Iteration        Objective     Infeasibilities num(sum)
          0     0.0000000000e+00 Ph1: 0(0) 0s
       2641     1.4496872501e+06 Pr: 0(0); Du: 0(2.30926e-14) 0s
       2641     1.4496872501e+06 Pr: 0(0); Du: 0(2.30926e-14) 0s
Solving the original LP from the solution after postsolve
Model   status      : Optimal
Simplex   iterations: 2641
Objective value     :  1.4496872501e+06
HiGHS run time      :          0.33
INFO:linopy.constants: Optimization successful:
Status: ok
Termination condition: optimal
Solution: 9940 primals, 23828 duals
Objective: 1.45e+06
Solver model: available
Solver message: optimal

INFO:pypsa.optimization.optimize:The shadow-prices of the constraints Generator-fix-p-lower, Generator-fix-p-upper, Line-fix-s-lower, Line-fix-s-upper, Transformer-fix-s-lower, Transformer-fix-s-upper, StorageUnit-fix-p_dispatch-lower, StorageUnit-fix-p_dispatch-upper, StorageUnit-fix-p_store-lower, StorageUnit-fix-p_store-upper, StorageUnit-fix-state_of_charge-lower, StorageUnit-fix-state_of_charge-upper, Kirchhoff-Voltage-Law, StorageUnit-energy_balance were not assigned to the network.
WARNING:pypsa.consistency:The following buses have carriers which are not defined:
Index(['1', '2', '3', '4', '5', '6', '7', '8', '9', '10',
       ...
       '382_220kV', '384_220kV', '385_220kV', '391_220kV', '403_220kV',
       '404_220kV', '413_220kV', '421_220kV', '450_220kV', '458_220kV'],
      dtype='object', name='Bus', length=585)
WARNING:pypsa.consistency:The following storage_units have carriers which are not defined:
Index(['100_220kV Pumped Hydro', '114 Pumped Hydro', '121 Pumped Hydro',
       '140 Pumped Hydro', '141 Pumped Hydro', '158 Pumped Hydro',
       '166 Pumped Hydro', '205 Pumped Hydro', '228 Pumped Hydro',
       '235 Pumped Hydro', '25 Pumped Hydro', '266 Pumped Hydro',
       '268 Pumped Hydro', '279_220kV Pumped Hydro', '293 Pumped Hydro',
       '320 Pumped Hydro', '32_220kV Pumped Hydro', '333 Pumped Hydro',
       '342 Pumped Hydro', '343 Pumped Hydro', '362_220kV Pumped Hydro',
       '368 Pumped Hydro', '374 Pumped Hydro', '379 Pumped Hydro',
       '389 Pumped Hydro', '397 Pumped Hydro', '423 Pumped Hydro',
       '424 Pumped Hydro', '479 Pumped Hydro', '481 Pumped Hydro',
       '493 Pumped Hydro', '51 Pumped Hydro', '63 Pumped Hydro',
       '66 Pumped Hydro', '72 Pumped Hydro', '78_220kV Pumped Hydro',
       '8 Pumped Hydro', '98 Pumped Hydro'],
      dtype='object', name='StorageUnit')
WARNING:pypsa.consistency:The following generators have carriers which are not defined:
Index(['1 Gas', '1 Hard Coal', '102 Gas', '108 Run of River', '108 Waste',
       '111 Gas', '112 Gas', '112 Run of River', '114 Hard Coal',
       '115 Brown Coal',
       ...
       '382_220kV Solar', '384_220kV Solar', '385_220kV Solar',
       '391_220kV Solar', '403_220kV Solar', '404_220kV Solar',
       '413_220kV Solar', '421_220kV Solar', '450_220kV Solar',
       '458_220kV Solar'],
      dtype='object', name='Generator', length=1423)
WARNING:pypsa.consistency:The following transformers have zero r, which could break the linear load flow:
Index(['2', '5', '10', '12', '13', '15', '18', '20', '22', '24', '26', '30',
       '32', '37', '42', '46', '52', '56', '61', '68', '69', '74', '78', '86',
       '87', '94', '95', '96', '99', '100', '104', '105', '106', '107', '117',
       '120', '123', '124', '125', '128', '129', '138', '143', '156', '157',
       '159', '160', '165', '184', '191', '195', '201', '220', '231', '232',
       '233', '236', '247', '248', '250', '251', '252', '261', '263', '264',
       '267', '272', '279', '281', '282', '292', '303', '307', '308', '312',
       '315', '317', '322', '332', '334', '336', '338', '351', '353', '360',
       '362', '382', '384', '385', '391', '403', '404', '413', '421', '450',
       '458'],
      dtype='object', name='Transformer')
WARNING:pypsa.consistency:The following sub_networks have carriers which are not defined:
Index(['0'], dtype='object', name='SubNetwork')
WARNING:pypsa.consistency:The following lines have carriers which are not defined:
Index(['1', '2', '3', '4', '5', '6', '7', '8', '9', '10',
       ...
       '850', '851', '852', '853', '854', '855', '856', '857', '858', '859'],
      dtype='object', name='Line', length=852)
WARNING:pypsa.consistency:The following buses have carriers which are not defined:
Index(['1', '2', '3', '4', '5', '6', '7', '8', '9', '10',
       ...
       '382_220kV', '384_220kV', '385_220kV', '391_220kV', '403_220kV',
       '404_220kV', '413_220kV', '421_220kV', '450_220kV', '458_220kV'],
      dtype='object', name='Bus', length=585)
WARNING:pypsa.consistency:The following storage_units have carriers which are not defined:
Index(['100_220kV Pumped Hydro', '114 Pumped Hydro', '121 Pumped Hydro',
       '140 Pumped Hydro', '141 Pumped Hydro', '158 Pumped Hydro',
       '166 Pumped Hydro', '205 Pumped Hydro', '228 Pumped Hydro',
       '235 Pumped Hydro', '25 Pumped Hydro', '266 Pumped Hydro',
       '268 Pumped Hydro', '279_220kV Pumped Hydro', '293 Pumped Hydro',
       '320 Pumped Hydro', '32_220kV Pumped Hydro', '333 Pumped Hydro',
       '342 Pumped Hydro', '343 Pumped Hydro', '362_220kV Pumped Hydro',
       '368 Pumped Hydro', '374 Pumped Hydro', '379 Pumped Hydro',
       '389 Pumped Hydro', '397 Pumped Hydro', '423 Pumped Hydro',
       '424 Pumped Hydro', '479 Pumped Hydro', '481 Pumped Hydro',
       '493 Pumped Hydro', '51 Pumped Hydro', '63 Pumped Hydro',
       '66 Pumped Hydro', '72 Pumped Hydro', '78_220kV Pumped Hydro',
       '8 Pumped Hydro', '98 Pumped Hydro'],
      dtype='object', name='StorageUnit')
WARNING:pypsa.consistency:The following generators have carriers which are not defined:
Index(['1 Gas', '1 Hard Coal', '102 Gas', '108 Run of River', '108 Waste',
       '111 Gas', '112 Gas', '112 Run of River', '114 Hard Coal',
       '115 Brown Coal',
       ...
       '382_220kV Solar', '384_220kV Solar', '385_220kV Solar',
       '391_220kV Solar', '403_220kV Solar', '404_220kV Solar',
       '413_220kV Solar', '421_220kV Solar', '450_220kV Solar',
       '458_220kV Solar'],
      dtype='object', name='Generator', length=1423)
WARNING:pypsa.consistency:The following transformers have zero r, which could break the linear load flow:
Index(['2', '5', '10', '12', '13', '15', '18', '20', '22', '24', '26', '30',
       '32', '37', '42', '46', '52', '56', '61', '68', '69', '74', '78', '86',
       '87', '94', '95', '96', '99', '100', '104', '105', '106', '107', '117',
       '120', '123', '124', '125', '128', '129', '138', '143', '156', '157',
       '159', '160', '165', '184', '191', '195', '201', '220', '231', '232',
       '233', '236', '247', '248', '250', '251', '252', '261', '263', '264',
       '267', '272', '279', '281', '282', '292', '303', '307', '308', '312',
       '315', '317', '322', '332', '334', '336', '338', '351', '353', '360',
       '362', '382', '384', '385', '391', '403', '404', '413', '421', '450',
       '458'],
      dtype='object', name='Transformer')
WARNING:pypsa.consistency:The following sub_networks have carriers which are not defined:
Index(['0'], dtype='object', name='SubNetwork')
WARNING:pypsa.consistency:The following lines have carriers which are not defined:
Index(['1', '2', '3', '4', '5', '6', '7', '8', '9', '10',
       ...
       '850', '851', '852', '853', '854', '855', '856', '857', '858', '859'],
      dtype='object', name='Line', length=852)
INFO:linopy.model: Solve problem using Highs solver
INFO:linopy.io: Writing time: 0.2s
INFO:linopy.solvers:Log file at /tmp/highs.log
Running HiGHS 1.7.1 (git hash: 0c240d8): Copyright (c) 2024 HiGHS under MIT licence terms
INFO:linopy.constants: Optimization successful:
Status: ok
Termination condition: optimal
Solution: 9940 primals, 23828 duals
Objective: 8.74e+05
Solver model: available
Solver message: optimal

INFO:pypsa.optimization.optimize:The shadow-prices of the constraints Generator-fix-p-lower, Generator-fix-p-upper, Line-fix-s-lower, Line-fix-s-upper, Transformer-fix-s-lower, Transformer-fix-s-upper, StorageUnit-fix-p_dispatch-lower, StorageUnit-fix-p_dispatch-upper, StorageUnit-fix-p_store-lower, StorageUnit-fix-p_store-upper, StorageUnit-fix-state_of_charge-lower, StorageUnit-fix-state_of_charge-upper, Kirchhoff-Voltage-Law, StorageUnit-energy_balance were not assigned to the network.
Coefficient ranges:
  Matrix [1e-02, 2e+02]
  Cost   [3e+00, 1e+02]
  Bound  [0e+00, 0e+00]
  RHS    [2e-11, 6e+03]
Presolving model
3072 rows, 6884 cols, 18207 nonzeros  0s
2295 rows, 6091 cols, 17201 nonzeros  0s
2072 rows, 5207 cols, 16270 nonzeros  0s
Presolve : Reductions: rows 2072(-21756); columns 5207(-4733); elements 16270(-27248)
Solving the presolved LP
Using EKK dual simplex solver - serial
  Iteration        Objective     Infeasibilities num(sum)
          0     0.0000000000e+00 Ph1: 0(0) 0s
       2956     8.7376390233e+05 Pr: 0(0); Du: 0(8.88178e-16) 0s
Solving the original LP from the solution after postsolve
Model   status      : Optimal
Simplex   iterations: 2956
Objective value     :  8.7376390233e+05
HiGHS run time      :          0.39
WARNING:pypsa.consistency:The following buses have carriers which are not defined:
Index(['1', '2', '3', '4', '5', '6', '7', '8', '9', '10',
       ...
       '382_220kV', '384_220kV', '385_220kV', '391_220kV', '403_220kV',
       '404_220kV', '413_220kV', '421_220kV', '450_220kV', '458_220kV'],
      dtype='object', name='Bus', length=585)
WARNING:pypsa.consistency:The following storage_units have carriers which are not defined:
Index(['100_220kV Pumped Hydro', '114 Pumped Hydro', '121 Pumped Hydro',
       '140 Pumped Hydro', '141 Pumped Hydro', '158 Pumped Hydro',
       '166 Pumped Hydro', '205 Pumped Hydro', '228 Pumped Hydro',
       '235 Pumped Hydro', '25 Pumped Hydro', '266 Pumped Hydro',
       '268 Pumped Hydro', '279_220kV Pumped Hydro', '293 Pumped Hydro',
       '320 Pumped Hydro', '32_220kV Pumped Hydro', '333 Pumped Hydro',
       '342 Pumped Hydro', '343 Pumped Hydro', '362_220kV Pumped Hydro',
       '368 Pumped Hydro', '374 Pumped Hydro', '379 Pumped Hydro',
       '389 Pumped Hydro', '397 Pumped Hydro', '423 Pumped Hydro',
       '424 Pumped Hydro', '479 Pumped Hydro', '481 Pumped Hydro',
       '493 Pumped Hydro', '51 Pumped Hydro', '63 Pumped Hydro',
       '66 Pumped Hydro', '72 Pumped Hydro', '78_220kV Pumped Hydro',
       '8 Pumped Hydro', '98 Pumped Hydro'],
      dtype='object', name='StorageUnit')
WARNING:pypsa.consistency:The following generators have carriers which are not defined:
Index(['1 Gas', '1 Hard Coal', '102 Gas', '108 Run of River', '108 Waste',
       '111 Gas', '112 Gas', '112 Run of River', '114 Hard Coal',
       '115 Brown Coal',
       ...
       '382_220kV Solar', '384_220kV Solar', '385_220kV Solar',
       '391_220kV Solar', '403_220kV Solar', '404_220kV Solar',
       '413_220kV Solar', '421_220kV Solar', '450_220kV Solar',
       '458_220kV Solar'],
      dtype='object', name='Generator', length=1423)
WARNING:pypsa.consistency:The following transformers have zero r, which could break the linear load flow:
Index(['2', '5', '10', '12', '13', '15', '18', '20', '22', '24', '26', '30',
       '32', '37', '42', '46', '52', '56', '61', '68', '69', '74', '78', '86',
       '87', '94', '95', '96', '99', '100', '104', '105', '106', '107', '117',
       '120', '123', '124', '125', '128', '129', '138', '143', '156', '157',
       '159', '160', '165', '184', '191', '195', '201', '220', '231', '232',
       '233', '236', '247', '248', '250', '251', '252', '261', '263', '264',
       '267', '272', '279', '281', '282', '292', '303', '307', '308', '312',
       '315', '317', '322', '332', '334', '336', '338', '351', '353', '360',
       '362', '382', '384', '385', '391', '403', '404', '413', '421', '450',
       '458'],
      dtype='object', name='Transformer')
WARNING:pypsa.consistency:The following sub_networks have carriers which are not defined:
Index(['0'], dtype='object', name='SubNetwork')
WARNING:pypsa.consistency:The following lines have carriers which are not defined:
Index(['1', '2', '3', '4', '5', '6', '7', '8', '9', '10',
       ...
       '850', '851', '852', '853', '854', '855', '856', '857', '858', '859'],
      dtype='object', name='Line', length=852)
WARNING:pypsa.consistency:The following buses have carriers which are not defined:
Index(['1', '2', '3', '4', '5', '6', '7', '8', '9', '10',
       ...
       '382_220kV', '384_220kV', '385_220kV', '391_220kV', '403_220kV',
       '404_220kV', '413_220kV', '421_220kV', '450_220kV', '458_220kV'],
      dtype='object', name='Bus', length=585)
WARNING:pypsa.consistency:The following storage_units have carriers which are not defined:
Index(['100_220kV Pumped Hydro', '114 Pumped Hydro', '121 Pumped Hydro',
       '140 Pumped Hydro', '141 Pumped Hydro', '158 Pumped Hydro',
       '166 Pumped Hydro', '205 Pumped Hydro', '228 Pumped Hydro',
       '235 Pumped Hydro', '25 Pumped Hydro', '266 Pumped Hydro',
       '268 Pumped Hydro', '279_220kV Pumped Hydro', '293 Pumped Hydro',
       '320 Pumped Hydro', '32_220kV Pumped Hydro', '333 Pumped Hydro',
       '342 Pumped Hydro', '343 Pumped Hydro', '362_220kV Pumped Hydro',
       '368 Pumped Hydro', '374 Pumped Hydro', '379 Pumped Hydro',
       '389 Pumped Hydro', '397 Pumped Hydro', '423 Pumped Hydro',
       '424 Pumped Hydro', '479 Pumped Hydro', '481 Pumped Hydro',
       '493 Pumped Hydro', '51 Pumped Hydro', '63 Pumped Hydro',
       '66 Pumped Hydro', '72 Pumped Hydro', '78_220kV Pumped Hydro',
       '8 Pumped Hydro', '98 Pumped Hydro'],
      dtype='object', name='StorageUnit')
WARNING:pypsa.consistency:The following generators have carriers which are not defined:
Index(['1 Gas', '1 Hard Coal', '102 Gas', '108 Run of River', '108 Waste',
       '111 Gas', '112 Gas', '112 Run of River', '114 Hard Coal',
       '115 Brown Coal',
       ...
       '382_220kV Solar', '384_220kV Solar', '385_220kV Solar',
       '391_220kV Solar', '403_220kV Solar', '404_220kV Solar',
       '413_220kV Solar', '421_220kV Solar', '450_220kV Solar',
       '458_220kV Solar'],
      dtype='object', name='Generator', length=1423)
WARNING:pypsa.consistency:The following transformers have zero r, which could break the linear load flow:
Index(['2', '5', '10', '12', '13', '15', '18', '20', '22', '24', '26', '30',
       '32', '37', '42', '46', '52', '56', '61', '68', '69', '74', '78', '86',
       '87', '94', '95', '96', '99', '100', '104', '105', '106', '107', '117',
       '120', '123', '124', '125', '128', '129', '138', '143', '156', '157',
       '159', '160', '165', '184', '191', '195', '201', '220', '231', '232',
       '233', '236', '247', '248', '250', '251', '252', '261', '263', '264',
       '267', '272', '279', '281', '282', '292', '303', '307', '308', '312',
       '315', '317', '322', '332', '334', '336', '338', '351', '353', '360',
       '362', '382', '384', '385', '391', '403', '404', '413', '421', '450',
       '458'],
      dtype='object', name='Transformer')
WARNING:pypsa.consistency:The following sub_networks have carriers which are not defined:
Index(['0'], dtype='object', name='SubNetwork')
WARNING:pypsa.consistency:The following lines have carriers which are not defined:
Index(['1', '2', '3', '4', '5', '6', '7', '8', '9', '10',
       ...
       '850', '851', '852', '853', '854', '855', '856', '857', '858', '859'],
      dtype='object', name='Line', length=852)
INFO:linopy.model: Solve problem using Highs solver
INFO:linopy.io: Writing time: 0.2s
INFO:linopy.solvers:Log file at /tmp/highs.log
Running HiGHS 1.7.1 (git hash: 0c240d8): Copyright (c) 2024 HiGHS under MIT licence terms
Coefficient ranges:
  Matrix [1e-02, 2e+02]
  Cost   [3e+00, 1e+02]
  Bound  [0e+00, 0e+00]
  RHS    [7e-11, 6e+03]
Presolving model
3232 rows, 8647 cols, 20197 nonzeros  0s
2254 rows, 7641 cols, 18713 nonzeros  0s
2188 rows, 5451 cols, 16309 nonzeros  0s
2125 rows, 5370 cols, 16463 nonzeros  0s
Presolve : Reductions: rows 2125(-21703); columns 5370(-4570); elements 16463(-27055)
Solving the presolved LP
Using EKK dual simplex solver - serial
  Iteration        Objective     Infeasibilities num(sum)
          0     0.0000000000e+00 Ph1: 0(0) 0s
       2848     7.9078659488e+05 Pr: 0(0); Du: 0(7.62029e-14) 0s
Solving the original LP from the solution after postsolve
Model   status      : Optimal
Simplex   iterations: 2848
Objective value     :  7.9078659488e+05
HiGHS run time      :          0.38
INFO:linopy.constants: Optimization successful:
Status: ok
Termination condition: optimal
Solution: 9940 primals, 23828 duals
Objective: 7.91e+05
Solver model: available
Solver message: optimal

INFO:pypsa.optimization.optimize:The shadow-prices of the constraints Generator-fix-p-lower, Generator-fix-p-upper, Line-fix-s-lower, Line-fix-s-upper, Transformer-fix-s-lower, Transformer-fix-s-upper, StorageUnit-fix-p_dispatch-lower, StorageUnit-fix-p_dispatch-upper, StorageUnit-fix-p_store-lower, StorageUnit-fix-p_store-upper, StorageUnit-fix-state_of_charge-lower, StorageUnit-fix-state_of_charge-upper, Kirchhoff-Voltage-Law, StorageUnit-energy_balance were not assigned to the network.
WARNING:pypsa.consistency:The following buses have carriers which are not defined:
Index(['1', '2', '3', '4', '5', '6', '7', '8', '9', '10',
       ...
       '382_220kV', '384_220kV', '385_220kV', '391_220kV', '403_220kV',
       '404_220kV', '413_220kV', '421_220kV', '450_220kV', '458_220kV'],
      dtype='object', name='Bus', length=585)
WARNING:pypsa.consistency:The following storage_units have carriers which are not defined:
Index(['100_220kV Pumped Hydro', '114 Pumped Hydro', '121 Pumped Hydro',
       '140 Pumped Hydro', '141 Pumped Hydro', '158 Pumped Hydro',
       '166 Pumped Hydro', '205 Pumped Hydro', '228 Pumped Hydro',
       '235 Pumped Hydro', '25 Pumped Hydro', '266 Pumped Hydro',
       '268 Pumped Hydro', '279_220kV Pumped Hydro', '293 Pumped Hydro',
       '320 Pumped Hydro', '32_220kV Pumped Hydro', '333 Pumped Hydro',
       '342 Pumped Hydro', '343 Pumped Hydro', '362_220kV Pumped Hydro',
       '368 Pumped Hydro', '374 Pumped Hydro', '379 Pumped Hydro',
       '389 Pumped Hydro', '397 Pumped Hydro', '423 Pumped Hydro',
       '424 Pumped Hydro', '479 Pumped Hydro', '481 Pumped Hydro',
       '493 Pumped Hydro', '51 Pumped Hydro', '63 Pumped Hydro',
       '66 Pumped Hydro', '72 Pumped Hydro', '78_220kV Pumped Hydro',
       '8 Pumped Hydro', '98 Pumped Hydro'],
      dtype='object', name='StorageUnit')
WARNING:pypsa.consistency:The following generators have carriers which are not defined:
Index(['1 Gas', '1 Hard Coal', '102 Gas', '108 Run of River', '108 Waste',
       '111 Gas', '112 Gas', '112 Run of River', '114 Hard Coal',
       '115 Brown Coal',
       ...
       '382_220kV Solar', '384_220kV Solar', '385_220kV Solar',
       '391_220kV Solar', '403_220kV Solar', '404_220kV Solar',
       '413_220kV Solar', '421_220kV Solar', '450_220kV Solar',
       '458_220kV Solar'],
      dtype='object', name='Generator', length=1423)
WARNING:pypsa.consistency:The following transformers have zero r, which could break the linear load flow:
Index(['2', '5', '10', '12', '13', '15', '18', '20', '22', '24', '26', '30',
       '32', '37', '42', '46', '52', '56', '61', '68', '69', '74', '78', '86',
       '87', '94', '95', '96', '99', '100', '104', '105', '106', '107', '117',
       '120', '123', '124', '125', '128', '129', '138', '143', '156', '157',
       '159', '160', '165', '184', '191', '195', '201', '220', '231', '232',
       '233', '236', '247', '248', '250', '251', '252', '261', '263', '264',
       '267', '272', '279', '281', '282', '292', '303', '307', '308', '312',
       '315', '317', '322', '332', '334', '336', '338', '351', '353', '360',
       '362', '382', '384', '385', '391', '403', '404', '413', '421', '450',
       '458'],
      dtype='object', name='Transformer')
WARNING:pypsa.consistency:The following sub_networks have carriers which are not defined:
Index(['0'], dtype='object', name='SubNetwork')
WARNING:pypsa.consistency:The following lines have carriers which are not defined:
Index(['1', '2', '3', '4', '5', '6', '7', '8', '9', '10',
       ...
       '850', '851', '852', '853', '854', '855', '856', '857', '858', '859'],
      dtype='object', name='Line', length=852)
WARNING:pypsa.consistency:The following buses have carriers which are not defined:
Index(['1', '2', '3', '4', '5', '6', '7', '8', '9', '10',
       ...
       '382_220kV', '384_220kV', '385_220kV', '391_220kV', '403_220kV',
       '404_220kV', '413_220kV', '421_220kV', '450_220kV', '458_220kV'],
      dtype='object', name='Bus', length=585)
WARNING:pypsa.consistency:The following storage_units have carriers which are not defined:
Index(['100_220kV Pumped Hydro', '114 Pumped Hydro', '121 Pumped Hydro',
       '140 Pumped Hydro', '141 Pumped Hydro', '158 Pumped Hydro',
       '166 Pumped Hydro', '205 Pumped Hydro', '228 Pumped Hydro',
       '235 Pumped Hydro', '25 Pumped Hydro', '266 Pumped Hydro',
       '268 Pumped Hydro', '279_220kV Pumped Hydro', '293 Pumped Hydro',
       '320 Pumped Hydro', '32_220kV Pumped Hydro', '333 Pumped Hydro',
       '342 Pumped Hydro', '343 Pumped Hydro', '362_220kV Pumped Hydro',
       '368 Pumped Hydro', '374 Pumped Hydro', '379 Pumped Hydro',
       '389 Pumped Hydro', '397 Pumped Hydro', '423 Pumped Hydro',
       '424 Pumped Hydro', '479 Pumped Hydro', '481 Pumped Hydro',
       '493 Pumped Hydro', '51 Pumped Hydro', '63 Pumped Hydro',
       '66 Pumped Hydro', '72 Pumped Hydro', '78_220kV Pumped Hydro',
       '8 Pumped Hydro', '98 Pumped Hydro'],
      dtype='object', name='StorageUnit')
WARNING:pypsa.consistency:The following generators have carriers which are not defined:
Index(['1 Gas', '1 Hard Coal', '102 Gas', '108 Run of River', '108 Waste',
       '111 Gas', '112 Gas', '112 Run of River', '114 Hard Coal',
       '115 Brown Coal',
       ...
       '382_220kV Solar', '384_220kV Solar', '385_220kV Solar',
       '391_220kV Solar', '403_220kV Solar', '404_220kV Solar',
       '413_220kV Solar', '421_220kV Solar', '450_220kV Solar',
       '458_220kV Solar'],
      dtype='object', name='Generator', length=1423)
WARNING:pypsa.consistency:The following transformers have zero r, which could break the linear load flow:
Index(['2', '5', '10', '12', '13', '15', '18', '20', '22', '24', '26', '30',
       '32', '37', '42', '46', '52', '56', '61', '68', '69', '74', '78', '86',
       '87', '94', '95', '96', '99', '100', '104', '105', '106', '107', '117',
       '120', '123', '124', '125', '128', '129', '138', '143', '156', '157',
       '159', '160', '165', '184', '191', '195', '201', '220', '231', '232',
       '233', '236', '247', '248', '250', '251', '252', '261', '263', '264',
       '267', '272', '279', '281', '282', '292', '303', '307', '308', '312',
       '315', '317', '322', '332', '334', '336', '338', '351', '353', '360',
       '362', '382', '384', '385', '391', '403', '404', '413', '421', '450',
       '458'],
      dtype='object', name='Transformer')
WARNING:pypsa.consistency:The following sub_networks have carriers which are not defined:
Index(['0'], dtype='object', name='SubNetwork')
WARNING:pypsa.consistency:The following lines have carriers which are not defined:
Index(['1', '2', '3', '4', '5', '6', '7', '8', '9', '10',
       ...
       '850', '851', '852', '853', '854', '855', '856', '857', '858', '859'],
      dtype='object', name='Line', length=852)
INFO:linopy.model: Solve problem using Highs solver
INFO:linopy.io: Writing time: 0.2s
INFO:linopy.solvers:Log file at /tmp/highs.log
Running HiGHS 1.7.1 (git hash: 0c240d8): Copyright (c) 2024 HiGHS under MIT licence terms
Coefficient ranges:
INFO:linopy.constants: Optimization successful:
Status: ok
Termination condition: optimal
Solution: 9940 primals, 23828 duals
Objective: 1.46e+06
Solver model: available
Solver message: optimal

INFO:pypsa.optimization.optimize:The shadow-prices of the constraints Generator-fix-p-lower, Generator-fix-p-upper, Line-fix-s-lower, Line-fix-s-upper, Transformer-fix-s-lower, Transformer-fix-s-upper, StorageUnit-fix-p_dispatch-lower, StorageUnit-fix-p_dispatch-upper, StorageUnit-fix-p_store-lower, StorageUnit-fix-p_store-upper, StorageUnit-fix-state_of_charge-lower, StorageUnit-fix-state_of_charge-upper, Kirchhoff-Voltage-Law, StorageUnit-energy_balance were not assigned to the network.
  Matrix [1e-02, 2e+02]
  Cost   [3e+00, 1e+02]
  Bound  [0e+00, 0e+00]
  RHS    [4e-10, 6e+03]
Presolving model
3220 rows, 8585 cols, 20107 nonzeros  0s
2228 rows, 7559 cols, 18629 nonzeros  0s
2169 rows, 5426 cols, 16273 nonzeros  0s
2134 rows, 5373 cols, 16378 nonzeros  0s
Presolve : Reductions: rows 2134(-21694); columns 5373(-4567); elements 16378(-27140)
Solving the presolved LP
Using EKK dual simplex solver - serial
  Iteration        Objective     Infeasibilities num(sum)
          0     0.0000000000e+00 Ph1: 0(0) 0s
       2781     1.4552326783e+06 Pr: 0(0); Du: 0(1.38556e-13) 0s
Solving the original LP from the solution after postsolve
Model   status      : Optimal
Simplex   iterations: 2781
Objective value     :  1.4552326783e+06
HiGHS run time      :          0.36
WARNING:pypsa.consistency:The following buses have carriers which are not defined:
Index(['1', '2', '3', '4', '5', '6', '7', '8', '9', '10',
       ...
       '382_220kV', '384_220kV', '385_220kV', '391_220kV', '403_220kV',
       '404_220kV', '413_220kV', '421_220kV', '450_220kV', '458_220kV'],
      dtype='object', name='Bus', length=585)
WARNING:pypsa.consistency:The following storage_units have carriers which are not defined:
Index(['100_220kV Pumped Hydro', '114 Pumped Hydro', '121 Pumped Hydro',
       '140 Pumped Hydro', '141 Pumped Hydro', '158 Pumped Hydro',
       '166 Pumped Hydro', '205 Pumped Hydro', '228 Pumped Hydro',
       '235 Pumped Hydro', '25 Pumped Hydro', '266 Pumped Hydro',
       '268 Pumped Hydro', '279_220kV Pumped Hydro', '293 Pumped Hydro',
       '320 Pumped Hydro', '32_220kV Pumped Hydro', '333 Pumped Hydro',
       '342 Pumped Hydro', '343 Pumped Hydro', '362_220kV Pumped Hydro',
       '368 Pumped Hydro', '374 Pumped Hydro', '379 Pumped Hydro',
       '389 Pumped Hydro', '397 Pumped Hydro', '423 Pumped Hydro',
       '424 Pumped Hydro', '479 Pumped Hydro', '481 Pumped Hydro',
       '493 Pumped Hydro', '51 Pumped Hydro', '63 Pumped Hydro',
       '66 Pumped Hydro', '72 Pumped Hydro', '78_220kV Pumped Hydro',
       '8 Pumped Hydro', '98 Pumped Hydro'],
      dtype='object', name='StorageUnit')
WARNING:pypsa.consistency:The following generators have carriers which are not defined:
Index(['1 Gas', '1 Hard Coal', '102 Gas', '108 Run of River', '108 Waste',
       '111 Gas', '112 Gas', '112 Run of River', '114 Hard Coal',
       '115 Brown Coal',
       ...
       '382_220kV Solar', '384_220kV Solar', '385_220kV Solar',
       '391_220kV Solar', '403_220kV Solar', '404_220kV Solar',
       '413_220kV Solar', '421_220kV Solar', '450_220kV Solar',
       '458_220kV Solar'],
      dtype='object', name='Generator', length=1423)
WARNING:pypsa.consistency:The following transformers have zero r, which could break the linear load flow:
Index(['2', '5', '10', '12', '13', '15', '18', '20', '22', '24', '26', '30',
       '32', '37', '42', '46', '52', '56', '61', '68', '69', '74', '78', '86',
       '87', '94', '95', '96', '99', '100', '104', '105', '106', '107', '117',
       '120', '123', '124', '125', '128', '129', '138', '143', '156', '157',
       '159', '160', '165', '184', '191', '195', '201', '220', '231', '232',
       '233', '236', '247', '248', '250', '251', '252', '261', '263', '264',
       '267', '272', '279', '281', '282', '292', '303', '307', '308', '312',
       '315', '317', '322', '332', '334', '336', '338', '351', '353', '360',
       '362', '382', '384', '385', '391', '403', '404', '413', '421', '450',
       '458'],
      dtype='object', name='Transformer')
WARNING:pypsa.consistency:The following sub_networks have carriers which are not defined:
Index(['0'], dtype='object', name='SubNetwork')
WARNING:pypsa.consistency:The following lines have carriers which are not defined:
Index(['1', '2', '3', '4', '5', '6', '7', '8', '9', '10',
       ...
       '850', '851', '852', '853', '854', '855', '856', '857', '858', '859'],
      dtype='object', name='Line', length=852)
WARNING:pypsa.consistency:The following buses have carriers which are not defined:
Index(['1', '2', '3', '4', '5', '6', '7', '8', '9', '10',
       ...
       '382_220kV', '384_220kV', '385_220kV', '391_220kV', '403_220kV',
       '404_220kV', '413_220kV', '421_220kV', '450_220kV', '458_220kV'],
      dtype='object', name='Bus', length=585)
WARNING:pypsa.consistency:The following storage_units have carriers which are not defined:
Index(['100_220kV Pumped Hydro', '114 Pumped Hydro', '121 Pumped Hydro',
       '140 Pumped Hydro', '141 Pumped Hydro', '158 Pumped Hydro',
       '166 Pumped Hydro', '205 Pumped Hydro', '228 Pumped Hydro',
       '235 Pumped Hydro', '25 Pumped Hydro', '266 Pumped Hydro',
       '268 Pumped Hydro', '279_220kV Pumped Hydro', '293 Pumped Hydro',
       '320 Pumped Hydro', '32_220kV Pumped Hydro', '333 Pumped Hydro',
       '342 Pumped Hydro', '343 Pumped Hydro', '362_220kV Pumped Hydro',
       '368 Pumped Hydro', '374 Pumped Hydro', '379 Pumped Hydro',
       '389 Pumped Hydro', '397 Pumped Hydro', '423 Pumped Hydro',
       '424 Pumped Hydro', '479 Pumped Hydro', '481 Pumped Hydro',
       '493 Pumped Hydro', '51 Pumped Hydro', '63 Pumped Hydro',
       '66 Pumped Hydro', '72 Pumped Hydro', '78_220kV Pumped Hydro',
       '8 Pumped Hydro', '98 Pumped Hydro'],
      dtype='object', name='StorageUnit')
WARNING:pypsa.consistency:The following generators have carriers which are not defined:
Index(['1 Gas', '1 Hard Coal', '102 Gas', '108 Run of River', '108 Waste',
       '111 Gas', '112 Gas', '112 Run of River', '114 Hard Coal',
       '115 Brown Coal',
       ...
       '382_220kV Solar', '384_220kV Solar', '385_220kV Solar',
       '391_220kV Solar', '403_220kV Solar', '404_220kV Solar',
       '413_220kV Solar', '421_220kV Solar', '450_220kV Solar',
       '458_220kV Solar'],
      dtype='object', name='Generator', length=1423)
WARNING:pypsa.consistency:The following transformers have zero r, which could break the linear load flow:
Index(['2', '5', '10', '12', '13', '15', '18', '20', '22', '24', '26', '30',
       '32', '37', '42', '46', '52', '56', '61', '68', '69', '74', '78', '86',
       '87', '94', '95', '96', '99', '100', '104', '105', '106', '107', '117',
       '120', '123', '124', '125', '128', '129', '138', '143', '156', '157',
       '159', '160', '165', '184', '191', '195', '201', '220', '231', '232',
       '233', '236', '247', '248', '250', '251', '252', '261', '263', '264',
       '267', '272', '279', '281', '282', '292', '303', '307', '308', '312',
       '315', '317', '322', '332', '334', '336', '338', '351', '353', '360',
       '362', '382', '384', '385', '391', '403', '404', '413', '421', '450',
       '458'],
      dtype='object', name='Transformer')
WARNING:pypsa.consistency:The following sub_networks have carriers which are not defined:
Index(['0'], dtype='object', name='SubNetwork')
WARNING:pypsa.consistency:The following lines have carriers which are not defined:
Index(['1', '2', '3', '4', '5', '6', '7', '8', '9', '10',
       ...
       '850', '851', '852', '853', '854', '855', '856', '857', '858', '859'],
      dtype='object', name='Line', length=852)
INFO:linopy.model: Solve problem using Highs solver
INFO:linopy.io: Writing time: 0.2s
INFO:linopy.solvers:Log file at /tmp/highs.log
Running HiGHS 1.7.1 (git hash: 0c240d8): Copyright (c) 2024 HiGHS under MIT licence terms
Coefficient ranges:
INFO:linopy.constants: Optimization successful:
Status: ok
Termination condition: optimal
Solution: 9940 primals, 23828 duals
Objective: 2.65e+06
Solver model: available
Solver message: optimal

INFO:pypsa.optimization.optimize:The shadow-prices of the constraints Generator-fix-p-lower, Generator-fix-p-upper, Line-fix-s-lower, Line-fix-s-upper, Transformer-fix-s-lower, Transformer-fix-s-upper, StorageUnit-fix-p_dispatch-lower, StorageUnit-fix-p_dispatch-upper, StorageUnit-fix-p_store-lower, StorageUnit-fix-p_store-upper, StorageUnit-fix-state_of_charge-lower, StorageUnit-fix-state_of_charge-upper, Kirchhoff-Voltage-Law, StorageUnit-energy_balance were not assigned to the network.
  Matrix [1e-02, 2e+02]
  Cost   [3e+00, 1e+02]
  Bound  [0e+00, 0e+00]
  RHS    [7e-10, 6e+03]
Presolving model
3089 rows, 6987 cols, 18321 nonzeros  0s
2298 rows, 6180 cols, 17321 nonzeros  0s
2086 rows, 5254 cols, 16351 nonzeros  0s
Presolve : Reductions: rows 2086(-21742); columns 5254(-4686); elements 16351(-27167)
Solving the presolved LP
Using EKK dual simplex solver - serial
  Iteration        Objective     Infeasibilities num(sum)
          0     0.0000000000e+00 Ph1: 0(0) 0s
       2871     2.6475362720e+06 Pr: 0(0); Du: 0(1.97176e-13) 0s
Solving the original LP from the solution after postsolve
Model   status      : Optimal
Simplex   iterations: 2871
Objective value     :  2.6475362720e+06
HiGHS run time      :          0.38
WARNING:pypsa.consistency:The following buses have carriers which are not defined:
Index(['1', '2', '3', '4', '5', '6', '7', '8', '9', '10',
       ...
       '382_220kV', '384_220kV', '385_220kV', '391_220kV', '403_220kV',
       '404_220kV', '413_220kV', '421_220kV', '450_220kV', '458_220kV'],
      dtype='object', name='Bus', length=585)
WARNING:pypsa.consistency:The following storage_units have carriers which are not defined:
Index(['100_220kV Pumped Hydro', '114 Pumped Hydro', '121 Pumped Hydro',
       '140 Pumped Hydro', '141 Pumped Hydro', '158 Pumped Hydro',
       '166 Pumped Hydro', '205 Pumped Hydro', '228 Pumped Hydro',
       '235 Pumped Hydro', '25 Pumped Hydro', '266 Pumped Hydro',
       '268 Pumped Hydro', '279_220kV Pumped Hydro', '293 Pumped Hydro',
       '320 Pumped Hydro', '32_220kV Pumped Hydro', '333 Pumped Hydro',
       '342 Pumped Hydro', '343 Pumped Hydro', '362_220kV Pumped Hydro',
       '368 Pumped Hydro', '374 Pumped Hydro', '379 Pumped Hydro',
       '389 Pumped Hydro', '397 Pumped Hydro', '423 Pumped Hydro',
       '424 Pumped Hydro', '479 Pumped Hydro', '481 Pumped Hydro',
       '493 Pumped Hydro', '51 Pumped Hydro', '63 Pumped Hydro',
       '66 Pumped Hydro', '72 Pumped Hydro', '78_220kV Pumped Hydro',
       '8 Pumped Hydro', '98 Pumped Hydro'],
      dtype='object', name='StorageUnit')
WARNING:pypsa.consistency:The following generators have carriers which are not defined:
Index(['1 Gas', '1 Hard Coal', '102 Gas', '108 Run of River', '108 Waste',
       '111 Gas', '112 Gas', '112 Run of River', '114 Hard Coal',
       '115 Brown Coal',
       ...
       '382_220kV Solar', '384_220kV Solar', '385_220kV Solar',
       '391_220kV Solar', '403_220kV Solar', '404_220kV Solar',
       '413_220kV Solar', '421_220kV Solar', '450_220kV Solar',
       '458_220kV Solar'],
      dtype='object', name='Generator', length=1423)
WARNING:pypsa.consistency:The following transformers have zero r, which could break the linear load flow:
Index(['2', '5', '10', '12', '13', '15', '18', '20', '22', '24', '26', '30',
       '32', '37', '42', '46', '52', '56', '61', '68', '69', '74', '78', '86',
       '87', '94', '95', '96', '99', '100', '104', '105', '106', '107', '117',
       '120', '123', '124', '125', '128', '129', '138', '143', '156', '157',
       '159', '160', '165', '184', '191', '195', '201', '220', '231', '232',
       '233', '236', '247', '248', '250', '251', '252', '261', '263', '264',
       '267', '272', '279', '281', '282', '292', '303', '307', '308', '312',
       '315', '317', '322', '332', '334', '336', '338', '351', '353', '360',
       '362', '382', '384', '385', '391', '403', '404', '413', '421', '450',
       '458'],
      dtype='object', name='Transformer')
WARNING:pypsa.consistency:The following sub_networks have carriers which are not defined:
Index(['0'], dtype='object', name='SubNetwork')
WARNING:pypsa.consistency:The following lines have carriers which are not defined:
Index(['1', '2', '3', '4', '5', '6', '7', '8', '9', '10',
       ...
       '850', '851', '852', '853', '854', '855', '856', '857', '858', '859'],
      dtype='object', name='Line', length=852)
WARNING:pypsa.consistency:The following buses have carriers which are not defined:
Index(['1', '2', '3', '4', '5', '6', '7', '8', '9', '10',
       ...
       '382_220kV', '384_220kV', '385_220kV', '391_220kV', '403_220kV',
       '404_220kV', '413_220kV', '421_220kV', '450_220kV', '458_220kV'],
      dtype='object', name='Bus', length=585)
WARNING:pypsa.consistency:The following storage_units have carriers which are not defined:
Index(['100_220kV Pumped Hydro', '114 Pumped Hydro', '121 Pumped Hydro',
       '140 Pumped Hydro', '141 Pumped Hydro', '158 Pumped Hydro',
       '166 Pumped Hydro', '205 Pumped Hydro', '228 Pumped Hydro',
       '235 Pumped Hydro', '25 Pumped Hydro', '266 Pumped Hydro',
       '268 Pumped Hydro', '279_220kV Pumped Hydro', '293 Pumped Hydro',
       '320 Pumped Hydro', '32_220kV Pumped Hydro', '333 Pumped Hydro',
       '342 Pumped Hydro', '343 Pumped Hydro', '362_220kV Pumped Hydro',
       '368 Pumped Hydro', '374 Pumped Hydro', '379 Pumped Hydro',
       '389 Pumped Hydro', '397 Pumped Hydro', '423 Pumped Hydro',
       '424 Pumped Hydro', '479 Pumped Hydro', '481 Pumped Hydro',
       '493 Pumped Hydro', '51 Pumped Hydro', '63 Pumped Hydro',
       '66 Pumped Hydro', '72 Pumped Hydro', '78_220kV Pumped Hydro',
       '8 Pumped Hydro', '98 Pumped Hydro'],
      dtype='object', name='StorageUnit')
WARNING:pypsa.consistency:The following generators have carriers which are not defined:
Index(['1 Gas', '1 Hard Coal', '102 Gas', '108 Run of River', '108 Waste',
       '111 Gas', '112 Gas', '112 Run of River', '114 Hard Coal',
       '115 Brown Coal',
       ...
       '382_220kV Solar', '384_220kV Solar', '385_220kV Solar',
       '391_220kV Solar', '403_220kV Solar', '404_220kV Solar',
       '413_220kV Solar', '421_220kV Solar', '450_220kV Solar',
       '458_220kV Solar'],
      dtype='object', name='Generator', length=1423)
WARNING:pypsa.consistency:The following transformers have zero r, which could break the linear load flow:
Index(['2', '5', '10', '12', '13', '15', '18', '20', '22', '24', '26', '30',
       '32', '37', '42', '46', '52', '56', '61', '68', '69', '74', '78', '86',
       '87', '94', '95', '96', '99', '100', '104', '105', '106', '107', '117',
       '120', '123', '124', '125', '128', '129', '138', '143', '156', '157',
       '159', '160', '165', '184', '191', '195', '201', '220', '231', '232',
       '233', '236', '247', '248', '250', '251', '252', '261', '263', '264',
       '267', '272', '279', '281', '282', '292', '303', '307', '308', '312',
       '315', '317', '322', '332', '334', '336', '338', '351', '353', '360',
       '362', '382', '384', '385', '391', '403', '404', '413', '421', '450',
       '458'],
      dtype='object', name='Transformer')
WARNING:pypsa.consistency:The following sub_networks have carriers which are not defined:
Index(['0'], dtype='object', name='SubNetwork')
WARNING:pypsa.consistency:The following lines have carriers which are not defined:
Index(['1', '2', '3', '4', '5', '6', '7', '8', '9', '10',
       ...
       '850', '851', '852', '853', '854', '855', '856', '857', '858', '859'],
      dtype='object', name='Line', length=852)
INFO:linopy.model: Solve problem using Highs solver
INFO:linopy.io: Writing time: 0.2s
INFO:linopy.solvers:Log file at /tmp/highs.log
Running HiGHS 1.7.1 (git hash: 0c240d8): Copyright (c) 2024 HiGHS under MIT licence terms
Coefficient ranges:
  Matrix [1e-02, 2e+02]
  Cost   [3e+00, 1e+02]
  Bound  [0e+00, 0e+00]
  RHS    [9e-11, 6e+03]
Presolving model
3085 rows, 6973 cols, 18305 nonzeros  0s
2304 rows, 6176 cols, 17316 nonzeros  0s
2092 rows, 5271 cols, 16334 nonzeros  0s
Presolve : Reductions: rows 2092(-21736); columns 5271(-4669); elements 16334(-27184)
Solving the presolved LP
Using EKK dual simplex solver - serial
  Iteration        Objective     Infeasibilities num(sum)
          0     0.0000000000e+00 Ph1: 0(0) 0s
       2868     2.1429568887e+06 Pr: 0(0); Du: 0(1.03029e-13) 0s
Solving the original LP from the solution after postsolve
Model   status      : Optimal
Simplex   iterations: 2868
Objective value     :  2.1429568887e+06
HiGHS run time      :          0.37
INFO:linopy.constants: Optimization successful:
Status: ok
Termination condition: optimal
Solution: 9940 primals, 23828 duals
Objective: 2.14e+06
Solver model: available
Solver message: optimal

INFO:pypsa.optimization.optimize:The shadow-prices of the constraints Generator-fix-p-lower, Generator-fix-p-upper, Line-fix-s-lower, Line-fix-s-upper, Transformer-fix-s-lower, Transformer-fix-s-upper, StorageUnit-fix-p_dispatch-lower, StorageUnit-fix-p_dispatch-upper, StorageUnit-fix-p_store-lower, StorageUnit-fix-p_store-upper, StorageUnit-fix-state_of_charge-lower, StorageUnit-fix-state_of_charge-upper, Kirchhoff-Voltage-Law, StorageUnit-energy_balance were not assigned to the network.
[10]:
p_by_carrier = network.generators_t.p.groupby(network.generators.carrier, axis=1).sum()
p_by_carrier.drop(
    (p_by_carrier.max()[p_by_carrier.max() < 1700.0]).index, axis=1, inplace=True
)
p_by_carrier.columns
/tmp/ipykernel_5355/901685434.py:1: FutureWarning: DataFrame.groupby with axis=1 is deprecated. Do `frame.T.groupby(...)` without axis instead.
  p_by_carrier = network.generators_t.p.groupby(network.generators.carrier, axis=1).sum()
[10]:
Index(['Brown Coal', 'Gas', 'Hard Coal', 'Nuclear', 'Run of River', 'Solar',
       'Wind Offshore', 'Wind Onshore'],
      dtype='object', name='carrier')
[11]:
colors = {
    "Brown Coal": "brown",
    "Hard Coal": "k",
    "Nuclear": "r",
    "Run of River": "green",
    "Wind Onshore": "blue",
    "Solar": "yellow",
    "Wind Offshore": "cyan",
    "Waste": "orange",
    "Gas": "orange",
}
# reorder
cols = [
    "Nuclear",
    "Run of River",
    "Brown Coal",
    "Hard Coal",
    "Gas",
    "Wind Offshore",
    "Wind Onshore",
    "Solar",
]
p_by_carrier = p_by_carrier[cols]
[12]:
c = [colors[col] for col in p_by_carrier.columns]

fig, ax = plt.subplots(figsize=(12, 6))
(p_by_carrier / 1e3).plot(kind="area", ax=ax, linewidth=4, color=c, alpha=0.7)
ax.legend(ncol=4, loc="upper left")
ax.set_ylabel("GW")
ax.set_xlabel("")
fig.tight_layout()
../_images/examples_scigrid-lopf-then-pf_16_0.png
[13]:
fig, ax = plt.subplots(figsize=(12, 6))

p_storage = network.storage_units_t.p.sum(axis=1)
state_of_charge = network.storage_units_t.state_of_charge.sum(axis=1)
p_storage.plot(label="Pumped hydro dispatch", ax=ax, linewidth=3)
state_of_charge.plot(label="State of charge", ax=ax, linewidth=3)

ax.legend()
ax.grid()
ax.set_ylabel("MWh")
ax.set_xlabel("")
fig.tight_layout()
../_images/examples_scigrid-lopf-then-pf_17_0.png
[14]:
now = network.snapshots[4]

With the linear load flow, there is the following per unit loading:

[15]:
loading = network.lines_t.p0.loc[now] / network.lines.s_nom
loading.describe()
[15]:
count    852.000000
mean      -0.003145
std        0.260237
min       -0.700000
25%       -0.128281
50%        0.003209
75%        0.121985
max        0.700000
dtype: float64
[16]:
fig, ax = plt.subplots(subplot_kw={"projection": ccrs.EqualEarth()}, figsize=(9, 9))
network.plot(
    ax=ax,
    line_colors=abs(loading),
    line_cmap=plt.cm.jet,
    title="Line loading",
    bus_sizes=1e-3,
    bus_alpha=0.7,
)
fig.tight_layout();
/home/docs/checkouts/readthedocs.org/user_builds/pypsa/conda/latest/lib/python3.12/site-packages/cartopy/mpl/feature_artist.py:144: UserWarning: facecolor will have no effect as it has been defined as "never".
  warnings.warn('facecolor will have no effect as it has been '
../_images/examples_scigrid-lopf-then-pf_21_1.png

Let’s have a look at the marginal prices

[17]:
network.buses_t.marginal_price.loc[now].describe()
[17]:
count    585.000000
mean      15.737598
std       10.941995
min      -10.397824
25%        6.992120
50%       15.841190
75%       25.048186
max       52.150120
Name: 2011-01-01 04:00:00, dtype: float64
[18]:
fig, ax = plt.subplots(subplot_kw={"projection": ccrs.PlateCarree()}, figsize=(8, 8))

plt.hexbin(
    network.buses.x,
    network.buses.y,
    gridsize=20,
    C=network.buses_t.marginal_price.loc[now],
    cmap=plt.cm.jet,
    zorder=3,
)
network.plot(ax=ax, line_widths=pd.Series(0.5, network.lines.index), bus_sizes=0)

cb = plt.colorbar(location="bottom")
cb.set_label("Locational Marginal Price (EUR/MWh)")
fig.tight_layout()
/home/docs/checkouts/readthedocs.org/user_builds/pypsa/conda/latest/lib/python3.12/site-packages/cartopy/mpl/feature_artist.py:144: UserWarning: facecolor will have no effect as it has been defined as "never".
  warnings.warn('facecolor will have no effect as it has been '
../_images/examples_scigrid-lopf-then-pf_24_1.png

Curtailment variable#

By considering how much power is available and how much is generated, you can see what share is curtailed:

[19]:
carrier = "Wind Onshore"

capacity = network.generators.groupby("carrier").sum().at[carrier, "p_nom"]
p_available = network.generators_t.p_max_pu.multiply(network.generators["p_nom"])
p_available_by_carrier = p_available.groupby(network.generators.carrier, axis=1).sum()
p_curtailed_by_carrier = p_available_by_carrier - p_by_carrier
/tmp/ipykernel_5355/2097778438.py:5: FutureWarning: DataFrame.groupby with axis=1 is deprecated. Do `frame.T.groupby(...)` without axis instead.
  p_available_by_carrier = p_available.groupby(network.generators.carrier, axis=1).sum()
[20]:
p_df = pd.DataFrame(
    {
        carrier + " available": p_available_by_carrier[carrier],
        carrier + " dispatched": p_by_carrier[carrier],
        carrier + " curtailed": p_curtailed_by_carrier[carrier],
    }
)

p_df[carrier + " capacity"] = capacity
[21]:
p_df["Wind Onshore curtailed"][p_df["Wind Onshore curtailed"] < 0.0] = 0.0
/tmp/ipykernel_5355/1546145974.py:1: FutureWarning: ChainedAssignmentError: behaviour will change in pandas 3.0!
You are setting values through chained assignment. Currently this works in certain cases, but when using Copy-on-Write (which will become the default behaviour in pandas 3.0) this will never work to update the original DataFrame or Series, because the intermediate object on which we are setting values will behave as a copy.
A typical example is when you are setting values in a column of a DataFrame, like:

df["col"][row_indexer] = value

Use `df.loc[row_indexer, "col"] = values` instead, to perform the assignment in a single step and ensure this keeps updating the original `df`.

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy

  p_df["Wind Onshore curtailed"][p_df["Wind Onshore curtailed"] < 0.0] = 0.0
[22]:
fig, ax = plt.subplots(figsize=(10, 4))
p_df[[carrier + " dispatched", carrier + " curtailed"]].plot(
    kind="area", ax=ax, linewidth=3
)
p_df[[carrier + " available", carrier + " capacity"]].plot(ax=ax, linewidth=3)

ax.set_xlabel("")
ax.set_ylabel("Power [MW]")
ax.set_ylim([0, 40000])
ax.legend()
fig.tight_layout()
../_images/examples_scigrid-lopf-then-pf_29_0.png

Non-Linear Power Flow#

Now perform a full Newton-Raphson power flow on the first hour. For the PF, set the P to the optimised P.

[23]:
network.generators_t.p_set = network.generators_t.p
network.storage_units_t.p_set = network.storage_units_t.p

Set all buses to PV, since we don’t know what Q set points are

[24]:
network.generators.control = "PV"

# Need some PQ buses so that Jacobian doesn't break
f = network.generators[network.generators.bus == "492"]
network.generators.loc[f.index, "control"] = "PQ"

Now, perform the non-linear PF.

[25]:
info = network.pf();
INFO:pypsa.pf:Performing non-linear load-flow on AC sub-network SubNetwork 0 for snapshots DatetimeIndex(['2011-01-01 00:00:00', '2011-01-01 01:00:00',
               '2011-01-01 02:00:00', '2011-01-01 03:00:00',
               '2011-01-01 04:00:00', '2011-01-01 05:00:00',
               '2011-01-01 06:00:00', '2011-01-01 07:00:00',
               '2011-01-01 08:00:00', '2011-01-01 09:00:00',
               '2011-01-01 10:00:00', '2011-01-01 11:00:00',
               '2011-01-01 12:00:00', '2011-01-01 13:00:00',
               '2011-01-01 14:00:00', '2011-01-01 15:00:00',
               '2011-01-01 16:00:00', '2011-01-01 17:00:00',
               '2011-01-01 18:00:00', '2011-01-01 19:00:00',
               '2011-01-01 20:00:00', '2011-01-01 21:00:00',
               '2011-01-01 22:00:00', '2011-01-01 23:00:00'],
              dtype='datetime64[ns]', name='snapshot', freq=None)
INFO:pypsa.pf:Newton-Raphson solved in 4 iterations with error of 0.000000 in 0.039610 seconds
INFO:pypsa.pf:Newton-Raphson solved in 4 iterations with error of 0.000000 in 0.038545 seconds
INFO:pypsa.pf:Newton-Raphson solved in 4 iterations with error of 0.000000 in 0.038713 seconds
INFO:pypsa.pf:Newton-Raphson solved in 4 iterations with error of 0.000000 in 0.038486 seconds
INFO:pypsa.pf:Newton-Raphson solved in 4 iterations with error of 0.000000 in 0.038678 seconds
INFO:pypsa.pf:Newton-Raphson solved in 4 iterations with error of 0.000000 in 0.038713 seconds
INFO:pypsa.pf:Newton-Raphson solved in 4 iterations with error of 0.000000 in 0.038764 seconds
INFO:pypsa.pf:Newton-Raphson solved in 4 iterations with error of 0.000000 in 0.038472 seconds
INFO:pypsa.pf:Newton-Raphson solved in 4 iterations with error of 0.000000 in 0.038860 seconds
INFO:pypsa.pf:Newton-Raphson solved in 4 iterations with error of 0.000000 in 0.038955 seconds
INFO:pypsa.pf:Newton-Raphson solved in 4 iterations with error of 0.000000 in 0.041312 seconds
INFO:pypsa.pf:Newton-Raphson solved in 4 iterations with error of 0.000000 in 0.038584 seconds
INFO:pypsa.pf:Newton-Raphson solved in 4 iterations with error of 0.000000 in 0.038689 seconds
INFO:pypsa.pf:Newton-Raphson solved in 4 iterations with error of 0.000000 in 0.038734 seconds
INFO:pypsa.pf:Newton-Raphson solved in 4 iterations with error of 0.000000 in 0.038721 seconds
INFO:pypsa.pf:Newton-Raphson solved in 4 iterations with error of 0.000000 in 0.038760 seconds
INFO:pypsa.pf:Newton-Raphson solved in 4 iterations with error of 0.000000 in 0.038528 seconds
INFO:pypsa.pf:Newton-Raphson solved in 4 iterations with error of 0.000000 in 0.039038 seconds
INFO:pypsa.pf:Newton-Raphson solved in 4 iterations with error of 0.000000 in 0.038394 seconds
INFO:pypsa.pf:Newton-Raphson solved in 4 iterations with error of 0.000000 in 0.039289 seconds
INFO:pypsa.pf:Newton-Raphson solved in 4 iterations with error of 0.000000 in 0.039145 seconds
INFO:pypsa.pf:Newton-Raphson solved in 4 iterations with error of 0.000000 in 0.038579 seconds
INFO:pypsa.pf:Newton-Raphson solved in 4 iterations with error of 0.000000 in 0.038473 seconds
INFO:pypsa.pf:Newton-Raphson solved in 4 iterations with error of 0.000000 in 0.039293 seconds

Any failed to converge?

[26]:
(~info.converged).any().any()
[26]:
False

With the non-linear load flow, there is the following per unit loading of the full thermal rating.

[27]:
(network.lines_t.p0.loc[now] / network.lines.s_nom).describe()
[27]:
count    852.000000
mean       0.000226
std        0.262545
min       -0.813767
25%       -0.123980
50%        0.003103
75%        0.123851
max        0.827600
dtype: float64

Let’s inspect the voltage angle differences across the lines have (in degrees)

[28]:
df = network.lines.copy()

for b in ["bus0", "bus1"]:
    df = pd.merge(
        df, network.buses_t.v_ang.loc[[now]].T, how="left", left_on=b, right_index=True
    )

s = df[str(now) + "_x"] - df[str(now) + "_y"]

(s * 180 / np.pi).describe()
[28]:
count    852.000000
mean      -0.022249
std        2.386780
min      -12.158079
25%       -0.465772
50%        0.001604
75%        0.534861
max       17.959258
dtype: float64

Plot the reactive power

[29]:
fig, ax = plt.subplots(subplot_kw={"projection": ccrs.EqualEarth()}, figsize=(9, 9))

q = network.buses_t.q.loc[now]
bus_colors = pd.Series("r", network.buses.index)
bus_colors[q < 0.0] = "b"

network.plot(
    bus_sizes=1e-4 * abs(q),
    ax=ax,
    bus_colors=bus_colors,
    title="Reactive power feed-in (red=+ve, blue=-ve)",
);
/home/docs/checkouts/readthedocs.org/user_builds/pypsa/conda/latest/lib/python3.12/site-packages/cartopy/mpl/feature_artist.py:144: UserWarning: facecolor will have no effect as it has been defined as "never".
  warnings.warn('facecolor will have no effect as it has been '
../_images/examples_scigrid-lopf-then-pf_43_1.png