/// <summary> /// Runs a single simulation of the Madingley model /// </summary> /// <param name="scenarios">Parameter information and simulation number for all scenarios to be run</param> /// <param name="scenarioIndex">The index of the scenario to be run in this simulation</param> /// <param name="initialiseMadingley">Model initialization information for all simulations</param> /// <param name="outputFileSuffix">Suffix to be applied to the names of files written out by this simulation</param> /// <param name="simulation">The index of the simulation being run</param> public void RunSimulation(ScenarioParameterInitialisation scenarios, int scenarioIndex, MadingleyModelInitialisation initialiseMadingley, string outputFileSuffix, int simulation) { // Declare an instance of the class that runs a Madingley model simulation MadingleyModel MadingleyEcosystemModel; // Declare and start a timer StopWatch s = new StopWatch(); s.Start(); StopWatch t = new StopWatch(); t.Start(); // Initialize the instance of MadingleyModel MadingleyEcosystemModel = new MadingleyModel(initialiseMadingley, scenarios, scenarioIndex, outputFileSuffix, initialiseMadingley.GlobalModelTimeStepUnit, simulation); t.Stop(); // Run the simulation MadingleyEcosystemModel.RunMadingley(initialiseMadingley); // Stop the timer and write out the time taken to run this simulation s.Stop(); Console.WriteLine("Model run finished"); Console.WriteLine("Total elapsed time was {0} seconds", s.GetElapsedTimeSecs()); Console.WriteLine("Model setup time was {0} seconds", t.GetElapsedTimeSecs()); Console.WriteLine("Model run time was {0} seconds", s.GetElapsedTimeSecs() - t.GetElapsedTimeSecs()); }
/// <summary> /// Runs a single simulation of the Madingley model /// </summary> /// <param name="scenarios">Parameter information and simulation number for all scenarios to be run</param> /// <param name="scenarioIndex">The index of the scenario to be run in this simulation</param> /// <param name="initialiseMadingley">Model initialization information for all simulations</param> /// <param name="outputFileSuffix">Suffix to be applied to the names of files written out by this simulation</param> /// <param name="simulation">The index of the simulation being run</param> public void RunSimulation(ScenarioParameterInitialisation scenarios, int scenarioIndex, MadingleyModelInitialisation initialiseMadingley, string outputFileSuffix, int simulation) { // Declare an instance of the class that runs a Madingley model simulation MadingleyModel MadingleyEcosystemModel; // Declare and start a timer StopWatch s = new StopWatch(); s.Start(); StopWatch t = new StopWatch(); t.Start(); // Initialize the instance of MadingleyModel MadingleyEcosystemModel = new MadingleyModel(initialiseMadingley, scenarios, scenarioIndex, outputFileSuffix, initialiseMadingley.GlobalModelTimeStepUnit,simulation); t.Stop(); // Run the simulation MadingleyEcosystemModel.RunMadingley(initialiseMadingley); // Stop the timer and write out the time taken to run this simulation s.Stop(); Console.WriteLine("Model run finished"); Console.WriteLine("Total elapsed time was {0} seconds", s.GetElapsedTimeSecs()); Console.WriteLine("Model setup time was {0} seconds", t.GetElapsedTimeSecs()); Console.WriteLine("Model run time was {0} seconds", s.GetElapsedTimeSecs() - t.GetElapsedTimeSecs()); }