public static Initialize ( ICore modelCore ) : void | ||
modelCore | ICore | |
Résultat | void |
//--------------------------------------------------------------------- /// <summary> /// Initializes the extension with a data file. /// </summary> public override void Initialize() { Timestep = parameters.Timestep; mapNameTemplate = parameters.MapNamesTemplate; srdMapNames = parameters.SRDMapNames; nrdMapNames = parameters.NRDMapNames; vulnMapNames = parameters.BDPMapNames; SiteVars.Initialize(modelCore); manyAgentParameters = parameters.ManyAgentParameters; foreach (IAgent activeAgent in manyAgentParameters) { if (activeAgent == null) { PlugIn.ModelCore.Log.WriteLine("Agent Parameters NOT loading correctly."); } activeAgent.TimeToNextEpidemic = TimeToNext(activeAgent, Timestep) + activeAgent.StartYear; //BDA-Climate // if RandFunc == Climate, initial TimeToNextEpidemic = OutbreakLag - TimeSinceLastClimate //BDA-Climate int timeOfNext = PlugIn.ModelCore.CurrentTime + activeAgent.TimeToNextEpidemic - activeAgent.TimeSinceLastEpidemic; if (timeOfNext < Timestep) { timeOfNext = Timestep; } if (timeOfNext < activeAgent.StartYear) { timeOfNext = activeAgent.StartYear; } SiteVars.TimeOfNext.ActiveSiteValues = timeOfNext; int i = 0; activeAgent.DispersalNeighbors = GetDispersalNeighborhood(activeAgent, Timestep); if (activeAgent.DispersalNeighbors != null) { foreach (RelativeLocation reloc in activeAgent.DispersalNeighbors) { i++; } PlugIn.ModelCore.Log.WriteLine("Dispersal Neighborhood = {0} neighbors.", i); } i = 0; activeAgent.ResourceNeighbors = GetResourceNeighborhood(activeAgent); if (activeAgent.ResourceNeighbors != null) { foreach (RelativeLocationWeighted reloc in activeAgent.ResourceNeighbors) { i++; } PlugIn.ModelCore.Log.WriteLine("Resource Neighborhood = {0} neighbors.", i); } } string logFileName = parameters.LogFileName; PlugIn.ModelCore.Log.WriteLine("Opening BDA log file \"{0}\" ...", logFileName); log = PlugIn.ModelCore.CreateTextFile(logFileName); log.AutoFlush = true; log.Write("CurrentTime, ROS, AgentName, NumCohortsKilled, NumSitesDamaged, MeanSeverity"); log.WriteLine(""); }
//--------------------------------------------------------------------- /// <summary> /// Initializes the extension with a data file. /// </summary> public override void Initialize() { reinitialized = false; MetadataHandler.InitializeMetadata(parameters.Timestep, parameters.MapNamesTemplate, parameters.SRDMapNames, parameters.NRDMapNames, parameters.LogFileName, parameters.ManyAgentParameters, ModelCore); Timestep = parameters.Timestep; mapNameTemplate = parameters.MapNamesTemplate; srdMapNames = parameters.SRDMapNames; nrdMapNames = parameters.NRDMapNames; vulnMapNames = parameters.BDPMapNames; SiteVars.Initialize(modelCore); manyAgentParameters = parameters.ManyAgentParameters; foreach (IAgent activeAgent in manyAgentParameters) { if (activeAgent == null) { PlugIn.ModelCore.UI.WriteLine("Agent Parameters NOT loading correctly."); } activeAgent.TimeToNextEpidemic = TimeToNext(activeAgent, Timestep) + activeAgent.StartYear; int timeOfNext = PlugIn.ModelCore.CurrentTime + activeAgent.TimeToNextEpidemic - activeAgent.TimeSinceLastEpidemic; if (timeOfNext < Timestep) { timeOfNext = Timestep; } if (timeOfNext < activeAgent.StartYear) { timeOfNext = activeAgent.StartYear; } SiteVars.TimeOfNext.ActiveSiteValues = timeOfNext; int i = 0; activeAgent.DispersalNeighbors = GetDispersalNeighborhood(activeAgent, Timestep); if (activeAgent.DispersalNeighbors != null) { foreach (RelativeLocation reloc in activeAgent.DispersalNeighbors) { i++; } PlugIn.ModelCore.UI.WriteLine("Dispersal Neighborhood = {0} neighbors.", i); } i = 0; activeAgent.ResourceNeighbors = GetResourceNeighborhood(activeAgent); if (activeAgent.ResourceNeighbors != null) { foreach (RelativeLocationWeighted reloc in activeAgent.ResourceNeighbors) { i++; } PlugIn.ModelCore.UI.WriteLine("Resource Neighborhood = {0} neighbors.", i); } if (activeAgent.RandFunc == OutbreakPattern.Climate) { if (activeAgent.ClimateVarSource != "Library") { DataTable weatherTable = ClimateData.ReadWeatherFile(activeAgent.ClimateVarSource); activeAgent.ClimateDataTable = weatherTable; } } } //string logFileName = parameters.LogFileName; //PlugIn.ModelCore.UI.WriteLine("Opening BDA log file \"{0}\" ...", logFileName); //log = PlugIn.ModelCore.CreateTextFile(logFileName); //log.AutoFlush = true; //log.Write("CurrentTime, ROS, AgentName, NumCohortsKilled, NumSitesDamaged, MeanSeverity"); //log.WriteLine(""); }
//--------------------------------------------------------------------- /// <summary> /// Initializes the extension with a data file. /// </summary> public override void Initialize() { Timestep = parameters.Timestep; mapNameTemplate = parameters.MapNamesTemplate; srdMapNames = parameters.SRDMapNames; nrdMapNames = parameters.NRDMapNames; vulnMapNames = parameters.BDPMapNames; SiteVars.Initialize(modelCore); manyAgentParameters = parameters.ManyAgentParameters; foreach (IAgent activeAgent in manyAgentParameters) { int timeOfNext = 0; if (activeAgent == null) { PlugIn.ModelCore.Log.WriteLine("Agent Parameters NOT loading correctly."); } if (activeAgent.RandFunc.ToString().ToLower() != "climate") { activeAgent.TimeToNextEpidemic = activeAgent.TimeToNext(Timestep) + activeAgent.StartYear; //activeAgent.TimeToNextEpidemic = TimeToNext(activeAgent, Timestep) + activeAgent.StartYear; //BDA-Climate // if RandFunc == Climate, initial TimeToNextEpidemic = OutbreakLag - TimeSinceLastClimate //BDA-Climate //Amin BDA-Climate timeOfNext = PlugIn.ModelCore.CurrentTime + activeAgent.TimeToNextEpidemic - activeAgent.TimeSinceLastEpidemic; } else if (activeAgent.RandFunc.ToString().ToLower() == "climate") { activeAgent.TimeToNextEpidemic = ((Agent_Climate)activeAgent).OutbreakLag - ((Agent_Climate)activeAgent).TimeSinceLastClimate; timeOfNext = PlugIn.ModelCore.CurrentTime + activeAgent.TimeToNextEpidemic; //- activeAgent.TimeSinceLastEpidemic; } if (timeOfNext < Timestep) { timeOfNext = Timestep; } if (timeOfNext < activeAgent.StartYear) { timeOfNext = activeAgent.StartYear; } SiteVars.TimeOfNext.ActiveSiteValues = timeOfNext; int i = 0; activeAgent.DispersalNeighbors = GetDispersalNeighborhood(activeAgent, Timestep); if (activeAgent.DispersalNeighbors != null) { foreach (RelativeLocation reloc in activeAgent.DispersalNeighbors) { i++; } PlugIn.ModelCore.Log.WriteLine("Dispersal Neighborhood = {0} neighbors.", i); } i = 0; activeAgent.ResourceNeighbors = GetResourceNeighborhood(activeAgent); if (activeAgent.ResourceNeighbors != null) { foreach (RelativeLocationWeighted reloc in activeAgent.ResourceNeighbors) { i++; } PlugIn.ModelCore.Log.WriteLine("Resource Neighborhood = {0} neighbors.", i); } } string logFileName = parameters.LogFileName; PlugIn.ModelCore.Log.WriteLine("Opening BDA log file \"{0}\" ...", logFileName); log = PlugIn.ModelCore.CreateTextFile(logFileName); log.AutoFlush = true; log.Write("CurrentTime, ROS, AgentName, NumCohortsKilled, NumSitesDamaged, MeanSeverity"); log.WriteLine(""); //AminBDA //Console.WriteLine("\n\n -------------------------------------------\n\n"); //string in1 = Console.ReadLine(); //Console.WriteLine("\n\n -----------------Anual Climate-------------\n\n"); //Climate.GenerateClimate_GetPDSI(1893, 1897); //if (Climate.AllData.Count > 1) // Climate.GetPDSI(1893); Landis.Library.Climate.Climate.GetPDSI(1980); //Landis.Library.Climate.Climate.GetPDSI_Test(); //Landis.Library.Climate.Climate.Convert_USGS_to_ClimateData(Landis.Library.Climate.Period.Daily, "D:\\PSU\\Landis_II\\amin-branch\\USGS_Data\\GCM_data_4.4.13.csv\\GCM_data_4.4.13_ver2.csv"); //Landis.Library.Climate.Climate.Convert_USGS_to_ClimateData(Landis.Library.Climate.Period.Monthly, "D:\\PSU\\Landis_II\\amin-branch\\USGS_Data\\PRISM_data_AFRI_4.18.13.csv\\PRISM_data_AFRI_4.18.13.csv"); }