Skip to content

Commit

Permalink
Merge branch 'hybit' into features/hybit_pw_constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
birgits committed Aug 23, 2024
2 parents 4293a73 + 57744fc commit 4f1af01
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 6 deletions.
1 change: 1 addition & 0 deletions etrago/cluster/electrical.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ def cluster_on_extra_high_voltage(etrago, busmap, with_time=True):
"y": _leading(busmap, network.buses),
"geom": lambda x: np.nan,
"country": lambda x: "",
"scn_name": "first",
},
)

Expand Down
2 changes: 1 addition & 1 deletion etrago/execute/market_optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def build_market_model(self):
"""

# use existing preprocessing to get only the electricity system
net, weight, n_clusters, busmap_foreign = preprocessing(
net, _, _, busmap_foreign, _, _ = preprocessing(
self, apply_on="market_model"
)

Expand Down
4 changes: 0 additions & 4 deletions etrago/tools/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -831,10 +831,6 @@ def extension(self, **kwargs):

self.network = scenario.build_network(self.network)

# Allow lossless links to conduct bidirectional
self.network.links.loc[
self.network.links.efficiency == 1.0, "p_min_pu"
] = -1


def decommissioning(self, **kwargs):
Expand Down
34 changes: 33 additions & 1 deletion etrago/tools/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,12 @@ def connected_transformer(network, busids):
return network.transformers[mask]


def load_shedding(self, temporal_disaggregation=False, **kwargs):
def load_shedding(
self,
temporal_disaggregation=False,
negative_load_shedding_ev=True,
**kwargs,
):
"""Implement load shedding in existing network to identify
feasibility problems
Expand Down Expand Up @@ -682,6 +687,31 @@ def load_shedding(self, temporal_disaggregation=False, **kwargs):
"Generator",
)

if negative_load_shedding_ev:
# Add negative load shedding generators for e-Mobility buses
ev_buses = network.buses[network.buses.carrier == "Li_ion"].index
index_ev = list(
range(
start + len(network.buses.index),
start + len(network.buses.index) + len(ev_buses),
)
)
network.import_components_from_dataframe(
pd.DataFrame(
dict(
marginal_cost=-marginal_cost,
p_nom=p_nom,
p_min_pu=-1,
p_max_pu=0,
carrier="negative load shedding",
bus=ev_buses,
control="PQ",
),
index=index_ev,
),
"Generator",
)


def set_control_strategies(network):
"""Sets control strategies for AC generators and storage units
Expand Down Expand Up @@ -3065,6 +3095,8 @@ def select_elec_network(etrago, apply_on="grid_model"):
)
area_network = pypsa.Network()

n_clusters = pd.NA

else:
logger.warning(
"""Parameter apply_on must be either 'grid_model' or 'market_model'
Expand Down

0 comments on commit 4f1af01

Please sign in to comment.