Shadow prices in a unit commitment problem

1,008 views
Skip to first unread message

gktho...@gmail.com

unread,
Jun 13, 2018, 10:48:33 AM6/13/18
to pypsa
Hi everyone,

I have built a little unit commitment model - as in the tutorial - and now I wanted to look at the prices, but all marginal prices are NaN.

I noticed that this is also the case if I look at the tutorial. Is there a way to get shadow prices, or is that not compatible with unit commitment at the moment?

Many thanks in advance,
Georg

Tom Brown

unread,
Jun 16, 2018, 2:20:19 AM6/16/18
to py...@googlegroups.com
Hi Georg,

Unit commitment is a Mixed Integer Linear Problem (MILP) and they do not
in general have well-defined shadow prices. That is why solvers will
give NaN on the marginal prices.

There are heuristic ways to get equivalent prices out, but I'm not an
expert on this. You could rerun the problem without unit commitment, but
with the generator choices from the unit commitment, i.e. look at the
status variables and remove generators that have status 0 (off).

Best,

Tom
> --
> You received this message because you are subscribed to the Google
> Groups "pypsa" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to pypsa+un...@googlegroups.com
> <mailto:pypsa+un...@googlegroups.com>.
> To post to this group, send email to py...@googlegroups.com
> <mailto:py...@googlegroups.com>.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/pypsa/91ba9088-c294-4ca4-b347-6465b5300a3e%40googlegroups.com
> <https://groups.google.com/d/msgid/pypsa/91ba9088-c294-4ca4-b347-6465b5300a3e%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

--
Karlsruhe Institute of Technology (KIT)
Institute for Automation and Applied Informatics (IAI)

Dr. Tom Brown
Energy System Modelling

Phone: +49 721 608 25737
Fax: +49 721 608 22602
Website: https://www.iai.kit.edu/
Personal website: https://nworbmot.org/

Visitor Address:
Office 309
Campus North Building 445
Hermann-von-Helmholtz-Platz 1
76344 Eggenstein-Leopoldshafen

gktho...@gmail.com

unread,
Jun 20, 2018, 2:27:41 AM6/20/18
to pypsa
Thanks! That does the trick.

Best,
Georg

Jiří Šumbera

unread,
Oct 4, 2018, 1:03:54 PM10/4/18
to pypsa
Hi all, 

I am new to PyPSA, so apologies if this has been answered elsewhere (but I did not find it, even though I had looked).

1) How would one go about doing what Tom suggested below, i.e. remove generators that have status 0 (off). What if the generators are off only during part of the simulation, is it possible to remove them? Wouldn't decreasing p_nom or p_max_pu to 0 be easier?

2) The general approach I have seen for dealing with this issue (no dual variables in a MIPL problem) is not removing the generators, but rather fixing the unit commitment variables and rerunning the model as LP (which then provides shadow prices based on the marginal costs but without taking into account start-up costs etc.) Is this possible to do with PyPSA (and how)? I don't see and input attribute which would allow to specify the status (on or off), hence the crude approach I would take would be
i) in periods when status = 0, set p_min_pu=p_max_pu=0
ii) in periods when status = 1, set p_min_pu and p_max_pu to their "normal" values

Best regards
Jiri

Jonas Hörsch

unread,
Oct 8, 2018, 8:32:48 AM10/8/18
to Jiří Šumbera, pypsa
Hi Jiri and list,

indeed your general approach to fix the generator commitment status
variables is quite easy to realize using some of the less-well
documented interfaces of pypsa and the underlying pyomo, as demonstrated
in the attached notebook.

Contrary to what has been said the solution then does include startup
and shutdown costs, since the state changes are still properly tracked
in the objective (the state is only not optimized anymore).

Best regards,
Jonas

PyPSA dev team

unit-commitment.ipynb
signature.asc

Ross Donnelly

unread,
Oct 9, 2019, 2:27:14 PM10/9/19
to pypsa
Hi Jonas,

I realise your post was from last year but I have just found your solution to the same problem I was just having

I note that you say that the startup and shutdown costs would be included in marginal price calculation in your example but this does not appear to be the case for. Testing various start up and shut down costs results in no change in the final marginal price series.

Any advice on this?

Thanks
Ross

Rowan Tunnicliffe

unread,
Apr 20, 2023, 5:19:46 AM4/20/23
to pypsa
Hi all,

I've been trying to replicate this approach using a linopy model rather than a pyomo model as I've built my model custom constraints using linopy, but I'm not having much success. Has anyone else managed this or would be able to suggest how to achieve it?

Thanks,
Rowan

Fabian Hofmann

unread,
Apr 20, 2023, 6:48:17 AM4/20/23
to py...@googlegroups.com

Hey Ross,


I am not sure what the exact problem is, but in case you want to fix the status variable, please have a look at 


https://pypsa.readthedocs.io/en/latest/optimal_power_flow.html#fixing-variables


This gives you a hint on how to fix any variable in the `linopy` interface.


Best wishes,

Fabian Hofmann

--
You received this message because you are subscribed to the Google Groups "pypsa" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pypsa+un...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/pypsa/4517b081-8e6c-4091-8ff5-2dd9cc8ad21e%40googlegroups.com.
-- 
Fabian Hofmann 

Postdoctoral Researcher
Institute of Energy Technology
Technische Universität Berlin
http://fabianhofmann.org/

Group website: https://tub-ensys.github.io/
Reply all
Reply to author
Forward
0 new messages