KTH-dESA / OSeMOSYS_step

Scripts to conduct myopic runs with OSeMOSYS models
MIT License
0 stars 2 forks source link

Updated res capacity logic #48

Closed trevorb1 closed 1 year ago

trevorb1 commented 1 year ago

My bad for misunderstanding the residual capacity passing logic! I think this should address issue #46, as residual capacity is only added to the next step now, and not all subsequent steps.

We will need to update the flow chart representing this as well.

Closes #46

trevorb1 commented 1 year ago

@HauHe

HauHe commented 1 year ago

Hi @trevorb1, thanks for working on this so quickly. But I think here we had a little misunderstanding. What I meant in issue #46 is that when adding from the results parameter NewCapacity to the ResiudalCapacity of the next steps, only the NewCapacity for years within the step and not for all years in the model should be transfered, i.e., the first step is 5 years, which means the model is 10 years long, then only NewCapacity of the first 5 years should be passed to the ResidualCapacity of the next step, not of all 10 years. Does that make sense?

trevorb1 commented 1 year ago

Hey @HauHe! Did you want to check the logic now to see if I got it right?

What I implemented is

  1. NewCapacity is filtered for actual years per step (rather than modelled)
  2. ResidualCapacity is calculated based on Filtered NewCapacity results
  3. New residual capacity is added to existing residual capacity for all downstream steps with the same options
HauHe commented 1 year ago

I'll have a look here on GitHub now. And ask if I don't get it.

HauHe commented 1 year ago

@trevorb1 you "spread" the NewCapacity over their life time in the function get_new_capacity_lifetime in the main_utils.py right? And now the only the NewCapacity of the actual step years are forwarded, right? I think it looks good, but haven't gone through each and every line.

trevorb1 commented 1 year ago

I think we are on the same page, but you may want to review the logic just to make sure! See this code here:

https://github.com/trevorb1/OSeMOSYS_step/blob/93850e204fd54b9c83472049e22062e7b52ab697/src/main.py#L457-L540

HauHe commented 1 year ago

Hi Trevor, one potential issue that I see is the old_res_cap. You take it from the data folder of the current step (both in the case that we have options and in the case that we don't), but shouldn't we in both cases take the ResidualCapacity of the next steps? and only the NewCapacity of the current step?

trevorb1 commented 1 year ago

Ahh. good catch, maybe thats whats causing our issue!

trevorb1 commented 1 year ago

I pushed a new commit to update the logic (however, please double check). However, we still have the issue of some of the scenarios failing when compared to the previous version :(

HauHe commented 1 year ago

I have checked and the passing logic of the new capacity to the next steps seems to be correct now. Therefore, I merge it. Let's keep searching what's the issue.

HauHe commented 1 year ago

Uups, wrong button at first ...