| | |
| | | using System.Linq; |
| | | using System.Runtime.InteropServices; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | |
| | | namespace Yw.EPAcore.Core |
| | |
| | | class HydraulicCoreBase |
| | | { |
| | | |
| | | const string DLLName = "Yw.EPAcore.Core.dll";//"epanet2.2.dll";//"epanet2.2.dll" |
| | | //{ These are codes used by the DLL functions }Yw.EPAcore.Core |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | const string DLLName = "Yw.Hydraulic.Core.dll";//"epanet2.2.dll";//"epanet2.2.dll" |
| | | //{ These are codes used by the DLL functions }Yw.EPAcore.Core |
| | | |
| | | |
| | | #region 节点 |
| | |
| | | |
| | | // 获取节点 id |
| | | [DllImport(DLLName)] |
| | | public static extern int ENgetnodeid22(int projectID, int index, StringBuilder id); |
| | | public static extern int ENgetnodeid22(int projectID, int index, StringBuilder id); |
| | | [DllImport(DLLName)] |
| | | public static extern int ENgetnodecomment22(int projectID, int index, StringBuilder id); |
| | | [DllImport(DLLName)] |
| | | public static extern int ENaddnode22(int projectID, string id, int nodeType, ref int index); |
| | | |
| | | [DllImport(DLLName)] |
| | | public static extern int ENgetcoord22(int projectID, int index,ref double x,ref double y); |
| | | public static extern int ENgetcoord22(int projectID, int index, ref double x, ref double y); |
| | | [DllImport(DLLName)] |
| | | public static extern int ENsetcoord22(int projectID, int index, double x, double y); |
| | | public static extern int ENsetcoord22(int projectID, int index, double x, double y); |
| | | |
| | | // 设置节点参数 |
| | | [DllImport(DLLName)] |
| | |
| | | public static extern int ENgetlinktype22(int projectID, int index, ref int typecode); |
| | | // 增加管线 |
| | | [DllImport(DLLName)] |
| | | public static extern int ENaddlink22(int projectID,string id, int linkType,string fromNode,string toNode,ref int index); |
| | | public static extern int ENaddlink22(int projectID, string id, int linkType, string fromNode, string toNode, ref int index); |
| | | |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #region 模式 |
| | |
| | | [DllImport(DLLName)] |
| | | public static extern int ENsetpatternvalue22(int projectID, int index, int period, float value); |
| | | |
| | | |
| | | |
| | | |
| | | public static int ENsetpatternvalue_ex(int projectID, string patternID, int period, float value) |
| | | { |
| | | int err = 0; |
| | | int patternid = 0; |
| | | err=ENgetpatternindex22(projectID, patternID, ref patternid); |
| | | err = ENgetpatternindex22(projectID, patternID, ref patternid); |
| | | if (err > 0) return err; |
| | | if (patternid==0) |
| | | if (patternid == 0) |
| | | { |
| | | err=ENaddpattern22(projectID, patternID); |
| | | err = ENaddpattern22(projectID, patternID); |
| | | if (err > 0) return err; |
| | | err = ENgetpatternindex22(projectID, patternID, ref patternid); |
| | | if (err > 0) return err; |
| | |
| | | /// <param name="patternID"></param> |
| | | /// <param name="values"></param> |
| | | /// <returns></returns> |
| | | public static int ENsetpatternvalue_ex(int projectID,int nodeindex, string patternID, double[] values) |
| | | public static int ENsetpatternvalue_ex(int projectID, int nodeindex, string patternID, double[] values) |
| | | { |
| | | int err = 0; |
| | | int patternid = 0; |
| | | err = ENgetpatternindex22(projectID, patternID, ref patternid); |
| | | |
| | | |
| | | if (err > 0 || patternid == 0) |
| | | { |
| | | err = ENaddpattern22(projectID, patternID); |
| | |
| | | |
| | | [DllImport(DLLName)] |
| | | public static extern int ENsetcurve22(int projectID, int index, float[] Xvalues, float[] Yvalues, int n); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | public static extern int ENsetstatusreport22(int projectID, int code); |
| | | // 设置选项 |
| | | [DllImport(DLLName)] |
| | | public static extern int ENgetoption22(int projectID, int code,ref float v); |
| | | public static extern int ENgetoption22(int projectID, int code, ref float v); |
| | | |
| | | |
| | | // 设置选项 |
| | | [DllImport(DLLName)] |
| | | public static extern int ENgettimeparam22(int projectID, int code,ref int v); |
| | | public static extern int ENgettimeparam22(int projectID, int code, ref int v); |
| | | // 设置水质类型 |
| | | [DllImport(DLLName)] |
| | | public static extern int ENsetqualtype22(int projectID, int qualcode, string chemname, |
| | |
| | | |
| | | ////补充 |
| | | //EN_Project p, int nodeIndex, int demandIndex, |
| | | // double* baseDemand |
| | | // double* baseDemand |
| | | //补充 |
| | | [DllImport(DLLName)] |
| | | public static extern int ENgetbasedemand22(int projectID, int nodeIndex, int demandIndex, out List<double> baseDemand); |
| | |
| | | |
| | | //补充 |
| | | [DllImport(DLLName)] |
| | | public static extern int ENgetTotalDemand22(int projectID, int p,out double value); |
| | | public static extern int ENgetTotalDemand22(int projectID, int p, out double value); |
| | | |
| | | |
| | | //int DLLEXPORT EN_getTotalDemand(EN_Project pr, int p, double *value) |
| | | //int DLLEXPORT EN_getTotalDemand(EN_Project pr, int p, double *value) |
| | | // |
| | | } |
| | | |