Repository navigation
Conversation
In myopic mode each window is a separate model, so time_future.last() is the end of the window. The cost reporting used that year as the end of loan payments, and no later window reports the remaining payments, so output_cost and the total cost of a myopic run were too low. Add myopic_horizon_end, set by the loader in myopic runs to the last future period of the study, and use it for the reported loan costs. The objective still uses the window end, as described in the myopic docs, so the model decisions do not change. Fixes TemoaProject#364
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
WalkthroughMyopic runs now retain the full study-horizon end for loan-payment reporting. Cost polling uses that end period, and a full-run test checks reported payments for capacity built in 1990. ChangesMyopic loan payment reporting
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: Merge Risk: ⚪ Minimal · up to
|
Fixes #364.
In myopic mode each window is a separate model, so
time_future.last()is the end of the window.poll_cost_results()intable_data_puller.pypasses that year toloan_cost()asp_e, so the investment costs written tooutput_coststop at the end of the window. A technology's costs are written only in the window where it is built, so no later window reports the remaining payments. The total cost of a myopic run inoutput_objectiveis the sum ofoutput_cost, so it is too low as well.Change
myopic_horizon_end. In myopic runs the loader sets it to the last future period of the study, next tomyopic_discounting_year. Otherwise it is 0.costs.loan_payment_end()returns it, ortime_future.last()outside myopic runs.table_data_puller.pyand the economies-of-scale data puller use it forp_ein the reported loan costs.docs/source/myopic.rst. So the model decisions do not change. The last sentence of that paragraph, onoutput_cost, is updated.Results on the myopic Utopia test case (view depth 2, periods 1990 to 2020)
d_investinoutput_costflowinoutput_flow_outcapacityinoutput_net_capacityThe technologies built in 1990 are solved in the first window, which ends in 2010. They now report loan payments to 2020, not 2010. For example, the undiscounted
investof RHO goes from 2124.65 to 3186.97, which is 30/20 times the old value. The 2000 and 2010 builds are solved in the last window and do not change.Tests
test_myopic_utopia: new expected sum, with a comment. New check: RHO built in 1990 has a 30-year life that ends with the study, and its loan rate equals the global discount rate. So its discounted investment cost must equal built capacity timescost_invest(1633.052). Before the change it was the present value of 20 of the 30 payments, and the test fails onunstable.smoke_test.py::test_cliandtest_help, which time out on this machine without the change too.ruff check,ruff formatandmypy temoapass.Whether the objective of a window should also count payments to the end of the study is a modeling choice. This PR leaves it as it is.