Skip to content

add quadratic marginal cost for stores and storage units#655

Merged
fneum merged 2 commits intomasterfrom
fneum/quadratic-storageunit
Jun 27, 2023
Merged

add quadratic marginal cost for stores and storage units#655
fneum merged 2 commits intomasterfrom
fneum/quadratic-storageunit

Conversation

@fneum
Copy link
Member

@fneum fneum commented Jun 27, 2023

No description provided.

@fneum fneum enabled auto-merge June 27, 2023 07:37
@fneum fneum disabled auto-merge June 27, 2023 07:37
@fneum fneum added this to the Release v0.24 milestone Jun 27, 2023
@codecov
Copy link

codecov bot commented Jun 27, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.02 ⚠️

Comparison is base (f2c4900) 77.15% compared to head (63a2ce8) 77.13%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #655      +/-   ##
==========================================
- Coverage   77.15%   77.13%   -0.02%     
==========================================
  Files          27       27              
  Lines        6526     6526              
  Branches     1384     1384              
==========================================
- Hits         5035     5034       -1     
  Misses       1198     1198              
- Partials      293      294       +1     

see 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@fneum fneum merged commit d657adf into master Jun 27, 2023
@coroa
Copy link
Member

coroa commented Jun 29, 2023

What's the plan for the implementation in the objective function? is there already linopy support for a quadratic objective?

@coroa coroa deleted the fneum/quadratic-storageunit branch June 29, 2023 08:20
@fneum
Copy link
Member Author

fneum commented Jun 29, 2023

It's already done! Both in linopy and PyPSA (only linopy-based).

@coroa
Copy link
Member

coroa commented Jun 29, 2023

Awesome!

for c, attr in lookup.query("marginal_cost").index:
if "marginal_cost_quadratic" in n.df(c):
cost = (
get_as_dense(n, c, "marginal_cost_quadratic", sns)
.loc[:, lambda ds: (ds != 0).any()]
.mul(weighting, axis=0)
)
if cost.empty:
continue
operation = m[f"{c}-{attr}"].sel({"snapshot": sns, c: cost.columns})
objective.append((operation * operation * cost).sum())
is_quadratic = True

Do you know by any chance whether non-diagonal quadratic objective function parameters are also supported by linopy now, in the spirit of:

v A v where A is a quadratic matrix and v the vector of variables?

@FabianHofmann
Copy link
Contributor

Yes they are :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants