EnergyInnovation / eps-us

Energy Policy Simulator - United States
GNU General Public License v3.0
22 stars 7 forks source link

Bug in buy in-region policy calculation #188

Closed robbieorvis closed 2 years ago

robbieorvis commented 2 years ago

I am testing the new buy in-region policy and caught a but this morning in BAU Imported Output by ISIC Code.

Right now this is calculated as BAU Output by ISIC Code/BDCSoCbIC Domestic Contetnt Share of Consumption by ISIC Code.

However, this gives the total output, not the imported share. We need to subtract the BAU output at the end to get the correct value for just imported output.

robbieorvis commented 2 years ago

Also, I don't know if I see a feedback loop for changes in direct impacts to nonfuel production. Percent Change in Production due to Policies only seems to rely on BAU Output and BAU GDP. The Macroeconomic feedback loops only appears to factors in indirect and induced impacts, but not direct impacts. If this is correct, we need to add a piece that adjusts production (direct effects).

jrissman commented 2 years ago

Thank you for your careful review of this policy lever and finding these subtle bugs. The formula error was fixed in 31b7ee3 and the direct effects of the "Buy In-Region" policy were added to the macroeconomic feedback loops in c9b2640. This policy is the only one that has its direct effects in the macroeconomic feedback loops.

Most policies' direct effects are applied within the various sectors themselves and therefore to add the direct effects to the macroecnomic feedback loop would be double-counting (with positive feedback resulting in exponential growth). But the "Buy In-Region" policy is unique in that it first enters the calculation flow within the I/O model, after the sectors have been processed. Therefore, it is the only policy for which it is correct to include its direct effects in the macroeconomic feedback loops.

The only tricky part of this was isolating the direct effects of that one policy, but fortunately, it was able to be done carefully using variables from the I/O model and minimal added complexity.

robbieorvis commented 2 years ago

Unfortunately, this fix is not working as intended. As it is currently designed, it is causing issues from extremely large year over year changes in direct effects. I pushed a temporary set of files for you to review. If you turn on the CEPP_power_incentives.cin scenario, you'll see a floating point error calculating Buildings Sector Change in Fuel Industry Cash Flow. This itself comes from the macroeconomic feedback loop on building components energy use, and you can see in the new structure in the macroeconomic feedback loops part of the model that there is a value of -1 of GDP from many industries around 2031. I think there is some kind of bug in the calculation flow.

Sorry for this continuing to be problem, but it's quite urgent that we get it working correctly.

jrissman commented 2 years ago

I'll take a look right now.

Note that I had intended to spend Friday making a presentation that I must deliver on Tuesday, but I ended up spending Friday largely on EPS. I'm really going to need to spend Monday making that presentation.

robbieorvis commented 2 years ago

Thank you. I’m sorry for the urgency, it’s just we have been asked to show preliminary results on Monday.

Sent from my iPhone

On Sep 19, 2021, at 12:49 PM, Jeff Rissman @.***> wrote:



I'll take a look right now.

Note that I had intended to spend Friday making a presentation that I must deliver on Tuesday, but I ended up spending Friday largely on EPS. I'm really going to need to spend Monday making that presentation.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHubhttps://github.com/Energy-Innovation/eps-us/issues/188#issuecomment-922503324, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AK5N6SLPT5464HZDQUTUVO3UCYICDANCNFSM5EHVVATA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

jrissman commented 2 years ago

Is this posted to the right GitHub issue? Even when I break the feedback loop link for the new "buy in-region policy" section, the same floating point error occurs. (And the value that would be added to the feedback loops by the new buy in-region direct feedback is zero, as expected, since the Buy In-Region policy is not enabled in the test scenario you provided.) Did you mean to post this in the logit function GitHub issue?

BrokenLink

robbieorvis commented 2 years ago

Should be the right issue. The floating point error I see is in buildings from the feedback loop, different than the logit issue that was resolved.

You can actually turn off the RPS policy and you will see the issue is still there.

Sent from my iPhone

On Sep 19, 2021, at 12:57 PM, Jeff Rissman @.***> wrote:



Is this posted to the right GitHub issue? Even when I break the feedback loop link for the new "buy in-region policy" section, the same floating point error occurs. (And the value that would be added to the feedback loops by the new buy in-region direct feedback is zero, as expected, since the Buy In-Region policy is not enabled in the test scenario you provided.) Did you mean to post this in the logit function GitHub issue?

[BrokenLink]https://user-images.githubusercontent.com/7120106/133936038-95ba68dc-3f92-4c31-b6cc-b0f772ca4ce9.PNG

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHubhttps://github.com/Energy-Innovation/eps-us/issues/188#issuecomment-922504414, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AK5N6SPBYDGOT24Q6BC6QCLUCYJAJANCNFSM5EHVVATA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

jrissman commented 2 years ago

In the file FoPITY-4, there are VALUE errors in Excel for the "elec transmission growth" policy. FoPITY_Errors