I am trying to modify MimiDICE2016R2 using the Mimi API. I successfully defined new components and replaced the existing co2cycle, climatedynamics, damages components with the following code.
# Load newly defined compoments include("../input/FAIRco2cycle_component.jl") include("../input/UPDATEDclimatedynamics_component.jl") include("../input/UPDATEDdamages_component.jl") # Replace DICE2016R2 components with newly defined components replace!(m, :co2cycle => Main.FAIRco2cycle, reconnect = false) replace!(m, :climatedynamics => Main.UPDATEDclimatedynamics, reconnect = false) replace!(m, :damages => Main.UPDATEDdamages, reconnect = false)
Thereafter, I provided values for the unshared parameters in the new replaced components with update_param!() which worked fine as well. I can also connect the replaced co2cycle with the original emissions components:
connect_param!(m, :co2cycle, :E, :emissions, :E)
What I find strange here, is that the original component name “co2cycle” is maintained and not replaced by the new component name “FAIRco2cycle”. However, that is not my problem.
My problem arises when I try to connect the parameter TAT in component co2cycle with variable TAT in component climatedynamics with the following command:
connect_param!(m, :co2cylce, :TAT, :climatedynamcis, :TAT)
This throws me the error “MethodError: no method matching disconnect_param!(::Mimi.ModelDef, ::Nothing, ::Symbol)”.
Similarly but differently, if I try to connect the parameter TAT_IPCC in damages component with the variable TAT_IPCC in the climatedynamics component
connect_param!(m, :damages, :TAT_IPCC, :climatedynamcis, :TAT_IPCC)
it throws me the error “no method matching first_and_last(::Nothing)”.
I feel this is somehow related to the naming of the components after I replaced them, but I cannot find a solution. I would be very glad, if you could help me on that. A search in the forum did not produce question with a similar problem.