Floating pt. args in thread-safe API changed to doubles (Issue #365)

This commit is contained in:
Lew Rossman
2019-01-09 15:14:10 -05:00
parent 15bc01253b
commit dd376692ad
15 changed files with 2498 additions and 1999 deletions

View File

@@ -5,7 +5,7 @@ Attribute VB_Name = "Module1"
'Declarations of functions in the EPANET PROGRAMMERs TOOLKIT 'Declarations of functions in the EPANET PROGRAMMERs TOOLKIT
'(EPANET2.DLL) '(EPANET2.DLL)
'Last updated on 01/01/2019 'Last updated on 01/08/2019
' These are codes used by the DLL functions ' These are codes used by the DLL functions
Public Const EN_ELEVATION = 0 ' Node parameters Public Const EN_ELEVATION = 0 ' Node parameters
@@ -222,136 +222,136 @@ Public Const EN_R_IS_ACTIVE = 3
'System Functions 'System Functions
Declare Function ENgetversion Lib "epanet2.dll" (value As Long) As Long Declare Function ENgetversion Lib "epanet2.dll" (value As Long) As Long
Declare Function ENepanet Lib "epanet2.dll" (ByVal F1 As String, ByVal F2 As String, ByVal F3 As String, ByVal F4 As Any) As Long Declare Function ENepanet Lib "epanet2.dll" (ByVal inpFile As String, ByVal rptFile As String, ByVal outFile As String, ByVal pviewprog As Any) As Long
Declare Function ENinit Lib "epanet2.dll" (ByVal rptFile As String, ByVal binOutFile As String, ByVal UnitsType As Long, ByVal HeadlossFormula As Long) As Long Declare Function ENinit Lib "epanet2.dll" (ByVal rptFile As String, ByVal outFile As String, ByVal unitsType As Long, ByVal headlossType As Long) As Long
Declare Function ENopen Lib "epanet2.dll" (ByVal F1 As String, ByVal F2 As String, ByVal F3 As String) As Long Declare Function ENopen Lib "epanet2.dll" (ByVal inpFile As String, ByVal rptFile As String, ByVal outFile As String) As Long
Declare Function ENsaveinpfile Lib "epanet2.dll" (ByVal F As String) As Long Declare Function ENsaveinpfile Lib "epanet2.dll" (ByVal filename As String) As Long
Declare Function ENclose Lib "epanet2.dll" () As Long Declare Function ENclose Lib "epanet2.dll" () As Long
'Hydraulic Analysis Functions 'Hydraulic Analysis Functions
Declare Function ENsolveH Lib "epanet2.dll" () As Long Declare Function ENsolveH Lib "epanet2.dll" () As Long
Declare Function ENsaveH Lib "epanet2.dll" () As Long Declare Function ENsaveH Lib "epanet2.dll" () As Long
Declare Function ENopenH Lib "epanet2.dll" () As Long Declare Function ENopenH Lib "epanet2.dll" () As Long
Declare Function ENinitH Lib "epanet2.dll" (ByVal SaveFlag As Long) As Long Declare Function ENinitH Lib "epanet2.dll" (ByVal initFlag As Long) As Long
Declare Function ENrunH Lib "epanet2.dll" (T As Long) As Long Declare Function ENrunH Lib "epanet2.dll" (currentTime As Long) As Long
Declare Function ENnextH Lib "epanet2.dll" (Tstep As Long) As Long Declare Function ENnextH Lib "epanet2.dll" (tStep As Long) As Long
Declare Function ENcloseH Lib "epanet2.dll" () As Long Declare Function ENcloseH Lib "epanet2.dll" () As Long
Declare Function ENsavehydfile Lib "epanet2.dll" (ByVal F As String) As Long Declare Function ENsavehydfile Lib "epanet2.dll" (ByVal filename As String) As Long
Declare Function ENusehydfile Lib "epanet2.dll" (ByVal F As String) As Long Declare Function ENusehydfile Lib "epanet2.dll" (ByVal filename As String) As Long
'Water Quality Analysis Functions 'Water Quality Analysis Functions
Declare Function ENsolveQ Lib "epanet2.dll" () As Long Declare Function ENsolveQ Lib "epanet2.dll" () As Long
Declare Function ENopenQ Lib "epanet2.dll" () As Long Declare Function ENopenQ Lib "epanet2.dll" () As Long
Declare Function ENinitQ Lib "epanet2.dll" (ByVal SaveFlag As Long) As Long Declare Function ENinitQ Lib "epanet2.dll" (ByVal saveFlag As Long) As Long
Declare Function ENrunQ Lib "epanet2.dll" (T As Long) As Long Declare Function ENrunQ Lib "epanet2.dll" (currentTime As Long) As Long
Declare Function ENnextQ Lib "epanet2.dll" (Tstep As Long) As Long Declare Function ENnextQ Lib "epanet2.dll" (tStep As Long) As Long
Declare Function ENstepQ Lib "epanet2.dll" (Tleft As Long) As Long Declare Function ENstepQ Lib "epanet2.dll" (timeLeft As Long) As Long
Declare Function ENcloseQ Lib "epanet2.dll" () As Long Declare Function ENcloseQ Lib "epanet2.dll" () As Long
'Reporting Functions 'Reporting Functions
Declare Function ENwriteline Lib "epanet2.dll" (ByVal S As String) As Long Declare Function ENwriteline Lib "epanet2.dll" (ByVal line As String) As Long
Declare Function ENreport Lib "epanet2.dll" () As Long Declare Function ENreport Lib "epanet2.dll" () As Long
Declare Function ENresetreport Lib "epanet2.dll" () As Long Declare Function ENresetreport Lib "epanet2.dll" () As Long
Declare Function ENsetreport Lib "epanet2.dll" (ByVal S As String) As Long Declare Function ENsetreport Lib "epanet2.dll" (ByVal format As String) As Long
Declare Function ENsetstatusreport Lib "epanet2.dll" (ByVal code As Long) As Long Declare Function ENsetstatusreport Lib "epanet2.dll" (ByVal level As Long) As Long
Declare Function ENgetcount Lib "epanet2.dll" (ByVal code As Long, value As Long) As Long Declare Function ENgetcount Lib "epanet2.dll" (ByVal object As Long, count As Long) As Long
Declare Function ENgeterror Lib "epanet2.dll" (ByVal ErrCode As Long, ByVal ErrMsg As String, ByVal N As Long) As Long Declare Function ENgeterror Lib "epanet2.dll" (ByVal errcode As Long, ByVal errmsg As String, ByVal maxLen As Long) As Long
Declare Function ENgetstatistic Lib "epanet2.dll" (ByVal code As Long, ByRef value As Single) As Long Declare Function ENgetstatistic Lib "epanet2.dll" (ByVal type As Long, ByRef value As Single) As Long
'Analysis Options Functions 'Analysis Options Functions
Declare Function ENgetoption Lib "epanet2.dll" (ByVal code As Long, value As Single) As Long Declare Function ENgetoption Lib "epanet2.dll" (ByVal option As Long, value As Single) As Long
Declare Function ENsetoption Lib "epanet2.dll" (ByVal code As Long, ByVal value As Single) As Long Declare Function ENsetoption Lib "epanet2.dll" (ByVal option As Long, ByVal value As Single) As Long
Declare Function ENgetflowunits Lib "epanet2.dll" (code As Long) As Long Declare Function ENgetflowunits Lib "epanet2.dll" (units As Long) As Long
Declare Function ENsetflowunits Lib "epanet2.dll" (ByVal code As Long) As Long Declare Function ENsetflowunits Lib "epanet2.dll" (ByVal units As Long) As Long
Declare Function ENgettimeparam Lib "epanet2.dll" (ByVal code As Long, value As Long) As Long Declare Function ENgettimeparam Lib "epanet2.dll" (ByVal param As Long, value As Long) As Long
Declare Function ENsettimeparam Lib "epanet2.dll" (ByVal code As Long, ByVal value As Long) As Long Declare Function ENsettimeparam Lib "epanet2.dll" (ByVal param As Long, ByVal value As Long) As Long
Declare Function ENgetqualtype Lib "epanet2.dll" (QualCode As Long, TraceNode As Long) As Long Declare Function ENgetqualinfo Lib "epanet2.dll" (qualType As Long, ByVal chemName As String, ByVal chemUnits As String, traceNode As Long) As Long
Declare Function ENgetqualinfo Lib "epanet2.dll" (QualCode As Long, ByVal ChemName As String, ByVal ChemUnits As String, TraceNode As Long) As Long Declare Function ENgetqualtype Lib "epanet2.dll" (qualType As Long, traceNode As Long) As Long
Declare Function ENsetqualtype Lib "epanet2.dll" (ByVal QualCode As Long, ByVal ChemName As String, ByVal ChemUnits As String, ByVal TraceNode As String) As Long Declare Function ENsetqualtype Lib "epanet2.dll" (ByVal qualType As Long, ByVal chemName As String, ByVal chemUnits As String, ByVal traceNode As String) As Long
'Basic Node Functions 'Node Functions
Declare Function ENaddnode Lib "epanet2.dll" (ByVal id As String, ByVal nodeType As Long) As Long Declare Function ENaddnode Lib "epanet2.dll" (ByVal id As String, ByVal nodeType As Long) As Long
Declare Function ENdeletenode Lib "epanet2.dll" (ByVal linkIndex As Long, ByVal actionCode As Long) As Long Declare Function ENdeletenode Lib "epanet2.dll" (ByVal index As Long, ByVal actionCode As Long) As Long
Declare Function ENgetnodeindex Lib "epanet2.dll" (ByVal id As String, index As Long) As Long Declare Function ENgetnodeindex Lib "epanet2.dll" (ByVal id As String, index As Long) As Long
Declare Function ENgetnodeid Lib "epanet2.dll" (ByVal index As Long, ByVal id As String) As Long Declare Function ENgetnodeid Lib "epanet2.dll" (ByVal index As Long, ByVal id As String) As Long
Declare Function ENsetnodeid Lib "epanet2.dll" (ByVal index As Long, ByVal newid As String) As Long Declare Function ENsetnodeid Lib "epanet2.dll" (ByVal index As Long, ByVal newid As String) As Long
Declare Function ENgetnodetype Lib "epanet2.dll" (ByVal index As Long, code As Long) As Long Declare Function ENgetnodetype Lib "epanet2.dll" (ByVal index As Long, nodeType As Long) As Long
Declare Function ENgetnodevalue Lib "epanet2.dll" (ByVal index As Long, ByVal code As Long, value As Single) As Long Declare Function ENgetnodevalue Lib "epanet2.dll" (ByVal index As Long, ByVal property As Long, value As Single) As Long
Declare Function ENsetnodevalue Lib "epanet2.dll" (ByVal index As Long, ByVal code As Long, ByVal value As Single) As Long Declare Function ENsetnodevalue Lib "epanet2.dll" (ByVal index As Long, ByVal property As Long, ByVal value As Single) As Long
Declare Function ENsetjuncdata Lib "epanet2.dll" (ByVal index As Long, ByVal elev As Single, ByVal dmnd As Single, ByVal dmndpat As String) As Long Declare Function ENsetjuncdata Lib "epanet2.dll" (ByVal index As Long, ByVal elev As Single, ByVal dmnd As Single, ByVal dmndpat As String) As Long
Declare Function ENsettankdata Lib "epanet2.dll" (ByVal index As Long, ByVal elev As Single, ByVal initlvl As Single, ByVal minlvl As Single, ByVal maxlvl As Single, ByVal diam As Single, ByVal minvol As Single, ByVal volcurve As String) As Long Declare Function ENsettankdata Lib "epanet2.dll" (ByVal index As Long, ByVal elev As Single, ByVal initlvl As Single, ByVal minlvl As Single, ByVal maxlvl As Single, ByVal diam As Single, ByVal minvol As Single, ByVal volcurve As String) As Long
Declare Function ENgetcoord Lib "epanet2.dll" (ByVal index As Long, X As Single, Y As Single) As Long Declare Function ENgetcoord Lib "epanet2.dll" (ByVal index As Long, x As Single, y As Single) As Long
Declare Function ENsetcoord Lib "epanet2.dll" (ByVal index As Long, ByVal X As Single, ByVal Y As Single) As Long Declare Function ENsetcoord Lib "epanet2.dll" (ByVal index As Long, ByVal x As Single, ByVal y As Single) As Long
'Nodal Demand Functions 'Nodal Demand Functions
Declare Function ENgetdemandmodel Lib "epanet2.dll" (mtype As Long, pmin As Single, preq As Single, pexp As Single) As Long Declare Function ENgetdemandmodel Lib "epanet2.dll" (type As Long, pmin As Single, preq As Single, pexp As Single) As Long
Declare Function ENsetdemandmodel Lib "epanet2.dll" (ByVal mtype As Long, ByVal pmin As Single, ByVal preq As Single, ByVal pexp As Single) As Long Declare Function ENsetdemandmodel Lib "epanet2.dll" (ByVal type As Long, ByVal pmin As Single, ByVal preq As Single, ByVal pexp As Single) As Long
Declare Function ENgetnumdemands Lib "epanet2.dll" (ByVal index As Long, numDemands As Long) As Long Declare Function ENgetnumdemands Lib "epanet2.dll" (ByVal nodeIndex As Long, numDemands As Long) As Long
Declare Function ENgetbasedemand Lib "epanet2.dll" (ByVal index As Long, ByVal DemandIndex As Long, value As Single) As Long Declare Function ENgetbasedemand Lib "epanet2.dll" (ByVal nodeIndex As Long, ByVal demandIndex As Long, value As Single) As Long
Declare Function ENsetbasedemand Lib "epanet2.dll" (ByVal index As Long, ByVal DemandIndex As Long, ByVal BaseDemand As Single) As Long Declare Function ENsetbasedemand Lib "epanet2.dll" (ByVal nodeIndex As Long, ByVal demandIndex As Long, ByVal BaseDemand As Single) As Long
Declare Function ENgetdemandpattern Lib "epanet2.dll" (ByVal index As Long, ByVal DemandIndex As Long, PatIndex As Long) As Long Declare Function ENgetdemandpattern Lib "epanet2.dll" (ByVal nodeIndex As Long, ByVal demandIndex As Long, patIndex As Long) As Long
Declare Function ENsetdemandpattern Lib "epanet2.dll" (ByVal index As Long, ByVal DemandIndex As Long, ByVal PatIndex As Long) As Long Declare Function ENsetdemandpattern Lib "epanet2.dll" (ByVal nodeIndex As Long, ByVal demandIndex As Long, ByVal patIndex As Long) As Long
Declare Function ENgetdemandname Lib "epanet2.dll" (ByVal index As Long, ByVal DemandIndex As Long, ByVal demandName As String) As Long Declare Function ENgetdemandname Lib "epanet2.dll" (ByVal nodeIndex As Long, ByVal demandIndex As Long, ByVal demandName As String) As Long
Declare Function ENsetdemandname Lib "epanet2.dll" (ByVal nodeIndex As Long, ByVal DemandIndex As Long, ByVal demandName As String) As Long Declare Function ENsetdemandname Lib "epanet2.dll" (ByVal nodeIndex As Long, ByVal demandIndex As Long, ByVal demandName As String) As Long
'Basic Link Functions 'Link Functions
Declare Function ENaddlink Lib "epanet2.dll" (ByVal id As String, ByVal linkType As Long, ByVal fromNode As String, ByVal toNode As String) As Long Declare Function ENaddlink Lib "epanet2.dll" (ByVal id As String, ByVal linkType As Long, ByVal fromNode As String, ByVal toNode As String) As Long
Declare Function ENdeletelink Lib "epanet2.dll" (ByVal linkIndex As Long, ByVal actionCode As Long) As Long Declare Function ENdeletelink Lib "epanet2.dll" (ByVal index As Long, ByVal actionCode As Long) As Long
Declare Function ENgetlinkindex Lib "epanet2.dll" (ByVal id As String, index As Long) As Long Declare Function ENgetlinkindex Lib "epanet2.dll" (ByVal id As String, index As Long) As Long
Declare Function ENgetlinkid Lib "epanet2.dll" (ByVal index As Long, ByVal id As String) As Long Declare Function ENgetlinkid Lib "epanet2.dll" (ByVal index As Long, ByVal id As String) As Long
Declare Function ENsetlinkid Lib "epanet2.dll" (ByVal index As Long, ByVal newid As String) As Long Declare Function ENsetlinkid Lib "epanet2.dll" (ByVal index As Long, ByVal newid As String) As Long
Declare Function ENgetlinktype Lib "epanet2.dll" (ByVal index As Long, code As Long) As Long Declare Function ENgetlinktype Lib "epanet2.dll" (ByVal index As Long, linkType As Long) As Long
Declare Function ENsetlinktype Lib "epanet2.dll" (index As Long, ByVal code As Long) As Long Declare Function ENsetlinktype Lib "epanet2.dll" (index As Long, ByVal linkType As Long, ByVal actionCode As Long) As Long
Declare Function ENgetlinknodes Lib "epanet2.dll" (ByVal index As Long, node1 As Long, node2 As Long) As Long Declare Function ENgetlinknodes Lib "epanet2.dll" (ByVal index As Long, node1 As Long, node2 As Long) As Long
Declare Function ENsetlinknodes Lib "epanet2.dll" (ByVal index As Long, ByVal node1 As Long, ByVal node2 As Long) As Long Declare Function ENsetlinknodes Lib "epanet2.dll" (ByVal index As Long, ByVal node1 As Long, ByVal node2 As Long) As Long
Declare Function ENgetlinkvalue Lib "epanet2.dll" (ByVal index As Long, ByVal code As Long, value As Single) As Long Declare Function ENgetlinkvalue Lib "epanet2.dll" (ByVal index As Long, ByVal property As Long, value As Single) As Long
Declare Function ENsetlinkvalue Lib "epanet2.dll" (ByVal index As Long, ByVal code As Long, ByVal value As Single) As Long Declare Function ENsetlinkvalue Lib "epanet2.dll" (ByVal index As Long, ByVal property As Long, ByVal value As Single) As Long
Declare Function ENsetpipedata Lib "epanet2.dll" (ByVal index As Long, ByVal length As Single, ByVal diam As Single, ByVal rough As Single, ByVal mloss As Single) As Long Declare Function ENsetpipedata Lib "epanet2.dll" (ByVal index As Long, ByVal length As Single, ByVal diam As Single, ByVal rough As Single, ByVal mloss As Single) As Long
'Pump Functions 'Pump Functions
Declare Function ENgetheadcurveindex Lib "epanet2.dll" (ByVal pumpIndex As Long, curveIndex As Long) As Long Declare Function ENgetheadcurveindex Lib "epanet2.dll" (ByVal linkIndex As Long, curveIndex As Long) As Long
Declare Function ENsetheadcurveindex Lib "epanet2.dll" (ByVal pumpIndex As Long, ByVal curveIndex As Long) As Long Declare Function ENsetheadcurveindex Lib "epanet2.dll" (ByVal linkIndex As Long, ByVal curveIndex As Long) As Long
Declare Function ENgetpumptype Lib "epanet2.dll" (ByVal index As Long, PumpType As Long) As Long Declare Function ENgetpumptype Lib "epanet2.dll" (ByVal linkIndex As Long, pumpType As Long) As Long
'Time Pattern Functions 'Time Pattern Functions
Declare Function ENaddpattern Lib "epanet2.dll" (ByVal id As String) As Long Declare Function ENaddpattern Lib "epanet2.dll" (ByVal id As String) As Long
Declare Function ENgetpatternindex Lib "epanet2.dll" (ByVal id As String, index As Long) As Long Declare Function ENgetpatternindex Lib "epanet2.dll" (ByVal id As String, index As Long) As Long
Declare Function ENgetpatternid Lib "epanet2.dll" (ByVal index As Long, ByVal id As String) As Long Declare Function ENgetpatternid Lib "epanet2.dll" (ByVal index As Long, ByVal id As String) As Long
Declare Function ENgetpatternlen Lib "epanet2.dll" (ByVal index As Long, L As Long) As Long Declare Function ENgetpatternlen Lib "epanet2.dll" (ByVal index As Long, len As Long) As Long
Declare Function ENgetpatternvalue Lib "epanet2.dll" (ByVal index As Long, ByVal Period As Long, value As Single) As Long Declare Function ENgetpatternvalue Lib "epanet2.dll" (ByVal index As Long, ByVal period As Long, value As Single) As Long
Declare Function ENsetpatternvalue Lib "epanet2.dll" (ByVal index As Long, ByVal Period As Long, ByVal value As Single) As Long Declare Function ENsetpatternvalue Lib "epanet2.dll" (ByVal index As Long, ByVal period As Long, ByVal value As Single) As Long
Declare Function ENgetaveragepatternvalue Lib "epanet2.dll" (ByVal index As Long, value As Single) As Long Declare Function ENgetaveragepatternvalue Lib "epanet2.dll" (ByVal index As Long, value As Single) As Long
Declare Function ENsetpattern Lib "epanet2.dll" (ByVal index As Long, F As Any, ByVal N As Long) As Long Declare Function ENsetpattern Lib "epanet2.dll" (ByVal index As Long, values As Any, ByVal len As Long) As Long
'Data Curve Functions 'Data Curve Functions
Declare Function ENaddcurve Lib "epanet2.dll" (ByVal id As String) As Long Declare Function ENaddcurve Lib "epanet2.dll" (ByVal id As String) As Long
Declare Function ENgetcurveindex Lib "epanet2.dll" (ByVal id As String, index As Long) As Long Declare Function ENgetcurveindex Lib "epanet2.dll" (ByVal id As String, index As Long) As Long
Declare Function ENgetcurveid Lib "epanet2.dll" (ByVal index As Long, ByVal id As String) As Long Declare Function ENgetcurveid Lib "epanet2.dll" (ByVal index As Long, ByVal id As String) As Long
Declare Function ENgetcurvelen Lib "epanet2.dll" (ByVal index As Long, L As Long) As Long Declare Function ENgetcurvelen Lib "epanet2.dll" (ByVal index As Long, len As Long) As Long
Declare Function ENgetcurvetype Lib "epanet2.dll" (ByVal curveIndex As Long, CurveType As Long) As Long Declare Function ENgetcurvetype Lib "epanet2.dll" (ByVal index As Long, type As Long) As Long
Declare Function ENgetcurvevalue Lib "epanet2.dll" (ByVal index As Long, ByVal Ptn As Long, X As Single, Y As Single) As Long Declare Function ENgetcurvevalue Lib "epanet2.dll" (ByVal curveIndex As Long, ByVal pointIndex As Long, x As Single, y As Single) As Long
Declare Function ENsetcurvevalue Lib "epanet2.dll" (ByVal index As Long, ByVal Ptn As Long, ByVal X As Single, ByVal Y As Single) As Long Declare Function ENsetcurvevalue Lib "epanet2.dll" (ByVal curveIndex As Long, ByVal pointIndex As Long, ByVal x As Single, ByVal y As Single) As Long
Declare Function ENgetcurve Lib "epanet2.dll" (ByVal curveIndex As Long, ByVal CurveID As String, nValues As Long, xValues As Any, yValues As Any) As Long Declare Function ENgetcurve Lib "epanet2.dll" (ByVal index As Long, ByVal id As String, nPoints As Long, xValues As Any, yValues As Any) As Long
Declare Function ENsetcurve Lib "epanet2.dll" (ByVal index As Long, X As Any, Y As Any, ByVal N As Long) As Long Declare Function ENsetcurve Lib "epanet2.dll" (ByVal index As Long, xValues As Any, yValues As Any, ByVal nPoints As Long) As Long
'Simple Control Functions 'Simple Control Functions
Declare Function ENaddcontrol Lib "epanet2.dll" (Cindex As Long, ByVal Ctype As Long, ByVal Lindex As Long, ByVal setting As Single, ByVal Nindex As Long, ByVal Level As Single) As Long Declare Function ENaddcontrol Lib "epanet2.dll" (ByVal type As Long, ByVal linkIndex As Long, ByVal setting As Single, ByVal nodeIndex As Long, ByVal level As Single, index As Long) As Long
Declare Function ENdeletecontrol Lib "epanet2.dll" (ByVal Cindex As Long) As Long Declare Function ENdeletecontrol Lib "epanet2.dll" (ByVal index As Long) As Long
Declare Function ENgetcontrol Lib "epanet2.dll" (ByVal Cindex As Long, Ctype As Long, Lindex As Long, setting As Single, Nindex As Long, Level As Single) As Long Declare Function ENgetcontrol Lib "epanet2.dll" (ByVal index As Long, type As Long, linkIndex As Long, setting As Single, nodeIndex As Long, level As Single) As Long
Declare Function ENsetcontrol Lib "epanet2.dll" (ByVal Cindex As Long, ByVal Ctype As Long, ByVal Lindex As Long, ByVal setting As Single, ByVal Nindex As Long, ByVal Level As Single) As Long Declare Function ENsetcontrol Lib "epanet2.dll" (ByVal index As Long, ByVal type As Long, ByVal linkIndex As Long, ByVal setting As Single, ByVal nodeIndex As Long, ByVal level As Single) As Long
'Rue-Based Control Functions 'Rule-Based Control Functions
Declare Function ENaddrule Lib "epanet2.dll" (ByVal rule As String) As Long Declare Function ENaddrule Lib "epanet2.dll" (ByVal rule As String) As Long
Declare Function ENdeleterule Lib "epanet2.dll" (ByVal index As Long) As Long Declare Function ENdeleterule Lib "epanet2.dll" (ByVal index As Long) As Long
Declare Function ENgetrule Lib "epanet2.dll" (ByVal index As Long, nPremises As Long, nTrueActions As Long, nFalseActions As Long, priority As Single) As Long Declare Function ENgetrule Lib "epanet2.dll" (ByVal index As Long, nPremises As Long, nThenActions As Long, nElseActions As Long, priority As Single) As Long
Declare Function ENgetruleID Lib "epanet2.dll" (ByVal indexRule As Long, ByVal id As String) As Long Declare Function ENgetruleID Lib "epanet2.dll" (ByVal index As Long, ByVal id As String) As Long
Declare Function ENsetrulepriority Lib "epanet2.dll" (ByVal index As Long, ByVal priority As Single) As Long Declare Function ENsetrulepriority Lib "epanet2.dll" (ByVal index As Long, ByVal priority As Single) As Long
Declare Function ENgetpremise Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexPremise As Long, logop As Long, object As Long, indexObj As Long, variable As Long, relop As Long, status As Long, value As Single) As Long Declare Function ENgetpremise Lib "epanet2.dll" (ByVal ruleIndex As Long, ByVal premiseIndex As Long, logop As Long, object As Long, objIndex As Long, variable As Long, relop As Long, status As Long, value As Single) As Long
Declare Function ENsetpremise Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexPremise As Long, ByVal logop As Long, ByVal object As Long, ByVal indexObj As Long, ByVal variable As Long, ByVal relop As Long, ByVal status As Long, ByVal value As Single) As Long Declare Function ENsetpremise Lib "epanet2.dll" (ByVal ruleIndex As Long, ByVal premiseIndex As Long, ByVal logop As Long, ByVal object As Long, ByVal objIndex As Long, ByVal variable As Long, ByVal relop As Long, ByVal status As Long, ByVal value As Single) As Long
Declare Function ENsetpremiseindex Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexPremise As Long, ByVal indexObj As Long) As Long Declare Function ENsetpremiseindex Lib "epanet2.dll" (ByVal ruleIndex As Long, ByVal premiseIndex As Long, ByVal objIndex As Long) As Long
Declare Function ENsetpremisestatus Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexPremise As Long, ByVal status As Long) As Long Declare Function ENsetpremisestatus Lib "epanet2.dll" (ByVal ruleIndex As Long, ByVal premiseIndex As Long, ByVal status As Long) As Long
Declare Function ENsetpremisevalue Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexPremise As Long, ByVal value As Single) As Long Declare Function ENsetpremisevalue Lib "epanet2.dll" (ByVal ruleIndex As Long, ByVal premiseIndex As Long, ByVal value As Single) As Long
Declare Function ENgetthenaction Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexAction As Long, indexLink As Long, status As Long, setting As Single) As Long Declare Function ENgetthenaction Lib "epanet2.dll" (ByVal ruleIndex As Long, ByVal actionIndex As Long, linkIndex As Long, status As Long, setting As Single) As Long
Declare Function ENsetthenaction Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexAction As Long, ByVal indexLink As Long, ByVal status As Long, ByVal setting As Single) As Long Declare Function ENsetthenaction Lib "epanet2.dll" (ByVal ruleIndex As Long, ByVal actionIndex As Long, ByVal linkIndex As Long, ByVal status As Long, ByVal setting As Single) As Long
Declare Function ENgetelseaction Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexAction As Long, indexLink As Long, status As Long, setting As Single) As Long Declare Function ENgetelseaction Lib "epanet2.dll" (ByVal ruleIndex As Long, ByVal actionIndex As Long, linkIndex As Long, status As Long, setting As Single) As Long
Declare Function ENsetelseaction Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexAction As Long, ByVal indexLink As Long, ByVal status As Long, ByVal setting As Single) As Long Declare Function ENsetelseaction Lib "epanet2.dll" (ByVal ruleIndex As Long, ByVal actionIndex As Long, ByVal linkIndex As Long, ByVal status As Long, ByVal setting As Single) As Long

File diff suppressed because it is too large Load Diff

View File

@@ -4,7 +4,7 @@
'Declarations of functions in the EPANET PROGRAMMERs TOOLKIT 'Declarations of functions in the EPANET PROGRAMMERs TOOLKIT
'(EPANET2.DLL) for use with VB.Net. '(EPANET2.DLL) for use with VB.Net.
'Last updated on 01/01/2019 'Last updated on 01/08/2019
Imports System.Runtime.InteropServices Imports System.Runtime.InteropServices
Imports System.Text Imports System.Text
@@ -226,139 +226,139 @@ Public Const EN_R_IS_ACTIVE = 3
'These are the external functions that comprise the DLL 'These are the external functions that comprise the DLL
'System Functions 'System Functions
Declare Function ENgetversion Lib "epanet2.dll" (ByRef Value As Int32) As Int32 Declare Function ENgetversion Lib "epanet2.dll" (value As Int32) As Int32
Declare Function ENepanet Lib "epanet2.dll" (ByVal F1 As String, ByVal F2 As String, ByVal F3 As String, ByVal F4 As String) As Int32 Declare Function ENepanet Lib "epanet2.dll" (ByVal inpFile As String, ByVal rptFile As String, ByVal outFile As String, ByVal pviewprog As Any) As Int32
Declare Function ENinit Lib "epanet2.dll" (ByVal rptFile As String, ByVal binOutFile As String, ByVal UnitsType As Int32, ByVal HeadlossFormula As Int32) As Int32 Declare Function ENinit Lib "epanet2.dll" (ByVal rptFile As String, ByVal outFile As String, ByVal unitsType As Int32, ByVal headlossType As Int32) As Int32
Declare Function ENopen Lib "epanet2.dll" (ByVal F1 As String, ByVal F2 As String, ByVal F3 As String) As Int32 Declare Function ENopen Lib "epanet2.dll" (ByVal inpFile As String, ByVal rptFile As String, ByVal outFile As String) As Int32
Declare Function ENsaveinpfile Lib "epanet2.dll" (ByVal F As String) As Int32 Declare Function ENsaveinpfile Lib "epanet2.dll" (ByVal filename As String) As Int32
Declare Function ENclose Lib "epanet2.dll" () As Int32 Declare Function ENclose Lib "epanet2.dll" () As Int32
'Hydraulic Analysis Functions 'Hydraulic Analysis Functions
Declare Function ENsolveH Lib "epanet2.dll" () As Int32 Declare Function ENsolveH Lib "epanet2.dll" () As Int32
Declare Function ENsaveH Lib "epanet2.dll" () As Int32 Declare Function ENsaveH Lib "epanet2.dll" () As Int32
Declare Function ENopenH Lib "epanet2.dll" () As Int32 Declare Function ENopenH Lib "epanet2.dll" () As Int32
Declare Function ENinitH Lib "epanet2.dll" (ByVal SaveFlag As Int32) As Int32 Declare Function ENinitH Lib "epanet2.dll" (ByVal initFlag As Int32) As Int32
Declare Function ENrunH Lib "epanet2.dll" (ByRef T As Int32) As Int32 Declare Function ENrunH Lib "epanet2.dll" (currentTime As Int32) As Int32
Declare Function ENnextH Lib "epanet2.dll" (ByRef Tstep As Int32) As Int32 Declare Function ENnextH Lib "epanet2.dll" (tStep As Int32) As Int32
Declare Function ENcloseH Lib "epanet2.dll" () As Int32 Declare Function ENcloseH Lib "epanet2.dll" () As Int32
Declare Function ENsavehydfile Lib "epanet2.dll" (ByVal F As String) As Int32 Declare Function ENsavehydfile Lib "epanet2.dll" (ByVal filename As String) As Int32
Declare Function ENusehydfile Lib "epanet2.dll" (ByVal F As String) As Int32 Declare Function ENusehydfile Lib "epanet2.dll" (ByVal filename As String) As Int32
'Water Quality Analysis Functions 'Water Quality Analysis Functions
Declare Function ENsolveQ Lib "epanet2.dll" () As Int32 Declare Function ENsolveQ Lib "epanet2.dll" () As Int32
Declare Function ENopenQ Lib "epanet2.dll" () As Int32 Declare Function ENopenQ Lib "epanet2.dll" () As Int32
Declare Function ENinitQ Lib "epanet2.dll" (ByVal SaveFlag As Int32) As Int32 Declare Function ENinitQ Lib "epanet2.dll" (ByVal saveFlag As Int32) As Int32
Declare Function ENrunQ Lib "epanet2.dll" (ByRef T As Int32) As Int32 Declare Function ENrunQ Lib "epanet2.dll" (currentTime As Int32) As Int32
Declare Function ENnextQ Lib "epanet2.dll" (ByRef Tstep As Int32) As Int32 Declare Function ENnextQ Lib "epanet2.dll" (tStep As Int32) As Int32
Declare Function ENstepQ Lib "epanet2.dll" (ByRef Tleft As Int32) As Int32 Declare Function ENstepQ Lib "epanet2.dll" (timeLeft As Int32) As Int32
Declare Function ENcloseQ Lib "epanet2.dll" () As Int32 Declare Function ENcloseQ Lib "epanet2.dll" () As Int32
'Reporting Functions 'Reporting Functions
Declare Function ENwriteline Lib "epanet2.dll" (ByVal S As String) As Int32 Declare Function ENwriteline Lib "epanet2.dll" (ByVal line As String) As Int32
Declare Function ENreport Lib "epanet2.dll" () As Int32 Declare Function ENreport Lib "epanet2.dll" () As Int32
Declare Function ENresetreport Lib "epanet2.dll" () As Int32 Declare Function ENresetreport Lib "epanet2.dll" () As Int32
Declare Function ENsetreport Lib "epanet2.dll" (ByVal S As String) As Int32 Declare Function ENsetreport Lib "epanet2.dll" (ByVal format As String) As Int32
Declare Function ENsetstatusreport Lib "epanet2.dll" (ByVal Code As Int32) As Int32 Declare Function ENsetstatusreport Lib "epanet2.dll" (ByVal level As Int32) As Int32
Declare Function ENgetcount Lib "epanet2.dll" (ByVal Code As Int32, ByRef Value As Int32) As Int32 Declare Function ENgetcount Lib "epanet2.dll" (ByVal object As Int32, count As Int32) As Int32
Declare Function ENgeterror Lib "epanet2.dll" (ByVal ErrCode As Int32, ByVal ErrMsg As StringBuilder, ByVal N As Int32) As Int32 Declare Function ENgeterror Lib "epanet2.dll" (ByVal errcode As Int32, ByVal errmsg As String, ByVal maxLen As Int32) As Int32
Declare Function ENgetstatistic Lib "epanet2.dll" (ByVal code As Int32, ByRef value As Single) As Int32 Declare Function ENgetstatistic Lib "epanet2.dll" (ByVal type As Int32, ByRef value As Single) As Int32
'Analysis Options Functions 'Analysis Options Functions
Declare Function ENgetoption Lib "epanet2.dll" (ByVal Code As Int32, ByRef Value As Single) As Int32 Declare Function ENgetoption Lib "epanet2.dll" (ByVal option As Int32, value As Single) As Int32
Declare Function ENsetoption Lib "epanet2.dll" (ByVal Code As Int32, ByVal Value As Single) As Int32 Declare Function ENsetoption Lib "epanet2.dll" (ByVal option As Int32, ByVal value As Single) As Int32
Declare Function ENgetflowunits Lib "epanet2.dll" (ByRef Code As Int32) As Int32 Declare Function ENgetflowunits Lib "epanet2.dll" (units As Int32) As Int32
Declare Function ENsetflowunits Lib "epanet2.dll" (ByVal code As Int32) As Int32 Declare Function ENsetflowunits Lib "epanet2.dll" (ByVal units As Int32) As Int32
Declare Function ENgettimeparam Lib "epanet2.dll" (ByVal Code As Int32, ByRef Value As Int32) As Int32 Declare Function ENgettimeparam Lib "epanet2.dll" (ByVal param As Int32, value As Int32) As Int32
Declare Function ENsettimeparam Lib "epanet2.dll" (ByVal Code As Int32, ByVal Value As Int32) As Int32 Declare Function ENsettimeparam Lib "epanet2.dll" (ByVal param As Int32, ByVal value As Int32) As Int32
Declare Function ENgetqualtype Lib "epanet2.dll" (ByRef QualCode As Int32, ByRef TraceNode As Int32) As Int32 Declare Function ENgetqualinfo Lib "epanet2.dll" (qualType As Int32, ByVal chemName As String, ByVal chemUnits As String, traceNode As Int32) As Int32
Declare Function ENgetqualinfo Lib "epanet2.dll" (ByRef QualCode As Int32, ByVal ChemName As String, ByVal ChemUnits As String, ByRef TraceNode As Int32) As Int32 Declare Function ENgetqualtype Lib "epanet2.dll" (qualType As Int32, traceNode As Int32) As Int32
Declare Function ENsetqualtype Lib "epanet2.dll" (ByVal QualCode As Int32, ByVal ChemName As String, ByVal ChemUnits As String, ByVal TraceNode As String) As Int32 Declare Function ENsetqualtype Lib "epanet2.dll" (ByVal qualType As Int32, ByVal chemName As String, ByVal chemUnits As String, ByVal traceNode As String) As Int32
'Basic Node Functions 'Node Functions
Declare Function ENaddnode Lib "epanet2.dll" (ByVal id As String, ByVal nodeType As Int32) As Int32 Declare Function ENaddnode Lib "epanet2.dll" (ByVal id As String, ByVal nodeType As Int32) As Int32
Declare Function ENdeletenode Lib "epanet2.dll" (ByVal linkIndex As Long) As Long Declare Function ENdeletenode Lib "epanet2.dll" (ByVal index As Int32, ByVal actionCode As Int32) As Int32
Declare Function ENgetnodeindex Lib "epanet2.dll" (ByVal ID As String, ByRef Index As Int32) As Int32 Declare Function ENgetnodeindex Lib "epanet2.dll" (ByVal id As String, index As Int32) As Int32
Declare Function ENgetnodeid Lib "epanet2.dll" (ByVal Index As Int32, ByVal ID As StringBuilder) As Int32 Declare Function ENgetnodeid Lib "epanet2.dll" (ByVal index As Int32, ByVal id As String) As Int32
Declare Function ENsetnodeid Lib "epanet2.dll" (ByVal index As Int32, ByVal newid As String) As Int32 Declare Function ENsetnodeid Lib "epanet2.dll" (ByVal index As Int32, ByVal newid As String) As Int32
Declare Function ENgetnodetype Lib "epanet2.dll" (ByVal Index As Int32, ByRef Code As Int32) As Int32 Declare Function ENgetnodetype Lib "epanet2.dll" (ByVal index As Int32, nodeType As Int32) As Int32
Declare Function ENgetnodevalue Lib "epanet2.dll" (ByVal Index As Int32, ByVal Code As Int32, ByRef Value As Single) As Int32 Declare Function ENgetnodevalue Lib "epanet2.dll" (ByVal index As Int32, ByVal property As Int32, value As Single) As Int32
Declare Function ENsetnodevalue Lib "epanet2.dll" (ByVal Index As Int32, ByVal Code As Int32, ByVal Value As Single) As Int32 Declare Function ENsetnodevalue Lib "epanet2.dll" (ByVal index As Int32, ByVal property As Int32, ByVal value As Single) As Int32
Declare Function ENsetjuncdata Lib "epanet2.dll" (ByVal index As Int32, ByVal elev As Single, ByVal dmnd As Single, ByVal dmndpat As String) As Int32 Declare Function ENsetjuncdata Lib "epanet2.dll" (ByVal index As Int32, ByVal elev As Single, ByVal dmnd As Single, ByVal dmndpat As String) As Int32
Declare Function ENsettankdata Lib "epanet2.dll" (ByVal index As Int32, ByVal elev As Single, ByVal initlvl As Single, ByVal minlvl As Single, ByVal maxlvl As Single, ByVal diam As Single, ByVal minvol As Single, ByVal volcurve As String) As Int32 Declare Function ENsettankdata Lib "epanet2.dll" (ByVal index As Int32, ByVal elev As Single, ByVal initlvl As Single, ByVal minlvl As Single, ByVal maxlvl As Single, ByVal diam As Single, ByVal minvol As Single, ByVal volcurve As String) As Int32
Declare Function ENgetcoord Lib "epanet2.dll" (ByVal Index As Int32, ByRef X As Single, ByRef Y As Single) As Int32 Declare Function ENgetcoord Lib "epanet2.dll" (ByVal index As Int32, x As Single, y As Single) As Int32
Declare Function ENsetcoord Lib "epanet2.dll" (ByVal Index As Int32, ByVal X As Single, ByVal Y As Single) As Int32 Declare Function ENsetcoord Lib "epanet2.dll" (ByVal index As Int32, ByVal x As Single, ByVal y As Single) As Int32
'Nodal Demand Functions 'Nodal Demand Functions
Declare Function ENgetdemandmodel Lib "epanet2.dll" (ByRef mtype As Int32, ByRef pmin As Single, ByRef preq As Single, ByRef pexp As Single) As Int32 Declare Function ENgetdemandmodel Lib "epanet2.dll" (type As Int32, pmin As Single, preq As Single, pexp As Single) As Int32
Declare Function ENsetdemandmodel Lib "epanet2.dll" (ByVal mtype As Int32, ByVal pmin As Single, ByVal preq As Single, ByVal pexp As Single) As Int32 Declare Function ENsetdemandmodel Lib "epanet2.dll" (ByVal type As Int32, ByVal pmin As Single, ByVal preq As Single, ByVal pexp As Single) As Int32
Declare Function ENgetnumdemands Lib "epanet2.dll" (ByVal Index As Int32, ByRef numDemands As Int32) As Int32 'ES Declare Function ENgetnumdemands Lib "epanet2.dll" (ByVal nodeIndex As Int32, numDemands As Int32) As Int32
Declare Function ENgetbasedemand Lib "epanet2.dll" (ByVal Index As Int32, ByVal DemandIndex As Int32, ByRef BaseDemand As Single) As Int32 'ES Declare Function ENgetbasedemand Lib "epanet2.dll" (ByVal nodeIndex As Int32, ByVal demandIndex As Int32, value As Single) As Int32
Declare Function ENsetbasedemand Lib "epanet2.dll" (ByVal Index As Int32, ByVal DemandIndex As Int32, ByVal BaseDemand As Single) As Int32 'ES Declare Function ENsetbasedemand Lib "epanet2.dll" (ByVal nodeIndex As Int32, ByVal demandIndex As Int32, ByVal BaseDemand As Single) As Int32
Declare Function ENgetdemandpattern Lib "epanet2.dll" (ByVal Index As Int32, ByVal DemandIndex As Int32, ByRef PatIndex As Int32) As Int32 'ES Declare Function ENgetdemandpattern Lib "epanet2.dll" (ByVal nodeIndex As Int32, ByVal demandIndex As Int32, patIndex As Int32) As Int32
Declare Function ENsetdemandpattern Lib "epanet2.dll" (ByVal index As Int32, ByVal DemandIndex As Int32, ByVal PatIndex As Int32) As Int32 Declare Function ENsetdemandpattern Lib "epanet2.dll" (ByVal nodeIndex As Int32, ByVal demandIndex As Int32, ByVal patIndex As Int32) As Int32
Declare Function ENgetdemandname Lib "epanet2.dll" (ByVal index As Int32, ByVal DemandIndex As Int32, ByVal demandName As String) As Int32 Declare Function ENgetdemandname Lib "epanet2.dll" (ByVal nodeIndex As Int32, ByVal demandIndex As Int32, ByVal demandName As String) As Int32
Declare Function ENsetdemandname Lib "epanet2.dll" (ByVal nodeIndex As Int32, ByVal DemandIndex As Int32, ByVal demandName As String) As Int32 Declare Function ENsetdemandname Lib "epanet2.dll" (ByVal nodeIndex As Int32, ByVal demandIndex As Int32, ByVal demandName As String) As Int32
'Basic Link Functions 'Link Functions
Declare Function ENaddlink Lib "epanet2.dll" (ByVal id As String, ByVal linkType As Int32, ByVal fromNode As String, ByVal toNode As String) As Int32 Declare Function ENaddlink Lib "epanet2.dll" (ByVal id As String, ByVal linkType As Int32, ByVal fromNode As String, ByVal toNode As String) As Int32
Declare Function ENdeletelink Lib "epanet2.dll" (ByVal nodeIndex As Long) As Long Declare Function ENdeletelink Lib "epanet2.dll" (ByVal index As Int32, ByVal actionCode As Int32) As Int32
Declare Function ENgetlinkindex Lib "epanet2.dll" (ByVal ID As String, ByRef Index As Int32) As Int32 Declare Function ENgetlinkindex Lib "epanet2.dll" (ByVal id As String, index As Int32) As Int32
Declare Function ENgetlinkid Lib "epanet2.dll" (ByVal Index As Int32, ByVal ID As StringBuilder) As Int32 Declare Function ENgetlinkid Lib "epanet2.dll" (ByVal index As Int32, ByVal id As String) As Int32
Declare Function ENsetlinkid Lib "epanet2.dll" (ByVal index As Int32, ByVal newid As String) As Int32 Declare Function ENsetlinkid Lib "epanet2.dll" (ByVal index As Int32, ByVal newid As String) As Int32
Declare Function ENgetlinktype Lib "epanet2.dll" (ByVal Index As Int32, ByRef Code As Int32) As Int32 Declare Function ENgetlinktype Lib "epanet2.dll" (ByVal index As Int32, linkType As Int32) As Int32
Declare Function ENsetlinktype Lib "epanet2.dll" (ByRef index As Int32, ByVal code As Int32) As Int32 Declare Function ENsetlinktype Lib "epanet2.dll" (index As Int32, ByVal linkType As Int32, ByVal actionCode As Int32) As Int32
Declare Function ENgetlinknodes Lib "epanet2.dll" (ByVal Index As Int32, ByRef Node1 As Int32, ByRef Node2 As Int32) As Int32 Declare Function ENgetlinknodes Lib "epanet2.dll" (ByVal index As Int32, node1 As Int32, node2 As Int32) As Int32
Declare Function ENsetlinknodes Lib "epanet2.dll" (ByVal index As Int32, ByVal node1 As Int32, ByVal node2 As Int32) As Int32 Declare Function ENsetlinknodes Lib "epanet2.dll" (ByVal index As Int32, ByVal node1 As Int32, ByVal node2 As Int32) As Int32
Declare Function ENgetlinkvalue Lib "epanet2.dll" (ByVal Index As Int32, ByVal Code As Int32, ByRef Value As Single) As Int32 Declare Function ENgetlinkvalue Lib "epanet2.dll" (ByVal index As Int32, ByVal property As Int32, value As Single) As Int32
Declare Function ENsetlinkvalue Lib "epanet2.dll" (ByVal Index As Int32, ByVal Code As Int32, ByVal Value As Single) As Int32 Declare Function ENsetlinkvalue Lib "epanet2.dll" (ByVal index As Int32, ByVal property As Int32, ByVal value As Single) As Int32
Declare Function ENsetpipedata Lib "epanet2.dll" (ByVal index As Int32, ByVal length As Single, ByVal diam As Single, ByVal rough As Single, ByVal mloss As Single) As Int32 Declare Function ENsetpipedata Lib "epanet2.dll" (ByVal index As Int32, ByVal length As Single, ByVal diam As Single, ByVal rough As Single, ByVal mloss As Single) As Int32
'Pump Functions 'Pump Functions
Declare Function ENgetheadcurveindex Lib "epanet2.dll" (ByVal Index As Int32, ByVal CurveIndex As int32) As Int32 'ES Declare Function ENgetheadcurveindex Lib "epanet2.dll" (ByVal linkIndex As Int32, curveIndex As Int32) As Int32
Declare Function ENsetheadcurveindex Lib "epanet2.dll" (ByVal pumpIndex As Int32, ByVal curveIndex As Int32) As Int32 Declare Function ENsetheadcurveindex Lib "epanet2.dll" (ByVal linkIndex As Int32, ByVal curveIndex As Int32) As Int32
Declare Function ENgetpumptype Lib "epanet2.dll" (ByVal Index As Int32, ByRef PumpType As Int32) As Int32 'ES Declare Function ENgetpumptype Lib "epanet2.dll" (ByVal linkIndex As Int32, pumpType As Int32) As Int32
'Time Pattern Functions 'Time Pattern Functions
Declare Function ENaddpattern Lib "epanet2.dll" (ByVal ID As String) As Int32 Declare Function ENaddpattern Lib "epanet2.dll" (ByVal id As String) As Int32
Declare Function ENgetpatternindex Lib "epanet2.dll" (ByVal ID As String, ByRef Index As Int32) As Int32 Declare Function ENgetpatternindex Lib "epanet2.dll" (ByVal id As String, index As Int32) As Int32
Declare Function ENgetpatternid Lib "epanet2.dll" (ByVal Index As Int32, ByVal ID As StringBuilder) As Int32 Declare Function ENgetpatternid Lib "epanet2.dll" (ByVal index As Int32, ByVal id As String) As Int32
Declare Function ENgetpatternlen Lib "epanet2.dll" (ByVal Index As Int32, ByRef L As Int32) As Int32 Declare Function ENgetpatternlen Lib "epanet2.dll" (ByVal index As Int32, len As Int32) As Int32
Declare Function ENgetpatternvalue Lib "epanet2.dll" (ByVal Index As Int32, ByVal Period As Int32, ByRef Value As Single) As Int32 Declare Function ENgetpatternvalue Lib "epanet2.dll" (ByVal index As Int32, ByVal period As Int32, value As Single) As Int32
Declare Function ENsetpatternvalue Lib "epanet2.dll" (ByVal Index As Int32, ByVal Period As Int32, ByVal Value As Single) As Int32 Declare Function ENsetpatternvalue Lib "epanet2.dll" (ByVal index As Int32, ByVal period As Int32, ByVal value As Single) As Int32
Declare Function ENgetaveragepatternvalue Lib "epanet2.dll" (ByVal index As Int32, ByRef value As Single) As Int32 Declare Function ENgetaveragepatternvalue Lib "epanet2.dll" (ByVal index As Int32, value As Single) As Int32
Declare Function ENsetpattern Lib "epanet2.dll" (ByVal Index as Int32, ByRef F as Single, ByVal N as Int32) as Int32 Declare Function ENsetpattern Lib "epanet2.dll" (ByVal index As Int32, values As Any, ByVal len As Int32) As Int32
'Data Curve Functions 'Data Curve Functions
Declare Function ENaddcurve Lib "epanet2.dll" (ByVal ID As String) As Int32 Declare Function ENaddcurve Lib "epanet2.dll" (ByVal id As String) As Int32
Declare Function ENgetcurveindex Lib "epanet2.dll" (ByVal ID As String, ByRef Index As Int32) As Int32 Declare Function ENgetcurveindex Lib "epanet2.dll" (ByVal id As String, index As Int32) As Int32
Declare Function ENgetcurveid Lib "epanet2.dll" (ByVal Index As Int32, ByVal ID As StringBuilder) As Int32 Declare Function ENgetcurveid Lib "epanet2.dll" (ByVal index As Int32, ByVal id As String) As Int32
Declare Function ENgetcurvelen Lib "epanet2.dll" (ByVal Index As Int32, ByRef L As Int32) As Int32 Declare Function ENgetcurvelen Lib "epanet2.dll" (ByVal index As Int32, len As Int32) As Int32
Declare Function ENgetcurvetype Lib "epanet2.dll" (ByVal curveIndex As Int32, ByRef CurveType As Int32) As Int32 Declare Function ENgetcurvetype Lib "epanet2.dll" (ByVal index As Int32, type As Int32) As Int32
Declare Function ENgetcurvevalue Lib "epanet2.dll" (ByVal Index As Int32, ByVal Pnt As Int32, ByRef X As Single, ByRef Y As Single) As Int32 Declare Function ENgetcurvevalue Lib "epanet2.dll" (ByVal curveIndex As Int32, ByVal pointIndex As Int32, x As Single, y As Single) As Int32
Declare Function ENsetcurvevalue Lib "epanet2.dll" (ByVal Index As Int32, ByVal Pnt As Int32, ByVal X As Single, ByVal Y As Single) As Int32 Declare Function ENsetcurvevalue Lib "epanet2.dll" (ByVal curveIndex As Int32, ByVal pointIndex As Int32, ByVal x As Single, ByVal y As Single) As Int32
Declare Function ENgetcurve Lib "epanet2.dll" (ByVal CurveIndex As Int32, ByRef nValues As Int32, ByRef xValues As Single, ByRef yValues As Single) As Int32 'ES Declare Function ENgetcurve Lib "epanet2.dll" (ByVal index As Int32, ByVal id As String, nPoints As Int32, xValues As Any, yValues As Any) As Int32
Declare Function ENsetcurve Lib "epanet2.dll" (ByVal Index as Int32, ByRef X as Single, ByRef Y as Single, ByVal N as Int32) as Int32 Declare Function ENsetcurve Lib "epanet2.dll" (ByVal index As Int32, xValues As Any, yValues As Any, ByVal nPoints As Int32) As Int32
'Simple Control Functions 'Simple Control Functions
Declare Function ENaddcontrol Lib "epanet2.dll" (ByRef Cindex As Int32, ByVal Ctype As Int32, ByVal Lindex As Int32, ByVal setting As Single, ByVal Nindex As Int32, ByVal Level As Single) As Int32 Declare Function ENaddcontrol Lib "epanet2.dll" (ByVal type As Int32, ByVal linkIndex As Int32, ByVal setting As Single, ByVal nodeIndex As Int32, ByVal level As Single, index As Int32) As Int32
Declare Function ENdeletecontrol Lib "epanet2.dll" (ByVal Cindex as Int32) As Int32 Declare Function ENdeletecontrol Lib "epanet2.dll" (ByVal index As Int32) As Int32
Declare Function ENgetcontrol Lib "epanet2.dll" (ByVal Cindex As Int32, ByRef CtlType As Int32, ByRef Lindex As Int32, ByRef Setting As Single, ByRef Nindex As Int32, ByRef Level As Single) As Int32 Declare Function ENgetcontrol Lib "epanet2.dll" (ByVal index As Int32, type As Int32, linkIndex As Int32, setting As Single, nodeIndex As Int32, level As Single) As Int32
Declare Function ENsetcontrol Lib "epanet2.dll" (ByVal Cindex As Int32, ByVal CtlType As Int32, ByVal Lindex As Int32, ByVal Setting As Single, ByVal Nindex As Int32, ByVal Level As Single) As Int32 Declare Function ENsetcontrol Lib "epanet2.dll" (ByVal index As Int32, ByVal type As Int32, ByVal linkIndex As Int32, ByVal setting As Single, ByVal nodeIndex As Int32, ByVal level As Single) As Int32
'Rule-Based Control Functions 'Rule-Based Control Functions
Declare Function ENaddrule Lib "epanet2.dll" (ByVal rule As String) as Int32 Declare Function ENaddrule Lib "epanet2.dll" (ByVal rule As String) As Int32
Declare Function ENdeleterule Lib "epanet2.dll" (ByVal index As Int32) As Int32 Declare Function ENdeleterule Lib "epanet2.dll" (ByVal index As Int32) As Int32
Declare Function ENgetrule Lib "epanet2.dll" (ByVal index As Int32, ByRef nPremises As Int32, ByRef nTrueActions As Int32, ByRef nFalseActions As Int32, ByRef priority As Single) As Int32 Declare Function ENgetrule Lib "epanet2.dll" (ByVal index As Int32, nPremises As Int32, nThenActions As Int32, nElseActions As Int32, priority As Single) As Int32
Declare Function ENgetruleID Lib "epanet2.dll" (ByVal indexRule As Int32, ByVal id As StringBuilder) As Int32 Declare Function ENgetruleID Lib "epanet2.dll" (ByVal index As Int32, ByVal id As String) As Int32
Declare Function ENsetrulepriority Lib "epanet2.dll" (ByVal index As Int32, ByVal priority As Single) As Int32 Declare Function ENsetrulepriority Lib "epanet2.dll" (ByVal index As Int32, ByVal priority As Single) As Int32
Declare Function ENgetpremise Lib "epanet2.dll" (ByVal indexRule As Int32, ByVal indexPremise As Int32, ByRef logop As Int32, ByRef object As Int32, ByRef indexObj As Int32, ByRef variable As Int32, ByRef relop As Int32, ByRef status As Int32, ByRef value As Single) As Int32 Declare Function ENgetpremise Lib "epanet2.dll" (ByVal ruleIndex As Int32, ByVal premiseIndex As Int32, logop As Int32, object As Int32, objIndex As Int32, variable As Int32, relop As Int32, status As Int32, value As Single) As Int32
Declare Function ENsetpremise Lib "epanet2.dll" (ByVal indexRule As Int32, ByVal indexPremise As Int32, ByVal logop As Int32, ByVal object As Int32, ByVal indexObj As Int32, ByVal variable As Int32, ByVal relop As Int32, ByVal status As Int32, ByVal value As Single) As Int32 Declare Function ENsetpremise Lib "epanet2.dll" (ByVal ruleIndex As Int32, ByVal premiseIndex As Int32, ByVal logop As Int32, ByVal object As Int32, ByVal objIndex As Int32, ByVal variable As Int32, ByVal relop As Int32, ByVal status As Int32, ByVal value As Single) As Int32
Declare Function ENsetpremiseindex Lib "epanet2.dll" (ByVal indexRule As Int32, ByVal indexPremise As Int32, ByVal indexObj As Int32) As Int32 Declare Function ENsetpremiseindex Lib "epanet2.dll" (ByVal ruleIndex As Int32, ByVal premiseIndex As Int32, ByVal objIndex As Int32) As Int32
Declare Function ENsetpremisestatus Lib "epanet2.dll" (ByVal indexRule As Int32, ByVal indexPremise As Int32, ByVal status As Int32) As Int32 Declare Function ENsetpremisestatus Lib "epanet2.dll" (ByVal ruleIndex As Int32, ByVal premiseIndex As Int32, ByVal status As Int32) As Int32
Declare Function ENsetpremisevalue Lib "epanet2.dll" (ByVal indexRule As Int32, ByVal indexPremise As Int32, ByVal value As Single) As Int32 Declare Function ENsetpremisevalue Lib "epanet2.dll" (ByVal ruleIndex As Int32, ByVal premiseIndex As Int32, ByVal value As Single) As Int32
Declare Function ENgetthenaction Lib "epanet2.dll" (ByVal indexRule As Int32, ByVal indexAction As Int32, ByRef indexLink As Int32, ByRef status As Int32, ByRef setting As Single) As Int32 Declare Function ENgetthenaction Lib "epanet2.dll" (ByVal ruleIndex As Int32, ByVal actionIndex As Int32, linkIndex As Int32, status As Int32, setting As Single) As Int32
Declare Function ENsetthenaction Lib "epanet2.dll" (ByVal indexRule As Int32, ByVal indexAction As Int32, ByVal indexLink As Int32, ByVal status As Int32, ByVal setting As Single) As Int32 Declare Function ENsetthenaction Lib "epanet2.dll" (ByVal ruleIndex As Int32, ByVal actionIndex As Int32, ByVal linkIndex As Int32, ByVal status As Int32, ByVal setting As Single) As Int32
Declare Function ENgetelseaction Lib "epanet2.dll" (ByVal indexRule As Int32, ByVal indexAction As Int32, ByRef indexLink As Int32, ByRef status As Int32, ByRef setting As Single) As Int32 Declare Function ENgetelseaction Lib "epanet2.dll" (ByVal ruleIndex As Int32, ByVal actionIndex As Int32, linkIndex As Int32, status As Int32, setting As Single) As Int32
Declare Function ENsetelseaction Lib "epanet2.dll" (ByVal indexRule As Int32, ByVal indexAction As Int32, ByVal indexLink As Int32, ByVal status As Int32, ByVal setting As Single) As Int32 Declare Function ENsetelseaction Lib "epanet2.dll" (ByVal ruleIndex As Int32, ByVal actionIndex As Int32, ByVal linkIndex As Int32, ByVal status As Int32, ByVal setting As Single) As Int32
End Module End Module

File diff suppressed because it is too large Load Diff

View File

@@ -1,13 +1,15 @@
/** @file epanet2_enums.h
*/
/* /*
****************************************************************************** ******************************************************************************
Project: OWA EPANET Project: OWA EPANET
Version: 2.2 Version: 2.2
Module: epanet2_enums.h Module: epanet2_enums.h
Description: enums shared between API versions Description: enumerations of symbolic constants used by the API
Authors: see AUTHORS Authors: see AUTHORS
Copyright: see AUTHORS Copyright: see AUTHORS
License: see LICENSE License: see LICENSE
Last Updated: 01/01/2019 Last Updated: 01/08/2019
****************************************************************************** ******************************************************************************
*/ */
@@ -31,12 +33,12 @@ typedef enum {
EN_SOURCEQUAL = 5, //!< Quality source strength EN_SOURCEQUAL = 5, //!< Quality source strength
EN_SOURCEPAT = 6, //!< Quality source pattern EN_SOURCEPAT = 6, //!< Quality source pattern
EN_SOURCETYPE = 7, //!< Qualiy source type EN_SOURCETYPE = 7, //!< Qualiy source type
EN_TANKLEVEL = 8, //!< Tank water level EN_TANKLEVEL = 8, //!< Current computed tank water level
EN_DEMAND = 9, //!< Current simulated demand EN_DEMAND = 9, //!< Current computed demand
EN_HEAD = 10, //!< Current hydraulic head EN_HEAD = 10, //!< Current computed hydraulic head
EN_PRESSURE = 11, //!< Current pressure EN_PRESSURE = 11, //!< Current computed pressure
EN_QUALITY = 12, //!< Current quality EN_QUALITY = 12, //!< Current computed quality
EN_SOURCEMASS = 13, //!< Current source mass inflow EN_SOURCEMASS = 13, //!< Current computed quality source mass inflow
EN_INITVOLUME = 14, //!< Tank initial volume EN_INITVOLUME = 14, //!< Tank initial volume
EN_MIXMODEL = 15, //!< Tank mixing model EN_MIXMODEL = 15, //!< Tank mixing model
EN_MIXZONEVOL = 16, //!< Tank mixing zone volume EN_MIXZONEVOL = 16, //!< Tank mixing zone volume
@@ -47,74 +49,74 @@ typedef enum {
EN_MAXLEVEL = 21, //!< Tank maximum level EN_MAXLEVEL = 21, //!< Tank maximum level
EN_MIXFRACTION = 22, //!< Tank mixing fraction EN_MIXFRACTION = 22, //!< Tank mixing fraction
EN_TANK_KBULK = 23, //!< Tank bulk decay coefficient EN_TANK_KBULK = 23, //!< Tank bulk decay coefficient
EN_TANKVOLUME = 24, //!< Tank current volume EN_TANKVOLUME = 24, //!< Current computed tank volume
EN_MAXVOLUME = 25 //!< Tank maximum volume EN_MAXVOLUME = 25 //!< Tank maximum volume
} EN_NodeProperty; } EN_NodeProperty;
/// Link property codes /// Link property codes
typedef enum { typedef enum {
EN_DIAMETER = 0, //!< Pipe/valve diameter EN_DIAMETER = 0, //!< Pipe/valve diameter
EN_LENGTH = 1, //!> Pipe length EN_LENGTH = 1, //!< Pipe length
EN_ROUGHNESS = 2, //!> Pipe roughness coefficient EN_ROUGHNESS = 2, //!< Pipe roughness coefficient
EN_MINORLOSS = 3, //!> Pipe/valve minor loss coefficient EN_MINORLOSS = 3, //!< Pipe/valve minor loss coefficient
EN_INITSTATUS = 4, //!> Initial status (e.g., OPEN/CLOSED) EN_INITSTATUS = 4, //!< Initial status (e.g., OPEN/CLOSED)
EN_INITSETTING = 5, //!> Initial pump speed or valve setting EN_INITSETTING = 5, //!< Initial pump speed or valve setting
EN_KBULK = 6, //!> Bulk chemical reaction coefficient EN_KBULK = 6, //!< Bulk chemical reaction coefficient
EN_KWALL = 7, //!> Pipe wall chemical reaction coefficient EN_KWALL = 7, //!< Pipe wall chemical reaction coefficient
EN_FLOW = 8, //!> Current link flow rate EN_FLOW = 8, //!< Current computed flow rate
EN_VELOCITY = 9, //!> Current link flow velocity EN_VELOCITY = 9, //!< Current computed flow velocity
EN_HEADLOSS = 10, //!> Current head loss across link EN_HEADLOSS = 10, //!< Current computed head loss
EN_STATUS = 11, //!> Current link status EN_STATUS = 11, //!< Current link status
EN_SETTING = 12, //!> Current link setting EN_SETTING = 12, //!< Current link setting
EN_ENERGY = 13, //!> Current pump energy usage EN_ENERGY = 13, //!< Current computed pump energy usage
EN_LINKQUAL = 14, //!> Current link quality EN_LINKQUAL = 14, //!< Current computed link quality
EN_LINKPATTERN = 15, //!> Pump speed time pattern EN_LINKPATTERN = 15, //!< Pump speed time pattern
EN_PUMP_STATE = 16, //!> Current pump status EN_PUMP_STATE = 16, //!< Current computed pump state
EN_PUMP_EFFIC = 17, //!> Current pump efficiency EN_PUMP_EFFIC = 17, //!< Current computed pump efficiency
EN_PUMP_POWER = 18, //!> Pump constant power rating EN_PUMP_POWER = 18, //!< Pump constant power rating
EN_PUMP_HCURVE = 19, //!> Pump head v. flow curve EN_PUMP_HCURVE = 19, //!< Pump head v. flow curve
EN_PUMP_ECURVE = 20, //!> Pump efficiency v. flow curve EN_PUMP_ECURVE = 20, //!< Pump efficiency v. flow curve
EN_PUMP_ECOST = 21, //!> Pump average energy price EN_PUMP_ECOST = 21, //!< Pump average energy price
EN_PUMP_EPAT = 22 //!> Pump energy price time pattern EN_PUMP_EPAT = 22 //!< Pump energy price time pattern
} EN_LinkProperty; } EN_LinkProperty;
/// Time parameter codes /// Time parameter codes (all in seconds)
typedef enum { typedef enum {
EN_DURATION = 0, //!> Total simulation duration EN_DURATION = 0, //!< Total simulation duration
EN_HYDSTEP = 1, //!> Hydraulic time step EN_HYDSTEP = 1, //!< Hydraulic time step
EN_QUALSTEP = 2, //!> Water quality time step EN_QUALSTEP = 2, //!< Water quality time step
EN_PATTERNSTEP = 3, //!> Time pattern period EN_PATTERNSTEP = 3, //!< Time pattern period
EN_PATTERNSTART = 4, //!> Time when time patterns begin EN_PATTERNSTART = 4, //!< Time when time patterns begin
EN_REPORTSTEP = 5, //!> Reporting time step EN_REPORTSTEP = 5, //!< Reporting time step
EN_REPORTSTART = 6, //!> Time when reporting starts EN_REPORTSTART = 6, //!< Time when reporting starts
EN_RULESTEP = 7, //!> Rule evaluation time step EN_RULESTEP = 7, //!< Rule evaluation time step
EN_STATISTIC = 8, //!> Reporting statistic code EN_STATISTIC = 8, //!< Reporting statistic code
EN_PERIODS = 9, //!> Number of reporting time periods EN_PERIODS = 9, //!< Number of reporting time periods
EN_STARTTIME = 10, //!> Simulation starting time of day EN_STARTTIME = 10, //!< Simulation starting time of day
EN_HTIME = 11, //!> Elapsed time of current hydraulic solution EN_HTIME = 11, //!< Elapsed time of current hydraulic solution
EN_QTIME = 12, //!> Elapsed time of current quality solution EN_QTIME = 12, //!< Elapsed time of current quality solution
EN_HALTFLAG = 13, //!> Flag indicating if simulation halted EN_HALTFLAG = 13, //!< Flag indicating if the simulation was halted
EN_NEXTEVENT = 14, //!> Next time until a tank becomes empty or full EN_NEXTEVENT = 14, //!< Next time until a tank becomes empty or full
EN_NEXTEVENTIDX = 15 //!> Index of next tank that becomes empty or full EN_NEXTEVENTIDX = 15 //!< Index of next tank that becomes empty or full
} EN_TimeProperty; } EN_TimeProperty;
/// Analysis statistic codes /// Statistics for the most current hydraulic/quality analysis made
typedef enum { typedef enum {
EN_ITERATIONS = 0, //!< Number of hydraulic iterations EN_ITERATIONS = 0, //!< Number of hydraulic iterations taken
EN_RELATIVEERROR = 1, //!< Sum of all flow changes / total flow EN_RELATIVEERROR = 1, //!< Sum of link flow changes / sum of link flows
EN_MAXHEADERROR = 2, //!< Largest head loss error for links EN_MAXHEADERROR = 2, //!< Largest head loss error for links
EN_MAXFLOWCHANGE = 3, //!< Largest flow change in links EN_MAXFLOWCHANGE = 3, //!< Largest flow change in links
EN_MASSBALANCE = 4 //!< Water quality mass balance ratio EN_MASSBALANCE = 4 //!< Cumulative water quality mass balance ratio
} EN_AnalysisStatistic; } EN_AnalysisStatistic;
/// Object count codes /// Object count codes
typedef enum { typedef enum {
EN_NODECOUNT = 0, //!< Number of nodes (Juntions + Tanks + Reservoirs) EN_NODECOUNT = 0, //!< Number of nodes (junctions + tanks + reservoirs)
EN_TANKCOUNT = 1, //!< Number of tanks and Reservoirs EN_TANKCOUNT = 1, //!< Number of tanks and reservoirs
EN_LINKCOUNT = 2, //!< Number of links (Pipes + Pumps + Valves) EN_LINKCOUNT = 2, //!< Number of links (pipes + pumps + valves)
EN_PATCOUNT = 3, //!< Number of time patterns EN_PATCOUNT = 3, //!< Number of time patterns
EN_CURVECOUNT = 4, //!< Number of curves EN_CURVECOUNT = 4, //!< Number of data curves
EN_CONTROLCOUNT = 5, //!< Number of simple controls EN_CONTROLCOUNT = 5, //!< Number of simple controls
EN_RULECOUNT = 6 //!< Number of rule-based controls EN_RULECOUNT = 6 //!< Number of rule-based controls
} EN_CountType; } EN_CountType;
@@ -164,16 +166,16 @@ typedef enum {
/// Flow units types /// Flow units types
typedef enum { typedef enum {
EN_CFS = 0, EN_CFS = 0, //!< Cubic feet per second
EN_GPM = 1, EN_GPM = 1, //!< Gallons per minute
EN_MGD = 2, EN_MGD = 2, //!< Million gallons per day
EN_IMGD = 3, EN_IMGD = 3, //!< Imperial million gallons per day
EN_AFD = 4, EN_AFD = 4, //!< Acre-feet per day
EN_LPS = 5, EN_LPS = 5, //!< Liters per second
EN_LPM = 6, EN_LPM = 6, //!< Liters per minute
EN_MLD = 7, EN_MLD = 7, //!< Million liters per day
EN_CMH = 8, EN_CMH = 8, //!< Cubic meters per hour
EN_CMD = 9 EN_CMD = 9 //!< Cubic meters per day
} EN_FlowUnits; } EN_FlowUnits;
/// Demand model types /// Demand model types
@@ -184,35 +186,35 @@ typedef enum {
/// Simulation option codes /// Simulation option codes
typedef enum { typedef enum {
EN_TRIALS = 0, //!> Maximum hydraulic trials allowed EN_TRIALS = 0, //!< Maximum hydraulic trials allowed
EN_ACCURACY = 1, //!> Hydraulic convergence accuracy EN_ACCURACY = 1, //!< Hydraulic convergence accuracy
EN_TOLERANCE = 2, //!> Water quality tolerance EN_TOLERANCE = 2, //!< Water quality tolerance
EN_EMITEXPON = 3, //!> Exponent for emitter head loss formula EN_EMITEXPON = 3, //!< Exponent for emitter head loss formula
EN_DEMANDMULT = 4, //!> Global demand multiplier EN_DEMANDMULT = 4, //!< Global demand multiplier
EN_HEADERROR = 5, //!> Maximum allowable head loss error EN_HEADERROR = 5, //!< Maximum allowable head loss error
EN_FLOWCHANGE = 6, //!> Maximum allowable flow change EN_FLOWCHANGE = 6, //!< Maximum allowable flow change
EN_DEFDEMANDPAT = 7, //!> Default demand time pattern EN_DEFDEMANDPAT = 7, //!< Default demand time pattern
EN_HEADLOSSFORM = 8, //!> Head loss formula code EN_HEADLOSSFORM = 8, //!< Head loss formula
EN_GLOBALEFFIC = 9, //!> Global pump efficiency EN_GLOBALEFFIC = 9, //!< Global pump efficiency
EN_GLOBALPRICE = 10, //!> Global energy price per KWH EN_GLOBALPRICE = 10, //!< Global energy price per KWH
EN_GLOBALPATTERN = 11, //!> Global energy price pattern EN_GLOBALPATTERN = 11, //!< Global energy price pattern
EN_DEMANDCHARGE = 12 //!> Energy charge per max. KW usage EN_DEMANDCHARGE = 12 //!< Energy charge per max. KW usage
} EN_Option; } EN_Option;
/// Simple control types /// Simple control types
typedef enum { typedef enum {
EN_LOWLEVEL = 0, EN_LOWLEVEL = 0, //!< Act when level drops below a setpoint
EN_HILEVEL = 1, EN_HILEVEL = 1, //!< Act when level rises above a setpoint
EN_TIMER = 2, EN_TIMER = 2, //!< Act at a prescribed elapsed amount of time
EN_TIMEOFDAY = 3 EN_TIMEOFDAY = 3 //!< Act at a particular time of day
} EN_ControlType; } EN_ControlType;
/// Reporting statistic types /// Reporting statistic types
typedef enum { typedef enum {
EN_AVERAGE = 1, //!> Report average value over simulation period EN_AVERAGE = 1, //!< Report average value over simulation period
EN_MINIMUM = 2, //!> Report minimum value over simulation period EN_MINIMUM = 2, //!< Report minimum value over simulation period
EN_MAXIMUM = 3, //!> Report maximum value over simulation period EN_MAXIMUM = 3, //!< Report maximum value over simulation period
EN_RANGE = 4 //!> Report maximum - minimum over simulation period EN_RANGE = 4 //!< Report maximum - minimum over simulation period
} EN_StatisticType; } EN_StatisticType;
/// Tank mixing models /// Tank mixing models
@@ -225,10 +227,10 @@ typedef enum {
/// Hydraulic initialization options /// Hydraulic initialization options
typedef enum { typedef enum {
EN_NOSAVE = 0, //!> Don't save hydraulics; don't re-initialize flows EN_NOSAVE = 0, //!< Don't save hydraulics; don't re-initialize flows
EN_SAVE = 1, //!> Save hydraulics to file, don't re-initialize flows EN_SAVE = 1, //!< Save hydraulics to file, don't re-initialize flows
EN_INITFLOW = 10, //!> Don't save hydraulics; re-initialize flows EN_INITFLOW = 10, //!< Don't save hydraulics; re-initialize flows
EN_SAVE_AND_INIT = 11 //!> Save hydraulics; re-initialize flows EN_SAVE_AND_INIT = 11 //!< Save hydraulics; re-initialize flows
} EN_SaveOption; } EN_SaveOption;
/// Pump curve types /// Pump curve types
@@ -250,60 +252,60 @@ typedef enum {
/// Deletion action codes /// Deletion action codes
typedef enum { typedef enum {
EN_UNCONDITIONAL = 0, //!> Delete all controls that contain object EN_UNCONDITIONAL = 0, //!< Delete all controls that contain object
EN_CONDITIONAL = 1 //!> Cancel object deletion if contained in controls EN_CONDITIONAL = 1 //!< Cancel object deletion if contained in controls
} EN_ActionCodeType; } EN_ActionCodeType;
/// Status report options /// Options for reporting on the status of the hydraulic solver at each time period
typedef enum { typedef enum {
EN_NO_REPORT = 0, EN_NO_REPORT = 0, //!< No status reporting
EN_NORMAL_REPORT = 1, EN_NORMAL_REPORT = 1, //!< Normal level of status reporting
EN_FULL_REPORT = 2 EN_FULL_REPORT = 2 //!< Full level of status reporting
} EN_StatusReport; } EN_StatusReport;
/// Rule object codes /// Codes for objects referred to in the clauses of rule-based controls
typedef enum { typedef enum {
EN_R_NODE = 6, EN_R_NODE = 6, //!< Clause refers to a node
EN_R_LINK = 7, EN_R_LINK = 7, //!< Clause refers to a link
EN_R_SYSTEM = 8 EN_R_SYSTEM = 8 //!< Clause refers to a system parameter (e.g., time)
} EN_RuleObject; } EN_RuleObject;
/// Rule variable codes /// Codes for variables used in the clauses of rule-based controls
typedef enum { typedef enum {
EN_R_DEMAND = 0, EN_R_DEMAND = 0, //!< Nodal demand
EN_R_HEAD = 1, EN_R_HEAD = 1, //!< Nodal hydraulic head
EN_R_GRADE = 2, EN_R_GRADE = 2, //!< Nodal hydraulic grade
EN_R_LEVEL = 3, EN_R_LEVEL = 3, //!< Tank water level
EN_R_PRESSURE = 4, EN_R_PRESSURE = 4, //!< Nodal pressure
EN_R_FLOW = 5, EN_R_FLOW = 5, //!< Link flow rate
EN_R_STATUS = 6, EN_R_STATUS = 6, //!< Link status
EN_R_SETTING = 7, EN_R_SETTING = 7, //!< Link setting
EN_R_POWER = 8, EN_R_POWER = 8, //!< Pump power output
EN_R_TIME = 9, EN_R_TIME = 9, //!< Elapsed simulation time
EN_R_CLOCKTIME = 10, EN_R_CLOCKTIME = 10, //!< Time of day
EN_R_FILLTIME = 11, EN_R_FILLTIME = 11, //!< Time to fill a tank
EN_R_DRAINTIME = 12 EN_R_DRAINTIME = 12 //!< Time to drain a tank
} EN_RuleVariable; } EN_RuleVariable;
/// Rule operator types /// Comparison operators used in the premises of rule-based controls
typedef enum { typedef enum {
EN_R_EQ = 0, EN_R_EQ = 0, //!< Equal to
EN_R_NE = 1, EN_R_NE = 1, //!< Not equal
EN_R_LE = 2, EN_R_LE = 2, //!< Less than or equal to
EN_R_GE = 3, EN_R_GE = 3, //!< Greater than or equal to
EN_R_LT = 4, EN_R_LT = 4, //!< Less than
EN_R_GT = 5, EN_R_GT = 5, //!< Greater than
EN_R_IS = 6, EN_R_IS = 6, //!< Is equal to
EN_R_NOT = 7, EN_R_NOT = 7, //!< Is not equal to
EN_R_BELOW = 8, EN_R_BELOW = 8, //!< Is below
EN_R_ABOVE = 9 EN_R_ABOVE = 9 //!< Is above
} EN_RuleOperator; } EN_RuleOperator;
/// Rule status types /// Status codes used in the clauses of rule-based controls
typedef enum { typedef enum {
EN_R_IS_OPEN = 1, EN_R_IS_OPEN = 1, //!< Link is open
EN_R_IS_CLOSED = 2, EN_R_IS_CLOSED = 2, //!< Link is closed
EN_R_IS_ACTIVE = 3 EN_R_IS_ACTIVE = 3 //!< Control valve is active
} EN_RuleStatus; } EN_RuleStatus;

File diff suppressed because it is too large Load Diff

View File

@@ -7,10 +7,15 @@
Authors: see AUTHORS Authors: see AUTHORS
Copyright: see AUTHORS Copyright: see AUTHORS
License: see LICENSE License: see LICENSE
Last Updated: 11/29/2018 Last Updated: 01/09/2019
****************************************************************************** ******************************************************************************
*/ */
#ifndef __APPLE__
#include <malloc.h>
#else
#include <stdlib.h>
#endif
#include <string.h>
#include "types.h" #include "types.h"
#include "funcs.h" #include "funcs.h"
@@ -46,13 +51,13 @@ void removetmpfiles()
********************************************************************/ ********************************************************************/
int DLLEXPORT ENepanet(const char *f1, const char *f2, const char *f3, int DLLEXPORT ENepanet(const char *inpFile, const char *rptFile,
void (*pviewprog)(char *)) const char *outFile, void (*pviewprog)(char *))
{ {
/*------------------------------------------------------------------------ /*------------------------------------------------------------------------
** Input: f1 = name of EPANET formatted input file ** Input: inpFile = name of EPANET formatted input file
** f2 = name of report file ** rptFile = name of report file
** f3 = name of binary output file ** outFile = name of binary output file
** pviewprog = see note below ** pviewprog = see note below
** Output: none ** Output: none
** Returns: error code ** Returns: error code
@@ -71,7 +76,7 @@ int DLLEXPORT ENepanet(const char *f1, const char *f2, const char *f3,
// Run the project and record any warning // Run the project and record any warning
createtmpfiles(); createtmpfiles();
errcode = EN_runproject(_defaultProject, f1, f2, f3, pviewprog); errcode = EN_runproject(_defaultProject, inpFile, rptFile, outFile, pviewprog);
if (errcode < 100) warncode = errcode; if (errcode < 100) warncode = errcode;
removetmpfiles(); removetmpfiles();
@@ -80,20 +85,20 @@ int DLLEXPORT ENepanet(const char *f1, const char *f2, const char *f3,
return errcode; return errcode;
} }
int DLLEXPORT ENinit(const char *f2, const char *f3, int UnitsType, int DLLEXPORT ENinit(const char *rptFile, const char *outFile, int unitsType,
int HeadlossFormula) int headlossType)
{ {
int errcode = 0; int errcode = 0;
createtmpfiles(); createtmpfiles();
errcode = EN_init(_defaultProject, f2, f3, UnitsType, HeadlossFormula); errcode = EN_init(_defaultProject, rptFile, outFile, unitsType, headlossType);
return errcode; return errcode;
} }
int DLLEXPORT ENopen(const char *f1, const char *f2, const char *f3) int DLLEXPORT ENopen(const char *inpFile, const char *rptFile, const char *outFile)
{ {
int errcode = 0; int errcode = 0;
createtmpfiles(); createtmpfiles();
errcode = EN_open(_defaultProject, f1, f2, f3); errcode = EN_open(_defaultProject, inpFile, rptFile, outFile);
return errcode; return errcode;
} }
@@ -121,11 +126,11 @@ int DLLEXPORT ENsaveH() { return EN_saveH(_defaultProject); }
int DLLEXPORT ENopenH() { return EN_openH(_defaultProject); } int DLLEXPORT ENopenH() { return EN_openH(_defaultProject); }
int DLLEXPORT ENinitH(int flag) { return EN_initH(_defaultProject, flag); } int DLLEXPORT ENinitH(int initFlag) { return EN_initH(_defaultProject, initFlag); }
int DLLEXPORT ENrunH(long *t) { return EN_runH(_defaultProject, t); } int DLLEXPORT ENrunH(long *currentTime) { return EN_runH(_defaultProject, currentTime); }
int DLLEXPORT ENnextH(long *tstep) { return EN_nextH(_defaultProject, tstep); } int DLLEXPORT ENnextH(long *tStep) { return EN_nextH(_defaultProject, tStep); }
int DLLEXPORT ENcloseH() { return EN_closeH(_defaultProject); } int DLLEXPORT ENcloseH() { return EN_closeH(_defaultProject); }
@@ -149,13 +154,13 @@ int DLLEXPORT ENsolveQ() { return EN_solveQ(_defaultProject); }
int DLLEXPORT ENopenQ() { return EN_openQ(_defaultProject); } int DLLEXPORT ENopenQ() { return EN_openQ(_defaultProject); }
int DLLEXPORT ENinitQ(int saveflag) { return EN_initQ(_defaultProject, saveflag); } int DLLEXPORT ENinitQ(int saveFlag) { return EN_initQ(_defaultProject, saveFlag); }
int DLLEXPORT ENrunQ(long *t) { return EN_runQ(_defaultProject, t); } int DLLEXPORT ENrunQ(long *currentTime) { return EN_runQ(_defaultProject, currentTime); }
int DLLEXPORT ENnextQ(long *tstep) { return EN_nextQ(_defaultProject, tstep); } int DLLEXPORT ENnextQ(long *tStep) { return EN_nextQ(_defaultProject, tStep); }
int DLLEXPORT ENstepQ(long *tleft) { return EN_stepQ(_defaultProject, tleft); } int DLLEXPORT ENstepQ(long *timeLeft) { return EN_stepQ(_defaultProject, timeLeft); }
int DLLEXPORT ENcloseQ() { return EN_closeQ(_defaultProject); } int DLLEXPORT ENcloseQ() { return EN_closeQ(_defaultProject); }
@@ -171,28 +176,31 @@ int DLLEXPORT ENreport() { return EN_report(_defaultProject); }
int DLLEXPORT ENresetreport() { return EN_resetreport(_defaultProject); } int DLLEXPORT ENresetreport() { return EN_resetreport(_defaultProject); }
int DLLEXPORT ENsetreport(char *s) { return EN_setreport(_defaultProject, s); } int DLLEXPORT ENsetreport(char *format) { return EN_setreport(_defaultProject, format); }
int DLLEXPORT ENsetstatusreport(int code) int DLLEXPORT ENsetstatusreport(int level)
{ {
return EN_setstatusreport(_defaultProject, code); return EN_setstatusreport(_defaultProject, level);
} }
int DLLEXPORT ENgetversion(int *v) { return EN_getversion(v); } int DLLEXPORT ENgetversion(int *version) { return EN_getversion(version); }
int DLLEXPORT ENgetcount(int code, int *count) int DLLEXPORT ENgetcount(int object, int *count)
{ {
return EN_getcount(_defaultProject, (EN_CountType)code, count); return EN_getcount(_defaultProject, object, count);
} }
int DLLEXPORT ENgeterror(int errcode, char *errmsg, int n) int DLLEXPORT ENgeterror(int errcode, char *errmsg, int maxLen)
{ {
return EN_geterror(errcode, errmsg, n); return EN_geterror(errcode, errmsg, maxLen);
} }
int DLLEXPORT ENgetstatistic(int code, EN_API_FLOAT_TYPE *value) int DLLEXPORT ENgetstatistic(int type, EN_API_FLOAT_TYPE *value)
{ {
return EN_getstatistic(_defaultProject, code, value); double v = 0.0;
int errcode = EN_getstatistic(_defaultProject, type, &v);
*value = (EN_API_FLOAT_TYPE)v;
return errcode;
} }
/******************************************************************** /********************************************************************
@@ -201,45 +209,54 @@ int DLLEXPORT ENgetstatistic(int code, EN_API_FLOAT_TYPE *value)
********************************************************************/ ********************************************************************/
int DLLEXPORT ENgetoption(int code, EN_API_FLOAT_TYPE *value) int DLLEXPORT ENgetoption(int option, EN_API_FLOAT_TYPE *value)
{ {
return EN_getoption(_defaultProject, (EN_Option)code, value); double v = 0.0;
int errcode = EN_getoption(_defaultProject, option, &v);
*value = (EN_API_FLOAT_TYPE)v;
return errcode;
} }
int DLLEXPORT ENsetoption(int code, EN_API_FLOAT_TYPE v) int DLLEXPORT ENsetoption(int option, EN_API_FLOAT_TYPE value)
{ {
return EN_setoption(_defaultProject, code, v); return EN_setoption(_defaultProject, option, value);
} }
int DLLEXPORT ENgetflowunits(int *code) { return EN_getflowunits(_defaultProject, code); } int DLLEXPORT ENgetflowunits(int *units)
int DLLEXPORT ENsetflowunits(int code) { return EN_setflowunits(_defaultProject, code); }
int DLLEXPORT ENgettimeparam(int code, long *value)
{ {
return EN_gettimeparam(_defaultProject, code, value); return EN_getflowunits(_defaultProject, units);
} }
int DLLEXPORT ENsettimeparam(int code, long value) int DLLEXPORT ENsetflowunits(int units)
{ {
return EN_settimeparam(_defaultProject, code, value); return EN_setflowunits(_defaultProject, units);
} }
int DLLEXPORT ENgetqualinfo(int *qualcode, char *chemname, char *chemunits, int DLLEXPORT ENgettimeparam(int param, long *value)
int *tracenode)
{ {
return EN_getqualinfo(_defaultProject, qualcode, chemname, chemunits, tracenode); return EN_gettimeparam(_defaultProject, param, value);
} }
int DLLEXPORT ENgetqualtype(int *qualcode, int *tracenode) int DLLEXPORT ENsettimeparam(int param, long value)
{ {
return EN_getqualtype(_defaultProject, qualcode, tracenode); return EN_settimeparam(_defaultProject, param, value);
} }
int DLLEXPORT ENsetqualtype(int qualcode, char *chemname, char *chemunits, int DLLEXPORT ENgetqualinfo(int *qualType, char *chemName, char *chemUnits,
char *tracenode) int *traceNode)
{ {
return EN_setqualtype(_defaultProject, qualcode, chemname, chemunits, tracenode); return EN_getqualinfo(_defaultProject, qualType, chemName, chemUnits, traceNode);
}
int DLLEXPORT ENgetqualtype(int *qualType, int *traceNode)
{
return EN_getqualtype(_defaultProject, qualType, traceNode);
}
int DLLEXPORT ENsetqualtype(int qualType, char *chemName, char *chemUnits,
char *traceNode)
{
return EN_setqualtype(_defaultProject, qualType, chemName, chemUnits, traceNode);
} }
/******************************************************************** /********************************************************************
@@ -248,7 +265,7 @@ int DLLEXPORT ENsetqualtype(int qualcode, char *chemname, char *chemunits,
********************************************************************/ ********************************************************************/
int DLLEXPORT ENaddnode(char *id, EN_NodeType nodeType) int DLLEXPORT ENaddnode(char *id, int nodeType)
{ {
return EN_addnode(_defaultProject, id, nodeType); return EN_addnode(_defaultProject, id, nodeType);
} }
@@ -273,19 +290,22 @@ int DLLEXPORT ENsetnodeid(int index, char *newid)
return EN_setnodeid(_defaultProject, index, newid); return EN_setnodeid(_defaultProject, index, newid);
} }
int DLLEXPORT ENgetnodetype(int index, int *code) int DLLEXPORT ENgetnodetype(int index, int *nodeType)
{ {
return EN_getnodetype(_defaultProject, index, code); return EN_getnodetype(_defaultProject, index, nodeType);
} }
int DLLEXPORT ENgetnodevalue(int index, int code, EN_API_FLOAT_TYPE *value) int DLLEXPORT ENgetnodevalue(int index, int property, EN_API_FLOAT_TYPE *value)
{ {
return EN_getnodevalue(_defaultProject, index, code, value); double v = 0.0;
int errcode = EN_getnodevalue(_defaultProject, index, property, &v);
*value = (EN_API_FLOAT_TYPE)v;
return errcode;
} }
int DLLEXPORT ENsetnodevalue(int index, int code, EN_API_FLOAT_TYPE v) int DLLEXPORT ENsetnodevalue(int index, int property, EN_API_FLOAT_TYPE value)
{ {
return EN_setnodevalue(_defaultProject, index, code, v); return EN_setnodevalue(_defaultProject, index, property, value);
} }
int DLLEXPORT ENsetjuncdata(int index, EN_API_FLOAT_TYPE elev, EN_API_FLOAT_TYPE dmnd, int DLLEXPORT ENsetjuncdata(int index, EN_API_FLOAT_TYPE elev, EN_API_FLOAT_TYPE dmnd,
@@ -294,8 +314,9 @@ int DLLEXPORT ENsetjuncdata(int index, EN_API_FLOAT_TYPE elev, EN_API_FLOAT_TYPE
return EN_setjuncdata(_defaultProject, index, elev, dmnd, dmndpat); return EN_setjuncdata(_defaultProject, index, elev, dmnd, dmndpat);
} }
int DLLEXPORT ENsettankdata(int index, EN_API_FLOAT_TYPE elev, EN_API_FLOAT_TYPE initlvl, int DLLEXPORT ENsettankdata(int index, EN_API_FLOAT_TYPE elev,
EN_API_FLOAT_TYPE minlvl, EN_API_FLOAT_TYPE maxlvl, EN_API_FLOAT_TYPE diam, EN_API_FLOAT_TYPE initlvl, EN_API_FLOAT_TYPE minlvl,
EN_API_FLOAT_TYPE maxlvl, EN_API_FLOAT_TYPE diam,
EN_API_FLOAT_TYPE minvol, char *volcurve) EN_API_FLOAT_TYPE minvol, char *volcurve)
{ {
return EN_settankdata(_defaultProject, index, elev, initlvl, minlvl, maxlvl, return EN_settankdata(_defaultProject, index, elev, initlvl, minlvl, maxlvl,
@@ -304,7 +325,11 @@ int DLLEXPORT ENsettankdata(int index, EN_API_FLOAT_TYPE elev, EN_API_FLOAT_TYP
int DLLEXPORT ENgetcoord(int index, EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y) int DLLEXPORT ENgetcoord(int index, EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y)
{ {
return EN_getcoord(_defaultProject, index, x, y); double xx = 0.0, yy = 0.0;
int errcode = EN_getcoord(_defaultProject, index, &xx, &yy);
*x = (EN_API_FLOAT_TYPE)xx;
*y = (EN_API_FLOAT_TYPE)yy;
return errcode;
} }
int DLLEXPORT ENsetcoord(int index, EN_API_FLOAT_TYPE x, EN_API_FLOAT_TYPE y) int DLLEXPORT ENsetcoord(int index, EN_API_FLOAT_TYPE x, EN_API_FLOAT_TYPE y)
@@ -318,16 +343,21 @@ int DLLEXPORT ENsetcoord(int index, EN_API_FLOAT_TYPE x, EN_API_FLOAT_TYPE y)
********************************************************************/ ********************************************************************/
int DLLEXPORT ENgetdemandmodel(int *type, EN_API_FLOAT_TYPE *pmin, int DLLEXPORT ENgetdemandmodel(int *model, EN_API_FLOAT_TYPE *pmin,
EN_API_FLOAT_TYPE *preq, EN_API_FLOAT_TYPE *pexp) EN_API_FLOAT_TYPE *preq, EN_API_FLOAT_TYPE *pexp)
{ {
return EN_getdemandmodel(_defaultProject, type, pmin, preq, pexp); double pmin2 = 0.0, preq2 = 0.0, pexp2 = 0.0;
int errcode = EN_getdemandmodel(_defaultProject, model, &pmin2, &preq2, &pexp2);
*pmin = (EN_API_FLOAT_TYPE)pmin2;
*preq = (EN_API_FLOAT_TYPE)preq2;
*pexp = (EN_API_FLOAT_TYPE)pexp2;
return errcode;
} }
int DLLEXPORT ENsetdemandmodel(int type, EN_API_FLOAT_TYPE pmin, int DLLEXPORT ENsetdemandmodel(int model, EN_API_FLOAT_TYPE pmin,
EN_API_FLOAT_TYPE preq, EN_API_FLOAT_TYPE pexp) EN_API_FLOAT_TYPE preq, EN_API_FLOAT_TYPE pexp)
{ {
return EN_setdemandmodel(_defaultProject, type, pmin, preq, pexp); return EN_setdemandmodel(_defaultProject, model, pmin, preq, pexp);
} }
int DLLEXPORT ENgetnumdemands(int nodeIndex, int *numDemands) int DLLEXPORT ENgetnumdemands(int nodeIndex, int *numDemands)
@@ -335,34 +365,39 @@ int DLLEXPORT ENgetnumdemands(int nodeIndex, int *numDemands)
return EN_getnumdemands(_defaultProject, nodeIndex, numDemands); return EN_getnumdemands(_defaultProject, nodeIndex, numDemands);
} }
int DLLEXPORT ENgetbasedemand(int nodeIndex, int demandIdx, EN_API_FLOAT_TYPE *baseDemand) int DLLEXPORT ENgetbasedemand(int nodeIndex, int demandIndex,
EN_API_FLOAT_TYPE *baseDemand)
{ {
return EN_getbasedemand(_defaultProject, nodeIndex, demandIdx, baseDemand); double bd2 = 0.0;
int errcode = EN_getbasedemand(_defaultProject, nodeIndex, demandIndex, &bd2);
*baseDemand = (EN_API_FLOAT_TYPE)bd2;
return errcode;
} }
int DLLEXPORT ENsetbasedemand(int nodeIndex, int demandIdx, EN_API_FLOAT_TYPE baseDemand) int DLLEXPORT ENsetbasedemand(int nodeIndex, int demandIndex,
EN_API_FLOAT_TYPE baseDemand)
{ {
return EN_setbasedemand(_defaultProject, nodeIndex, demandIdx, baseDemand); return EN_setbasedemand(_defaultProject, nodeIndex, demandIndex, baseDemand);
} }
int DLLEXPORT ENsetdemandpattern(int nodeIndex, int demandIdx, int patIndex) int DLLEXPORT ENsetdemandpattern(int nodeIndex, int demandIndex, int patIndex)
{ {
return EN_setdemandpattern(_defaultProject, nodeIndex, demandIdx, patIndex); return EN_setdemandpattern(_defaultProject, nodeIndex, demandIndex, patIndex);
} }
int DLLEXPORT ENgetdemandpattern(int nodeIndex, int demandIdx, int *pattIdx) int DLLEXPORT ENgetdemandpattern(int nodeIndex, int demandIndex, int *pattIdx)
{ {
return EN_getdemandpattern(_defaultProject, nodeIndex, demandIdx, pattIdx); return EN_getdemandpattern(_defaultProject, nodeIndex, demandIndex, pattIdx);
} }
int DLLEXPORT ENgetdemandname(int nodeIndex, int demandIdx, char *demandName) int DLLEXPORT ENgetdemandname(int nodeIndex, int demandIndex, char *demandName)
{ {
return EN_getdemandname(_defaultProject, nodeIndex, demandIdx, demandName); return EN_getdemandname(_defaultProject, nodeIndex, demandIndex, demandName);
} }
int DLLEXPORT ENsetdemandname(int nodeIndex, int demandIdx, char *demandName) int DLLEXPORT ENsetdemandname(int nodeIndex, int demandIndex, char *demandName)
{ {
return EN_setdemandname(_defaultProject, nodeIndex, demandIdx, demandName); return EN_setdemandname(_defaultProject, nodeIndex, demandIndex, demandName);
} }
/******************************************************************** /********************************************************************
@@ -371,7 +406,7 @@ int DLLEXPORT ENsetdemandname(int nodeIndex, int demandIdx, char *demandName)
********************************************************************/ ********************************************************************/
int DLLEXPORT ENaddlink(char *id, EN_LinkType linkType, char *fromNode, char *toNode) int DLLEXPORT ENaddlink(char *id, int linkType, char *fromNode, char *toNode)
{ {
return EN_addlink(_defaultProject, id, linkType, fromNode, toNode); return EN_addlink(_defaultProject, id, linkType, fromNode, toNode);
} }
@@ -396,14 +431,14 @@ int DLLEXPORT ENsetlinkid(int index, char *newid)
return EN_setlinkid(_defaultProject, index, newid); return EN_setlinkid(_defaultProject, index, newid);
} }
int DLLEXPORT ENgetlinktype(int index, EN_LinkType *code) int DLLEXPORT ENgetlinktype(int index, int *linkType)
{ {
return EN_getlinktype(_defaultProject, index, code); return EN_getlinktype(_defaultProject, index, linkType);
} }
int DLLEXPORT ENsetlinktype(int *index, EN_LinkType type, int actionCode) int DLLEXPORT ENsetlinktype(int *index, int linkType, int actionCode)
{ {
return EN_setlinktype(_defaultProject, index, type, actionCode); return EN_setlinktype(_defaultProject, index, linkType, actionCode);
} }
int DLLEXPORT ENgetlinknodes(int index, int *node1, int *node2) int DLLEXPORT ENgetlinknodes(int index, int *node1, int *node2)
@@ -416,18 +451,21 @@ int DLLEXPORT ENsetlinknodes(int index, int node1, int node2)
return EN_setlinknodes(_defaultProject, index, node1, node2); return EN_setlinknodes(_defaultProject, index, node1, node2);
} }
int DLLEXPORT ENgetlinkvalue(int index, int code, EN_API_FLOAT_TYPE *value) int DLLEXPORT ENgetlinkvalue(int index, int property, EN_API_FLOAT_TYPE *value)
{ {
return EN_getlinkvalue(_defaultProject, index, (EN_LinkProperty)code, value); double v = 0.0;
int errcode = EN_getlinkvalue(_defaultProject, index, property, &v);
*value = (EN_API_FLOAT_TYPE)v;
return errcode;
} }
int DLLEXPORT ENsetlinkvalue(int index, int code, EN_API_FLOAT_TYPE v) int DLLEXPORT ENsetlinkvalue(int index, int property, EN_API_FLOAT_TYPE value)
{ {
return EN_setlinkvalue(_defaultProject, index, code, v); return EN_setlinkvalue(_defaultProject, index, property, value);
} }
int DLLEXPORT ENsetpipedata(int index, EN_API_FLOAT_TYPE length, EN_API_FLOAT_TYPE diam, int DLLEXPORT ENsetpipedata(int index, EN_API_FLOAT_TYPE length,
EN_API_FLOAT_TYPE rough, EN_API_FLOAT_TYPE mloss) EN_API_FLOAT_TYPE diam, EN_API_FLOAT_TYPE rough, EN_API_FLOAT_TYPE mloss)
{ {
return EN_setpipedata(_defaultProject, index, length, diam, rough, mloss); return EN_setpipedata(_defaultProject, index, length, diam, rough, mloss);
} }
@@ -439,19 +477,19 @@ int DLLEXPORT ENsetpipedata(int index, EN_API_FLOAT_TYPE length, EN_API_FLOAT_TY
********************************************************************/ ********************************************************************/
int DLLEXPORT ENgetpumptype(int index, int *type) int DLLEXPORT ENgetpumptype(int linkIndex, int *pumpType)
{ {
return EN_getpumptype(_defaultProject, index, type); return EN_getpumptype(_defaultProject, linkIndex, pumpType);
} }
int DLLEXPORT ENgetheadcurveindex(int index, int *curveindex) int DLLEXPORT ENgetheadcurveindex(int linkIndex, int *curveIndex)
{ {
return EN_getheadcurveindex(_defaultProject, index, curveindex); return EN_getheadcurveindex(_defaultProject, linkIndex, curveIndex);
} }
int DLLEXPORT ENsetheadcurveindex(int index, int curveindex) int DLLEXPORT ENsetheadcurveindex(int linkIndex, int curveIndex)
{ {
return EN_setheadcurveindex(_defaultProject, index, curveindex); return EN_setheadcurveindex(_defaultProject, linkIndex, curveIndex);
} }
/******************************************************************** /********************************************************************
@@ -482,7 +520,10 @@ int DLLEXPORT ENgetpatternlen(int index, int *len)
int DLLEXPORT ENgetpatternvalue(int index, int period, EN_API_FLOAT_TYPE *value) int DLLEXPORT ENgetpatternvalue(int index, int period, EN_API_FLOAT_TYPE *value)
{ {
return EN_getpatternvalue(_defaultProject, index, period, value); double v = 0.0;
int errcode = EN_getpatternvalue(_defaultProject, index, period, &v);
*value = (EN_API_FLOAT_TYPE)v;
return errcode;
} }
int DLLEXPORT ENsetpatternvalue(int index, int period, EN_API_FLOAT_TYPE value) int DLLEXPORT ENsetpatternvalue(int index, int period, EN_API_FLOAT_TYPE value)
@@ -492,12 +533,25 @@ int DLLEXPORT ENsetpatternvalue(int index, int period, EN_API_FLOAT_TYPE value)
int DLLEXPORT ENgetaveragepatternvalue(int index, EN_API_FLOAT_TYPE *value) int DLLEXPORT ENgetaveragepatternvalue(int index, EN_API_FLOAT_TYPE *value)
{ {
return EN_getaveragepatternvalue(_defaultProject, index, value); double v;
int errcode = EN_getaveragepatternvalue(_defaultProject, index, &v);
*value = (EN_API_FLOAT_TYPE)v;
return errcode;
} }
int DLLEXPORT ENsetpattern(int index, EN_API_FLOAT_TYPE *f, int n) int DLLEXPORT ENsetpattern(int index, EN_API_FLOAT_TYPE *values, int len)
{ {
return EN_setpattern(_defaultProject, index, f, n); double *v = NULL;
int i, errcode;
v = (double *)calloc(len, sizeof(double));
if (v)
{
for (i = 0; i < len; i++) v[i] = values[i];
errcode = EN_setpattern(_defaultProject, index, v, len);
}
else errcode = 101;
free(v);
return errcode;
} }
/******************************************************************** /********************************************************************
@@ -526,32 +580,67 @@ int DLLEXPORT ENgetcurvelen(int index, int *len)
return EN_getcurvelen(_defaultProject, index, len); return EN_getcurvelen(_defaultProject, index, len);
} }
int DLLEXPORT ENgetcurvetype(int curveindex, int *type) int DLLEXPORT ENgetcurvetype(int index, int *type)
{ {
return EN_getcurvetype(_defaultProject, curveindex, type); return EN_getcurvetype(_defaultProject, index, type);
} }
int DLLEXPORT ENgetcurvevalue(int index, int pnt, EN_API_FLOAT_TYPE *x, int DLLEXPORT ENgetcurvevalue(int curveIndex, int pointIndex, EN_API_FLOAT_TYPE *x,
EN_API_FLOAT_TYPE *y) EN_API_FLOAT_TYPE *y)
{ {
return EN_getcurvevalue(_defaultProject, index, pnt, x, y); double xx = 0.0, yy = 0.0;
int errcode = EN_getcurvevalue(_defaultProject, curveIndex, pointIndex, &xx, &yy);
*x = (EN_API_FLOAT_TYPE)xx;
*y = (EN_API_FLOAT_TYPE)yy;
return errcode;
} }
int DLLEXPORT ENsetcurvevalue(int index, int pnt, EN_API_FLOAT_TYPE x, int DLLEXPORT ENsetcurvevalue(int curveIndex, int pointIndex, EN_API_FLOAT_TYPE x,
EN_API_FLOAT_TYPE y) EN_API_FLOAT_TYPE y)
{ {
return EN_setcurvevalue(_defaultProject, index, pnt, x, y); return EN_setcurvevalue(_defaultProject, curveIndex, pointIndex, x, y);
} }
int DLLEXPORT ENgetcurve(int curveIndex, char *id, int *nValues, int DLLEXPORT ENgetcurve(int index, char *id, int *nPoints,
EN_API_FLOAT_TYPE **xValues, EN_API_FLOAT_TYPE **yValues) EN_API_FLOAT_TYPE **xValues, EN_API_FLOAT_TYPE **yValues)
{ {
return EN_getcurve(_defaultProject, curveIndex, id, nValues, xValues, yValues); int i;
Network *net = &_defaultProject->network;
Scurve *curve;
if (index <= 0 || index > net->Ncurves) return 206;
curve = &net->Curve[index];
strncpy(id, curve->ID, MAXID);
*nPoints = curve->Npts;
for (i = 0; i < curve->Npts; i++)
{
*xValues[i] = (EN_API_FLOAT_TYPE)curve->X[i];
*yValues[i] = (EN_API_FLOAT_TYPE)curve->Y[i];
}
return 0;
} }
int DLLEXPORT ENsetcurve(int index, EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y, int n) int DLLEXPORT ENsetcurve(int index, EN_API_FLOAT_TYPE *xValues,
EN_API_FLOAT_TYPE *yValues, int nPoints)
{ {
return EN_setcurve(_defaultProject, index, x, y, n); double *xx = NULL;
double *yy = NULL;
int i, errcode;
xx = (double *)calloc(nPoints, sizeof(double));
yy = (double *)calloc(nPoints, sizeof(double));
if (xx && yy)
{
for (i = 0; i < nPoints; i++)
{
xx[i] = xValues[i];
yy[i] = yValues[i];
}
errcode = EN_setcurve(_defaultProject, index, xx, yy, nPoints);
}
else errcode = 101;
free(xx);
free(yy);
return errcode;
} }
/******************************************************************** /********************************************************************
@@ -560,27 +649,34 @@ int DLLEXPORT ENsetcurve(int index, EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y,
********************************************************************/ ********************************************************************/
int DLLEXPORT ENaddcontrol(int *cindex, int ctype, int lindex, EN_API_FLOAT_TYPE setting, int DLLEXPORT ENaddcontrol(int type, int linkIndex, EN_API_FLOAT_TYPE setting,
int nindex, EN_API_FLOAT_TYPE level) int nodeIndex, EN_API_FLOAT_TYPE level, int *index)
{ {
return EN_addcontrol(_defaultProject, cindex, ctype, lindex, setting, nindex, level); return EN_addcontrol(_defaultProject, type, linkIndex, setting, nodeIndex,
level, index);
} }
int DLLEXPORT ENdeletecontrol(int cindex) int DLLEXPORT ENdeletecontrol(int index)
{ {
return EN_deletecontrol(_defaultProject, cindex); return EN_deletecontrol(_defaultProject, index);
} }
int DLLEXPORT ENgetcontrol(int cindex, int *ctype, int *lindex, EN_API_FLOAT_TYPE *setting, int DLLEXPORT ENgetcontrol(int index, int *type, int *linkIndex,
int *nindex, EN_API_FLOAT_TYPE *level) EN_API_FLOAT_TYPE *setting, int *nodeIndex, EN_API_FLOAT_TYPE *level)
{ {
return EN_getcontrol(_defaultProject, cindex, ctype, lindex, setting, nindex, level); double setting2 = 0.0, level2 = 0.0;
int errcode = EN_getcontrol(_defaultProject, index, type, linkIndex, &setting2,
nodeIndex, &level2);
*setting = (EN_API_FLOAT_TYPE)setting2;
*level = (EN_API_FLOAT_TYPE)level2;
return errcode;
} }
int DLLEXPORT ENsetcontrol(int cindex, int ctype, int lindex, EN_API_FLOAT_TYPE setting, int DLLEXPORT ENsetcontrol(int index, int type, int linkIndex,
int nindex, EN_API_FLOAT_TYPE level) EN_API_FLOAT_TYPE setting, int nodeIndex, EN_API_FLOAT_TYPE level)
{ {
return EN_setcontrol(_defaultProject, cindex, ctype, lindex, setting, nindex, level); return EN_setcontrol(_defaultProject, index, type, linkIndex, setting,
nodeIndex, level);
} }
/******************************************************************** /********************************************************************
@@ -599,10 +695,14 @@ int DLLEXPORT ENdeleterule(int index)
return EN_deleterule(_defaultProject, index); return EN_deleterule(_defaultProject, index);
} }
int DLLEXPORT ENgetrule(int index, int *nPremises, int *nThenActions, int *nElseActions, int DLLEXPORT ENgetrule(int index, int *nPremises, int *nThenActions,
EN_API_FLOAT_TYPE *priority) int *nElseActions, EN_API_FLOAT_TYPE *priority)
{ {
return EN_getrule(_defaultProject, index, nPremises, nThenActions, nElseActions, priority); double priority2 = 0.0;
int errcode = EN_getrule(_defaultProject, index, nPremises, nThenActions,
nElseActions, &priority2);
*priority = (EN_API_FLOAT_TYPE)priority2;
return errcode;
} }
int DLLEXPORT ENgetruleID(int index, char* id) int DLLEXPORT ENgetruleID(int index, char* id)
@@ -610,17 +710,19 @@ int DLLEXPORT ENgetruleID(int index, char* id)
return EN_getruleID(_defaultProject, index, id); return EN_getruleID(_defaultProject, index, id);
} }
int DLLEXPORT ENgetpremise(int ruleIndex, int premiseIndex, int *logop, int DLLEXPORT ENgetpremise(int ruleIndex, int premiseIndex, int *logop, int *object,
int *object, int *objIndex, int *variable, int *objIndex, int *variable, int *relop, int *status,
int *relop, int *status, EN_API_FLOAT_TYPE *value) EN_API_FLOAT_TYPE *value)
{ {
return EN_getpremise(_defaultProject, ruleIndex, premiseIndex, logop, object, double v = 0.0;
objIndex, variable, relop, status, value); int errcode = EN_getpremise(_defaultProject, ruleIndex, premiseIndex, logop,
object, objIndex, variable, relop, status, &v);
*value = (EN_API_FLOAT_TYPE)v;
return errcode;
} }
int DLLEXPORT ENsetpremise(int ruleIndex, int premiseIndex, int logop, int DLLEXPORT ENsetpremise(int ruleIndex, int premiseIndex, int logop, int object,
int object, int objIndex, int variable, int relop, int objIndex, int variable, int relop, int status, EN_API_FLOAT_TYPE value)
int status, EN_API_FLOAT_TYPE value)
{ {
return EN_setpremise(_defaultProject, ruleIndex, premiseIndex, logop, object, return EN_setpremise(_defaultProject, ruleIndex, premiseIndex, logop, object,
objIndex, variable, relop, status, value); objIndex, variable, relop, status, value);
@@ -644,8 +746,11 @@ int DLLEXPORT ENsetpremisevalue(int ruleIndex, int premiseIndex, EN_API_FLOAT_TY
int DLLEXPORT ENgetthenaction(int ruleIndex, int actionIndex, int *linkIndex, int DLLEXPORT ENgetthenaction(int ruleIndex, int actionIndex, int *linkIndex,
int *status, EN_API_FLOAT_TYPE *setting) int *status, EN_API_FLOAT_TYPE *setting)
{ {
return EN_getthenaction(_defaultProject, ruleIndex, actionIndex, linkIndex, double setting2 = 0.0;
status, setting); int errcode = EN_getthenaction(_defaultProject, ruleIndex, actionIndex, linkIndex,
status, &setting2);
*setting = (EN_API_FLOAT_TYPE)setting2;
return errcode;
} }
int DLLEXPORT ENsetthenaction(int ruleIndex, int actionIndex, int linkIndex, int DLLEXPORT ENsetthenaction(int ruleIndex, int actionIndex, int linkIndex,
@@ -658,8 +763,11 @@ int DLLEXPORT ENsetthenaction(int ruleIndex, int actionIndex, int linkIndex,
int DLLEXPORT ENgetelseaction(int ruleIndex, int actionIndex, int *linkIndex, int DLLEXPORT ENgetelseaction(int ruleIndex, int actionIndex, int *linkIndex,
int *status, EN_API_FLOAT_TYPE *setting) int *status, EN_API_FLOAT_TYPE *setting)
{ {
return EN_getelseaction(_defaultProject, ruleIndex, actionIndex, linkIndex, double setting2 = 0.0;
status, setting); int errcode = EN_getelseaction(_defaultProject, ruleIndex, actionIndex, linkIndex,
status, &setting2);
*setting = (EN_API_FLOAT_TYPE)setting2;
return errcode;
} }
int DLLEXPORT ENsetelseaction(int ruleIndex, int actionIndex, int linkIndex, int DLLEXPORT ENsetelseaction(int ruleIndex, int actionIndex, int linkIndex,

View File

@@ -8,7 +8,6 @@ DAT(105,"water quality solver not opened")
DAT(106,"no results saved to report on") DAT(106,"no results saved to report on")
DAT(107,"hydraulics supplied from external file") DAT(107,"hydraulics supplied from external file")
DAT(108,"cannot use external file while hydraulics solver is active") DAT(108,"cannot use external file while hydraulics solver is active")
DAT(109,"cannot change time parameter when solver is active")
DAT(110,"cannot solve network hydraulic equations") DAT(110,"cannot solve network hydraulic equations")
DAT(120,"cannot solve water quality transport equations") DAT(120,"cannot solve water quality transport equations")
@@ -23,9 +22,7 @@ DAT(204,"undefined link")
DAT(205,"undefined time pattern") DAT(205,"undefined time pattern")
DAT(206,"undefined curve") DAT(206,"undefined curve")
DAT(207,"attempt to control CV/GPV link") DAT(207,"attempt to control CV/GPV link")
DAT(208,"reference to undefined node")
DAT(209,"illegal node property value") DAT(209,"illegal node property value")
DAT(210,"reference to undefined link")
DAT(211,"illegal link property value") DAT(211,"illegal link property value")
DAT(212,"undefined trace node") DAT(212,"undefined trace node")
DAT(213,"invalid option value") DAT(213,"invalid option value")

View File

@@ -116,7 +116,7 @@ int saveinpfile(Project *pr, const char *fname)
Scurve *curve; Scurve *curve;
// Open the new text file // Open the new text file
if ((f = fopen(fname, "wt")) == NULL) return (308); if ((f = fopen(fname, "wt")) == NULL) return 302;
// Write [TITLE] section // Write [TITLE] section
fprintf(f, s_TITLE); fprintf(f, s_TITLE);

View File

@@ -1479,10 +1479,10 @@ int reportdata(Project *pr)
else if (match(parser->Tok[n], w_ALL)) rpt->Nodeflag = 1; // All nodes else if (match(parser->Tok[n], w_ALL)) rpt->Nodeflag = 1; // All nodes
else else
{ {
if (net->Nnodes == 0) return setError(parser, 1, 208); if (net->Nnodes == 0) return setError(parser, 1, 203);
for (i = 1; i <= n; i++) for (i = 1; i <= n; i++)
{ {
if ((j = findnode(net, parser->Tok[i])) == 0) return setError(parser, i, 208); if ((j = findnode(net, parser->Tok[i])) == 0) return setError(parser, i, 203);
net->Node[j].Rpt = 1; net->Node[j].Rpt = 1;
} }
rpt->Nodeflag = 2; rpt->Nodeflag = 2;
@@ -1497,10 +1497,10 @@ int reportdata(Project *pr)
else if (match(parser->Tok[n], w_ALL)) rpt->Linkflag = 1; else if (match(parser->Tok[n], w_ALL)) rpt->Linkflag = 1;
else else
{ {
if (net->Nlinks == 0) return setError(parser, 1, 210); if (net->Nlinks == 0) return setError(parser, 1, 204);
for (i = 1; i <= n; i++) for (i = 1; i <= n; i++)
{ {
if ((j = findlink(net, parser->Tok[i])) == 0) return setError(parser, i, 210); if ((j = findlink(net, parser->Tok[i])) == 0) return setError(parser, i, 204);
net->Link[j].Rpt = 1; net->Link[j].Rpt = 1;
} }
rpt->Linkflag = 2; rpt->Linkflag = 2;

View File

@@ -43,7 +43,7 @@ int main(int argc, char *argv[])
int error = 0; int error = 0;
int ruleCount, nP, nTA, nEA; int ruleCount, nP, nTA, nEA;
int link113, node23, link22, pump9_before, pump9_after; int link113, node23, link22, pump9_before, pump9_after;
float priority; double priority;
EN_Project ph = NULL; EN_Project ph = NULL;
EN_createproject(&ph); EN_createproject(&ph);

View File

@@ -34,7 +34,7 @@ BOOST_AUTO_TEST_CASE(test_net_builder)
int flag = 00; int flag = 00;
long t, tstep; long t, tstep;
int i, ind, Lindex, Nindex, Cindex; int i, ind, Lindex, Nindex, Cindex;
float h_orig, h_build, h_build_loaded; double h_orig, h_build, h_build_loaded;
// first we load Net1.inp, run it and record the head in Tank 2 at the end of the simulation (h_orig) // first we load Net1.inp, run it and record the head in Tank 2 at the end of the simulation (h_orig)
EN_Project ph = NULL; EN_Project ph = NULL;
@@ -80,13 +80,13 @@ BOOST_AUTO_TEST_CASE(test_net_builder)
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// now we build Net1 from scratch... // now we build Net1 from scratch...
char juncs[9][10] = { "10", "11", "12", "13", "21", "22", "23", "31", "32" }; char juncs[9][10] = { "10", "11", "12", "13", "21", "22", "23", "31", "32" };
float e[9] = {710, 710, 700, 695, 700, 695, 690, 700, 710}; double e[9] = {710, 710, 700, 695, 700, 695, 690, 700, 710};
float d[9] = {0, 150, 150, 100, 150, 200, 150, 100, 100 }; double d[9] = {0, 150, 150, 100, 150, 200, 150, 100, 100 };
float X[9] = {20, 30, 50, 70, 30, 50, 70, 30, 50}; double X[9] = {20, 30, 50, 70, 30, 50, 70, 30, 50};
float Y[9] = {70, 70, 70, 70, 40, 40, 40, 10, 10 }; double Y[9] = {70, 70, 70, 70, 40, 40, 40, 10, 10 };
float L[12] = {10530, 5280, 5280, 5280, 5280, 5280, 200, 5280, 5280, 5280, 5280, 5280}; double L[12] = {10530, 5280, 5280, 5280, 5280, 5280, 200, 5280, 5280, 5280, 5280, 5280};
float dia[12] = { 18, 14, 10, 10, 12, 6, 18, 10, 12, 8, 8, 6 }; double dia[12] = { 18, 14, 10, 10, 12, 6, 18, 10, 12, 8, 8, 6 };
float P[12] = { 1.0f, 1.2f, 1.4f, 1.6f, 1.4f, 1.2f, 1.0f, 0.8f, 0.6f, 0.4f, 0.6f, 0.8f }; double P[12] = { 1.0f, 1.2f, 1.4f, 1.6f, 1.4f, 1.2f, 1.0f, 0.8f, 0.6f, 0.4f, 0.6f, 0.8f };
error = EN_createproject(&ph); error = EN_createproject(&ph);
error = EN_init(ph, "net.rpt", "net.out", EN_GPM, EN_HW); error = EN_init(ph, "net.rpt", "net.out", EN_GPM, EN_HW);
@@ -187,9 +187,9 @@ BOOST_AUTO_TEST_CASE(test_net_builder)
BOOST_REQUIRE(error == 0); BOOST_REQUIRE(error == 0);
// Add controls // Add controls
error = EN_addcontrol(ph, &Cindex, EN_LOWLEVEL, Lindex, 1, Nindex, 110); error = EN_addcontrol(ph, EN_LOWLEVEL, Lindex, 1, Nindex, 110, &Cindex);
BOOST_REQUIRE(error == 0); BOOST_REQUIRE(error == 0);
error = EN_addcontrol(ph, &Cindex, EN_HILEVEL, Lindex, 0, Nindex, 140); error = EN_addcontrol(ph, EN_HILEVEL, Lindex, 0, Nindex, 140, &Cindex);
BOOST_REQUIRE(error == 0); BOOST_REQUIRE(error == 0);
error = EN_openH(ph); error = EN_openH(ph);
@@ -250,10 +250,10 @@ BOOST_AUTO_TEST_CASE(test_net_builder)
// if we got this far we can compare results // if we got this far we can compare results
// compare the original to the build & saved network // compare the original to the build & saved network
BOOST_REQUIRE(h_orig == h_build_loaded); BOOST_REQUIRE(abs(h_orig - h_build_loaded) < 0.0001);
// compare the original to the build without saving // compare the original to the build without saving
BOOST_REQUIRE(h_orig == h_build); // this seems to fail :( BOOST_REQUIRE(abs(h_orig - h_build) < 0.0001);
} }

View File

@@ -36,8 +36,8 @@ int main(int argc, char *argv[])
int index; int index;
char id[EN_MAXID+1]; char id[EN_MAXID+1];
float p1_1, p2_1, p1_2, p2_2; double p1_1, p2_1, p1_2, p2_2;
float q1_1, q2_1, q1_2, q2_2; double q1_1, q2_1, q1_2, q2_2;
// Create & initialize a project // Create & initialize a project
EN_Project ph = NULL; EN_Project ph = NULL;
@@ -100,10 +100,10 @@ int main(int argc, char *argv[])
cout << "\n Link L2 Flow: " << q2_1 << " " << q2_2; cout << "\n Link L2 Flow: " << q2_1 << " " << q2_2;
// Compare old & new results // Compare old & new results
BOOST_REQUIRE(p1_1 == p1_2); BOOST_REQUIRE(abs(p1_1 - p1_2) < 1.e-5);
BOOST_REQUIRE(p2_1 == p2_2); BOOST_REQUIRE(abs(p2_1 - p2_2) < 1.e-5);
BOOST_REQUIRE(q1_1 == q1_2); BOOST_REQUIRE(abs(q1_1 - q1_2) < 1.e-5);
BOOST_REQUIRE(q2_1 == q2_2); BOOST_REQUIRE(abs(q2_1 - q2_2) < 1.e-5);
// Close project // Close project
EN_close(ph); EN_close(ph);

View File

@@ -27,7 +27,7 @@ BOOST_AUTO_TEST_CASE(test_setlinktype)
{ {
int error = 0; int error = 0;
int p113, n31, p121, n113_1, n113_2; int p113, n31, p121, n113_1, n113_2;
float q113 = 0.0f, p31 = 0.0f, diam; double q113 = 0.0, p31 = 0.0, diam;
EN_Project ph = NULL; EN_Project ph = NULL;
EN_createproject(&ph); EN_createproject(&ph);

View File

@@ -301,7 +301,7 @@ BOOST_FIXTURE_TEST_CASE(test_add_control, Fixture)
{ {
int flag = 00; int flag = 00;
long t, tstep; long t, tstep;
float h1, h2; double h1, h2;
int Cindex; int Cindex;
// run with original controls // run with original controls
@@ -328,10 +328,10 @@ BOOST_FIXTURE_TEST_CASE(test_add_control, Fixture)
BOOST_REQUIRE(error == 0); BOOST_REQUIRE(error == 0);
// add new controls // add new controls
error = EN_addcontrol(ph, &Cindex, 0, 13, 1, 11, 110); error = EN_addcontrol(ph, 0, 13, 1, 11, 110, &Cindex);
BOOST_REQUIRE(error == 0); BOOST_REQUIRE(error == 0);
BOOST_CHECK(Cindex == 3); BOOST_CHECK(Cindex == 3);
error = EN_addcontrol(ph, &Cindex, 1, 13, 0, 11, 140); error = EN_addcontrol(ph, 1, 13, 0, 11, 140, &Cindex);
BOOST_REQUIRE(error == 0); BOOST_REQUIRE(error == 0);
BOOST_CHECK(Cindex == 4); BOOST_CHECK(Cindex == 4);
@@ -352,7 +352,7 @@ BOOST_FIXTURE_TEST_CASE(test_add_control, Fixture)
error = EN_closeH(ph); error = EN_closeH(ph);
BOOST_REQUIRE(error == 0); BOOST_REQUIRE(error == 0);
BOOST_CHECK(h1 == h2); // end head should be the same with new controls BOOST_CHECK(abs(h1 - h2) < 1.e-5); // end head should be the same with new controls
} }
BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE_END()