Egret icon indicating copy to clipboard operation
Egret copied to clipboard

Bugs in KOW_generation_limits

Open HunterTracer opened this issue 1 year ago • 0 comments

In line 305-306 in model_library/unit_commitment/generation_limits.py, the coef is set as max((Pmax - SD - SD_time_limit * RD) - (Pmax - SU - (SU_time_limit+1) * RU), 0). However, I think there is a mistake in its order and it should be reversed. The correct one should be max((Pmax - SU - (SU_time_limit + 1) * RU) - (Pmax - SD - SD_time_limit * RD), 0).

Consider that UnitOn(t) = 1, UnitStart(t - SU_time_limit - 1) = 1 and meanwhile UnitStop(t + 1 + SD_time_limit) = 1, then the maximum power of Pg(t) should be min((SU + (SU_time_limit+1) * RU), (SD + SD_time_limit * RD)). However, in the current program, if UnitOn(t) = 1, UnitStart(t - SU_time_limit - 1) = 1 and meanwhile UnitStop(t + 1 + SD_time_limit) = 1 and (SU + (SU_time_limit+1) * RU) > (SD + SD_time_limit * RD), then the upper bound will be (SD + SD_time_limit * RD) - ((SU + (SU_time_limit+1) * RU) - (SD + SD_time_limit * RD)) instead of the true value (SD + SD_time_limit * RD), which is invalid.

I also check the generation limits in KOW_production_costs_super_tight in production_cost.py and find the order is right. Since we already subtract sd_step[SD_time_limit]*m.UnitStop[g,t+1+SD_time_limit] in line 276, then it is correct to subtract max(su_step[j]-sd_step[SD_time_limit],0)*m.UnitStart[g,t-j] in line 280. I also find that at first the order in KOW_production_costs_super_tight was also wrong and get fixed in https://github.com/grid-parity-exchange/Egret/commit/d21d5d74431d8b20824fd59673e2fde3f43b137d. Unfortunately, it seems that the bugs in generation_limits.py are not considered in this code.

Is it a bug? I already submit my code at https://github.com/grid-parity-exchange/Egret/pull/312. Many thanks! @bknueven

HunterTracer avatar Oct 05 '23 12:10 HunterTracer