1 | ' Required external libraries
|
---|
2 | Imports EwECore
|
---|
3 | Imports EwECore.DataSources
|
---|
4 | Imports EwEUtils
|
---|
5 | Imports EwEUtils.Core
|
---|
6 |
|
---|
7 | Module EwE7
|
---|
8 |
|
---|
9 | ' Main Sub routine called when program is run.
|
---|
10 | Sub Main()
|
---|
11 | Dim core As New cCore() ' (1) Define core and database variables
|
---|
12 | Dim ds As IEwEDataSource = cDataSourceFactory.Create(eDataSourceTypes.ACCDB)
|
---|
13 |
|
---|
14 | ds.Open("baltic.ewemdb", core) ' (2) Open the database called baltic.ewemdb.
|
---|
15 |
|
---|
16 | core.InitCore() ' (3) Tells the core to do some initialization and load the model
|
---|
17 | core.LoadModel(ds)
|
---|
18 | core.RunEcoPath() ' (4) Runs Ecopath
|
---|
19 |
|
---|
20 | ' (5) Writes to the console the group name and Ecopath EE for group 1.
|
---|
21 | Console.WriteLine("Group '" & core.EcoPathGroupOutputs(1).Name & "'" & _
|
---|
22 | " EE estimated to " & core.EcoPathGroupOutputs(1).EEOutput)
|
---|
23 |
|
---|
24 | core.LoadEcosimScenario(1) ' (6) Loads an ecosim scenario
|
---|
25 | core.RunEcoSim(AddressOf EcosimResultsHandler) ' (7) Runs Ecosim with delegate
|
---|
26 |
|
---|
27 | core.CloseModel() ' (8) Tells the model to shutdown properly.
|
---|
28 |
|
---|
29 | Console.WriteLine("Press a key to exit") ' Waits and ask the user to hit a key before closing.
|
---|
30 | Console.ReadKey()
|
---|
31 | End Sub
|
---|
32 |
|
---|
33 | ' Ecosim delegate - a sub function/subroutine that is
|
---|
34 | ' called at the end of every timestep.
|
---|
35 | ' One would obtain the results from the results object.
|
---|
36 | Private Sub EcosimResultsHandler(ByVal iTime As Long, ByVal EcoSimResults As cEcoSimResults)
|
---|
37 | System.Console.WriteLine("Time Step = " & iTime.ToString & _
|
---|
38 | "; Biomass of group 1 = " & EcoSimResults.Biomass(1).ToString)
|
---|
39 | End Sub
|
---|
40 |
|
---|
41 | End Module
|
---|