pencleanenergy / MATCH-model

MATCH model for planning time-coincident clean energy portfolios
GNU Affero General Public License v3.0
27 stars 10 forks source link

Strange code pattern #70

Open eric-muller opened 1 year ago

eric-muller commented 1 year ago

In a number of places, we have a PERIODS p, and want to use data indexed by TIMEPOINTS for that period p:

excess_generation.py:50 generators/dispatch.py:367 generators/dispatch.py:384 for t in m.TIMEPOINTS if m.tp_period[t] == p

renewable_target.py:72 renewable_target.py:83 for (z, t) in m.ZONE_TIMEPOINTS if m.tp_period[t] == p

However, at renewable_target.py:97, the TIMEPOINTS are not restricted to those in the period: for t in m.TIMEPOINTS

I don't understand enough of the code to tell if this a problem or not, I only noticed the difference of pattern. If it is intended, a comment may help the reader.

grgmiller commented 1 year ago

Thanks for flagging this. We should probably make this consistent but it likely should not affect the outputs. Because the model only runs for a single year (period), the total set of timepoints should be the same as the subset of timepoints within the single period.