Time resolution -- is it implicitly 1 hour?

294 views
Skip to first unread message

David Kayanan

unread,
Mar 23, 2021, 3:00:31 AM3/23/21
to pypsa
Hello all,

I'm new to PyPSA and everything is quite impressive so far. Much thanks to all behind this!

Correct me if I'm wrong, but it appears as though that PyPSA's notion of time is discrete, and it doesn't even ask you what the duration of each snapshot is.

If the marginal_cost parameter is interepretted as Currency / MWh, optimizing dispatch only (w/o capital costs, and considering fuel costs only) seemingly implies that each snapshot is 1 hour, if you compare the objective function and the MW * marginal cost of each generator.

However, I am studying power system flexibility, which is why time dynamics is relevant. Many markets are moving toward 5-min dispatch (e.g. NEM in Au, WESM in Ph, to name a few). I am playing with models of different time resolution.

Because PyPSA doesn't seem to let you set the time resolution and instead assumes 1h, the only fix for me as of writing (PyPSA 0.17.1) is to adjust the MC to Currency / (MW * resolution in h). This seems to be the only way, especially if you consider other costs in the objective (e.g. startup costs).

Is this right? Any plans on including an explicit duration in the model? It seems to be simple to implement. Thank you!

Tom Brown

unread,
Mar 23, 2021, 11:17:49 AM3/23/21
to py...@googlegroups.com
Hi David,

Yes, this is taken into account in PyPSA with the
network.snapshot_weightings, which tells PyPSA the duration of each
snapshot. For a 3-hourly model set it to 3; for a 5-minute model set it
to 1/12.

We will be altering this interface soon to distinguish between objective
function weighting and storage-power-energy duration, but for now you
can use it as described above.

Best wishes,

Tom

On 23/03/2021 08:00, David Kayanan wrote:
> Hello all,
>
> I'm new to PyPSA and everything is quite impressive so far. Much thanks
> to all behind this!
>
> Correct me if I'm wrong, but it appears as though that PyPSA's notion of
> time is discrete, and it doesn't even ask you what the duration of each
> snapshot is.
>
> If the marginal_cost parameter is interepretted as Currency / MWh,
> optimizing dispatch only (w/o capital costs, and considering fuel costs
> only) seemingly *_implies that each snapshot is 1 hour,_* if you compare
> the objective function and the MW * marginal cost of each generator.
>
> However, I am studying power system flexibility, which is why time
> dynamics is relevant. Many markets are moving toward 5-min dispatch
> (e.g. NEM in Au, WESM in Ph, to name a few). I am playing with models of
> different time resolution.
>
> Because PyPSA doesn't seem to let you set the time resolution and
> instead assumes 1h, the only fix for me as of writing (PyPSA 0.17.1) is
> to adjust the MC to Currency / (MW * resolution in h). This seems to be
> the only way, especially if you consider other costs in the objective
> (e.g. startup costs).
>
> Is this right? Any plans on including an explicit duration in the model?
> It seems to be simple to implement. Thank you!
>
> --
> 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 view this discussion on the web, visit
> https://groups.google.com/d/msgid/pypsa/8de70f16-96fa-4441-af48-aeef0d9eed84n%40googlegroups.com
> <https://groups.google.com/d/msgid/pypsa/8de70f16-96fa-4441-af48-aeef0d9eed84n%40googlegroups.com?utm_medium=email&utm_source=footer>.

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

Tom Brown (he/him)
Research Group Leader, Energy System Modelling

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

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

David Kayanan

unread,
Mar 24, 2021, 10:27:55 PM3/24/21
to pypsa
Dear Tom,

Thanks for your prompt response! And yes, that did the trick. I might just add that this is the way I did it:

net = pypsa.Network()

net.set_snapshots(NetLoad_MW_5m.index)           # NetLoad_MW_5m is my demand data
net.snapshot_weightings= pd.Series(dur_H, index=net.snapshots)    # dur_H is my period duration. For 5 mins, this is 5/60

I don't think there's a method for this, but I just directly set the attribute.

Best regads,
David

Reply all
Reply to author
Forward
0 new messages