Skip to content

334 locational eligibility based on operation rates#513

Draft
lovinduw wants to merge 13 commits intodevelopfrom
334-locational-eligibility-based-on-operation-rates
Draft

334 locational eligibility based on operation rates#513
lovinduw wants to merge 13 commits intodevelopfrom
334-locational-eligibility-based-on-operation-rates

Conversation

@lovinduw
Copy link
Collaborator

When looking into the issue we identified that Transmission capacity min/max/fix or operation min/max/fix can be submitted as Dataframes or as Dataseries. These values are pre-processed in the preprocess2dimData function in Utils. During this pre-processing, if these values are in Dataframe format, only the locations which has a value > 0 are considered. But, if they are in Series format, all the values are considered including 0s. If locationEligibility is not set by the user in the beginning, it will be automatically set such that only the locations which has a value > 0 for capacity min/max/fix or operation min/max/fix are considered as eligible. Later, this locationEligibility is checked with the locations in the processed capacity min/max/fix or operation min/max/fix data and the process fails if they are not the same.

Therefore, if the inputs (capacity min/max/fix) are in Series format with some values 0, this creates error. To avoid this, we added new lines to Utils in preprocess2dimData function and now it only considers values greater than 0 for Series as well (similar to Dataframes) if the LocationEligibility is not set at the beginning.

@phil-fzj
Copy link
Collaborator

closes #133

@phil-fzj phil-fzj linked an issue Nov 28, 2025 that may be closed by this pull request
@phil-fzj
Copy link
Collaborator

phil-fzj commented Jan 8, 2026

@lovinduw can you check this comment i made last time? #133 (comment)
And if not integrate this?

@JohannesBehrens JohannesBehrens self-requested a review January 22, 2026 13:53
Copy link
Collaborator

@JohannesBehrens JohannesBehrens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this code update include code to set loc elig to 0 when operation rate max is 0 for all time steps/ investment periods?

name="transmission",
commodity="energy",
operationRateMax=operationRateMax,
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add assertion statements to make sure the test works as intended

index.append(loc)
data_.append(data[loc])
data_ = pd.Series(data_, index=index)
data_.sort_index(inplace=True)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code looks like it would simply ignore data, which is zero? Doesn't this result in Nones which are ignored later?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This becomes a problem when we want to set for example operationRateMax = 0. If this is ignored the operation would not be constrained

@lovinduw
Copy link
Collaborator Author

lovinduw commented Feb 5, 2026

@JohannesBehrens:

I reviewed the issue from the beginning. The problem occurs when the locationEligibility for transmission components are not explicitly declared and transmission capacityFix = 0 values (for some lines) is explicitly declared. When the locationEligibility is not set, Fine set the locationEligibility based on the capacityFix values. This locationEligibility is set only for the transmission lines with a capacity > 0. For example if capacityMax[loc1_loc2] = 1.5, locationEligibility[loc1_loc2] = 1. If capacityMax[loc1_loc3] = 0, it won't appear in locationEligibility. Therefore, when Fine checks the indexes in the capacityFix and locationEligibility, it creates an error because the number of indexes in capacityFix > number of indexes in locationEligibility. This is because the indexes with capacity 0 in capacityFix are not there in the locationEligibility indexes. Apart from capacityFix, if we define operationMax values with values 0, a similar error is raised. In this case, the indexes in locationEligibility (which is still created based on capacityFix values) are not matching with the columns of operationMax (operationMax is a DataFrame).

However, if only operationMax is defined without defining capacityFix, then the locationEligibility is set for all transmission lines (even for lines with operationMax = 0). Therefore, in this case no error occurs.

Possible solution:

If we can remove the below code lines in transmission.py, which removes the locationEligibility of the lines with capacityFix = 0, the problem will be resolved. But, need your opinion with why we have that code lines in the first place. Is it just to speedup the optimization/ memory save etc.?

image

@phil-fzj phil-fzj marked this pull request as draft February 20, 2026 11:54
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.

Locational Eligibility based on operation rates

4 participants