Skip to content

Scenario Module

The purpose of the Scenario Module is to create and compare model simulations, called scenarios.

Install the NuGet package DHI.MikeOperations.ScenarioManager to maintain and find models, scenarios and simulations.

To be able to run a scenario, requires that the adapter NuGet package associated to the model is installed.

The sample code below shows how to get a scenario and run it.

// Get the scenario module
var scenarioModule = application.Modules.Get("Scenario Manager") as DHI.Solutions.ScenarioManager.Interfaces.IScenarioModule;

// Get a scenario from its path.
var scenario = scenarioModule.ScenarioList.Fetch("[Full path to the scenaro in the scenario manager]");

// Create a simulation variable for the simulation.
DHI.Solutions.ScenarioManager.Interfaces.ISimulation sim = null;

// Run the simulation.
scenarioModule.RunScenario(scenario, false, false, ref sim);
# Get the scenario module
scenarioModule = app.Modules.Get("Scenario Manager")

# Get a scenario from its path.
scenario = scenarioModule.ScenarioList.Fetch("[Full path to the scenaro in the scenario manager]")

# Declare a reference simulation in order to get the simulation being created  when running the simulation.
sim = clr.Reference[DHI.Solutions.ScenarioManager.Interfaces.ISimulation]()

# Run the simulation.
scenarioModule.RunScenario(scenario, False, False, sim);
# Get the scenario module
scenarioModule = DHI.Solutions.ScenarioManager.Interfaces.IScenarioModule(app.Modules.Get("Scenario Manager"))

# Get a scenario from its path.
scenario = scenarioModule.ScenarioList.Fetch("[Full path to the scenaro in the scenario manager]")

# Declare a reference simulation in order to get the simulation being created  when running the simulation.
sim = clr.Reference[DHI.Solutions.ScenarioManager.Interfaces.ISimulation]()

# Run the simulation.
scenarioModule.RunScenario(scenario, False, False, sim);

Module Providers

The following providers are included in the scenario module.

Provider Description
ModelSetupList Manage the ModelSetups available in the database. Query this list/provider to find models registered.
ModelSetupGroupList Manage model groups available in the database.
ModelObjectList Manage the ModelObjects available in the database. Model objects contains parameters and can have associated input and output time series. Model objects also contains spatial information (x, y, z).
LinkingModelSetupList Manage the Linking Model Setups available in the database
LinkedTransferList Manage the Linked Transfers available in the database
ScenarioList Manage scenarios available in the database. Query this list/provider to find scenarios of a model setup.
ScenarioComparisonList Manage scenarios comparisons available in the database
ScenarioComparisonModelSetupAssociationList Manage scenarios comparison model setup association available in the database
ScenarioComparisonSimulationAssociationList Manage scenarios comparison Simulation association available in the database
OptimizationScenarioList Manage optimization scenarios available in the database
ModelSetupIndicatorDefinitionList Manage model setup indicator definition in the database
ModelInputTimeSeriesList Manage model setup input timeseries. Query this list/provider to find input time series definitions of a model setup and model objects.
ModelOutputTimeSeriesList Manage model setup output timeseries. Query this list/provider to find model output time series definitions of a model setup and model objects.
SimulationList Manage simulations available in the database. Query this list/provider to find simulations of a scenario.
SimulationIndicatorList Manage simulation indicators.
ModelSpatialOutputTimeSeriesList Manage model setup spatial output time series. Query this list/provider to find spatial output registered with a model setup.
ModelSpatialInputTimeSeriesList Manage model setup spatial input time series. Query this list/provider to find spatial input registered with a model seetup.

Read more about using module providers here

Remote Engine Execution Providers

The scenario manager of MIKE OPERATIONS can use remote engine execution providers for running simulations using remote model execution services. Currently MIKE OPERATIONS only support the MIKE Cloud Platform Model Execuytion Service.

The use of remote engine execution services, are specified on the scenario properties. When configured, simply run the scenario.

MIKE Cloud Engine Execution Service

The engine execution service of the MIKE Cloud Platform.

NuGet package: DHI.MikeOperations.ScenarioManager.Execution.MikeCloud

Configure the MIKE Cloud Engine Execution Service as a engine execution provider in the scenario manager of MIKE Workbench or at startup.

// Get the scenario module.
var module = application.Modules.Get("Scenario Manager") as DHI.Solutions.ScenarioManager.Interfaces.IScenarioModule;

// Create the provider.
var engineExecutionProvider = new DHI.Solutions.ScenarioManager.CloudExecutionService.MIKECloudExecutionServiceProvider();

// Startup the provider with the connection string as argument and add it to the list of engine execution providers.
engineExecutionProvider.StartUp(application, module, "[API Key]");
module.ExecutionServiceProviders.Add(engineExecutionProvider);
# Get the scenario module.
module = app.Modules.Get("Scenario Manager")

# Create the provider.
engineExecutionProvider = DHI.Solutions.ScenarioManager.CloudExecutionService.MIKECloudExecutionServiceProvider()

# Startup the provider with the connection string as argument and add it to the list of engine execution providers.
engineExecutionProvider.StartUp(application, module, "[API Key]")
module.ExecutionServiceProviders.Add(engineExecutionProvider)
# Get the scenario module.
module = DHI.Solutions.ScenarioManager.Interfaces.IScenarioModule(app.Modules.Get("Scenario Manager"))

# Create the provider.
engineExecutionProvider = DHI.Solutions.ScenarioManager.CloudExecutionService.MIKECloudExecutionServiceProvider()

# Startup the provider with the connection string as argument and add it to the list of engine execution providers.
engineExecutionProvider.StartUp(application, module, "[API Key]")
module.ExecutionServiceProviders.Add(engineExecutionProvider)

Supported Adapters

The following adapters of MIKE OPERATIONS is currently supported using the MIKE Cloud engine executon service. Refer to the DHI Platform documentation for an updated list of supported engines and engine versions.

  • FEFLOW
  • MIKE11
  • MIKE1D (MIKE+)
  • MIKE21FM
  • MIKE flood
  • MIKE Hydro Basin
  • MIKE Hydro River
  • MIKE SHE

Pool Types

The model execution service support the following pool types (machine configurations). Refer to the MIKE Cloud Platform documentation for more information.

Pool Type Name Description
VM-S-5 Based on either the 2.4 GHz Intel Xeon® E5-2673 v3 (Haswell) processor or the 2.3 GHz Intel Xeon® E5-2673 v4 (Broadwell) processor. It offers a powerful combination of CPU, memory and local disk for most production applications.
VM-S-40 The machine is hyper-threaded and based on the Intel Xeon® Platinum 8168 (SkyLake) processor, which can achieve single core Turbo clock speeds of 3.7 GHz and sustained all core Turbo as high as 3.4 GHz with the Intel Turbo Boost Technology 2.0.
VM-S-100 The machine is hyper-threaded and based on the Intel Xeon® Platinum 8168 (SkyLake) processor, which can achieve single core Turbo clock speeds of 3.7 GHz and sustained all core Turbo as high as 3.4 GHz with the Intel Turbo Boost Technology 2.0.
VM-G-5 NC-series VMs are powered by the NVIDIA Tesla K80 card and the Intel Xeon E5-2690 v3 (Haswell) processor. 1 x NVIDIA Tesla K80
VM-G-40 NC-series VMs are powered by the NVIDIA Tesla K80 card and the Intel Xeon E5-2690 v3 (Haswell) processor. 4 x NVIDIA Tesla K80

Query Properties

Model Setup

Query Property Type Database Column Note
AdapterReference string adapter
Description string description
ContentId Guid
GroupId Guid model_setup_group_id
Folder string folder
Id Guid id
IndicatorsEnabled boolean indicators_enabled
IsLinkingModel bool is_linking_model
LayerSetting string layer_setting
ModelObjectTypeListBlob Guid model_object_type_list_blob
ModelType string model_type
Name string name
ModelOutputTimeseriesBlob Guid output_time_series_blob
ModelInputTimeseriesBlob Guid input_time_series_blob
ModelObjectBlob Guid model_object_blob
SaveInitCondToDisk bool save_initcond_to_disk
SaveSimContentToDisk bool save_simcontent_to_disk
SimulationEndDate DateTime simulation_end_date
SimulationStartDate DateTime simulation_start_date
TimeOfForecast DateTime time_of_forecast
Version Guid version

Scenario

Query Property Type Database Column Note
Description string description
Id Guid id
InitialCondition string initial_condition
ModelObjectParametersSpreadsheetId Guid param_spreadsheet_id
ModelSetupId Guid model_setup_id
Name string name
PostProPreparedScriptId Guid post_process_script_id
PreProPreparedScriptId Guid pre_process_script_id
Settings string settings
SimulationDates string simulation_dates
Version Guid version

Simulation

Query Property Type Database Column Note
ContentId Guid content
Description string description
EnsembleRuns int ensemble_runs
Id Guid id
InputInitialCondition string input_initial_condition
JobInstanceLog string job_instance_log
ModelObjectParametersSpreadsheetId Guid param_spreadsheet_id
ModelSetupId Guid model_setup_id
Name string name
OutputInitialConditionContentId Guid out_init_condition_content
OutputInitialConditionDescription string out_init_condition_description
OutputInitialConditionEndDate DateTime out_init_condition_end_date
OutputInitialConditionStartDate DateTime out_init_condition_start_date
ParentId Guid parent_id
ScenarioId Guid scenario_id
SimulationEndDate DateTime simulation_end_date
SimulationStartDate DateTime simulation_start_date
Status string status UNDEFINED
INITIALIZED_ERROR
INITIALIZED
INPUT_DATA_ERROR
INPUT_DATA_OK
MODEL_RUN_ERROR
MODEL_RUN_OK
OUTPUT_DATA_ERROR
OUTPUT_DATA_OK
APPROVED
TimeOfForecast DateTime time_of_forecast
TimeOfSimulationRun DateTime time_of_simulation_run
TotalSimulationTime string total_simulation_time
Version Guid version

Code Samples

Get Simulations of a scenario

// Get the scenario module
var scenarioModule = application.Modules.Get("Scenario Manager") as DHI.Solutions.ScenarioManager.Interfaces.IScenarioModule;

// Get the scenario
var scenario = scenarioModule.ScenarioList.Fetch("[Full path to the scenaro in the scenario manager]");

// Create the qwuery
var query = new DHI.Solutions.Generic.Query();
query.Add(new DHI.Solutions.Generic.QueryElement("ScenarioId", scenario.Id, DHI.Solutions.Generic.QueryOperator.Eq));

// Fetch using the query
var simList = scenarioModule.SimulationList.Fetch(query);
# Get the scenario module
scenarioModule = app.Modules.Get("Scenario Manager")

# Get the scenario
scenario = scenarioModule.ScenarioList.Fetch("[Full path to the scenaro in the scenario manager]")

# Create the qwuery
query = DHI.Solutions.Generic.Query()
query.Add(DHI.Solutions.Generic.QueryElement("ScenarioId", scenario.Id, DHI.Solutions.Generic.QueryOperator.Eq))

# Fetch using the query
simList = scenarioModule.SimulationList.Fetch(query)
# Get the scenario module
scenarioModule = DHI.Solutions.ScenarioManager.Interfaces.IScenarioModule(app.Modules.Get("Scenario Manager"))

# Get the scenario
scenario = scenarioModule.ScenarioList.Fetch("[Full path to the scenaro in the scenario manager]")

# Create the qwuery
query = DHI.Solutions.Generic.Query()
query.Add(DHI.Solutions.Generic.QueryElement("ScenarioId", scenario.Id, DHI.Solutions.Generic.QueryOperator.Eq))

# Fetch using the query
simList = scenarioModule.SimulationList.Fetch(query)

Get output time series of a simulation

// Get the scenario module
var scenarioModule = application.Modules.Get("Scenario Manager") as DHI.Solutions.ScenarioManager.Interfaces.IScenarioModule;

// Get the simulation from the full path (or from the id).
var simulation = scenarioModule.SimulationList.Fetch("[Full path of the simulation (entity descriptor)]]");

// Fetch all simulation output time series of the simulation.
var simulationOutputTimeSeriesList = simulation.SimulationOutputTimeseriesList.FetchAll();

// Get the time series and values of each simulation output time series.
foreach (var tsOutput in simulationOutputTimeSeriesList)
{
    var ts = scenarioModule.GetSimulationOutputDataSeries(tsOutput);
    var valuePairList = ts.FetchAll();
}
# Get the scenario module
scenarioModule = app.Modules.Get("Scenario Manager")

# Get the simulation from the full path (or from the id).
simulation = scenarioModule.SimulationList.Fetch("[Full path of the simulation (entity descriptor)]]")

# Fetch all simulation output time series of the simulation.
simulationOutputTimeSeriesList = simulation.SimulationOutputTimeseriesList.FetchAll()

# Get the time series and values of each simulation output time series.
for tsOutput in simulationOutputTimeSeriesList:
    ts = scenarioModule.GetSimulationOutputDataSeries(tsOutput)
    valuePairList = ts.FetchAll()
# Get the scenario module
scenarioModule = DHI.Solutions.ScenarioManager.Interfaces.IScenarioModule(app.Modules.Get("Scenario Manager"))

# Get the simulation from the full path (or from the id).
simulation = scenarioModule.SimulationList.Fetch("[Full path of the simulation (entity descriptor)]]")

# Fetch all simulation output time series of the simulation.
simulationOutputTimeSeriesList = simulation.SimulationOutputTimeseriesList.FetchAll()

# Get the time series and values of each simulation output time series.
for tsOutput in simulationOutputTimeSeriesList:
    ts = scenarioModule.GetSimulationOutputDataSeries(tsOutput)
    valuePairList = ts.FetchAll()

Include input or output to a scenario

A scenario only handles parameters, model input and model output included in the scenario.

// Get the scenario module
var scenarioModule = application.Modules.Get("Scenario Manager") as DHI.Solutions.ScenarioManager.Interfaces.IScenarioModule;

// Fetch the model object to include.
var modelObjectName = "[name of the model object]]";
var query = new DHI.Solutions.Generic.Query();
query.Add(new DHI.Solutions.Generic.QueryElement("Name", modelObjectName, DHI.Solutions.Generic.QueryOperator.Eq));
var modelObject = scenarioModule.ModelObjectList.Fetch(query) as DHI.Solutions.ScenarioManager.Interfaces.IModelObject;

// Fetch the scenario
var scenario = scenarioModule.ScenarioList.Fetch("[Full path of the scenario]]");
var entityToInclude = new System.Collections.Generic.List<DHI.Solutions.Generic.IEntity>();

// Add model object to to the list.
// Note that all parameters, input and output time series of a model object will be included when adding a model object.
entityToInclude.Add(modelObject);

// Include entities in the scenario.
// Note that IModelInputTimeseries, IModelOutputTimeseries, IModelSetupSpatialOutputTimeseries and IModelObject can be included individually.
scenario.Include(entityToInclude);
# Get the scenario module
scenarioModule = app.Modules.Get("Scenario Manager")

# Fetch the model object to include.
modelObjectName = "[name of the model object]]"
query = DHI.Solutions.Generic.Query()
query.Add(DHI.Solutions.Generic.QueryElement("Name", modelObjectName, DHI.Solutions.Generic.QueryOperator.Eq))
modelObject = scenarioModule.ModelObjectList.Fetch(query)

# Fetch the scenario
scenario = scenarioModule.ScenarioList.Fetch("[Full path of the scenario]]")
entityToInclude = System.Collections.Generic.List<DHI.Solutions.Generic.IEntity>()

# Add model object to to the list.
# Note that all parameters, input and output time series of a model object will be included when adding a model object.
entityToInclude.Add(modelObject)

# Include entities in the scenario.
# Note that IModelInputTimeseries, IModelOutputTimeseries, IModelSetupSpatialOutputTimeseries and IModelObject can be included individually.
scenario.Include(entityToInclude)
# Get the scenario module
scenarioModule = DHI.Solutions.ScenarioManager.Interfaces.IScenarioModule(app.Modules.Get("Scenario Manager"))

# Fetch the model object to include.
modelObjectName = "[name of the model object]]"
query = DHI.Solutions.Generic.Query()
query.Add(DHI.Solutions.Generic.QueryElement("Name", modelObjectName, DHI.Solutions.Generic.QueryOperator.Eq))
modelObject = scenarioModule.ModelObjectList.Fetch(query)

# Fetch the scenario
scenario = scenarioModule.ScenarioList.Fetch("[Full path of the scenario]]")
entityToInclude = System.Collections.Generic.List<DHI.Solutions.Generic.IEntity>()

# Add model object to to the list.
# Note that all parameters, input and output time series of a model object will be included when adding a model object.
entityToInclude.Add(modelObject)

# Include entities in the scenario.
# Note that IModelInputTimeseries, IModelOutputTimeseries, IModelSetupSpatialOutputTimeseries and IModelObject can be included individually.
scenario.Include(entityToInclude)

Set a time series as input

// Get the scenario module
var scenarioModule = application.Modules.Get("Scenario Manager") as DHI.Solutions.ScenarioManager.Interfaces.IScenarioModule;

// Fetch the scenario
var scenario = scenarioModule.ScenarioList.Fetch("[Full path of the scenario]]");

// Get the time series to use as input in the scenario.
var tsModule = application.Modules.Get("Time series Manager") as DHI.Solutions.TimeseriesManager.Interfaces.ITimeSeriesModule;
var ts = tsModule.TimeSeriesList.Fetch("/Telemetry/Discharge/Q3070.dfs0 [HE Moste]");

// Get all the input time series included in the scenario.
var simulationInputTimeSeriesList = scenario.ScenarioInputTimeseriesDefinitionList.FetchAll();

// Set the time series as the input time series.
simulationInputTimeSeriesList[0].TimeseriesId = ts.Id;

// Update in the database.
scenario.ScenarioInputTimeseriesDefinitionList.Update(simulationInputTimeSeriesList[0]);
# Get the scenario module
scenarioModule = app.Modules.Get("Scenario Manager")

# Fetch the scenario
scenario = scenarioModule.ScenarioList.Fetch("[Full path of the scenario]]")

# Get the time series to use as input in the scenario.
tsModule = application.Modules.Get("Time series Manager")
ts = tsModule.TimeSeriesList.Fetch("/Telemetry/Discharge/Q3070.dfs0 [HE Moste]")

# Get all the input time series included in the scenario.
simulationInputTimeSeriesList = scenario.ScenarioInputTimeseriesDefinitionList.FetchAll()

# Set the time series as the input time series.
simulationInputTimeSeriesList[0].TimeseriesId = ts.Id

# Update in the database.
scenario.ScenarioInputTimeseriesDefinitionList.Update(simulationInputTimeSeriesList[0])
# Get the scenario module
scenarioModule = DHI.Solutions.ScenarioManager.Interfaces.IScenarioModule(app.Modules.Get("Scenario Manager"))

# Fetch the scenario
scenario = scenarioModule.ScenarioList.Fetch("[Full path of the scenario]]")

# Get the time series to use as input in the scenario.
tsModule = DHI.Solutions.TimeseriesManager.Interfaces.ITimeSeriesModule(application.Modules.Get("Time series Manager"))
ts = tsModule.TimeSeriesList.Fetch("/Telemetry/Discharge/Q3070.dfs0 [HE Moste]")

# Get all the input time series included in the scenario.
simulationInputTimeSeriesList = scenario.ScenarioInputTimeseriesDefinitionList.FetchAll()

# Set the time series as the input time series.
simulationInputTimeSeriesList[0].TimeseriesId = ts.Id

# Update in the database.
scenario.ScenarioInputTimeseriesDefinitionList.Update(simulationInputTimeSeriesList[0])

Adapters

In order for the MIKE Workbench to communicate in a standard way with different types of modeling tools the adapter concept is used. This means that a model can be registered in and controlled from the MIKE Workbench if a piece of software is added to the MIKE Workbench – the adapter – between the MIKE Workbench business logic and the model setup/model tool specifics.

The adapter shall ‘shield’ the model setup and proprietary files from MIKE Workbench, making the model setup appear like any other model setup to the MIKE Workbench. The responsibilities of the adapter are in short:

  • Configuration
    • Describe the setup in MIKE Workbench context (model objects, input/output time series, outputs, initial conditions)
    • Provide model setup data enabling the MIKE Workbench to run the same model setup.
  • Runtime
    • Convert the input data provided by the MIKE Workbench to proprietary formats (initial conditions, input time series)
    • Execute the model
    • Assess success/failure of the model run
    • Extract outputs to MIKE Workbench format (new initial states, output time series, output data)

EPANET

The EPANET adapter provides functionality for reading and updating model input and output, as well as running the model.

API
NuGet Package DHI.MikeOperations.ScenarioManager.Adapters.EPANET
API Reference DHI.Solutions.Adapters.EPANET.EPANETAdapter

FEFLOW

FEFLOW (Finite Element subsurface FLOW system) is a model capable of simulating groundwater flow, mass transfer and heat transfer in porous media and fractured media. The model uses finite element analysis to solve the groundwater flow equation of both saturated and unsaturated conditions as well as mass and heat transport, including fluid density effects and chemical kinetics for multi-component reaction systems. With FEFLOW, you can create layer-based, partially unstructured or fully unstructured meshes in 3D. Produce precise spatial representation of complex geological and geometrical settings such as rivers, fractures, pipes, tunnels and well locations. Deactivate and reactivate mesh elements within the model domain to account for temporal changes such as tunnel excavations or mine plans.

API
NuGet Package DHI.MikeOperations.ScenarioManager.Adapters.FEFLOW
API Reference DHI.Solutions.Adapters.FEFLOW.FEFLOWAdapter

Generic

A model can be for a variety of different purposes, likewise model could be developed using different modelling tools like MIKE 11, MIKE 21, MIKE SHE etc… Therefore, to provide users with an option to register any type of model with MIKE Workbench this adapter has been created. It doesn’t provide user with full flexibility of editing different options via MIKE Workbench but still it enables users to register their models by writing a configuration file. The configuration file should adhere to an xml schema which is mentioned later in this document. It also provides users with an option to register their FLOOD WATCH models without having to write the configuration file. But for this to work user need to follow a strict predefined FLOOD WATCH folder structure. Folder structure required is also mentioned later in this document.

API
NuGet Package DHI.MikeOperations.ScenarioManager.Adapters.Generic
API Reference DHI.Solutions.Adapters.Generic.GenericAdapter

GoldSim

GoldSim is dynamic, probabilistic simulation software developed by GoldSim Technology Group. This general-purpose simulator is a hybrid of several simulation approaches, combining an extension of system dynamics with some aspects of discrete event simulation, and embedding the dynamic simulation engine within a Monte Carlo simulation framework. While it is a general-purpose simulator, GoldSim has been most extensively used for environmental and engineering risk analysis, with applications in the areas of water resource management, mining, radioactive waste management , geological carbon sequestration , aerospace mission risk analysis and energy.

API
NuGet Package DHI.MikeOperations.ScenarioManager.Adapters.GoldSim
API Reference DHI.Solutions.Adapters.GoldSim.GoldSimAdapter

HEC-RAS

The HEC-RAS adapter enables use of HEC-RAS model setups within MIKE Workbench. The adapter supports unsteady 1D-flow and 2D-flow models. HEC-RAS (Hydrologic Engineering Center-River Analysis System), is developed by the USACE (United States Army Corps of Engineers).

The following versions of HEC-RAS is currently supported:

  • 5.0.3
  • 5.0.4
  • 5.0.5
  • 5.0.7
  • 6.1.0
API
NuGet Package DHI.MikeOperations.ScenarioManager.Adapters.HECRAS
API Reference DHI.Solutions.Adapters.HECRAS.HECRASAdapter

MIKE11

The MIKE 11 adapter enables use of MIKE 11 model setups (.sim11) within the MIKE Workbench. The adapter supports the following MIKE 11 modules:

  • HD
  • RR
  • DA
  • FF
  • ICE
  • AD
  • WQ
API
NuGet Package DHI.MikeOperations.ScenarioManager.Adapters.MIKE11
API Reference DHI.Solutions.Adapters.MIKE11.MIKE11Adapter

MIKE1D

The adapter contains the MIKE1D (MIKE+) adapter for MIKE OPERATIONS. The MIKE+ adapter enables use of MIKE+ model setups (.m1dx) within the MIKE Workbench.

API
NuGet Package DHI.MikeOperations.ScenarioManager.Adapters.MIKE1D
API Reference DHI.Solutions.Adapters.MIKE1D.MIKE1DAdapter

MIKE21FM

The MIKE 21 FM adapter enables use of MIKE 21 FM model setups (.m21fm, .m3fm, .mfm) within MIKE Workbench. The adaptor supports the following models:

  • MIKE 21 FM
  • MIKE 3 FM

The flow model (FM) is a comprehensive modelling system for two- and three-dimensional water modelling. The 2D and 3D models carry the same name as the classic DHI model versions MIKE 21 and MIKE 3 with an "FM" added referring to the type of grid - Flexible Mesh.

API
NuGet Package DHI.MikeOperations.ScenarioManager.Adapters.MIKE21FM
API Reference DHI.Solutions.Adapters.MIKE21FM.MIKE21FMAdapter

MIKE FLOOD

MIKE FLOOD is the unique toolbox for professional flood modelers. It includes a wide selection of specialized 1D and 2D flood simulation engines, enabling you to model any flood problem - whether it involves rivers, floodplains, flooding in streets, drainage networks, coastal areas, dams, levee and dike breaches, or any combination of these. The core elements in MIKE FLOOD are the models, MIKE HYDRO River for rivers, MIKE URBAN for collection systems and MIKE 21 for 2D surface flow. These are coupled to form a three-way coupled modelling tool.

The MIKE FLODD adapter enables use of MIKE FLODD model setups (.couple) within MIKE Workbench.

API
NuGet Package DHI.MikeOperations.ScenarioManager.Adapters.MIKEFlood
API Reference DHI.Solutions.Adapters.MIKEFlood.MIKEFloodAdapter

MIKE HYDRO Basin

The MIKE HYDRO Basin adapter enables use of MIKE HYDRO Basin model setups (.mhydro) within the MIKE Workbench.

The adapter supports the Rainfall-Runoff model specified in the Catchment definitions and crop yield model specified in Irrigation data. Hotstart functionality for Rainfall-Runoff simulations (if specified) and for MIKE HYDRO Basin parameters (e. g. initial reservoir levels) is supported as well. As all adapters, the MIKE HYDRO Basin adapter supports setting of editable model parameters via the user interface and via a spreadsheet. It is also possible to define ensembles of parameters in the spreadsheet.

API
NuGet Package DHI.MikeOperations.ScenarioManager.Adapters.MIKEHydroBasin
API Reference DHI.Solutions.Adapters.MIKEHydro.MIKEHydroAdapter

MIKE HYDRO River

The MIKE HYDRO River adapter enables use of MIKE HYDRO River model setups (.mhydro) within the MIKE Workbench.

The adapter supports the Rainfall-Runoff model specified in the Catchment definitions. AD boundary conditions and AD initial conditions are supported as well. As all adapters, the MIKE HYDRO River adapter supports setting of editable model parameters via the user interface and via a spreadsheet. It is also possible to define ensembles of parameters in the spreadsheet. It can take advantage of a multi-core machine and execute different runs of an ensemble simulation simultaneously in order to speed up ensemble model runs.

API
NuGet Package DHI.MikeOperations.ScenarioManager.Adapters.MIKEHydroRiver
API Reference DHI.Solutions.Adapters.MIKEHydroRiver.MIKEHydroRiverAdapter

MIKE SHE

The MIKE SHE adapter enables use of MIKE SHE model setups (.she) within the MIKE Workbench.

API
NuGet Package DHI.MikeOperations.ScenarioManager.Adapters.MIKESHE
API Reference DHI.Solutions.Adapters.MIKESHE.MIKESHEAdapter

NWS

This adapter supports 3 NWS models, SNOW-17, SACSMA and UNIT-HG. It further offers the WEIGHT-TS calculation and time series transfer similar to functionality in CHPS/FEWS.

API
NuGet Package DHI.MikeOperations.ScenarioManager.Adapters.NWS
API Reference DHI.Solutions.Adapters.NWS.NWSAdapter

SWAT

SWAT (Soil and Water Assessment Tool) is a river basin scale model developed to quantify the impact of land management practices in large, complex watersheds. It is a hydrology model with the following components:

  • Weather
  • Surface runoff
  • Return flow
  • Percolation
  • Evapotranspiration
  • Transmission losses
  • Pond and reservoir storage
  • Crop growth and irrigation
  • Groundwater flow
  • Reach routing
  • Nutrient and pesticide loading
  • Water transfer
API
NuGet Package DHI.MikeOperations.ScenarioManager.Adapters.SWAT
API Reference DHI.Solutions.Adapters.SWAT.SWATAdapter

WEAP

WEAP ("Water Evaluation And Planning" system) is a water resources planning and analysis model based on a lumped, node based approach similar to MIKE HYDRO Basin. WEAP is developed by the Stockholm Environment Institute's U.S. Center.

API
NuGet Package DHI.MikeOperations.ScenarioManager.Adapters.WEAP
API Reference DHI.Solutions.Adapters.WEAP.WEAPAdapter

Tools

When using the API for running tools, every tool is following the concept show below.

// Get the tool from the tool name.
var tool = application.Tools.CreateNew("Hierarchy Configuration") as DHI.Solutions.ScenarioManager.UI.Tools.HierarchyDefinitionTool.HierarchyDefinitionTool;

// Add input items to the tool.
tool.InputItems.Add(scenario);

// Set the properties of the tool.
tool.Update = false;

// Execute the tool.
tool.Execute();

// Get the output of the tool (if any).
var output = tool.OutputItems[0];
# Get the tool from the tool name.
tool = application.Tools.CreateNew("Hierarchy Configuration")

# Add input items to the tool.
tool.InputItems.Add(scenario)

# Set the properties of the tool.
tool.Update = false

# Execute the tool.
tool.Execute()

# Get the output of the tool (if any).
var output = tool.OutputItems[0]

Confidence Intervals

RStatisticsConfidenceIntervalTool class

Tool Info Confidence Intervals
NuGet Package DHI.MikeOperations.ScenarioManager.Tools.RStatistics
API Reference DHI.Solutions.ScenarioManager.Tools.RStatisticsTool.IRStatisticsConfidenceIntervalTool
Input Items No input items required
Output Items A time series

Tool Properties

  • Action: Gets or sets the action to perform.
  • DataCollectionSpreadsheetPath: Gets or sets the full path to the data collection spreadsheet.
  • DataCollectionScenarioPath: Gets or sets the path of the scenario for collecting data.
  • FromDate: Gets or sets the time of forecast date from where simulations of the data collection scenario are taken.
  • ToDate: Gets or sets the time of forecast date to where simulations of the data collection scenario are taken.
  • CollectionPeriodInterval: Gets or sets the time period used when collecting data. This interval can only be specified when new data collection spreadsheets are created. For existing spreadsheets, the collection interval is specified by the spreadsheet.
  • CollectionPeriodLength: Gets or sets the length of the period interval used when collection data. This interval can only be specified when new data collection spreadsheets are created. For existing spreadsheets, the collection interval is specified by the spreadsheet.
  • UpdateMappingSheet: Gets or sets a value indicating whether the mapping sheet should be updated, so that a row in the mapping sheet and a data collection sheet is present for all output time series of the scenario.
  • Mask: Gets or sets the mask for finding output time series for mapping. If the mask is not specified, no time series is found for mapping. Regular expressions are used for finding matching output time series.
  • AnalysisName: Gets or sets the name of the analysis. The name is used for updating error model in the document manager.
  • ModelType: Gets or sets the model type (1-4).
  • UseWeights: Gets or sets a value indicating whether weights should be used.
  • ConfidenceIntervals: Gets or sets a comma separated string with confidence intervals to use for calculating the error model. The list must use decimal points. Default: "0.05,0.125,0.5,0.875,0.95"
  • TimeSeriesPath: Gets or sets the path to the time series to generate confidence intervals for.
  • ErrorModelPath: Gets or sets the path in the document manager to the error model to use for generating confidence intervals.
  • LastError: Gets or sets the last error when taking initial error into consideration. Last error is the difference between the observed last observed value and a previous simulation (obs.value - sim.value).

Tool Methods

  • GetAnalysisMeasures(): Gets an array of measures supported by the analysis.

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("Confidence Intervals") as DHI.Solutions.ScenarioManager.Tools.RStatisticsTool.IRStatisticsConfidenceIntervalTool;
# Get the tool.
tool = app.Tools.CreateNew("Confidence Intervals")
# Get the tool.
tool = DHI.Solutions.ScenarioManager.Tools.RStatisticsTool.IRStatisticsConfidenceIntervalTool(app.Tools.CreateNew("Confidence Intervals"))

Goodness of Fit

RStatisticsGoodnessOfFitTool class

Tool Info Goodness of Fit
NuGet Package DHI.MikeOperations.ScenarioManager.Tools.RStatistics
API Reference DHI.Solutions.ScenarioManager.Tools.RStatisticsTool.IRStatisticsGoodnessOfFitTool
Input Items No input items required
Output Items A time series

Tool Properties

  • Action: Gets or sets the action to perform.
  • DataCollectionSpreadsheetPath: Gets or sets the full path to the data collection spreadsheet.
  • DataCollectionScenarioPath: Gets or sets the path of the scenario for collecting data.
  • FromDate: Gets or sets the time of forecast date from where simulations of the data collection scenario are taken.
  • ToDate: Gets or sets the time of forecast date to where simulations of the data collection scenario are taken.
  • CollectionPeriodInterval: Gets or sets the time period used when collecting data. This interval can only be specified when new data collection spreadsheets are created. For existing spreadsheets, the collection interval is specified by the spreadsheet.
  • CollectionPeriodLength: Gets or sets the length of the period interval used when collection data. This interval can only be specified when new data collection spreadsheets are created. For existing spreadsheets, the collection interval is specified by the spreadsheet.
  • UpdateMappingSheet: Gets or sets a value indicating whether the mapping sheet should be updated, so that a row in the mapping sheet and a data collection sheet is present for all output time series of the scenario.
  • Mask: Gets or sets the mask for finding output time series for mapping. If the mask is not specified, no time series is found for mapping. Regular expressions are used for finding matching output time series.
  • ResultSpreadsheetPath: Gets or sets the full path of the spreadsheet for the analysis results.
  • ModelObjectName: Gets or sets the model object name to get results for.
  • ModelObjectVariable: Gets or sets the model object variable to get results for.

Tool Methods

  • GetAnalysisMeasures(): Gets an array of measures supported by the analysis.

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("Goodness of Fit") as DHI.Solutions.ScenarioManager.Tools.RStatisticsTool.IRStatisticsGoodnessOfFitTool;
# Get the tool.
tool = app.Tools.CreateNew("Goodness of Fit")
# Get the tool.
tool = DHI.Solutions.ScenarioManager.Tools.RStatisticsTool.IRStatisticsGoodnessOfFitTool(app.Tools.CreateNew("Goodness of Fit"))

Hierarchy Configuration

The Hierarchy tool allows the user to define the input timeseries of a scenario in a robust and user-friendly way.

Tool Info Hierarchy Configuration
NuGet Package DHI.MikeOperations.ScenarioManager.Tools.HierarchyConfiguration
API Reference DHI.Solutions.ScenarioManager.UI.Tools.HierarchyDefinitionTool.IHierarchyDefinitionTool
Input Items A single scenario or a single scenario input time series
Output Items No output items

Tool Properties

  • Update: Gets or sets a value indicating whether to update the XML on the ScenarioInputTimeSeriesDefinition table in the database. Default=true. Always false for input items of type ISimulationInputTimeseries

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("Hierarchy Configuration") as DHI.Solutions.ScenarioManager.UI.Tools.HierarchyDefinitionTool.IHierarchyDefinitionTool;
# Get the tool.
tool = app.Tools.CreateNew("Hierarchy Configuration")
# Get the tool.
tool = DHI.Solutions.ScenarioManager.UI.Tools.HierarchyDefinitionTool.IHierarchyDefinitionTool(app.Tools.CreateNew("Hierarchy Configuration"))

Longitudinal Profile

This tool creates a longitudinal profile time series based on simulation output time series. It supports the calculation points, structures, cross sections and boundaries of MIKE11 model, the calculation points, structures and cross sections of MIKE HYDRO River model, and the nodes of MIKE+ model.

Tool Info Longitudinal Profile
NuGet Package DHI.MikeOperations.ScenarioManager.Tools.LongitudinalProfile
API Reference DHI.Solutions.ScenarioManager.Tools.SimulationTimeSeriesProfileTool.ISimulationTimeSeriesProfileTool
Input Items One or more simulation model objects
Output Items An X-Y data series

Tool Properties

  • TimeSeriesInformation: Gets or sets the value of TimeSeriesInformation
  • TimeRelativeToTOF: Gets or sets the value of TimeRelativeToTOF (seconds)
  • AdditionalTimeSeries: Gets or sets the value of AdditionalTimeSeries

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("Longitudinal Profile") as DHI.Solutions.ScenarioManager.Tools.SimulationTimeSeriesProfileTool.ISimulationTimeSeriesProfileTool;
# Get the tool.
tool = app.Tools.CreateNew("Longitudinal Profile")
# Get the tool.
tool = DHI.Solutions.ScenarioManager.Tools.SimulationTimeSeriesProfileTool.ISimulationTimeSeriesProfileTool(app.Tools.CreateNew("Longitudinal Profile"))

R-Statistics

QueryToolTool class

Tool Info R-Statistics
NuGet Package DHI.MikeOperations.ScenarioManager.Tools.RStatistics
API Reference DHI.Solutions.ScenarioManager.Tools.RStatisticsTool.IRStatisticsTool
Input Items No input items required
Output Items No output items

Tool Properties

  • ArgumentString: Gets or sets the argument string to use for the R-execution.
  • WorkingFolder: Gets or sets the working folder for the script execution.
  • Use64Bit: Gets or sets a value indicating whether the 64 bit version of should be used. If the 64 bit execution file does not exist, 32 bit execution will be used.
  • RVersion: Gets or sets the value of R version

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("R-Statistics") as DHI.Solutions.ScenarioManager.Tools.RStatisticsTool.IRStatisticsTool;
# Get the tool.
tool = app.Tools.CreateNew("R-Statistics")
# Get the tool.
tool = DHI.Solutions.ScenarioManager.Tools.RStatisticsTool.IRStatisticsTool(app.Tools.CreateNew("R-Statistics"))

Skill Scores

RStatisticsSkillScoresTool class

Tool Info Skill Scores
NuGet Package DHI.MikeOperations.ScenarioManager.Tools.RStatistics
API Reference DHI.Solutions.ScenarioManager.Tools.RStatisticsTool.IRStatisticsSkillScoresTool
Input Items No input items required
Output Items A data table

Tool Properties

  • Action: Gets or sets the action to perform.
  • DataCollectionSpreadsheetPath: Gets or sets the full path to the data collection spreadsheet.
  • DataCollectionScenarioPath: Gets or sets the path of the scenario for collecting data.
  • FromDate: Gets or sets the time of forecast date from where simulations of the data collection scenario are taken.
  • ToDate: Gets or sets the time of forecast date to where simulations of the data collection scenario are taken.
  • CollectionPeriodInterval: Gets or sets the time period used when collecting data. This interval can only be specified when new data collection spreadsheets are created. For existing spreadsheets, the collection interval is specified by the spreadsheet.
  • CollectionPeriodLength: Gets or sets the length of the period interval used when collection data. This interval can only be specified when new data collection spreadsheets are created. For existing spreadsheets, the collection interval is specified by the spreadsheet.
  • UpdateMappingSheet: Gets or sets a value indicating whether the mapping sheet should be updated, so that a row in the mapping sheet and a data collection sheet is present for all output time series of the scenario.
  • Mask: Gets or sets the mask for finding output time series for mapping. If the mask is not specified, no time series is found for mapping. Regular expressions are used for finding matching output time series.
  • ResultSpreadsheetPath: Gets or sets the full path of the spreadsheet for the analysis results.
  • ModelObjectName: Gets or sets the model object name to get results for.
  • ModelObjectVariable: Gets or sets the model object variable to get results for.
  • CrossingTimeTolerance: Gets or sets the crossing time toloerance.
  • MaxLeadTimeSteps: Gets or sets the max lead time steps.

Tool Methods

  • GetAnalysisMeasures(): Gets an array of measures supported by the analysis.

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("Skill Scores") as DHI.Solutions.ScenarioManager.Tools.RStatisticsTool.IRStatisticsSkillScoresTool;
# Get the tool.
tool = app.Tools.CreateNew("Skill Scores")
# Get the tool.
tool = DHI.Solutions.ScenarioManager.Tools.RStatisticsTool.IRStatisticsSkillScoresTool(app.Tools.CreateNew("Skill Scores"))