Spaces:
Sleeping
Sleeping
Commit
·
a9e5e58
1
Parent(s):
b4eb2a5
Upload app.py
Browse files
app.py
CHANGED
@@ -216,11 +216,9 @@ i_with_capacity = m.solution['K'].where( m.solution['K'] > 0).dropna(dim = 'i').
|
|
216 |
df_production = m.solution['y'].sel(i = i_with_capacity).to_dataframe().reset_index()
|
217 |
fig = px.area(m.solution['y'].sel(i = i_with_capacity).to_dataframe().reset_index(), y='y', x='t', title='Production', color='i')
|
218 |
|
219 |
-
|
220 |
with colb2:
|
221 |
fig
|
222 |
|
223 |
-
|
224 |
# %%
|
225 |
|
226 |
df_price = m.constraints['load'].dual.to_dataframe().reset_index()
|
@@ -231,17 +229,19 @@ fig = px.line(df_price, y='dual', x='t', title='Prices')
|
|
231 |
with colb1:
|
232 |
fig
|
233 |
|
234 |
-
|
235 |
# %%
|
236 |
|
237 |
df_contr_marg = m.constraints['max_cap'].dual.to_dataframe().reset_index()
|
238 |
df_contr_marg['dual'] = df_contr_marg['dual'] / dt * (-1)
|
|
|
239 |
# %%
|
240 |
|
241 |
fig = px.line(df_contr_marg, y='dual', x='t',title='contribution margin', color='i')
|
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='y_curt', x='t', title='Curtailment', color='i')
|
@@ -250,11 +250,17 @@ with colb1:
|
|
250 |
fig
|
251 |
|
252 |
# %%
|
253 |
-
|
|
|
254 |
|
255 |
with colb2:
|
256 |
-
|
257 |
|
|
|
|
|
|
|
|
|
|
|
258 |
|
259 |
# %%
|
260 |
((m.solution['y'] / eff_i) * co2_factor_i * dt).sum()
|
@@ -276,6 +282,7 @@ with pd.ExcelWriter(output, engine='xlsxwriter') as writer:
|
|
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 |
|
|
|
216 |
df_production = m.solution['y'].sel(i = i_with_capacity).to_dataframe().reset_index()
|
217 |
fig = px.area(m.solution['y'].sel(i = i_with_capacity).to_dataframe().reset_index(), y='y', x='t', title='Production', color='i')
|
218 |
|
|
|
219 |
with colb2:
|
220 |
fig
|
221 |
|
|
|
222 |
# %%
|
223 |
|
224 |
df_price = m.constraints['load'].dual.to_dataframe().reset_index()
|
|
|
229 |
with colb1:
|
230 |
fig
|
231 |
|
|
|
232 |
# %%
|
233 |
|
234 |
df_contr_marg = m.constraints['max_cap'].dual.to_dataframe().reset_index()
|
235 |
df_contr_marg['dual'] = df_contr_marg['dual'] / dt * (-1)
|
236 |
+
|
237 |
# %%
|
238 |
|
239 |
fig = px.line(df_contr_marg, y='dual', x='t',title='contribution margin', color='i')
|
240 |
with colb2:
|
241 |
fig
|
242 |
|
243 |
+
# %%
|
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='y_curt', x='t', title='Curtailment', color='i')
|
|
|
250 |
fig
|
251 |
|
252 |
# %%
|
253 |
+
df_charging = m.solution['y_ch'].sel(i = i).to_dataframe().reset_index()
|
254 |
+
fig = px.area(m.solution['y_ch'].sel(i = i).to_dataframe().reset_index(), y='y_ch', x='t', title='Charging', color='i')
|
255 |
|
256 |
with colb2:
|
257 |
+
fig
|
258 |
|
259 |
+
# %%
|
260 |
+
df_Co2_price = pd.DataFrame({'CO2_Price': [float(m.constraints['CO2_limit'].dual.values) * (-1)]})
|
261 |
+
|
262 |
+
with colb1:
|
263 |
+
st.write('CO2 Price ' + str(df_Co2_price))
|
264 |
|
265 |
# %%
|
266 |
((m.solution['y'] / eff_i) * co2_factor_i * dt).sum()
|
|
|
282 |
df_contr_marg.to_excel(writer, sheet_name='Contribution Margin', index=False)
|
283 |
df_new_capacities.to_excel(writer, sheet_name='Capacities', index=False)
|
284 |
df_production.to_excel(writer, sheet_name='Production', index=False)
|
285 |
+
df_charging.to_excel(writer, sheet_name='Charging', index=False)
|
286 |
df_curtailment.to_excel(writer, sheet_name='Curtailment', index=False)
|
287 |
df_Co2_price.to_excel(writer, sheet_name='CO2_Price', index=False)
|
288 |
|