private void AddWelfareComponents(string name, Esmf.Model.Model model, WelfareSpec swf) { switch (swf.SWF) { case WelfareType.Global: model.AddComponent(name, typeof(Fund.Components.Welfare.GlobalWelfareComponent), typeof(Fund.Components.Welfare.IGlobalWelfareState), "socioeconomic"); model[name].Parameters["population"].Bind("socioeconomic", "globalpopulation"); model[name].Parameters["consumption"].Bind("socioeconomic", "globalconsumption"); break; case WelfareType.Pearce: case WelfareType.Utilitarian: model.AddComponent(name, typeof(Fund.Components.Welfare.UtilitarianWelfareComponent), typeof(Fund.Components.Welfare.IUtilitarianWelfareState), "socioeconomic"); model[name].Parameters["population"].Bind("socioeconomic", "populationin1"); model[name].Parameters["consumption"].Bind("socioeconomic", "consumption"); model[name].Parameters["welfareweight"].SetValue((Timestep t, Region r) => 1.0); break; case WelfareType.Negishi: throw new NotImplementedException(); case WelfareType.Tol: case WelfareType.Regional: model.AddComponent(name, typeof(Fund.Components.Welfare.RegionalWelfareComponent), typeof(Fund.Components.Welfare.IRegionalWelfareState), "socioeconomic"); model[name].Parameters["population"].Bind("socioeconomic", "populationin1"); model[name].Parameters["consumption"].Bind("socioeconomic", "consumption"); break; default: throw new NotImplementedException(); } SetUtilityParameters(model, name, swf); }
private void SetUtilityParameters(Esmf.Model.Model model, string name, WelfareSpec swf) { model[name].Parameters["prtp"].SetValue(swf.Prtp); model[name].Parameters["elasticityofmarginalutility"].SetValue(swf.Eta); model[name].Parameters["starttimestep"].SetValue(EmissionYear); model[name].Parameters["stoptimestep"].SetValue(EmissionYear + YearsToAggregate); model[name].Variables["marginalwelfare"].StoreOutput = true; model["socioeconomic"].Parameters["runwithoutpopulationperturbation"].SetValue(true); }