Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

marginal_cost_quadratic does not affect buses_t.marginal_price #790

Closed
loongmxbt opened this issue Nov 23, 2023 · 2 comments
Closed

marginal_cost_quadratic does not affect buses_t.marginal_price #790

loongmxbt opened this issue Nov 23, 2023 · 2 comments
Labels

Comments

@loongmxbt
Copy link
Contributor

Hi, I've tried the field marginal_cost_quadratic and seems does not affect the objective value. I assume the marginal_cost_quadratic turns the cost into a*p^2 + b*p, and if I randomly add the marginal_cost_quadraticcolumn, the objective value and marginal_price will change.

BTW, is any example notebook of setting the marginal_cost_quadratic?

import pypsa

n = pypsa.examples.ac_dc_meshed()


n.optimize(solver_name='highs')
print('First Result')
print(n.buses_t.marginal_price["London"])
print(n.generators_t.p)


print('Second Result')

# n.generators.loc["Manchester Wind","marginal_cost"] = 0.08
n.generators.loc["Manchester Wind","marginal_cost_quadratic"] = 0.02
# n.generators["marginal_cost_quadratic"] = 0.1

n.optimize(solver_name='highs')
print(n.generators_t.p)
print(n.buses_t.marginal_price["London"])
1st
Objective value     : -3.4742542914e+06
2nd
Objective value     : -3.4742542914e+06
@loongmxbt loongmxbt added the bug label Nov 23, 2023
@fneum
Copy link
Member

fneum commented Nov 23, 2023

Possibly related to PyPSA/linopy#171

@fneum
Copy link
Member

fneum commented Aug 3, 2024

I have tried with a slightly different setup, and the quadratic cost terms definitely impacted prices and costs. Perhaps the marginal_cost_quadratic was too small here to have an effect?

I noticed that if you specify the solver in HiGHS (e.g. IPM), the quadratic terms are ignored.

@fneum fneum closed this as completed Aug 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants