The use of the value() function during instantiation of ETL costs in endogenous_technology_learning.py is causing the model to skip these ETL features. Additionally, the exponential cost function V_CostInvest = C0 * V_CapIncrease(M, r, t, p)**-log2(1 / (1 - LR)), if reached, would likely raise a ValueError ValueError: Model objective (TotalCost) contains nonlinear terms that cannot be written to LP format in Temoa as the framework is designed to work with linear problems.
The value() function is meant to be used on a parameter to return a numeric value or on a solved variable, after optimisation, to return the optimised value of that decision variable. When used on a decision variable during instantiation, this function will return 0 as the variable has not yet been solved for. Any if statements calling the value() of a decision variable will therefore always be false during instantiation.
As a result, the following lines of code in endogenous_technology_learning.py are never reached: 21-23, 28-35, 77-81. This means the ETL cost function on line 79, V_CostInvest = C0 * V_CapIncrease(M, r, t, p)**-log2(1 / (1 - LR)) is never reached and, instead, V_CostInvest is always pulled from the database table in line 93 V_CostInvest = value(M.CostInvest[r, t, timesteps[i]])
Were line 79 reached, this would raise an error as Temoa would attempt to write the non-linear equation V_CostInvest = C0 * V_CapIncrease(M, r, t, p)**-log2(1 / (1 - LR)) to a temporary LP file to hand to the solver. This would return the ValueError: Model objective (TotalCost) contains nonlinear terms that cannot be written to LP format error.
A working MILP implementation of global, clustered ETL, based on TIMES (https://iea-etsap.org/docs/TIMESDoc-Intro.pdf, p66-75), is openly available here to replicate or use (see constraint functions beginning "ETL" in temoa/temoa_model/temoa_rules.py)
The use of the
value()function during instantiation of ETL costs inendogenous_technology_learning.pyis causing the model to skip these ETL features. Additionally, the exponential cost functionV_CostInvest = C0 * V_CapIncrease(M, r, t, p)**-log2(1 / (1 - LR)), if reached, would likely raise a ValueErrorValueError: Model objective (TotalCost) contains nonlinear terms that cannot be written to LP formatin Temoa as the framework is designed to work with linear problems.The
value()function is meant to be used on a parameter to return a numeric value or on a solved variable, after optimisation, to return the optimised value of that decision variable. When used on a decision variable during instantiation, this function will return 0 as the variable has not yet been solved for. Anyifstatements calling thevalue()of a decision variable will therefore always be false during instantiation.As a result, the following lines of code in
endogenous_technology_learning.pyare never reached: 21-23, 28-35, 77-81. This means the ETL cost function on line 79,V_CostInvest = C0 * V_CapIncrease(M, r, t, p)**-log2(1 / (1 - LR))is never reached and, instead, V_CostInvest is always pulled from the database table in line 93V_CostInvest = value(M.CostInvest[r, t, timesteps[i]])Were line 79 reached, this would raise an error as Temoa would attempt to write the non-linear equation
V_CostInvest = C0 * V_CapIncrease(M, r, t, p)**-log2(1 / (1 - LR))to a temporary LP file to hand to the solver. This would return theValueError: Model objective (TotalCost) contains nonlinear terms that cannot be written to LP formaterror.A working MILP implementation of global, clustered ETL, based on TIMES (https://iea-etsap.org/docs/TIMESDoc-Intro.pdf, p66-75), is openly available here to replicate or use (see constraint functions beginning "ETL" in temoa/temoa_model/temoa_rules.py)