Skip to content

MIKE+ Tools

Purpose and scope

This chapter is to describe how to use the MIKE+ tools by API. This document will not go to detailed description of each tool. Please go to MIKE+ documentation to get to know each of the tool. Please check below tools which are included here.

  • Import tool
  • Topology repair tool
  • Interpolation tool
  • Connection repair tool
  • Catchment imperviousness processing tool
  • Catchment slope/length processing tool
  • Catchment spatial processing tool
  • MIKE1D analysis tool
  • Exclude natural channels tool
  • Geocode tool
  • Result difference tool
  • Simplification tool
  • WD distributed demands tool
  • WD Zone mapping tool
  • WD Valve criticality tool

Import tool

Import tool is to import different source data into MIKE+ database. The supported data formats are:

  • Shape file
  • Excel file
  • CAD file
  • Geodatabase
  • ODBC data (.mdb and .sqlite)
  • Sql server
  • Oracle
  • Another MIKE+ database

There are two ways to use the import tool.

  • Use import tool by command
  • Use import tool by API

Use import tool by command

A xml configuration file is needed by using the import tool in command line. Please use below command line to get help.

DHI.MIKEPlus.ToolShell.exe importtool -h

Use import tool by API

using DHI.Amelia.Tools.ImportTool.ImportEngine
internal override void Execute()
{
    bool oracleAssemblyLoaded = false;
    var dataTables = CreateDataTableContainer(dbOrMuppfile)
    var importEngine = new ImportToolBase(dataTables);
    importEngine.Load(_ConfigFile);
    FunctionHelper.ChangeFilePathInConfigToAbsolute(importEngine.JobConfigSectionsDic, _ConfigFile);
    importEngine.OnTableDataProcessing += OnTableDataProcessing;
    foreach (var item in importEngine.JobConfigSectionsDic)
    {
        var jobConfig = item.Key;
        var targetType = jobConfig.JobProps.Find(x => x.First == JobKeywordConstString.TargetType).Second;
        var target = jobConfig.JobProps.Find(x => x.First == JobKeywordConstString.Target).Second;
        if (targetType == Enum.GetName(typeof(ImportSupportedDataType), ImportSupportedDataType.MUPlusDB)
            && (target == null || !File.Exists(target)))
        {
            throw(new Exception("Target database is not exist. Please correct it in your configuration file."));
        }
        var srcType = jobConfig.JobProps.Find(x => x.First == JobKeywordConstString.SourceType).Second;
        if ((targetType == Enum.GetName(typeof(ImportSupportedDataType), ImportSupportedDataType.Oracle)
            || srcType == Enum.GetName(typeof(ImportSupportedDataType), ImportSupportedDataType.Oracle))
            && !oracleAssemblyLoaded)
        {
            oracleAssemblyLoaded = true;
            var assembly = Assembly.LoadFrom(_oracleAccessFile);
            if (assembly == null)
                throw (new Exception("Oracle data access assembly can't be loaded. Please use '-p [the path of Oracle.DataAccess.dll]' to specify the data access."));
        }
        if (srcType == Enum.GetName(typeof(ImportSupportedDataType), ImportSupportedDataType.ResultLayer))
            throw (new Exception("Import from result layer data is not supported for this command line."));
        if (srcType == Enum.GetName(typeof(ImportSupportedDataType), ImportSupportedDataType.MUPlusDB)
            && targetType != Enum.GetName(typeof(ImportSupportedDataType), ImportSupportedDataType.MUPlusDB))
        {
            // This is an export case
            var srcValue = jobConfig.JobProps.Find(x => x.First == JobKeywordConstString.Source).Second;
            if (srcValue == null || !File.Exists(srcValue))
                    throw (new Exception("Source database is not exist. Please correct it in your configuration file."));
        }
    }

    importEngine.Run();
}

private void OnTableDataProcessing(object sender, MappingGroupRowDataImportedEventArgs e)
{
    Console.WriteLine(e.TileInfo);
}

Topology repair tool

Topology repair tool offers a way to detect and repair topology or network geometry issues in the model.

using DHI.Amelia.Tools.TopologyRepairTool
public void TopologyRepairTest()
{
    var topologyParam = new TopologyRepairParam
    {
        DissolveOverlapNode = true,
        CorrectLinkConnection = true,
        SearchJunction4Connection = true,
        CreateJunction4Connection = true,
        SplitLinkOnTJunction = true,
        AddMissingZones = true,
        OverlapNodeSearchRadius = 0.1,
        JunctionSearchRadius4Connection = 0.1,
        TJunctionSplitSearchRadius = 0.1
    };

    var dataTables = CreateDataTableContainer(dbOrMuppfile);
    BaseTopologyRepairTool topologyRepairTool = BaseTopologyRepairTool.CreateRepairTool(dataTables);
    topologyRepairTool.Run(topologyParam, (new CancellationTokenSource()).Token, false);
}

Interpolation tool

The field assignment and interpolation tool is a controlled tool that will assign values to any field in the MIKE+ database either by taking the attribute value directly from another feature/attribute or by interpolating between any num­ber of other features.

using DHI.Amelia.Tools.InterpolationEngine
public void InterpolationToolTest()
{
    var param = new InterpolationToolParameters()
    {
        TargetTable = DbTableNames.NodeTable,
        TargetAttribute = NodeFields.InvertLevel,
        assigmentMethod = (int)InterpolationToolParameters.AssignMethod.NearestFeature,
        SourceTable = DbTableNames.NodeTable,
        SourceAttribute = NodeFields.InvertLevel,
        bOverallMissingValues = true,
    };

    var dataTables = CreateDataTableContainer(dbOrMuppfile);
    var engine = new InterpolationEngine.InterpolationEngine(dataTables);
    engine.Run(param, false);
}

Connection repair tool

Connection repair tool is to repair the connection line. It will re-create all the connection geometry based on the connection info. For CS MIKE 1D module, it will repair station connections, catchment connections and load point connections. For WD Epanet module, it will repair station connections and demand allocation connections. For CS SWMM module, it will repair the station connections and catchment connections.

using DHI.Amelia.Tools.ConnectionRepairEngine
public void RepairConnectionLinesGeometry()
{
    var connectRepairEngine = new ConnectionRepairEngine(_dataTables);
    connectRepairEngine.Run();
}

Catchment imperviousness processing tool

This tool is to calculate imperviousness for catchcment. There are two model types.

Paramter name Description
modelType "T_A_Curve" type is to calculate the value for "ModelAImpArea" of catchment table, used for CS MIKE 1D module."SWMM_Hydro" type is to calculate the value for "SWMM_Impervious" of catchment table, used for CS SWMM module.
landUseLayers The key of landUseLayers is the shape file name. The value of landUseLayers is the imperviousnes of that layer.
landUseLayerGeomtries This is optional. The tool engine will get the geometry from the shapefile if it is null.
using DHI.Amelia.Tools.CatchmentProcessing
public void CatchmentTool_Imperviousnes(List<string> selectedCatchments, ProcessingModelType modelType,
  Dictionary<string, double> landUseLayers, IDictionary<string, IList<Geometry>> landUseLayerGeomtries = null)
{
    var catchmentProcess = new CatchmentProcessing(_dataTables);
    catchmentProcess.RuningProgress += ToolProgressHandler;
    catchmentProcess.Imperviousnes(selectedCatchments, modelType, landUseLayers, landUseLayerGeomtries, compList);
}

Catchment slope/length processing tool

This tool is to calculate slope for catchcments. It will update the CatchmentFields.ModelBSlope and CatchmentFields.ModelBLength in CS MIKE1D module. It will update the CatchmentFields.SWMM_Slope and CatchmentFields.SWMM_Width in CS SWMM module.

Paramter name Description
overwrite true is to overwrite all the current slope and length field values. Flase is only set those field value which is null.
direction 0 is Downstream, 1 is Upstream.
using DHI.Amelia.Tools.CatchmentProcessing
public CmdResultInfo CatchmentTool_CalculateSlopeLength(IList<string> selectedCatchMuids, bool overwrite, double minSlope, int direction, string slopeLineLayer, string DEMRasterFile, int itemNo, eumUnit demZUnit, out List<string> warnings)
{
    var catchSlope = new CatchmentSlope(_dataTables);
    catchSlope.RuningProgress += ToolProgressHandler;
    return catchSlope.CalculateSlopeLength(selectedCatchMuids, overwrite, minSlope, direction, slopeLineLayer, DEMRasterFile, itemNo, demZUnit, out warnings);
}

Catchment spatial processing tool

Catchment spatial analysis tools allow the user to perform several GIS-processing oper­ations on various polygon and line layers available in the project. These lay­ers are either model element layers, or shapefile layers loaded into the project. Below is the API example of this tool.

Paramter name Description
TargetLayerName It can be polygon table data, or can be shapefile.
PolygonMethod There are four process methods for polygon processing. They are Clip, Eraser, Merge and Join. There are two methods for line processing. They are Buffer and ToPolygon.
using DHI.Amelia.Tools.SpatialProcessingEngine
public void CatchmentSpatialProcessing()
{
    var spParams = new SpatialProcessingParameters()
    {
        TargetLayerName = new LayerInfo() 
        {
            TableName = DbTableNames.CatchmentTable,
            IsModelLayer = true,
            IsPolygon = true,
        },
        ReferenceLayerName = new LayerInfo()
        {
            LayerName = referenceShapefile,
            Path = referenceShapefile,
            IsModelLayer = false,
            IsPolygon = true,
            Projection = shapefileProjection
        },
        PolygonMethod = SpatialPolygonMethods.Clip,
        OutPutPath = outputShapefilePath
    };
    var dataTables = CreateDataTableContainer(dbOrMuppfile);
    SpatialProcessingEngine.SpatialProcessingEngine spEngine = new SpatialProcessingEngine.SpatialProcessingEngine(dataTables);
    spEngine.SpatialProcessingRun(spParams);
}

MIKE1D analysis tool

This tool is to find elements of a river or CS network that may be contributing to instabilities during an HD simulation. The tool produces a list of h-points ranked according to one of the three following criteria, all ranked from smallest to largest:

  • Time step required to achieve a specified stability criterion
  • Flow area
  • Length

Below is the API example.

Paramter name Description
Type If it is FlowArea type, please specify FlowType and FlowValue.
NumElement It is the number of reporting points
using DHI.Amelia.Tools.AnalysisToolEngine
public (List<AnalysisToolOrder>, List<string>) MIKE1DAnalysisTool()
{
    string simulationId = string.Empty;
    var toolParams = new AnalysisToolTransferParameter()
    {
        Muid = simulationId,
        Type = AnalysisToolLocationType.TimeStep,
        TimeType = AnalysisToolWaterDepthDefinitionType.UserDefinedGlobal,
        TimeValue = 1.0,
        Courant = 0.8,
        NumElement = 10
    };
    var dataTables = CreateDataTableContainer(@"C:\Users\wuw\Documents\test.sqlite");
    Tools.AnalysisToolEngine.AnalysisToolEngine engine = new Tools.AnalysisToolEngine.AnalysisToolEngine();
    return engine.Run(toolParams, dataTables);
}

Exclude natural channels tool

This tool works for 2D overland module with river. This opens a tool which generates mesh arcs, defining polygons representing the river extent and being excluded from the mesh. When the 2D domain is defined with a rectangular grid, the tool creates polygons defining inactive areas. Please refer "Excluding rivers and nautral channel tool" in MIKE+ to get to know the detail of ExcludeNaturalChannelsParam.

using DHI.Amelia.Tools.ExcludeNaturalChannelsEngine
public string ExcludeNaturealChannels_RunEngine(ExcludeNaturalChannelsParam param)
{
    var dataTables = CreateDataTableContainer(dbOrMuppfile);
    var dataService = new AmeliaDataService() { DataTables = dataTables };
    var domainService = new AmeliaDomainService{
        DataTables = dataTables,
        DataService = dataService
    };
    domainService.Load2DDomainData(muppfile, true);
    var engine = new ExcludeNaturalChannelsEngine(_dataTables, domainService.FloodingDataContainer);
    return engine.Run(param);
}

Geocode tool

For SWMM, this tool can connect station/catchment to node/pipe based on specified rules. For CS MIKE 1D, this tool can connect station/catchment/load point to node/pipe based on specified rules. For WD Epanet, this tool can connect station/demand allocation to node/pipe based on specified rules. For DHI.Amelia.DomainServices.Interface.TransferEntity.CatchmentTool.ConnectionParameters:

Paramter name Description
geocodeType 0:Catchment; 1:LoadPoint; 2:Station; 3:DemandAllocation
netWorkType It is the network type for element
using DHI.Amelia.Tools.GeoCodeTool
public CmdResultInfo RunGeocodingEngine(ConnectionParameters param, string additionalInfo,
    CancellationToken token)
{
    var geoCoder = new GeoCodeEngine(_dataTables);
    geoCoder.RuningProgress += ToolProgressHandler;
    var maxDistance = param.ApplyMaxDistance ? param.maxDistance : -1;
    var maxDiameter = param.ApplyMaxDiameter ? param.maxDiameter : -1;

    switch (param.geocodeType)
    {
        case GeocodeType.GeocodeCatchment:
                if (_dataTables.ActiveModel == MUModelOption.CS_SWMM)
                {
                    return geoCoder.GeocodeSWMMCatchment(param.CatchmentSelection, param.netWorkType, maxDistance,
                        param.ConnectionType, maxDiameter, param.itemString, param.UserDefineValueNo, param.netWorkTypeList);
                }
                else
                {
                    return geoCoder.GeocodeM1dCatchment(param.CatchmentSelection, param.netWorkType, maxDistance,
                        param.ConnectionType, maxDiameter, param.itemString, param.UserDefineValueNo, param.netWorkTypeList);
                }

        case GeocodeType.GeocodeLoadPoint:
            return geoCoder.GeocodeLoadPoints(param.LoadPointSelection, param.netWorkType,
                maxDistance, param.ConnectionType, maxDiameter, param.itemString, param.UserDefineValueNo, param.netWorkTypeList);

        case GeocodeType.GeocodeStation:
                if(_dataTables.ActiveModel == MUModelOption.WD_EPANET)
                {
                    return geoCoder.GeocodeWDStations(param.StationSelection, param.netWorkType,
                        maxDistance, param.ConnectionType, maxDiameter, param.itemString, param.UserDefineValueNo);
                }
                else
                {
                    return geoCoder.GeocodeStations(param.StationSelection, param.netWorkType,
                        maxDistance, param.ConnectionType, maxDiameter, param.itemString, param.UserDefineValueNo);
                }
        case GeocodeType.GeocodeDemandAlloc:
            return geoCoder.GeocodeDemand(param.DemandSelection, param.JunctionSelection, param.PipesSelection,
                param.netWorkType, maxDistance, param.ConnectionType, maxDiameter,
                param.itemString, token);

        default:
            return null;
    }
}

Result difference tool

The 'Result differences' tool is designed for comparing results from different variants of hydraulic network simulations, and report any significant differ­ence of result. Please check MIKE+ manual to understand this tool. This tool is quite complex. The best way to use this tool is to use the command line. To use result difference command line, a xml configuration file is needed. MIKE+ application can help to prepare this xml file. MIKE+ manual describes how to use the this tool with a command line. A .htm report file will be generated after this tool has been executed. It also very simple to use API if a configuration file is availiable.

using DHI.Amelia.Tools.ResultDifferenceEngine
internal void RunResultDifferenceEngine()
{
    ResultComparisonEngine engine = new ResultComparisonEngine(null);
    engine.Run(_ConfigFile, _CompareID, ComparisonUnitSystem.AutoDetect);
}

if _CompareID is null, then it will compare all the item in the configuration file. ComparisonUnitSystem controls the result data under which unit. "AutoDetect" means use the unit in the result file.

Simplification tool

This tool can trim network element by giving conditions. It also can merge network and catchments. And another function of this tool is to surrogate a prismatic con­duit (e.g. a pipeline) by an orifice and a basin. There is also a command line to use this tool. MIKE+ manual describes the details of using it. Below API needs the xml configure file as the input parameters. All the parameters are configured in the xml file. Please use MIKE+ application to prepare this configuration file.

using DHI.Amelia.Tools.SimplificationEngine
Public override void RunSimplificationTool()
{
    var simpToolEngine = SimpToolBase.LoadingTool(ConfigFile, dbOrMuppfile, out List<string> errorMsgs);
    if (simpToolEngine.SimpSelection.CurSelection == null || simpToolEngine.SimpSelection.CurSelection.Count == 0)
    {
        var areOfInterest = (simpToolEngine.SimpSelection.AreaOfInterest as AreaOfInterest);
        switch ((areOfInterest.Settings as AreaOfInterestSettings).Areatype)
        {
            case AreaOfInterestOption.FLAG:
            case AreaOfInterestOption.MAP_SELECTION:
            case AreaOfInterestOption.POLYGON:
                errorMsgs.Add("Interest area type of 'FLAG', 'MAP_SELECTION' and 'POLYGON' are not supported in command line.");
                return;
        }
    }
    if (simpToolEngine.Prepare())
    {
        simpToolEngine.Execute();
    }
}

Below is the API example to merge CS pipes which doesn't need xml configuration file. The SimpSelection is the merge targets. It should include both nodes and pipes. It can be calculated by AreaOfInterest and Exclusion. It also can be defined by Ultimate directly.

using DHI.Amelia.Tools.SimplificationEngine.Core.ToolSet;
using DHI.Amelia.Tools.SimplificationEngine.Core.Parameters;
using DHI.Amelia.Tools.SimplificationEngine.Core;
public SimpReportBase CSPipeMergeTest()
{
    var dataTables = CreateDataTableContainer(dbOrMuppfile);
    var mergeSettings = new NetworkMergeSettings()
    {
        SimilarAge = false,
        SimilarPipeInvertIevel = true,
        SimilarPipeInvertLevelDif = 0.1,
        SimilarFrictionLoss = false,
        SimilarSize = false,
        SimilarSlope = false,
        SimilarSlopePercentage = false,
    };
    var reconnectSettings = new NetworkReconnectSettings()
    {
        MoveMethod = NetworkMoveMethod.MOVE_TO_DOWNSTREAM,
    };
    var tool = SimpToolBase.CreateTool(dataTables, SimpToolType.MERGING_CSNETWORK, mergeSettings, reconnectSettings);
    var context = tool.Context;
    if (tool == null) return null;

    var areaSettings = new NetworkAreaOfInterestSettings()
    {
        Areatype = AreaOfInterestOption.COMPLETE,
        UseNetworkType = true,
    };
    var areaOfInterest = new AreaOfInterest(context, areaSettings);
    var excludeSetting = new NetworkExclusionSettings()
    {
        ExclusionOptions = ExclusionOption.BASIN | ExclusionOption.OUTLETS,
    };
    var exclusion = new Exclusion(context, excludeSetting);
    var ultimateSettings = new SelectionSettings()
    {
        SelTarget = new Dictionary<string, HashSet<string>> {
            { DbTableNames.NodeTable, new HashSet<string>() { "Node_1","Node_2", "Node_3" } },
            { DbTableNames.LinkTable, new HashSet<string>() { "Link_1", "Link_2" } },},
    };
    var ultimate = new Ultimate(context, ultimateSettings);
    // Calculate target network elements by interest area and exlusion
    var simpSelection = new SimpSelections(areaOfInterest, exclusion, null);
    // Use specified selection network element
    //var simpSelection = new SimpSelections(null, null, ultimate); 
    tool.SimpSelection = simpSelection;
    if (tool.Prepare() && tool.Execute(false))
    {
        return tool.Report;
    }

    return null;
}

Below is the API example to merge catchments which doesn't need xml configuration file. The SimpSelection is the merge targets. It can be calculated by AreaOfInterest and Exclusion. It also can be defined by Ultimate directly.

using DHI.Amelia.Tools.SimplificationEngine.Core.ToolSet;
using DHI.Amelia.Tools.SimplificationEngine.Core.Parameters;
using DHI.Amelia.Tools.SimplificationEngine.Core;
public SimpReportBase CatchmentMergeTest()
{
    var dataTables = CreateDataTableContainer(dbOrMuppfile);
    var mergeSettings = new CatchmentMergeSettings()
    {
        HydrologyModel = GlobalUtility.DomainOptions.msmCatchment_HModelNo.Time_Area_A,
        MergeCatchmentClusters = false,
        NetworkType = 1, // 1:Waste water, 2:Storm water, 3:Combined, 4:Rising main, 5:Overland flow
        TASettings = new TAMergeSettings() 
        {
            MethodLoss = CatchmentMergeMethod.Maximum,
            MethodCTime = CatchmentMergeMethod.Maximum,
            MethodRFactor = CatchmentMergeMethod.Maximum,
            MethodCurve = CatchmentMergeMethod.Maximum,
            MethodCoeff = CatchmentMergeMethod.Maximum
        },
    };
    var reconnectSettings = new CatchmentReconnectSettings()
    {
        MoveMethod = CatchmentMoveMethod.MOVE_TO_NOCONNECT
    };
    var tool = SimpToolBase.CreateTool(dataTables, SimpToolType.MERGING_CATCHMENT, mergeSettings, reconnectSettings);
    var context = tool.Context;
    if (tool == null) return null;

    var areaSettings = new CatchmentAreaOfInterestSettings()
    {
        Areatype = AreaOfInterestOption.COMPLETE,
        NetworkType = 1,
        CatHModelNo = GlobalUtility.DomainOptions.msmCatchment_HModelNo.Time_Area_A
    };
    var areaOfInterest = new AreaOfInterest(context, areaSettings);
    var excludeSetting = new CatchmentExclusionSettings()
    {
        ExclusionOptions = ExclusionOption.LARGE_CATCHMENTS,
        CatchAreaThreshold = 100,
    };
    var exclusion = new Exclusion(context, excludeSetting);
    var ultimateSettings = new SelectionSettings()
    {
        SelTarget = new Dictionary<string, HashSet<string>> {
            { DbTableNames.CatchmentTable, new HashSet<string>() { "Catch_1", "Catch_2", "Catch_3" } } },
    };
    var ultimate = new Ultimate(context, ultimateSettings);
    // Calculate target network elements by interest area and exlusion
    var simpSelection = new SimpSelections(areaOfInterest, exclusion, null);
    // Use specified selection network element
    //var simpSelection = new SimpSelections(null, null, ultimate); 
    tool.SimpSelection = simpSelection;
    if (tool.Prepare() && tool.Execute(false))
    {
        return tool.Report;
    }

    return null;
}

WD Valve criticality tool

The Valve Criticality tool allows analysis of a valve from the valve layer to determine which valves need to be closed in order to replace the selected valve. Below is the API example to track critical valves.

Paramter name Description
linkDbFile This can be a shapefile, or it can be WD pipe table name (DbTableNames.WdPipeTable)
linkIDField If linkDbFile is a shapefile, this field should be specified.
valveDbFile This can be a shapefile, or it can be WD valve table name (DbTableNames.WdValveTable)
valveIDField If valveDbFile is a shapefile, this field should be specified.
connectIntersection True is to connect pipes at crossing intersections
using DHI.Amelia.Tools.ValveCriticalityEngine
public void ValveCriticalToolTest(string linkDbFile, string linkIDField, string valveDbFile, string valveIDField, double dTolerance, bool connectIntersection, string linkLayerProj = null, string valveLayerProj = null)
{
    var dataTables = CreateDataTableContainer(dbOrMuppfile);
    var criticalEngine = new CriticalityEngine(dataTables, connectIntersection);
    criticalEngine.RuningProgress += ToolProgressHandler;
    criticalEngine.TrackCriticalValve(linkDbFile, linkIDField, valveDbFile, valveIDField, dTolerance, linkLayerProj, valveLayerProj);
}

If you only want to process a specified valve, please use below method.

Paramter name Description
valveID It is the muid of the WD valve if valveDbFile is DbTableNames.WdValveTable. It is the feature id if valveDbFile is a shapefile.
criticalEngine.TrackCriticalValves(linkDbFile, valveDbFile, valveID, dTolerance, linkLayerProj, valveLayerProj);

WD distributed demands tool

This tool is used to automatically assign the demands at the appropriate junc­tion nodes. Please find the input parameters in DHI.Amelia.DomainServices.Interface.TransferEntity.DistributedDemandTool.DistributedDemandParameter. You can easily find the meaning of each parameters based on MIKE+ Distributed demand tool.

using DHI.Amelia.Tools.DistributedDemandEngine
public Task<CmdResultInfo> DistributedDemandToolTest(DistributedDemandParameter paramter,
    CancellationTokenSource cancelSource = null)
{
    if (cancelSource == null)
    {
        cancelSource = new CancellationTokenSource();
    }

    var distributeEngine = new DistributionEngine(_dataTables);
    // To calculate water demand based on pipe demand coefficents
    distributeEngine.PipeDistribution.CalWDDemand(paramter, cancelSource);
    // To calculate water demand based on node demand coefficents
    distributeEngine.NodeDistribution.CalWDDemand(paramter, cancelSource);
    // To calculate water demand based on area of input shape file data
    distributeEngine.AreaDistribution.CalWDDemand(paramter, cancelSource);
    // To calculate water demand based on land use/people of input shape file data
    distributeEngine.LandUseDistribution.CalWDDemand(paramter, cancelSource);
}

WD Zone mapping tool

Zone Mapping tool is to divide network into different "zones" in the model, based on the network topology and geometry, closed pipes, closed valves, and pumps.

using DHI.Amelia.Tools.ZoneMappingEngine
public void ZoneMappingEngineTest()
{
    var ct = CancellationTokenSource.CreateLinkedTokenSource(new CancellationToken());
    var dataTables = CreateDataTableContainer(dbOrMuppfile);
    var zoneMappingEngine = new ZoneMappingEngine.ZoneMappingEngine(dataTables);
    var zoneMappingParams = new ZoneMappingParameter()
    {
        Pump = true,
        CheckValve = true,
        ClosedLink = true,
        IsMerge = true,
        MergeZones = 10, 
        FCV = true,
        GPV = true,
        PBV = true,
        PRV = true,
        PSV = true,
        TCV = true
    };

    var task = zoneMappingEngine.ApplyZoneMapping(zoneMappingParams, ct);
    await task;
}