= Run Ecosim via Console Application = This tutorial will guide you through how to make an console application that would run Ecosim and Ecospace. You can extend these to make applications such as monte carlos routines, or create/modify multiple databases. This tutorial will extend the EweConsoleAppExample tutorial. 1. Follow EweConsoleAppExample and ensure it runs. 2. After step (5) (Line 21 = 'Console.!WriteLine...'), add the following code to Load an Ecosim Scenario and run Ecosim with a delegate (name of a function that should be called at the end of every timestep). {{{ core.LoadEcosimScenario(1) ' (6) Loads an ecosim scenario core.RunEcoSim(AddressOf EcosimResultsHandler) ' (7) Runs Ecosim with delegate }}} 3. Add the following code after the sub routine {{{ End Sub }}} which is the function that you defined in step (7). The following sub routine will print the biomass of group 1 at every timestep. {{{ ' Ecosim delegate - a sub function/subroutine that is ' called at the end of every timestep. ' One would obtain the results from the results object. Private Sub EcosimResultsHandler(ByVal iTime As Long, ByVal EcoSimResults As cEcoSimResults) System.Console.WriteLine("Time Step = " & iTime.ToString & _ "; Biomass of group 1 = " & EcoSimResults.Biomass(1).ToString & vbCrLf) End Sub }}} 4. Hit F5 or in the menu, Debug>Start Debugging. You should get the following output. {{{ Time Step = 320; Biomass of group 1 = 0.993543 Time Step = 321; Biomass of group 1 = 0.9935352 Time Step = 322; Biomass of group 1 = 0.9935276 Time Step = 323; Biomass of group 1 = 0.99352 Time Step = 324; Biomass of group 1 = 0.9935125 Press a key to exit }}} The .vb file can be found at the bottom of this page. Simply replace this file with the EwE7.vb found in the EweConsoleAppExample tutorial.