Skip to content

Latest commit

 

History

History
90 lines (77 loc) · 1.9 KB

LMP.md

File metadata and controls

90 lines (77 loc) · 1.9 KB
jupyter
jupytext kernelspec
formats text_representation
ipynb,md
extension format_name format_version jupytext_version
.md
markdown
1.3
1.13.8
display_name language name
Python 3 (ipykernel)
python
python3
import geopandas as gpd
import matplotlib.pyplot as plt
%matplotlib inline
europe = gpd.read_file('resources/europe_shape.geojson')
europe.plot()
# Without GB, NO, SE, FI, LV, LT, EE
europe = gpd.read_file('resources/europe_shape.geojson')
europe.plot()
# The above plus GB
europe = gpd.read_file('resources/europe_shape.geojson')
europe.plot()
# The above minus IE and GB
europe = gpd.read_file('resources/europe_shape.geojson')
europe.plot()
import pypsa
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
plt.style.use("bmh")
%matplotlib inline

n = pypsa.Network("results/networks/elec_s_128_ec_lcopt_2H.nc")
# n.plot()

fig,ax = plt.subplots(
    figsize=(30,30),
    subplot_kw={"projection": ccrs.PlateCarree()}
)

max_marginal_price = n.buses_t.marginal_price.max().max()
min_marginal_price = n.buses_t.marginal_price.min().min()
colors = (n.buses_t.marginal_price.loc[n.snapshots[6]] - min_marginal_price) / (max_marginal_price - min_marginal_price)

display(n.buses_t.marginal_price)
n.plot(ax=ax, bus_colors=colors, bus_cmap=plt.cm.jet)
# n.plot(ax=ax, boundaries=(-9, 28, 30, 75))

ax.axis('off')
n = pypsa.Network("results/networks/elec_s_143_ec_lcopt_2H.nc")
display(n.buses_t.marginal_price)

for snapshot in n.snapshots[0:1]:
    display(snapshot)
    prices = bus_text=n.buses_t.marginal_price.loc[snapshot]
    n.iplot(
        mapbox=True,
        size=(2000, 2000),
        bus_text=prices,
        bus_colors=prices,
        line_text=None
    )
n.lopf(
        n.snapshots[0:2],
        solver_name="cbc",
        pyomo=False,
    )