Spaces:
Sleeping
Sleeping
Commit
·
e54aef8
1
Parent(s):
1573472
Upload app.py
Browse files
app.py
CHANGED
@@ -142,7 +142,7 @@ y = m.add_variables(coords = [t,i], name = 'y', lower = 0) # Electricit
|
|
142 |
y_ch = m.add_variables(coords = [t,i], name = 'y_ch', lower = 0) # Electricity consumption --> für alles außer Elektrolyseure und Speicher ausschließen
|
143 |
l = m.add_variables(coords = [t,i], name = 'l', lower = 0) # Storage filling level
|
144 |
w = m.add_variables(coords = [t], name = 'w', lower = 0) # RES curtailment
|
145 |
-
|
146 |
|
147 |
## Objective function
|
148 |
C_tot = C_op + C_inv
|
@@ -171,7 +171,7 @@ maxcha_iSto_t = m.add_constraints((y.sel(i = iSto) + y_ch.sel(i = iSto) - K.sel(
|
|
171 |
ptg_prod_iPtG_t = m.add_constraints((y_ch.sel(i = iPtG) - K.sel(i = iPtG) <= K_0_i.sel(i = iPtG)), name = 'max_cha_ptg')
|
172 |
|
173 |
## Infeed of renewables
|
174 |
-
infeed_iRes_t = m.add_constraints((y.sel(i = iRes) - s_t_r_iRes.sel(i = iRes).sel(t = t) * K.sel(i = iRes)
|
175 |
|
176 |
## Maximum filling level restriction storage power plant
|
177 |
maxcapsto_iSto_t = m.add_constraints((l.sel(i = iSto) - K.sel(i = iSto) * e2p_iSto.sel(i = iSto) <= K_0_i.sel(i = iSto) * e2p_iSto.sel(i = iSto)), name = 'max_sto_filling')
|
@@ -242,7 +242,12 @@ fig = px.line(df_contr_marg, y='dual', x='t',title='contribution margin', color=
|
|
242 |
with colb2:
|
243 |
fig
|
244 |
|
245 |
-
|
|
|
|
|
|
|
|
|
|
|
246 |
|
247 |
# %%
|
248 |
df_Co2_price = pd.DataFrame({'CO2_Price': [float(m.constraints['CO2_limit'].dual.values) * (-1)]})
|
@@ -271,6 +276,7 @@ with pd.ExcelWriter(output, engine='xlsxwriter') as writer:
|
|
271 |
df_contr_marg.to_excel(writer, sheet_name='Contribution Margin', index=False)
|
272 |
df_new_capacities.to_excel(writer, sheet_name='Capacities', index=False)
|
273 |
df_production.to_excel(writer, sheet_name='Production', index=False)
|
|
|
274 |
df_Co2_price.to_excel(writer, sheet_name='CO2_Price', index=False)
|
275 |
|
276 |
|
|
|
142 |
y_ch = m.add_variables(coords = [t,i], name = 'y_ch', lower = 0) # Electricity consumption --> für alles außer Elektrolyseure und Speicher ausschließen
|
143 |
l = m.add_variables(coords = [t,i], name = 'l', lower = 0) # Storage filling level
|
144 |
w = m.add_variables(coords = [t], name = 'w', lower = 0) # RES curtailment
|
145 |
+
y_curt = m.add_variables(coords = [t,i], name = 'y_curt', lower = 0)
|
146 |
|
147 |
## Objective function
|
148 |
C_tot = C_op + C_inv
|
|
|
171 |
ptg_prod_iPtG_t = m.add_constraints((y_ch.sel(i = iPtG) - K.sel(i = iPtG) <= K_0_i.sel(i = iPtG)), name = 'max_cha_ptg')
|
172 |
|
173 |
## Infeed of renewables
|
174 |
+
infeed_iRes_t = m.add_constraints((y.sel(i = iRes) - s_t_r_iRes.sel(i = iRes).sel(t = t) * K.sel(i = iRes) + y_curt.sel(i = iRes) == s_t_r_iRes.sel(i = iRes).sel(t = t) * K_0_i.sel(i = iRes)), name = 'infeed')
|
175 |
|
176 |
## Maximum filling level restriction storage power plant
|
177 |
maxcapsto_iSto_t = m.add_constraints((l.sel(i = iSto) - K.sel(i = iSto) * e2p_iSto.sel(i = iSto) <= K_0_i.sel(i = iSto) * e2p_iSto.sel(i = iSto)), name = 'max_sto_filling')
|
|
|
242 |
with colb2:
|
243 |
fig
|
244 |
|
245 |
+
# curtailment
|
246 |
+
df_curtailment = m.solution['y_curt'].sel(i = iRes).to_dataframe().reset_index()
|
247 |
+
fig = px.area(m.solution['y_curt'].sel(i = iRes).to_dataframe().reset_index(), y='curtailment', x='t', title='Curtailment', color='iRes')
|
248 |
+
|
249 |
+
with colb1:
|
250 |
+
fig
|
251 |
|
252 |
# %%
|
253 |
df_Co2_price = pd.DataFrame({'CO2_Price': [float(m.constraints['CO2_limit'].dual.values) * (-1)]})
|
|
|
276 |
df_contr_marg.to_excel(writer, sheet_name='Contribution Margin', index=False)
|
277 |
df_new_capacities.to_excel(writer, sheet_name='Capacities', index=False)
|
278 |
df_production.to_excel(writer, sheet_name='Production', index=False)
|
279 |
+
df_curtailment.to_excel(writer, sheet_name='Curtailment', index=False)
|
280 |
df_Co2_price.to_excel(writer, sheet_name='CO2_Price', index=False)
|
281 |
|
282 |
|