diff --git a/data/SC validation data/create_scc_validation_file.jl b/data/SC validation data/create_scc_validation_file.jl index af26201..6704464 100644 --- a/data/SC validation data/create_scc_validation_file.jl +++ b/data/SC validation data/create_scc_validation_file.jl @@ -15,7 +15,7 @@ specs = Dict([ :last_year => [2200, 2305], ]) -results = DataFrame(year = [], eta = [], prtp = [], last_year = [], SC = []) +results = DataFrame(year=[], eta=[], prtp=[], last_year=[], SC=[]) for year in specs[:year] for eta in specs[:eta] diff --git a/src/MimiDICE2013.jl b/src/MimiDICE2013.jl index af745a2..d82ab20 100644 --- a/src/MimiDICE2013.jl +++ b/src/MimiDICE2013.jl @@ -69,30 +69,30 @@ function constructdice(params_dict) end # Set shared parameters - name is a Symbol representing the param_name, here - # we will create a shared model parameter with the same name as the component - # parameter and then connect our component parameters to this shared model parameter + # we will create a shared model parameter with the same name as the component + # parameter and then connect our component parameters to this shared model parameter - # * for convenience later, name shared model parameter same as the component - # parameters, but this is not required could give a unique name * + # * for convenience later, name shared model parameter same as the component + # parameters, but this is not required could give a unique name * - add_shared_param!(m, :fco22x, params_dict[:shared][:fco22x]) - connect_param!(m, :climatedynamics, :fco22x, :fco22x) - connect_param!(m, :radiativeforcing, :fco22x, :fco22x) + add_shared_param!(m, :fco22x, params_dict[:shared][:fco22x]) + connect_param!(m, :climatedynamics, :fco22x, :fco22x) + connect_param!(m, :radiativeforcing, :fco22x, :fco22x) - add_shared_param!(m, :MIU, params_dict[:shared][:MIU], dims = [:time]) - connect_param!(m, :neteconomy, :MIU, :MIU) - connect_param!(m, :emissions, :MIU, :MIU) + add_shared_param!(m, :MIU, params_dict[:shared][:MIU], dims=[:time]) + connect_param!(m, :neteconomy, :MIU, :MIU) + connect_param!(m, :emissions, :MIU, :MIU) - add_shared_param!(m, :l, params_dict[:shared][:l], dims = [:time]) - connect_param!(m, :neteconomy, :l, :l) - connect_param!(m, :grosseconomy, :l, :l) - connect_param!(m, :welfare, :l, :l) + add_shared_param!(m, :l, params_dict[:shared][:l], dims=[:time]) + connect_param!(m, :neteconomy, :l, :l) + connect_param!(m, :grosseconomy, :l, :l) + connect_param!(m, :welfare, :l, :l) return m end -function getdiceexcel(;datafile=joinpath(dirname(@__FILE__), "..", "data", "DICE_2013_Excel.xlsm")) +function getdiceexcel(; datafile=joinpath(dirname(@__FILE__), "..", "data", "DICE_2013_Excel.xlsm")) params_dict = getdice2013excelparameters(datafile) m = constructdice(params_dict) @@ -100,7 +100,7 @@ function getdiceexcel(;datafile=joinpath(dirname(@__FILE__), "..", "data", "DICE return m end -function getdicegams(;datafile=joinpath(dirname(@__FILE__), "..", "data", "DICE2013_IAMF_Parameters.xlsx")) +function getdicegams(; datafile=joinpath(dirname(@__FILE__), "..", "data", "DICE2013_IAMF_Parameters.xlsx")) params_dict = getdice2013gamsparameters(datafile) m = constructdice(params_dict) diff --git a/src/components/climatedynamics_component.jl b/src/components/climatedynamics_component.jl index 1ab4c77..ca2ac99 100644 --- a/src/components/climatedynamics_component.jl +++ b/src/components/climatedynamics_component.jl @@ -1,11 +1,11 @@ @defcomp climatedynamics begin - TATM = Variable(index=[time]) # Increase in temperature of atmosphere (degrees C from 1900) - TOCEAN = Variable(index=[time]) # Increase in temperature of lower oceans (degrees C from 1900) + TATM = Variable(index=[time]) # Increase in temperature of atmosphere (degrees C from 1900) + TOCEAN = Variable(index=[time]) # Increase in temperature of lower oceans (degrees C from 1900) - FORC = Parameter(index=[time]) # Increase in radiative forcing (watts per m2 from 1900) - fco22x = Parameter() # Forcings of equilibrium CO2 doubling (Wm-2) - t2xco2 = Parameter() # Equilibrium temp impact (oC per doubling CO2) - tatm0 = Parameter() # Initial atmospheric temp change (C from 1900) + FORC = Parameter(index=[time]) # Increase in radiative forcing (watts per m2 from 1900) + fco22x = Parameter() # Forcings of equilibrium CO2 doubling (Wm-2) + t2xco2 = Parameter() # Equilibrium temp impact (oC per doubling CO2) + tatm0 = Parameter() # Initial atmospheric temp change (C from 1900) tocean0 = Parameter() # Initial lower stratum temp change (C from 1900) # Transient TSC Correction ("Speed of Adjustment Parameter") @@ -18,14 +18,14 @@ if is_first(t) v.TATM[t] = p.tatm0 else - v.TATM[t] = v.TATM[t - 1] + p.c1 * ((p.FORC[t] - (p.fco22x / p.t2xco2) * v.TATM[t - 1]) - (p.c3 * (v.TATM[t - 1] - v.TOCEAN[t - 1]))) + v.TATM[t] = v.TATM[t-1] + p.c1 * ((p.FORC[t] - (p.fco22x / p.t2xco2) * v.TATM[t-1]) - (p.c3 * (v.TATM[t-1] - v.TOCEAN[t-1]))) end # Define function for TOCEAN if is_first(t) v.TOCEAN[t] = p.tocean0 else - v.TOCEAN[t] = v.TOCEAN[t - 1] + p.c4 * (v.TATM[t - 1] - v.TOCEAN[t - 1]) + v.TOCEAN[t] = v.TOCEAN[t-1] + p.c4 * (v.TATM[t-1] - v.TOCEAN[t-1]) end end -end \ No newline at end of file +end diff --git a/src/components/co2cycle_component.jl b/src/components/co2cycle_component.jl index 2f0510b..b42201d 100644 --- a/src/components/co2cycle_component.jl +++ b/src/components/co2cycle_component.jl @@ -1,42 +1,42 @@ @defcomp co2cycle begin - MAT = Variable(index=[time]) # Carbon concentration increase in atmosphere (GtC from 1750) - ML = Variable(index=[time]) # Carbon concentration increase in lower oceans (GtC from 1750) - MU = Variable(index=[time]) # Carbon concentration increase in shallow oceans (GtC from 1750) + MAT = Variable(index=[time]) # Carbon concentration increase in atmosphere (GtC from 1750) + ML = Variable(index=[time]) # Carbon concentration increase in lower oceans (GtC from 1750) + MU = Variable(index=[time]) # Carbon concentration increase in shallow oceans (GtC from 1750) - E = Parameter(index=[time]) # Total CO2 emissions (GtCO2 per year) - mat0 = Parameter() # Initial Concentration in atmosphere 2010 (GtC) - ml0 = Parameter() # Initial Concentration in lower strata 2010 (GtC) - mu0 = Parameter() # Initial Concentration in upper strata 2010 (GtC) + E = Parameter(index=[time]) # Total CO2 emissions (GtCO2 per year) + mat0 = Parameter() # Initial Concentration in atmosphere 2010 (GtC) + ml0 = Parameter() # Initial Concentration in lower strata 2010 (GtC) + mu0 = Parameter() # Initial Concentration in upper strata 2010 (GtC) # Parameters for long-run consistency of carbon cycle - b11 = Parameter() # Carbon cycle transition matrix atmosphere to atmosphere - b12 = Parameter() # Carbon cycle transition matrix atmosphere to shallow ocean - b21 = Parameter() # Carbon cycle transition matrix biosphere/shallow oceans to atmosphere - b22 = Parameter() # Carbon cycle transition matrix shallow ocean to shallow oceans - b23 = Parameter() # Carbon cycle transition matrix shallow to deep ocean - b32 = Parameter() # Carbon cycle transition matrix deep ocean to shallow ocean - b33 = Parameter() # Carbon cycle transition matrix deep ocean to deep oceans + b11 = Parameter() # Carbon cycle transition matrix atmosphere to atmosphere + b12 = Parameter() # Carbon cycle transition matrix atmosphere to shallow ocean + b21 = Parameter() # Carbon cycle transition matrix biosphere/shallow oceans to atmosphere + b22 = Parameter() # Carbon cycle transition matrix shallow ocean to shallow oceans + b23 = Parameter() # Carbon cycle transition matrix shallow to deep ocean + b32 = Parameter() # Carbon cycle transition matrix deep ocean to shallow ocean + b33 = Parameter() # Carbon cycle transition matrix deep ocean to deep oceans function run_timestep(p, v, d, t) # Define function for MAT if is_first(t) v.MAT[t] = p.mat0 else - v.MAT[t] = v.MAT[t - 1] * p.b11 + v.MU[t - 1] * p.b21 + (p.E[t - 1] * (5 / 3.666)) + v.MAT[t] = v.MAT[t-1] * p.b11 + v.MU[t-1] * p.b21 + (p.E[t-1] * (5 / 3.666)) end # Define function for MU if is_first(t) v.MU[t] = p.mu0 else - v.MU[t] = v.MAT[t - 1] * p.b12 + v.MU[t - 1] * p.b22 + v.ML[t - 1] * p.b32 + v.MU[t] = v.MAT[t-1] * p.b12 + v.MU[t-1] * p.b22 + v.ML[t-1] * p.b32 end # Define function for ML if is_first(t) v.ML[t] = p.ml0 else - v.ML[t] = v.ML[t - 1] * p.b33 + v.MU[t - 1] * p.b23 + v.ML[t] = v.ML[t-1] * p.b33 + v.MU[t-1] * p.b23 end end end diff --git a/src/components/damages_component.jl b/src/components/damages_component.jl index 791774d..12eb2da 100644 --- a/src/components/damages_component.jl +++ b/src/components/damages_component.jl @@ -2,18 +2,18 @@ DAMAGES = Variable(index=[time]) # Damages (trillions 2005 USD per year) DAMFRAC = Variable(index=[time]) # Damages (fraction of gross output) - TATM = Parameter(index=[time]) # Increase temperature of atmosphere (degrees C from 1900) - YGROSS = Parameter(index=[time]) # Gross world product GROSS of abatement and damages (trillions 2005 USD per year) - a1 = Parameter() # Damage coefficient - a2 = Parameter() # Damage quadratic term - a3 = Parameter() # Damage exponent - damadj = Parameter() # Adjustment exponent in damage function + TATM = Parameter(index=[time]) # Increase temperature of atmosphere (degrees C from 1900) + YGROSS = Parameter(index=[time]) # Gross world product GROSS of abatement and damages (trillions 2005 USD per year) + a1 = Parameter() # Damage coefficient + a2 = Parameter() # Damage quadratic term + a3 = Parameter() # Damage exponent + damadj = Parameter() # Adjustment exponent in damage function usedamadj = Parameter{Bool}() # Only the Excel version uses the damadj parameter function run_timestep(p, v, d, t) # Define function for DAMFRAC v.DAMFRAC[t] = p.a1 * p.TATM[t] + p.a2 * p.TATM[t]^p.a3 - + # Define function for DAMAGES if p.usedamadj # Excel version diff --git a/src/components/emissions_component.jl b/src/components/emissions_component.jl index 8a39ece..b6fe0e8 100644 --- a/src/components/emissions_component.jl +++ b/src/components/emissions_component.jl @@ -1,26 +1,26 @@ @defcomp emissions begin - CCA = Variable(index=[time]) # Cumulative indiustrial emissions - E = Variable(index=[time]) # Total CO2 emissions (GtCO2 per year) - EIND = Variable(index=[time]) # Industrial emissions (GtCO2 per year) + CCA = Variable(index=[time]) # Cumulative indiustrial emissions + E = Variable(index=[time]) # Total CO2 emissions (GtCO2 per year) + EIND = Variable(index=[time]) # Industrial emissions (GtCO2 per year) - etree = Parameter(index=[time]) # Emissions from deforestation - MIU = Parameter(index=[time]) # Emission control rate GHGs - sigma = Parameter(index=[time]) # CO2-equivalent-emissions output ratio - YGROSS = Parameter(index=[time]) # Gross world product GROSS of abatement and damages (trillions 2005 USD per year) - cca0 = Parameter() # Initial cumulative industrial emissions + etree = Parameter(index=[time]) # Emissions from deforestation + MIU = Parameter(index=[time]) # Emission control rate GHGs + sigma = Parameter(index=[time]) # CO2-equivalent-emissions output ratio + YGROSS = Parameter(index=[time]) # Gross world product GROSS of abatement and damages (trillions 2005 USD per year) + cca0 = Parameter() # Initial cumulative industrial emissions function run_timestep(p, v, d, t) # Define function for EIND v.EIND[t] = p.sigma[t] * p.YGROSS[t] * (1 - p.MIU[t]) - + # Define function for E v.E[t] = v.EIND[t] + p.etree[t] - + # Define function for CCA if is_first(t) v.CCA[t] = p.cca0 else - v.CCA[t] = v.CCA[t - 1] + v.EIND[t - 1] * 5 / 3.666 + v.CCA[t] = v.CCA[t-1] + v.EIND[t-1] * 5 / 3.666 end end diff --git a/src/components/grosseconomy_component.jl b/src/components/grosseconomy_component.jl index 977ceb9..7320954 100644 --- a/src/components/grosseconomy_component.jl +++ b/src/components/grosseconomy_component.jl @@ -1,20 +1,20 @@ @defcomp grosseconomy begin - K = Variable(index=[time]) # Capital stock (trillions 2005 US dollars) - YGROSS = Variable(index=[time]) # Gross world product GROSS of abatement and damages (trillions 2005 USD per year) + K = Variable(index=[time]) # Capital stock (trillions 2005 US dollars) + YGROSS = Variable(index=[time]) # Gross world product GROSS of abatement and damages (trillions 2005 USD per year) - al = Parameter(index=[time]) # Level of total factor productivity - I = Parameter(index=[time]) # Investment (trillions 2005 USD per year) - l = Parameter(index=[time]) # Level of population and labor - dk = Parameter() # Depreciation rate on capital (per year) - gama = Parameter() # Capital elasticity in production function - k0 = Parameter() # Initial capital value (trill 2005 USD) + al = Parameter(index=[time]) # Level of total factor productivity + I = Parameter(index=[time]) # Investment (trillions 2005 USD per year) + l = Parameter(index=[time]) # Level of population and labor + dk = Parameter() # Depreciation rate on capital (per year) + gama = Parameter() # Capital elasticity in production function + k0 = Parameter() # Initial capital value (trill 2005 USD) function run_timestep(p, v, d, t) # Define function for K if is_first(t) v.K[t] = p.k0 else - v.K[t] = (1 - p.dk)^5 * v.K[t - 1] + 5 * p.I[t - 1] + v.K[t] = (1 - p.dk)^5 * v.K[t-1] + 5 * p.I[t-1] end # Define function for YGROSS diff --git a/src/components/neteconomy_component.jl b/src/components/neteconomy_component.jl index beb71f4..171e28a 100644 --- a/src/components/neteconomy_component.jl +++ b/src/components/neteconomy_component.jl @@ -1,46 +1,46 @@ @defcomp neteconomy begin - ABATECOST = Variable(index=[time]) # Cost of emissions reductions (trillions 2005 USD per year) - C = Variable(index=[time]) # Consumption (trillions 2005 US dollars per year) - CPC = Variable(index=[time]) # Per capita consumption (thousands 2005 USD per year) - CPRICE = Variable(index=[time]) # Carbon price (2005$ per ton of CO2) - I = Variable(index=[time]) # Investment (trillions 2005 USD per year) - MCABATE = Variable(index=[time]) # Marginal cost of abatement (2005$ per ton CO2) - Y = Variable(index=[time]) # Gross world product net of abatement and damages (trillions 2005 USD per year) - YNET = Variable(index=[time]) # Output net of damages equation (trillions 2005 USD per year) - - cost1 = Parameter(index=[time]) # Abatement cost function coefficient - DAMAGES = Parameter(index=[time]) # Damages (Trillion $) - l = Parameter(index=[time]) # Level of population and labor - MIU = Parameter(index=[time]) # Emission control rate GHGs - partfract = Parameter(index=[time]) # Fraction of emissions in control regime - pbacktime = Parameter(index=[time]) # Backstop price - S = Parameter(index=[time]) # Gross savings rate as fraction of gross world product - YGROSS = Parameter(index=[time]) # Gross world product GROSS of abatement and damages (trillions 2005 USD per year) - expcost2 = Parameter() # Exponent of control cost function + ABATECOST = Variable(index=[time]) # Cost of emissions reductions (trillions 2005 USD per year) + C = Variable(index=[time]) # Consumption (trillions 2005 US dollars per year) + CPC = Variable(index=[time]) # Per capita consumption (thousands 2005 USD per year) + CPRICE = Variable(index=[time]) # Carbon price (2005$ per ton of CO2) + I = Variable(index=[time]) # Investment (trillions 2005 USD per year) + MCABATE = Variable(index=[time]) # Marginal cost of abatement (2005$ per ton CO2) + Y = Variable(index=[time]) # Gross world product net of abatement and damages (trillions 2005 USD per year) + YNET = Variable(index=[time]) # Output net of damages equation (trillions 2005 USD per year) + + cost1 = Parameter(index=[time]) # Abatement cost function coefficient + DAMAGES = Parameter(index=[time]) # Damages (Trillion $) + l = Parameter(index=[time]) # Level of population and labor + MIU = Parameter(index=[time]) # Emission control rate GHGs + partfract = Parameter(index=[time]) # Fraction of emissions in control regime + pbacktime = Parameter(index=[time]) # Backstop price + S = Parameter(index=[time]) # Gross savings rate as fraction of gross world product + YGROSS = Parameter(index=[time]) # Gross world product GROSS of abatement and damages (trillions 2005 USD per year) + expcost2 = Parameter() # Exponent of control cost function function run_timestep(p, v, d, t) # Define function for YNET v.YNET[t] = p.YGROSS[t] - p.DAMAGES[t] - + # Define function for ABATECOST v.ABATECOST[t] = p.YGROSS[t] * p.cost1[t] * (p.MIU[t]^p.expcost2) * (p.partfract[t]^(1 - p.expcost2)) - + # Define function for MCABATE (equation from GAMS version) v.MCABATE[t] = p.pbacktime[t] * p.MIU[t]^(p.expcost2 - 1) - + # Define function for Y v.Y[t] = v.YNET[t] - v.ABATECOST[t] - + # Define function for I v.I[t] = p.S[t] * v.Y[t] - + # Define function for C v.C[t] = v.Y[t] - v.I[t] - + # Define function for CPC v.CPC[t] = 1000 * v.C[t] / p.l[t] - + # Define function for CPRICE (equation from GAMS version of DICE2013) v.CPRICE[t] = p.pbacktime[t] * (p.MIU[t] / p.partfract[t])^(p.expcost2 - 1) end diff --git a/src/components/radiativeforcing_component.jl b/src/components/radiativeforcing_component.jl index a17d37c..ce209d6 100644 --- a/src/components/radiativeforcing_component.jl +++ b/src/components/radiativeforcing_component.jl @@ -1,10 +1,10 @@ @defcomp radiativeforcing begin - FORC = Variable(index=[time]) # Increase in radiative forcing (watts per m2 from 1900) + FORC = Variable(index=[time]) # Increase in radiative forcing (watts per m2 from 1900) - forcoth = Parameter(index=[time]) # Exogenous forcing for other greenhouse gases - MAT = Parameter(index=[time]) # Carbon concentration increase in atmosphere (GtC from 1750) - eqmat = Parameter() # Equilibrium concentration of CO2 in atmosphere (GTC) - fco22x = Parameter() # Forcings of equilibrium CO2 doubling (Wm-2) + forcoth = Parameter(index=[time]) # Exogenous forcing for other greenhouse gases + MAT = Parameter(index=[time]) # Carbon concentration increase in atmosphere (GtC from 1750) + eqmat = Parameter() # Equilibrium concentration of CO2 in atmosphere (GTC) + fco22x = Parameter() # Forcings of equilibrium CO2 doubling (Wm-2) function run_timestep(p, v, d, t) # Define function for FORC diff --git a/src/components/welfare_component.jl b/src/components/welfare_component.jl index a16ac39..fcafa20 100644 --- a/src/components/welfare_component.jl +++ b/src/components/welfare_component.jl @@ -1,15 +1,15 @@ @defcomp welfare begin - CEMUTOTPER = Variable(index=[time]) # Period utility - CUMCEMUTOTPER = Variable(index=[time]) # Cumulative period utility - PERIODU = Variable(index=[time]) # One period utility function - UTILITY = Variable() # Welfare Function + CEMUTOTPER = Variable(index=[time]) # Period utility + CUMCEMUTOTPER = Variable(index=[time]) # Cumulative period utility + PERIODU = Variable(index=[time]) # One period utility function + UTILITY = Variable() # Welfare Function - CPC = Parameter(index=[time]) # Per capita consumption (thousands 2005 USD per year) - l = Parameter(index=[time]) # Level of population and labor - rr = Parameter(index=[time]) # Average utility social discount rate - elasmu = Parameter() # Elasticity of marginal utility of consumption - scale1 = Parameter() # Multiplicative scaling coefficient - scale2 = Parameter() # Additive scaling coefficient + CPC = Parameter(index=[time]) # Per capita consumption (thousands 2005 USD per year) + l = Parameter(index=[time]) # Level of population and labor + rr = Parameter(index=[time]) # Average utility social discount rate + elasmu = Parameter() # Elasticity of marginal utility of consumption + scale1 = Parameter() # Multiplicative scaling coefficient + scale2 = Parameter() # Additive scaling coefficient function run_timestep(p, v, d, t) # Define function for PERIODU @@ -19,7 +19,7 @@ v.CEMUTOTPER[t] = v.PERIODU[t] * p.l[t] * p.rr[t] # Define function for CUMCEMUTOTPER - v.CUMCEMUTOTPER[t] = v.CEMUTOTPER[t] + (!is_first(t) ? v.CUMCEMUTOTPER[t - 1] : 0) + v.CUMCEMUTOTPER[t] = v.CEMUTOTPER[t] + (!is_first(t) ? v.CUMCEMUTOTPER[t-1] : 0) # Define function for UTILITY if t == TimestepIndex(60) diff --git a/src/marginaldamage.jl b/src/marginaldamage.jl index 4655169..f8d1d21 100644 --- a/src/marginaldamage.jl +++ b/src/marginaldamage.jl @@ -30,8 +30,8 @@ function compute_scc_mm(m::Model=get_model(); year::Union{Int,Nothing}=nothing, mm = get_marginal_model(m; year=year) scc = _compute_scc(mm; year=year, last_year=last_year, prtp=prtp, eta=eta) - - return (scc = scc, mm = mm) + + return (scc=scc, mm=mm) end # helper function for computing SCC from a MarginalModel, not to be exported or advertised to users @@ -76,7 +76,7 @@ end Adds a marginal emission component to year m which adds 1Gt of additional CO2 emissions per year for five years starting in the specified `year`. """ -function add_marginal_emissions!(m::Model, year::Int) +function add_marginal_emissions!(m::Model, year::Int) add_comp!(m, Mimi.adder, :marginalemission, before=:co2cycle) time = Mimi.dimension(m, :time) @@ -91,11 +91,11 @@ end # Old available marginal model function -function getmarginal_dice_models(;emissionyear=2010) +function getmarginal_dice_models(; emissionyear=2010) DICE = constructdice() run(DICE) - + mm = MarginalModel(DICE) m1 = mm.base m2 = mm.modified @@ -114,4 +114,4 @@ function getmarginal_dice_models(;emissionyear=2010) run(m2) return m1, m2 -end \ No newline at end of file +end diff --git a/src/parameters.jl b/src/parameters.jl index dcaae5d..c251b2f 100644 --- a/src/parameters.jl +++ b/src/parameters.jl @@ -7,8 +7,8 @@ using XLSX: readxlsx """ function getdice2013excelparameters(filename) - p_unshared = Dict{Tuple{Symbol, Symbol},Any}() - p_shared = Dict{Symbol, Any}() + p_unshared = Dict{Tuple{Symbol,Symbol},Any}() + p_shared = Dict{Symbol,Any}() T = 60 @@ -19,60 +19,60 @@ function getdice2013excelparameters(filename) # SHARED PARAMETERS # - p_shared[:fco22x] = getparams(f, "B80:B80", :single, "Base", 1) # Forcings of equilibrium CO2 doubling (Wm-2) - p_shared[:MIU] = getparams(f, "B135:BI135", :all, "Base", T) # Optimized emission control rate results from DICE2013 (base case) - p_shared[:l] = getparams(f, "B53:BI53", :all, "Base", T) # Level of population and labor (millions) + p_shared[:fco22x] = getparams(f, "B80:B80", :single, "Base", 1) # Forcings of equilibrium CO2 doubling (Wm-2) + p_shared[:MIU] = getparams(f, "B135:BI135", :all, "Base", T) # Optimized emission control rate results from DICE2013 (base case) + p_shared[:l] = getparams(f, "B53:BI53", :all, "Base", T) # Level of population and labor (millions) # # COMPONENT PARAMETERS # - p_unshared[(:damages, :a1)] = getparams(f, "B25:B25", :single, "Base", 1) # Damage coefficient on temperature - p_unshared[(:damages, :a2)] = getparams(f, "B26:B26", :single, "Base", 1) # Damage quadratic term - p_unshared[(:damages, :a3)] = getparams(f, "B27:B27", :single, "Base", 1) # Damage exponent - p_unshared[(:grosseconomy, :al)] = getparams(f, "B21:BI21", :all, "Base", T) # Level of total factor productivity - p_unshared[(:co2cycle, :b11)] = getparams(f, "B65:B65", :single, "Base", 1) / 100 # Carbon cycle transition matrix atmosphere to atmosphere - p_unshared[(:co2cycle, :b12)] = getparams(f, "B67:B67", :single, "Base", 1) / 100 # Carbon cycle transition matrix atmosphere to shallow ocean - p_unshared[(:co2cycle, :b21)] = getparams(f, "B66:B66", :single, "Base", 1) / 100 # Carbon cycle transition matrix biosphere/shallow oceans to atmosphere - p_unshared[(:co2cycle, :b22)] = getparams(f, "B68:B68", :single, "Base", 1) / 100 # Carbon cycle transition matrix shallow ocean to shallow oceans - p_unshared[(:co2cycle, :b23)] = getparams(f, "B70:B70", :single, "Base", 1) / 100 # Carbon cycle transition matrix shallow to deep ocean - p_unshared[(:co2cycle, :b32)] = getparams(f, "B69:B69", :single, "Base", 1) / 100 # Carbon cycle transition matrix deep ocean to shallow ocean - p_unshared[(:co2cycle, :b33)] = getparams(f, "B71:B71", :single, "Base", 1) / 100 # Carbon cycle transition matrix deep ocean to deep oceans - p_unshared[(:climatedynamics, :c1)] = getparams(f, "B82:B82", :single, "Base", 1) # Speed of adjustment parameter for atmospheric temperature (per 5 years) - p_unshared[(:climatedynamics, :c3)] = getparams(f, "B83:B83", :single, "Base", 1) # Coefficient of heat loss from atmosphere to oceans - p_unshared[(:climatedynamics, :c4)] = getparams(f, "B84:B84", :single, "Base", 1) # Coefficient of heat gain by deep oceans - p_unshared[(:emissions, :cca0)] = getparams(f, "B92:B92", :single, "Base", T) # Initial cumulative industrial emissions - p_unshared[(:neteconomy, :cost1)] = getparams(f, "B32:BI32", :all, "Base", T) # Abatement cost function coefficient - p_unshared[(:damages, :damadj)] = getparams(f, "B56:B56", :single, "Parameters", 1) # Adjustment exponent in damage function - p_unshared[(:grosseconomy, :dk)] = getparams(f, "B6:B6", :single, "Base", 1) # Depreciation rate on capital (per year) - p_unshared[(:welfare, :elasmu)] = getparams(f, "B19:B19", :single, "Base", 1) # Elasticity of MU of consumption + p_unshared[(:damages, :a1)] = getparams(f, "B25:B25", :single, "Base", 1) # Damage coefficient on temperature + p_unshared[(:damages, :a2)] = getparams(f, "B26:B26", :single, "Base", 1) # Damage quadratic term + p_unshared[(:damages, :a3)] = getparams(f, "B27:B27", :single, "Base", 1) # Damage exponent + p_unshared[(:grosseconomy, :al)] = getparams(f, "B21:BI21", :all, "Base", T) # Level of total factor productivity + p_unshared[(:co2cycle, :b11)] = getparams(f, "B65:B65", :single, "Base", 1) / 100 # Carbon cycle transition matrix atmosphere to atmosphere + p_unshared[(:co2cycle, :b12)] = getparams(f, "B67:B67", :single, "Base", 1) / 100 # Carbon cycle transition matrix atmosphere to shallow ocean + p_unshared[(:co2cycle, :b21)] = getparams(f, "B66:B66", :single, "Base", 1) / 100 # Carbon cycle transition matrix biosphere/shallow oceans to atmosphere + p_unshared[(:co2cycle, :b22)] = getparams(f, "B68:B68", :single, "Base", 1) / 100 # Carbon cycle transition matrix shallow ocean to shallow oceans + p_unshared[(:co2cycle, :b23)] = getparams(f, "B70:B70", :single, "Base", 1) / 100 # Carbon cycle transition matrix shallow to deep ocean + p_unshared[(:co2cycle, :b32)] = getparams(f, "B69:B69", :single, "Base", 1) / 100 # Carbon cycle transition matrix deep ocean to shallow ocean + p_unshared[(:co2cycle, :b33)] = getparams(f, "B71:B71", :single, "Base", 1) / 100 # Carbon cycle transition matrix deep ocean to deep oceans + p_unshared[(:climatedynamics, :c1)] = getparams(f, "B82:B82", :single, "Base", 1) # Speed of adjustment parameter for atmospheric temperature (per 5 years) + p_unshared[(:climatedynamics, :c3)] = getparams(f, "B83:B83", :single, "Base", 1) # Coefficient of heat loss from atmosphere to oceans + p_unshared[(:climatedynamics, :c4)] = getparams(f, "B84:B84", :single, "Base", 1) # Coefficient of heat gain by deep oceans + p_unshared[(:emissions, :cca0)] = getparams(f, "B92:B92", :single, "Base", T) # Initial cumulative industrial emissions + p_unshared[(:neteconomy, :cost1)] = getparams(f, "B32:BI32", :all, "Base", T) # Abatement cost function coefficient + p_unshared[(:damages, :damadj)] = getparams(f, "B56:B56", :single, "Parameters", 1) # Adjustment exponent in damage function + p_unshared[(:grosseconomy, :dk)] = getparams(f, "B6:B6", :single, "Base", 1) # Depreciation rate on capital (per year) + p_unshared[(:welfare, :elasmu)] = getparams(f, "B19:B19", :single, "Base", 1) # Elasticity of MU of consumption p_unshared[(:radiativeforcing, :eqmat)] = getparams(f, "B71:B71", :single, "Parameters", 1) # Equilibirum concentration of CO2 in atmosphere (GTC) - p_unshared[(:emissions, :etree)] = getparams(f, "B44:BI44", :all, "Base", T) # Carbon emissions form land use change (GTCO2 per year) - p_unshared[(:neteconomy, :expcost2)] = getparams(f, "B39:B39", :single, "Base", 1) # Exponent of control cost function - p_unshared[(:radiativeforcing, :forcoth)] = getparams(f, "B73:BI73", :all, "Base", T) # Exogenous forcing for other greenhouse gases - p_unshared[(:grosseconomy, :gama)] = getparams(f, "B5:B5", :single, "Base", 1) # Capitail Share - p_unshared[(:grosseconomy, :k0)] = getparams(f, "B12:B12", :single, "Base", 1) # Initial capital - p_unshared[(:co2cycle, :mat0)] = getparams(f, "B60:B60", :single, "Base", 1) # Initial Concentration in atmosphere at end 2007 (GtC) - p_unshared[(:co2cycle, :ml0)] = getparams(f, "B63:B63", :single, "Base", 1) # Initial Concentration in deep oceans 2008 (GtC) - p_unshared[(:co2cycle, :mu0)] = getparams(f, "B62:B62", :single, "Base", 1) # Initial Concentration in biosphere/shallow oceans 2008 (GtC) - p_unshared[(:neteconomy, :partfract)] = getparams(f, "B47:BI47", :all, "Base", T) # Fraction of emissions in control regime - p_unshared[(:neteconomy, :pbacktime)] = getparams(f, "B34:BI34", :all, "Base", T) # Backstop price ($1000 per ton CO2) - p_unshared[(:welfare, :rr)] = getparams(f, "B18:BI18", :all, "Base", T) # Social Time Preference Factor - p_unshared[(:neteconomy, :S)] = getparams(f, "B131:BI131", :all, "Base", T) # Optimized savings rate (fraction of gross output) results from DICE2013 (base case) - p_unshared[(:welfare, :scale1)] = getparams(f, "B49:B49", :single, "Base", 1) # Multiplicative scaling coefficient - p_unshared[(:welfare, :scale2)] = getparams(f, "B50:B50", :single, "Base", 1) # Additive scaling coefficient - p_unshared[(:emissions, :sigma)] = getparams(f, "B41:BI41", :all, "Base", T) # (industrial, MTCO2/$1000 2000 US$) + p_unshared[(:emissions, :etree)] = getparams(f, "B44:BI44", :all, "Base", T) # Carbon emissions form land use change (GTCO2 per year) + p_unshared[(:neteconomy, :expcost2)] = getparams(f, "B39:B39", :single, "Base", 1) # Exponent of control cost function + p_unshared[(:radiativeforcing, :forcoth)] = getparams(f, "B73:BI73", :all, "Base", T) # Exogenous forcing for other greenhouse gases + p_unshared[(:grosseconomy, :gama)] = getparams(f, "B5:B5", :single, "Base", 1) # Capitail Share + p_unshared[(:grosseconomy, :k0)] = getparams(f, "B12:B12", :single, "Base", 1) # Initial capital + p_unshared[(:co2cycle, :mat0)] = getparams(f, "B60:B60", :single, "Base", 1) # Initial Concentration in atmosphere at end 2007 (GtC) + p_unshared[(:co2cycle, :ml0)] = getparams(f, "B63:B63", :single, "Base", 1) # Initial Concentration in deep oceans 2008 (GtC) + p_unshared[(:co2cycle, :mu0)] = getparams(f, "B62:B62", :single, "Base", 1) # Initial Concentration in biosphere/shallow oceans 2008 (GtC) + p_unshared[(:neteconomy, :partfract)] = getparams(f, "B47:BI47", :all, "Base", T) # Fraction of emissions in control regime + p_unshared[(:neteconomy, :pbacktime)] = getparams(f, "B34:BI34", :all, "Base", T) # Backstop price ($1000 per ton CO2) + p_unshared[(:welfare, :rr)] = getparams(f, "B18:BI18", :all, "Base", T) # Social Time Preference Factor + p_unshared[(:neteconomy, :S)] = getparams(f, "B131:BI131", :all, "Base", T) # Optimized savings rate (fraction of gross output) results from DICE2013 (base case) + p_unshared[(:welfare, :scale1)] = getparams(f, "B49:B49", :single, "Base", 1) # Multiplicative scaling coefficient + p_unshared[(:welfare, :scale2)] = getparams(f, "B50:B50", :single, "Base", 1) # Additive scaling coefficient + p_unshared[(:emissions, :sigma)] = getparams(f, "B41:BI41", :all, "Base", T) # (industrial, MTCO2/$1000 2000 US$) p_unshared[(:climatedynamics, :t2xco2)] = getparams(f, "B79:B79", :single, "Base", 1) # Equilibrium temp impact (oC per doubling CO2) - p_unshared[(:climatedynamics, :tatm0)] = getparams(f, "B76:B76", :single, "Base", 1) # Initial atmospheric temp change 2008-2011 (C from 1900) - p_unshared[(:climatedynamics, :tocean0)] = getparams(f, "B77:B77", :single, "Base", 1) # Initial temperature of deep oceans (deg C aboce 1900) - p_unshared[(:damages, :usedamadj)] = true + p_unshared[(:climatedynamics, :tatm0)] = getparams(f, "B76:B76", :single, "Base", 1) # Initial atmospheric temp change 2008-2011 (C from 1900) + p_unshared[(:climatedynamics, :tocean0)] = getparams(f, "B77:B77", :single, "Base", 1) # Initial temperature of deep oceans (deg C aboce 1900) + p_unshared[(:damages, :usedamadj)] = true return Dict(:unshared => p_unshared, :shared => p_shared) end function getdice2013gamsparameters(filename) - p_unshared = Dict{Tuple{Symbol, Symbol},Any}() - p_shared = Dict{Symbol, Any}() + p_unshared = Dict{Tuple{Symbol,Symbol},Any}() + p_shared = Dict{Symbol,Any}() T = 60 @@ -83,53 +83,53 @@ function getdice2013gamsparameters(filename) # # SHARED PARAMETERS # - p_shared[:MIU] = getparams(f, "B48:BI48", :all, sheet, T) # Optimized emission control rate results from DICE2013 (base case) - p_shared[:l] = getparams(f, "B6:BI6", :all, sheet, T) # Level of population and labor (millions) - p_shared[:fco22x] = getparams(f, "B30:B30", :single, sheet, 1) # Forcings of equilibrium CO2 doubling (Wm-2) + p_shared[:MIU] = getparams(f, "B48:BI48", :all, sheet, T) # Optimized emission control rate results from DICE2013 (base case) + p_shared[:l] = getparams(f, "B6:BI6", :all, sheet, T) # Level of population and labor (millions) + p_shared[:fco22x] = getparams(f, "B30:B30", :single, sheet, 1) # Forcings of equilibrium CO2 doubling (Wm-2) # # COMPONENT PARAMETERS # - p_unshared[(:damages, :a1)] = getparams(f, "B42:B42", :single, sheet, 1) # Damage coefficient on temperature - p_unshared[(:damages, :a2)] = getparams(f, "B43:B43", :single, sheet, 1) # Damage quadratic term - p_unshared[(:damages, :a3)] = getparams(f, "B44:B44", :single, sheet, 1) # Damage exponent - p_unshared[(:grosseconomy, :al)] = getparams(f, "B5:BI5", :all, sheet, T) # Level of total factor productivity - p_unshared[(:co2cycle, :b11)] = getparams(f, "B22:B22", :single, sheet, 1) # Carbon cycle transition matrix atmosphere to atmosphere - p_unshared[(:co2cycle, :b12)] = getparams(f, "B20:B20", :single, sheet, 1) # Carbon cycle transition matrix atmosphere to shallow ocean - p_unshared[(:co2cycle, :b21)] = getparams(f, "B23:B23", :single, sheet, 1) # Carbon cycle transition matrix biosphere/shallow oceans to atmosphere - p_unshared[(:co2cycle, :b22)] = getparams(f, "B24:B24", :single, sheet, 1) # Carbon cycle transition matrix shallow ocean to shallow oceans - p_unshared[(:co2cycle, :b23)] = getparams(f, "B21:B21", :single, sheet, 1) # Carbon cycle transition matrix shallow to deep ocean - p_unshared[(:co2cycle, :b32)] = getparams(f, "B25:B25", :single, sheet, 1) # Carbon cycle transition matrix deep ocean to shallow ocean - p_unshared[(:co2cycle, :b33)] = getparams(f, "B26:B26", :single, sheet, 1) # Carbon cycle transition matrix deep ocean to deep oceans - p_unshared[(:climatedynamics, :c1)] = getparams(f, "B37:B37", :single, sheet, 1) # Speed of adjustment parameter for atmospheric temperature (per 5 years) - p_unshared[(:climatedynamics, :c3)] = getparams(f, "B38:B38", :single, sheet, 1) # Coefficient of heat loss from atmosphere to oceans - p_unshared[(:climatedynamics, :c4)] = getparams(f, "B39:B39", :single, sheet, 1) # Coefficient of heat gain by deep oceans - p_unshared[(:emissions, :cca0)] = getparams(f, "B14:B14", :single, sheet, 1) # Initial cumulative industrial emissions - p_unshared[(:neteconomy, :cost1)] = getparams(f, "B47:BI47", :all, sheet, T) # Abatement cost function coefficient - p_unshared[(:damages, :damadj)] = 1.0 # Adjustment exponent in damage function (not used in GAMS version). - p_unshared[(:grosseconomy, :dk)] = getparams(f, "B8:B8", :single, sheet, 1) # Depreciation rate on capital (per year) - p_unshared[(:welfare, :elasmu)] = getparams(f, "B55:BI55", :single, sheet, 1) # Elasticity of MU of consumption + p_unshared[(:damages, :a1)] = getparams(f, "B42:B42", :single, sheet, 1) # Damage coefficient on temperature + p_unshared[(:damages, :a2)] = getparams(f, "B43:B43", :single, sheet, 1) # Damage quadratic term + p_unshared[(:damages, :a3)] = getparams(f, "B44:B44", :single, sheet, 1) # Damage exponent + p_unshared[(:grosseconomy, :al)] = getparams(f, "B5:BI5", :all, sheet, T) # Level of total factor productivity + p_unshared[(:co2cycle, :b11)] = getparams(f, "B22:B22", :single, sheet, 1) # Carbon cycle transition matrix atmosphere to atmosphere + p_unshared[(:co2cycle, :b12)] = getparams(f, "B20:B20", :single, sheet, 1) # Carbon cycle transition matrix atmosphere to shallow ocean + p_unshared[(:co2cycle, :b21)] = getparams(f, "B23:B23", :single, sheet, 1) # Carbon cycle transition matrix biosphere/shallow oceans to atmosphere + p_unshared[(:co2cycle, :b22)] = getparams(f, "B24:B24", :single, sheet, 1) # Carbon cycle transition matrix shallow ocean to shallow oceans + p_unshared[(:co2cycle, :b23)] = getparams(f, "B21:B21", :single, sheet, 1) # Carbon cycle transition matrix shallow to deep ocean + p_unshared[(:co2cycle, :b32)] = getparams(f, "B25:B25", :single, sheet, 1) # Carbon cycle transition matrix deep ocean to shallow ocean + p_unshared[(:co2cycle, :b33)] = getparams(f, "B26:B26", :single, sheet, 1) # Carbon cycle transition matrix deep ocean to deep oceans + p_unshared[(:climatedynamics, :c1)] = getparams(f, "B37:B37", :single, sheet, 1) # Speed of adjustment parameter for atmospheric temperature (per 5 years) + p_unshared[(:climatedynamics, :c3)] = getparams(f, "B38:B38", :single, sheet, 1) # Coefficient of heat loss from atmosphere to oceans + p_unshared[(:climatedynamics, :c4)] = getparams(f, "B39:B39", :single, sheet, 1) # Coefficient of heat gain by deep oceans + p_unshared[(:emissions, :cca0)] = getparams(f, "B14:B14", :single, sheet, 1) # Initial cumulative industrial emissions + p_unshared[(:neteconomy, :cost1)] = getparams(f, "B47:BI47", :all, sheet, T) # Abatement cost function coefficient + p_unshared[(:damages, :damadj)] = 1.0 # Adjustment exponent in damage function (not used in GAMS version). + p_unshared[(:grosseconomy, :dk)] = getparams(f, "B8:B8", :single, sheet, 1) # Depreciation rate on capital (per year) + p_unshared[(:welfare, :elasmu)] = getparams(f, "B55:BI55", :single, sheet, 1) # Elasticity of MU of consumption p_unshared[(:radiativeforcing, :eqmat)] = getparams(f, "B31:B31", :single, sheet, 1) # Equilibirum concentration of CO2 in atmosphere (GTC) - p_unshared[(:emissions, :etree)] = getparams(f, "B13:BI13", :all, sheet, T) # Carbon emissions form land use change (GTCO2 per year) - p_unshared[(:neteconomy, :expcost2)] = getparams(f, "B49:B49", :single, sheet, 1) # Exponent of control cost function - p_unshared[(:radiativeforcing, :forcoth)] = getparams(f, "B29:BI29", :all, sheet, T) # Exogenous forcing for other greenhouse gases - p_unshared[(:grosseconomy, :gama)] = getparams(f, "B7:B7", :single, sheet, 1) # Capitail Share - p_unshared[(:grosseconomy, :k0)] = getparams(f, "B9:B9", :single, sheet, 1) # Initial capital - p_unshared[(:co2cycle, :mat0)] = getparams(f, "B17:B17", :single, sheet, 1) # Initial Concentration in atmosphere at end 2007 (GtC) - p_unshared[(:co2cycle, :ml0)] = getparams(f, "B19:B19", :single, sheet, 1) # Initial Concentration in deep oceans 2008 (GtC) - p_unshared[(:co2cycle, :mu0)] = getparams(f, "B18:B18", :single, sheet, 1) # Initial Concentration in biosphere/shallow oceans 2008 (GtC) - p_unshared[(:neteconomy, :partfract)] = getparams(f, "B50:BI50", :all, sheet, T) # Fraction of emissions in control regime - p_unshared[(:neteconomy, :pbacktime)] = getparams(f, "B51:BI51", :all, sheet, T) # Backstop price ($1000 per ton CO2) - p_unshared[(:welfare, :rr)] = getparams(f, "B56:BI56", :all, sheet, T) # Social Time Preference Factor - p_unshared[(:neteconomy, :S)] = getparams(f, "B52:BI52", :all, sheet, T) # Optimized savings rate (fraction of gross output) results from DICE2013 (base case) - p_unshared[(:welfare, :scale1)] = getparams(f, "B57:B57", :single, sheet, 1) # Multiplicative scaling coefficient - p_unshared[(:welfare, :scale2)] = getparams(f, "B58:B58", :single, sheet, 1) # Additive scaling coefficient - p_unshared[(:emissions, :sigma)] = getparams(f, "B12:BI12", :all, sheet, T) # (industrial, MTCO2/$1000 2000 US$) + p_unshared[(:emissions, :etree)] = getparams(f, "B13:BI13", :all, sheet, T) # Carbon emissions form land use change (GTCO2 per year) + p_unshared[(:neteconomy, :expcost2)] = getparams(f, "B49:B49", :single, sheet, 1) # Exponent of control cost function + p_unshared[(:radiativeforcing, :forcoth)] = getparams(f, "B29:BI29", :all, sheet, T) # Exogenous forcing for other greenhouse gases + p_unshared[(:grosseconomy, :gama)] = getparams(f, "B7:B7", :single, sheet, 1) # Capitail Share + p_unshared[(:grosseconomy, :k0)] = getparams(f, "B9:B9", :single, sheet, 1) # Initial capital + p_unshared[(:co2cycle, :mat0)] = getparams(f, "B17:B17", :single, sheet, 1) # Initial Concentration in atmosphere at end 2007 (GtC) + p_unshared[(:co2cycle, :ml0)] = getparams(f, "B19:B19", :single, sheet, 1) # Initial Concentration in deep oceans 2008 (GtC) + p_unshared[(:co2cycle, :mu0)] = getparams(f, "B18:B18", :single, sheet, 1) # Initial Concentration in biosphere/shallow oceans 2008 (GtC) + p_unshared[(:neteconomy, :partfract)] = getparams(f, "B50:BI50", :all, sheet, T) # Fraction of emissions in control regime + p_unshared[(:neteconomy, :pbacktime)] = getparams(f, "B51:BI51", :all, sheet, T) # Backstop price ($1000 per ton CO2) + p_unshared[(:welfare, :rr)] = getparams(f, "B56:BI56", :all, sheet, T) # Social Time Preference Factor + p_unshared[(:neteconomy, :S)] = getparams(f, "B52:BI52", :all, sheet, T) # Optimized savings rate (fraction of gross output) results from DICE2013 (base case) + p_unshared[(:welfare, :scale1)] = getparams(f, "B57:B57", :single, sheet, 1) # Multiplicative scaling coefficient + p_unshared[(:welfare, :scale2)] = getparams(f, "B58:B58", :single, sheet, 1) # Additive scaling coefficient + p_unshared[(:emissions, :sigma)] = getparams(f, "B12:BI12", :all, sheet, T) # (industrial, MTCO2/$1000 2000 US$) p_unshared[(:climatedynamics, :t2xco2)] = getparams(f, "B34:B34", :single, sheet, 1) # Equilibrium temp impact (oC per doubling CO2) - p_unshared[(:climatedynamics, :tatm0)] = getparams(f, "B35:B35", :single, sheet, 1) # Initial atmospheric temp change 2008-2011 (C from 1900) - p_unshared[(:climatedynamics, :tocean0)] = getparams(f, "B36:B36", :single, sheet, 1) # Initial temperature of deep oceans (deg C aboce 1900) - p_unshared[(:damages, :usedamadj)] = false + p_unshared[(:climatedynamics, :tatm0)] = getparams(f, "B35:B35", :single, sheet, 1) # Initial atmospheric temp change 2008-2011 (C from 1900) + p_unshared[(:climatedynamics, :tocean0)] = getparams(f, "B36:B36", :single, sheet, 1) # Initial temperature of deep oceans (deg C aboce 1900) + p_unshared[(:damages, :usedamadj)] = false return Dict(:unshared => p_unshared, :shared => p_shared) end diff --git a/test/runtests.jl b/test/runtests.jl index 04eff05..9b72a21 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -15,7 +15,7 @@ using MimiDICE2013: getparams @testset "MimiDICE2013-model" begin - m = MimiDICE2013.get_model(); + m = MimiDICE2013.get_model() run(m) f = readxlsx(joinpath(dirname(@__FILE__), "..", "data", "DICE_2013_Excel.xlsm")) @@ -27,38 +27,38 @@ using MimiDICE2013: getparams T = 60 # TATM Test (temperature increase) - True_TATM = getparams(f, "B99:BI99", :all, "Base", T); + True_TATM = getparams(f, "B99:BI99", :all, "Base", T) @test maximum(abs, m[:climatedynamics, :TATM] .- True_TATM) ≈ 0. atol = Precision # MAT Test (carbon concentration atmosphere) - True_MAT = getparams(f, "B87:BI87", :all, "Base", T); + True_MAT = getparams(f, "B87:BI87", :all, "Base", T) @test maximum(abs, m[:co2cycle, :MAT] .- True_MAT) ≈ 0. atol = Precision # DAMFRAC Test (damages fraction) - True_DAMFRAC = getparams(f, "B105:BI105", :all, "Base", T); + True_DAMFRAC = getparams(f, "B105:BI105", :all, "Base", T) @test maximum(abs, m[:damages, :DAMFRAC] .- True_DAMFRAC) ≈ 0. atol = Precision # DAMAGES Test (damages $) - True_DAMAGES = getparams(f, "B106:BI106", :all, "Base", T); + True_DAMAGES = getparams(f, "B106:BI106", :all, "Base", T) @test maximum(abs, m[:damages, :DAMAGES] .- True_DAMAGES) ≈ 0. atol = Precision # E Test (emissions) - True_E = getparams(f, "B112:BI112", :all, "Base", T); + True_E = getparams(f, "B112:BI112", :all, "Base", T) @test maximum(abs, m[:emissions, :E] .- True_E) ≈ 0. atol = Precision # YGROSS Test (gross output) - True_YGROSS = getparams(f, "B104:BI104", :all, "Base", T); + True_YGROSS = getparams(f, "B104:BI104", :all, "Base", T) @test maximum(abs, m[:grosseconomy, :YGROSS] .- True_YGROSS) ≈ 0. atol = Precision # CPC Test (per capita consumption) - True_CPC = getparams(f, "B126:BI126", :all, "Base", T); + True_CPC = getparams(f, "B126:BI126", :all, "Base", T) @test maximum(abs, m[:neteconomy, :CPC] .- True_CPC) ≈ 0. atol = Precision # FORC Test (radiative forcing) - True_FORC = getparams(f, "B100:BI100", :all, "Base", T); + True_FORC = getparams(f, "B100:BI100", :all, "Base", T) @test maximum(abs, m[:radiativeforcing, :FORC] .- True_FORC) ≈ 0. atol = Precision - True_UTILITY = getparams(f, "B129:B129", :single, "Base", T); + True_UTILITY = getparams(f, "B129:B129", :single, "Base", T) @test maximum(abs, m[:welfare, :UTILITY] .- True_UTILITY) ≈ 0. atol = Precision end # MimiDICE2013-model testset @@ -72,7 +72,7 @@ using MimiDICE2013: getparams Precision = 1.0e-10 nullvalue = -999.999 - m = MimiDICE2013.get_model(); + m = MimiDICE2013.get_model() run(m) for c in map(nameof, Mimi.compdefs(m)), v in Mimi.variable_names(m, c) @@ -83,8 +83,8 @@ using MimiDICE2013: getparams df = load(filepath) |> DataFrame if typeof(results) <: Number - validation_results = df[1,1] - + validation_results = df[1, 1] + else validation_results = Matrix(df) @@ -95,7 +95,7 @@ using MimiDICE2013: getparams validation_results[isnan.(validation_results)] .= nullvalue # match dimensions - + if size(validation_results, 1) == 1 validation_results = validation_results' end @@ -135,10 +135,10 @@ using MimiDICE2013: getparams # Test with a modified model m = MimiDICE2013.get_model() - update_param!(m, :climatedynamics, :t2xco2, 5) + update_param!(m, :climatedynamics, :t2xco2, 5) scc4 = MimiDICE2013.compute_scc(m, year=2020) @test scc4 > scc1 # Test that a higher value of climate sensitivty makes the SCC bigger - + # Test compute_scc_mm result = MimiDICE2013.compute_scc_mm(year=2030) @test result.scc isa Float64 @@ -163,9 +163,9 @@ using MimiDICE2013: getparams :prtp => [0.015, 0.03], :last_year => [2200, 2305], ]) - - results = DataFrame(year = [], eta = [], prtp = [], last_year = [], SC = []) - + + results = DataFrame(year=[], eta=[], prtp=[], last_year=[], SC=[]) + for year in specs[:year] for eta in specs[:eta] for prtp in specs[:prtp] @@ -176,11 +176,11 @@ using MimiDICE2013: getparams end end end - + validation_results = load(joinpath(@__DIR__, "..", "data", "SC validation data", "deterministic_sc_values_v1-0-2.csv")) |> DataFrame # diffs = sort(results[!, :SC] - validation_results[!, :SC], rev = true) # println(diffs) - @test all(isapprox.(results[!, :SC], validation_results[!, :SC], atol = atol)) + @test all(isapprox.(results[!, :SC], validation_results[!, :SC], atol=atol)) end # SCC values testset end # MimiDICE2013 testset