MIKE1D Adapter¶
This adapter enables use of eWater Source models within the MIKE Workbench.
About MIKE1D¶
MIKE1D is a is a numerical simulation engine developed by DHI Group to simulates 1-dimensional water flow in river and sewer networks. Please refer to MIKE BY DHI for more information.
Prerequisite¶
The Adaptor requires MIKE1D1d to be installed on the MIKE Workbench computer (for registration) and the run machine. The execution of models will require a license on the run machine.
Supported Model objects¶
The below list of model objects can be derived from a MIKE1D setup.
- Basin
- Parameters:
- Name
- Invert level
- Terrain level
- Volume
- Volume variation
- Node location
- Parameters:
- Block calibration data
- Parameters:
- Flow max
- Flow min
- Objective value
- Objective value static
- Delay static
- Calibration active
- Block data name
- Time series path
- Parameters:
- Block data
- Parameters:
- Name
- Calculation model
- Overflow penalty
- Area
- Lower chainage
- Upper chainage
- Delay
- Delay unit
- Upper location
- Lower location
- Half life time
- Parameters:
- Catchment
- Parameters:
- Name
- Parameters:
- Catchment input
- Parameters:
- Name
- Type
- Parameters:
- Controlled link data
- Parameters:
- Outflow data name
- Inflow data name
- Parameters:
- Flow data
- Parameters:
- Name
- Time series scaling factor
- MPC controlled
- Linked
- Distribution type
- Location
- Delay
- Time series path
- Parameters:
- Forcing constraint data
- Parameters
- Bound value
- Bound
- Flow data name
- Time series path
- Parameters
- Forcing change penalty data
- Parameters
- Penalty
- Flow data name
- Parameters
- Initial state data
- Parameters:
- Initial value
- Reservoir name
- Time series path
- Parameters:
- Gate
- Parameters:
- Name
- From node
- To node
- Control type
- Parameters:
- Manhole
- Parameters:
- Diameter
- Invert level
- Name
- Node location
- Terrain level
- Parameters:
- MPC configuration
- Parameters:
- Name
- Time step
- Forcing penalty
- Ensemble size
- Optimisation method
- Soft constraints
- Parameters:
- MPC scenario
- Parameters:
- Scenario Id
- From node
- To node
- Real time
- Prediction horizon
- Time step
- Parameters:
- Output constraint data
- Parameters:
- Bound value
- Bound
- Violation penalty
- Block data name
- Time series path
- Parameters:
- Outlet
- Parameters:
- Constant water level
- Name
- Node location
- Terrain level
- Parameters:
- Regulation curve
- Parameters:
- Name
- Type
- Description
- Curve
- Parameters:
- Target data
- Parameters:
- Target value
- Penalty value
- Block data name
- Flow data name
- Target time series Id
- Parameters:
- Weir
- Parameters:
- Control type
- From node
- Name
- To node
- Parameters:
- Pump
- Parameters:
- Capacity curve
- Constant flow
- Control type
- Enabled
- From node
- Name
- Start level
- Stop level
- To node
- Type
- Parameters:
- Uncontrolled link data
- Parameters:
- Outflow block data name
- Inflow data name
- Parameters:
- Valve
- Parameters:
- Name
- From node
- To node
- Control type
- Parameters:
- Link
- Parameters:
- Diameter
- From node
- Height
- Name
- To node
- Type
- Width
- Parameters:
Configuration¶
Model preparation¶
The model must have been successfully executed.
Registration¶
An optional launch command for running the model can be specified.
If no launch command is specified, the adapter runs the MIKE1D engine to do a simulation.
Click Specify button, the Modify Run Settings dialog is shown.
Click OK button, the launch command is specified in the MIKE+ Model Registration dialog.
The MIKE+ adapter runs a user defined launch command if specified.
While registering the model, if outlets or catchments exist but no input time series is defined for them, some empty time series will be created as a placeholder when the Create additional catchment and outlet input time series is checked at registration.
Execution¶
When executing a simulation, the adapator:
1. Export model data to m1dx file
2. use Mike1DData to update the model data
3. Use DHI.Mike1D.Application.exe
to run a simulation
Alternatively, it can use Mike1DController
change engine¶
The launch command can be changed in the MIKE1D Adapter.xml
created during model registration.
<?xml version="1.0"?>
<MIKE1DAdapter>
<!-- ... -->
<LaunchCmd>
</LaunchCmd>
<LaunchArguments>
</LaunchArguments>
<LaunchSilentArguments>
</LaunchSilentArguments>
<MIKE1DRRFilePath>
</MIKE1DRRFilePath>
<MIKE1DHDFilePath>Brabrand.m1dx</MIKE1DHDFilePath>
<AdditionalResultFilePaths />
<MPCCouplingFilePath>
</MPCCouplingFilePath>
<MPCCatchmentDischargeFilePath>
</MPCCatchmentDischargeFilePath>
<MPCMikeUrbanFilePath>
</MPCMikeUrbanFilePath>
<MPCRainfallRunoffFilePath>
</MPCRainfallRunoffFilePath>
<MPCResultFilePredictionDataFilePath>
</MPCResultFilePredictionDataFilePath>
<MPCVolumeFlowRelationsFilePath>
</MPCVolumeFlowRelationsFilePath>
<MPCHotStartFilePath>
</MPCHotStartFilePath>
<Folders />
</MIKE1DAdapter>
Updating the launch command requires that the model setup is exported e.g. using the Open in Native Tool or by using an export script, so that that the MIKE1D Adapter.xml
can be changed.
After changing the MIKE1D Adapter.xml
file, the exported model, should be zipped and imported again, e.g. by using an zip and import script in the script manager.
def ReZipSetup(modelSetupPath, directory):
"""
<Script>
<Author>admin</Author>
<Description>Script to zip a folder and assign the result as content to a modelsetup, ths updating the blob</Description>
<Parameters>
<Parameter name="modelSetupPath" type="string">The full path of the model setup in the database (copy Full Path)</Parameter>
<Parameter name="directory" type="string">The directoy path in windows where the setup has been unpacked</Parameter>
</Parameters>
</Script>
"""
if (System.IO.Directory.Exists(directory) == False):
return;
scm = app.Modules.Get("Scenario Manager");
modelsetup = scm.ModelSetupList.Fetch(modelsetupPath);
zipptr = BaseAdapter.ZipFiles(directory, None, "no Adapter");
modelsetup.Content = zipptr;
scm.ModelSetupList.Update(modelsetup, True);
Warning
Be carefull when editing the model information and importing the changes, as the model information is used as when running simulation.
Limitations¶
-
m1dx-file must be in the root folder of the setup.
-
All files in the directory structure from the root folder and down including hotstart files (except result files) are zipped during registration, so reduce the size of data files and remove unnecessary files.