<jupyter_start><jupyter_text>Constraining the total capacity per bus and carrierIn this small example, we limit the nominal capacity of generators of the same production carrier at the same bus. Therefore, we introduce a column `nom_min_{carrier}` and `nom_max_{carrier}` in the `buses` dataframe. These are then used as lower and upper bounds of generators of the same carrier at the same bus. We start with importing a small example network.<jupyter_code>import pypsa
n = pypsa.examples.ac_dc_meshed(from_master=True)<jupyter_output><empty_output><jupyter_text>Now add a second wind generator at bus 'Frankfurt' and limit the combined capacity.<jupyter_code>n.add('Generator', 'Frankfurt Wind 2', bus='Frankfurt', capital_cost = 120,
      carrier='wind', p_nom_extendable=True)

n.buses.loc[['Frankfurt', 'Manchester'], 'nom_min_wind'] = 2000
n.buses.loc[['Frankfurt'],'nom_max_wind'] = 2200<jupyter_output><empty_output><jupyter_text>We are running the lopf and check whether the constraint is fulfilled.<jupyter_code>n.lopf(pyomo=False)

print(n.generators.p_nom_opt)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09709618874773139, 'fraction_numerical': 0.010889292196007259, 'mean_word_length': 7.110294117647059, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '74116', 'license': 'MIT', 'n_tokens_mistral': 371, 'n_tokens_neox': 346, 'n_words': 108, 'path': 'examples/notebooks/capacity-constraint-per-bus.ipynb', 'repo_name': 'martacki/PyPSA', 'size': '1102'}