Merge pull request #372 from LRossman/lrossman-dev
New updates to address compiler warnings (issue #370)
This commit is contained in:
@@ -261,7 +261,7 @@ Public Const EN_R_IS_ACTIVE = 3
|
|||||||
Declare Function ENsetstatusreport Lib "epanet2.dll" (ByVal level As Int32) As Int32
|
Declare Function ENsetstatusreport Lib "epanet2.dll" (ByVal level As Int32) As Int32
|
||||||
Declare Function ENgetcount Lib "epanet2.dll" (ByVal object As Int32, count 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 String, ByVal maxLen 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 type 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 option As Int32, value As Single) As Int32
|
Declare Function ENgetoption Lib "epanet2.dll" (ByVal option As Int32, value As Single) As Int32
|
||||||
@@ -289,8 +289,8 @@ Public Const EN_R_IS_ACTIVE = 3
|
|||||||
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" (type As Int32, pmin As Single, preq As Single, 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 type 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 nodeIndex As Int32, numDemands As Int32) As Int32
|
Declare Function ENgetnumdemands Lib "epanet2.dll" (ByVal nodeIndex As Int32, numDemands As Int32) As Int32
|
||||||
Declare Function ENgetbasedemand Lib "epanet2.dll" (ByVal nodeIndex As Int32, ByVal demandIndex As Int32, value As Single) As Int32
|
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 nodeIndex As Int32, ByVal demandIndex As Int32, ByVal BaseDemand As Single) As Int32
|
Declare Function ENsetbasedemand Lib "epanet2.dll" (ByVal nodeIndex As Int32, ByVal demandIndex As Int32, ByVal BaseDemand As Single) As Int32
|
||||||
@@ -322,28 +322,28 @@ Public Const EN_R_IS_ACTIVE = 3
|
|||||||
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, 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 String) 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, len 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, 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, 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, values As Any, ByVal len 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, 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 String) 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, len 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 index As Int32, type 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 curveIndex As Int32, ByVal pointIndex As Int32, x As Single, 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 curveIndex As Int32, ByVal pointIndex 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 index As Int32, ByVal id As String, nPoints As Int32, xValues As Any, yValues As Any) As Int32
|
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, xValues As Any, yValues As Any, ByVal nPoints 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" (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 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 index As Int32) As Int32
|
Declare Function ENdeletecontrol Lib "epanet2.dll" (ByVal index As Int32) 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 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 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
|
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
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,15 +1,15 @@
|
|||||||
/** @file epanet2_enums.h
|
/** @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: enumerations of symbolic constants used by the API
|
Description: enumerations of symbolic constants used by the API functions
|
||||||
Authors: see AUTHORS
|
Authors: see AUTHORS
|
||||||
Copyright: see AUTHORS
|
Copyright: see AUTHORS
|
||||||
License: see LICENSE
|
License: see LICENSE
|
||||||
Last Updated: 01/08/2019
|
Last Updated: 01/14/2019
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -23,65 +23,78 @@
|
|||||||
#define EN_MAXID 31 //!< Max. # characters in ID name
|
#define EN_MAXID 31 //!< Max. # characters in ID name
|
||||||
#define EN_MAXMSG 255 //!< Max. # characters in message text
|
#define EN_MAXMSG 255 //!< Max. # characters in message text
|
||||||
|
|
||||||
/// Node property codes
|
/// Node properties
|
||||||
|
/**
|
||||||
|
These node properties can be accessed with @ref EN_getnodevalue and
|
||||||
|
@ref EN_setnodevalue. Those marked as read only are computed values that can
|
||||||
|
only be retrieved.
|
||||||
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
EN_ELEVATION = 0, //!< Elevation
|
EN_ELEVATION = 0, //!< Elevation
|
||||||
EN_BASEDEMAND = 1, //!< Junction baseline demand, from last demand category
|
EN_BASEDEMAND = 1, //!< Primary demand baseline value
|
||||||
EN_PATTERN = 2, //!< Junction baseline demand pattern
|
EN_PATTERN = 2, //!< Primary demand time pattern index
|
||||||
EN_EMITTER = 3, //!< Junction emitter coefficient
|
EN_EMITTER = 3, //!< Emitter flow coefficient
|
||||||
EN_INITQUAL = 4, //!< Initial quality
|
EN_INITQUAL = 4, //!< Initial quality
|
||||||
EN_SOURCEQUAL = 5, //!< Quality source strength
|
EN_SOURCEQUAL = 5, //!< Quality source strength
|
||||||
EN_SOURCEPAT = 6, //!< Quality source pattern
|
EN_SOURCEPAT = 6, //!< Quality source pattern index
|
||||||
EN_SOURCETYPE = 7, //!< Qualiy source type
|
EN_SOURCETYPE = 7, //!< Quality source type (see @ref EN_SourceType)
|
||||||
EN_TANKLEVEL = 8, //!< Current computed tank water level
|
EN_TANKLEVEL = 8, //!< Current computed tank water level (read only)
|
||||||
EN_DEMAND = 9, //!< Current computed demand
|
EN_DEMAND = 9, //!< Current computed demand (read only)
|
||||||
EN_HEAD = 10, //!< Current computed hydraulic head
|
EN_HEAD = 10, //!< Current computed hydraulic head (read only)
|
||||||
EN_PRESSURE = 11, //!< Current computed pressure
|
EN_PRESSURE = 11, //!< Current computed pressure (read only)
|
||||||
EN_QUALITY = 12, //!< Current computed quality
|
EN_QUALITY = 12, //!< Current computed quality (read only)
|
||||||
EN_SOURCEMASS = 13, //!< Current computed quality source mass inflow
|
EN_SOURCEMASS = 13, //!< Current computed quality source mass inflow (read only)
|
||||||
EN_INITVOLUME = 14, //!< Tank initial volume
|
EN_INITVOLUME = 14, //!< Tank initial volume (read only)
|
||||||
EN_MIXMODEL = 15, //!< Tank mixing model
|
EN_MIXMODEL = 15, //!< Tank mixing model (see @ref EN_MixingModel)
|
||||||
EN_MIXZONEVOL = 16, //!< Tank mixing zone volume
|
EN_MIXZONEVOL = 16, //!< Tank mixing zone volume (read only)
|
||||||
EN_TANKDIAM = 17, //!< Tank diameter
|
EN_TANKDIAM = 17, //!< Tank diameter
|
||||||
EN_MINVOLUME = 18, //!< Tank minimum volume
|
EN_MINVOLUME = 18, //!< Tank minimum volume
|
||||||
EN_VOLCURVE = 19, //!< Tank volume curve
|
EN_VOLCURVE = 19, //!< Tank volume curve index
|
||||||
EN_MINLEVEL = 20, //!< Tank minimum level
|
EN_MINLEVEL = 20, //!< Tank minimum level
|
||||||
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, //!< Current computed tank volume
|
EN_TANKVOLUME = 24, //!< Current computed tank volume (read only)
|
||||||
EN_MAXVOLUME = 25 //!< Tank maximum volume
|
EN_MAXVOLUME = 25 //!< Tank maximum volume (read only)
|
||||||
} EN_NodeProperty;
|
} EN_NodeProperty;
|
||||||
|
|
||||||
/// Link property codes
|
/// Link properties
|
||||||
|
/**
|
||||||
|
These link properties can be accessed with @ref EN_getlinkvalue and @ref EN_setlinkvalue.
|
||||||
|
Those marked as read only are computed values that can only be retrieved.
|
||||||
|
*/
|
||||||
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 (see @ref EN_LinkStatusType)
|
||||||
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 computed flow rate
|
EN_FLOW = 8, //!< Current computed flow rate (read only)
|
||||||
EN_VELOCITY = 9, //!< Current computed flow velocity
|
EN_VELOCITY = 9, //!< Current computed flow velocity (read only)
|
||||||
EN_HEADLOSS = 10, //!< Current computed head loss
|
EN_HEADLOSS = 10, //!< Current computed head loss (read only)
|
||||||
EN_STATUS = 11, //!< Current link status
|
EN_STATUS = 11, //!< Current link status (see @ref EN_LinkStatusType)
|
||||||
EN_SETTING = 12, //!< Current link setting
|
EN_SETTING = 12, //!< Current link setting
|
||||||
EN_ENERGY = 13, //!< Current computed pump energy usage
|
EN_ENERGY = 13, //!< Current computed pump energy usage (read only)
|
||||||
EN_LINKQUAL = 14, //!< Current computed link quality
|
EN_LINKQUAL = 14, //!< Current computed link quality (read only)
|
||||||
EN_LINKPATTERN = 15, //!< Pump speed time pattern
|
EN_LINKPATTERN = 15, //!< Pump speed time pattern index
|
||||||
|
EN_PUMP_STATE = 16, //!< Current computed pump state (read only) (see @ref EN_PumpStateType)
|
||||||
EN_PUMP_STATE = 16, //!< Current computed pump state
|
EN_PUMP_EFFIC = 17, //!< Current computed pump efficiency (read only)
|
||||||
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 index
|
||||||
EN_PUMP_ECURVE = 20, //!< Pump efficiency v. flow curve
|
EN_PUMP_ECURVE = 20, //!< Pump efficiency v. flow curve index
|
||||||
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 index
|
||||||
} EN_LinkProperty;
|
} EN_LinkProperty;
|
||||||
|
|
||||||
/// Time parameter codes (all in seconds)
|
/// Time parameters
|
||||||
|
/**
|
||||||
|
These time parameters are accessed using @ref EN_gettimeparam and@ref EN_settimeparam.
|
||||||
|
All times are expressed in seconds The parameters marked as read only are
|
||||||
|
computed values that can only be retrieved.
|
||||||
|
*/
|
||||||
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
|
||||||
@@ -90,18 +103,23 @@ typedef enum {
|
|||||||
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-based control evaluation time step
|
||||||
EN_STATISTIC = 8, //!< Reporting statistic code
|
EN_STATISTIC = 8, //!< Reporting statistic code (see @ref EN_StatisticType)
|
||||||
EN_PERIODS = 9, //!< Number of reporting time periods
|
EN_PERIODS = 9, //!< Number of reporting time periods (read only)
|
||||||
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 (read only)
|
||||||
EN_QTIME = 12, //!< Elapsed time of current quality solution
|
EN_QTIME = 12, //!< Elapsed time of current quality solution (read only)
|
||||||
EN_HALTFLAG = 13, //!< Flag indicating if the simulation was halted
|
EN_HALTFLAG = 13, //!< Flag indicating if the simulation was halted (read only)
|
||||||
EN_NEXTEVENT = 14, //!< Next time until a tank becomes empty or full
|
EN_NEXTEVENT = 14, //!< Shortest time until a tank becomes empty or full (read only)
|
||||||
EN_NEXTEVENTIDX = 15 //!< Index of next tank that becomes empty or full
|
EN_NEXTEVENTTANK = 15 //!< Index of tank with shortest time to become empty or full (read only)
|
||||||
} EN_TimeProperty;
|
} EN_TimeParameter;
|
||||||
|
|
||||||
/// Statistics for the most current hydraulic/quality analysis made
|
/// Analysis convergence statistics
|
||||||
|
/**
|
||||||
|
These statistics report the convergence criteria for the most current hydraulic analysis
|
||||||
|
and the cumulative water quality mass balance error at the current simulation time. They
|
||||||
|
can be retrieved with @ref EN_getstatistic.
|
||||||
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
EN_ITERATIONS = 0, //!< Number of hydraulic iterations taken
|
EN_ITERATIONS = 0, //!< Number of hydraulic iterations taken
|
||||||
EN_RELATIVEERROR = 1, //!< Sum of link flow changes / sum of link flows
|
EN_RELATIVEERROR = 1, //!< Sum of link flow changes / sum of link flows
|
||||||
@@ -110,7 +128,10 @@ typedef enum {
|
|||||||
EN_MASSBALANCE = 4 //!< Cumulative water quality mass balance ratio
|
EN_MASSBALANCE = 4 //!< Cumulative water quality mass balance ratio
|
||||||
} EN_AnalysisStatistic;
|
} EN_AnalysisStatistic;
|
||||||
|
|
||||||
/// Object count codes
|
/// Types of objects to count
|
||||||
|
/**
|
||||||
|
These options tell @ref EN_getcount which type of object to count.
|
||||||
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
EN_NODECOUNT = 0, //!< Number of nodes (junctions + 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
|
||||||
@@ -121,14 +142,20 @@ typedef enum {
|
|||||||
EN_RULECOUNT = 6 //!< Number of rule-based controls
|
EN_RULECOUNT = 6 //!< Number of rule-based controls
|
||||||
} EN_CountType;
|
} EN_CountType;
|
||||||
|
|
||||||
/// Node type codes
|
/// Types of nodes
|
||||||
|
/**
|
||||||
|
These are the different types of nodes that can be returned by calling @ref EN_getnodetype.
|
||||||
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
EN_JUNCTION = 0, //!< Junction node
|
EN_JUNCTION = 0, //!< Junction node
|
||||||
EN_RESERVOIR = 1, //!< Reservoir node
|
EN_RESERVOIR = 1, //!< Reservoir node
|
||||||
EN_TANK = 2 //!< Storage tank node
|
EN_TANK = 2 //!< Storage tank node
|
||||||
} EN_NodeType;
|
} EN_NodeType;
|
||||||
|
|
||||||
/// Link type codes
|
/// Types of links
|
||||||
|
/**
|
||||||
|
These are the different types of links that can be returned by calling @ref EN_getlinktype.
|
||||||
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
EN_CVPIPE = 0, //!< Pipe with check valve
|
EN_CVPIPE = 0, //!< Pipe with check valve
|
||||||
EN_PIPE = 1, //!< Pipe
|
EN_PIPE = 1, //!< Pipe
|
||||||
@@ -141,7 +168,36 @@ typedef enum {
|
|||||||
EN_GPV = 8 //!< General purpose valve
|
EN_GPV = 8 //!< General purpose valve
|
||||||
} EN_LinkType;
|
} EN_LinkType;
|
||||||
|
|
||||||
/// Water quality analysis types
|
/// Link status
|
||||||
|
/**
|
||||||
|
One of these values is returned when @ref EN_getlinkvalue is used to retrieve a link's
|
||||||
|
initial status (EN_INITSTATUS) or its current status (EN_STATUS). These options are
|
||||||
|
also used with @ref EN_setlinkvalue to set values for these same properties.
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
EN_CLOSED = 0,
|
||||||
|
EN_OPEN = 1
|
||||||
|
} EN_LinkStatusType;
|
||||||
|
|
||||||
|
/// Pump states
|
||||||
|
/**
|
||||||
|
One of these codes is returned when @ref EN_getlinkvalue is used to retrieve a pump's
|
||||||
|
current operating state (EN_PUMP_STATE). EN_PUMP_XHEAD indicates that the pump has been
|
||||||
|
shut down because it is being asked to deliver more than its shutoff head. EN_PUMP_XFLOW
|
||||||
|
indicates that the pump is being asked to deliver more than its maximum flow.
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
EN_PUMP_XHEAD = 0, //!< Pump closed - cannot supply head
|
||||||
|
EN_PUMP_CLOSED = 2, //!< Pump closed
|
||||||
|
EN_PUMP_OPEN = 3, //!< Pump open
|
||||||
|
EN_PUMP_XFLOW = 5 //!< Pump open - cannot supply flow
|
||||||
|
} EN_PumpStateType;
|
||||||
|
|
||||||
|
/// Types of water quality analyses
|
||||||
|
/**
|
||||||
|
These are the different types of water quality analyses that EPANET can run. They
|
||||||
|
are used with @ref EN_getqualinfo, @ref EN_getqualtype, and @ref EN_setqualtype.
|
||||||
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
EN_NONE = 0, //!< No quality analysis
|
EN_NONE = 0, //!< No quality analysis
|
||||||
EN_CHEM = 1, //!< Chemical fate and transport
|
EN_CHEM = 1, //!< Chemical fate and transport
|
||||||
@@ -149,22 +205,40 @@ typedef enum {
|
|||||||
EN_TRACE = 3 //!< Source tracing analysis
|
EN_TRACE = 3 //!< Source tracing analysis
|
||||||
} EN_QualityType;
|
} EN_QualityType;
|
||||||
|
|
||||||
/// Water quality source types
|
/// Types of water quality sources
|
||||||
|
/**
|
||||||
|
These are the options for EN_SOURCETYPE, the type of external water quality
|
||||||
|
source assigned to a node. They are used in @ref EN_getnodevalue and @ref EN_setnodevalue.
|
||||||
|
The EN_SOURCEQUAL property is used in these functions to access a source's strength
|
||||||
|
and EN_SOURCEPATTERN to access a time pattern applied to the source.
|
||||||
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
EN_CONCEN = 0, //!< Concentration inflow source
|
EN_CONCEN = 0, //!< Concentration of any external inflow entering a node
|
||||||
EN_MASS = 1, //!< Mass inflow source
|
EN_MASS = 1, //!< Injects a given mass/minute into a node
|
||||||
EN_SETPOINT = 2, //!< Concentration setpoint source
|
EN_SETPOINT = 2, //!< Sets the concentration leaving a node to a given value
|
||||||
EN_FLOWPACED = 3 //!< Concentration flow paced source
|
EN_FLOWPACED = 3 //!< Adds a given value to the concentration leaving a node
|
||||||
} EN_SourceType;
|
} EN_SourceType;
|
||||||
|
|
||||||
/// Head loss formulas
|
/// Head loss formula choices
|
||||||
|
/**
|
||||||
|
These are the choices for the EN_HEADLOSSFORM option in @ref EN_getoption and
|
||||||
|
@ref EN_setoption. They are also used for the head loss type argument in @ref EN_init.
|
||||||
|
Each head loss formula uses a different type of roughness coefficient (EN_ROUGHNESS)
|
||||||
|
that can be set with @ref EN_setlinkvalue.
|
||||||
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
EN_HW = 0, //!< Hazen-Williams
|
EN_HW = 0, //!< Hazen-Williams
|
||||||
EN_DW = 1, //!< Darcy-Weisbach
|
EN_DW = 1, //!< Darcy-Weisbach
|
||||||
EN_CM = 2 //!< Chezy-Manning
|
EN_CM = 2 //!< Chezy-Manning
|
||||||
} EN_HeadLossType;
|
} EN_HeadLossType;
|
||||||
|
|
||||||
/// Flow units types
|
/// Flow units choices
|
||||||
|
/**
|
||||||
|
These choices for flow units are used with @ref EN_getflowunits and @ref EN_setflowunits.
|
||||||
|
They are also used for the flow units type argument in @ref EN_init. If flow units are
|
||||||
|
expressed in US Customary units (EN_CFS through EN_AFD) then all other quantities are
|
||||||
|
in US Customary units. Otherwise they are in metric units.
|
||||||
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
EN_CFS = 0, //!< Cubic feet per second
|
EN_CFS = 0, //!< Cubic feet per second
|
||||||
EN_GPM = 1, //!< Gallons per minute
|
EN_GPM = 1, //!< Gallons per minute
|
||||||
@@ -178,39 +252,65 @@ typedef enum {
|
|||||||
EN_CMD = 9 //!< Cubic meters per day
|
EN_CMD = 9 //!< Cubic meters per day
|
||||||
} EN_FlowUnits;
|
} EN_FlowUnits;
|
||||||
|
|
||||||
/// Demand model types
|
/// Types of demand models
|
||||||
|
/**
|
||||||
|
These choices for representing consumer demands are used with @ref EN_getdemandmodel
|
||||||
|
and @ref EN_setdemandmodel.
|
||||||
|
|
||||||
|
A demand driven analysis requires that a junction's full demand be supplied
|
||||||
|
in each time period independent of how much pressure is available. A pressure
|
||||||
|
driven analysis makes demand be a power function of pressure, up to the point
|
||||||
|
where the full demand is met.
|
||||||
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
EN_DDA = 0, //!< Demand driven analysis
|
EN_DDA = 0, //!< Demand driven analysis
|
||||||
EN_PDA = 1 //!< Pressure driven analysis
|
EN_PDA = 1 //!< Pressure driven analysis
|
||||||
} EN_DemandModel;
|
} EN_DemandModel;
|
||||||
|
|
||||||
/// Simulation option codes
|
/// Simulation options
|
||||||
|
/**
|
||||||
|
These options specify hydraulic convergence criteria, choice of head loss formula, and
|
||||||
|
several other parameters applied on a network-wide basis. They are accessed using the
|
||||||
|
@ref EN_getoption and @ref EN_setoption functions.
|
||||||
|
*/
|
||||||
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, //!< Maximum total relative flow change for hydraulic convergence
|
||||||
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 in emitter discharge 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 head loss error for hydraulic convergence
|
||||||
EN_FLOWCHANGE = 6, //!< Maximum allowable flow change
|
EN_FLOWCHANGE = 6, //!< Maximum flow change for hydraulic convergence
|
||||||
EN_DEFDEMANDPAT = 7, //!< Default demand time pattern
|
EN_DEFDEMANDPAT = 7, //!< Index of the default demand time pattern
|
||||||
EN_HEADLOSSFORM = 8, //!< Head loss formula
|
EN_HEADLOSSFORM = 8, //!< Head loss formula (see @ref EN_HeadLossType)
|
||||||
EN_GLOBALEFFIC = 9, //!< Global pump efficiency
|
EN_GLOBALEFFIC = 9, //!< Global pump efficiency (percent)
|
||||||
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, //!< Index of a 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
|
/// Types of simple controls
|
||||||
|
/**
|
||||||
|
These are the different types of simple (single statement) controls that can be applied
|
||||||
|
to network links. They are used as an argument to @ref EN_addcontrol,@ref EN_getcontrol,
|
||||||
|
and @ref EN_setcontrol.
|
||||||
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
EN_LOWLEVEL = 0, //!< Act when level drops below a setpoint
|
EN_LOWLEVEL = 0, //!< Act when pressure or tank level drops below a setpoint
|
||||||
EN_HILEVEL = 1, //!< Act when level rises above a setpoint
|
EN_HILEVEL = 1, //!< Act when pressure or tank level rises above a setpoint
|
||||||
EN_TIMER = 2, //!< Act at a prescribed elapsed amount of time
|
EN_TIMER = 2, //!< Act at a prescribed elapsed amount of time
|
||||||
EN_TIMEOFDAY = 3 //!< Act at a particular time of day
|
EN_TIMEOFDAY = 3 //!< Act at a particular time of day
|
||||||
} EN_ControlType;
|
} EN_ControlType;
|
||||||
|
|
||||||
/// Reporting statistic types
|
/// Reporting statistic choices
|
||||||
|
/**
|
||||||
|
These options determine what kind of statistical post-processing should be done on
|
||||||
|
the time series of simulation results generated before they are reported using
|
||||||
|
@ref EN_report. An option can be chosen by using `STATISTIC option` as the argument
|
||||||
|
to @ref EN_setreport.
|
||||||
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
EN_SERIES = 0, //!< Report all time series points
|
||||||
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
|
||||||
@@ -218,6 +318,11 @@ typedef enum {
|
|||||||
} EN_StatisticType;
|
} EN_StatisticType;
|
||||||
|
|
||||||
/// Tank mixing models
|
/// Tank mixing models
|
||||||
|
/**
|
||||||
|
These are the different types of models that describe water quality mixing in storage tanks.
|
||||||
|
The choice of model is accessed with the EN_MIXMODEL property of a Tank node using
|
||||||
|
@ref EN_getnodevalue and @ref EN_setnodevalue.
|
||||||
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
EN_MIX1 = 0, //!< Complete mix model
|
EN_MIX1 = 0, //!< Complete mix model
|
||||||
EN_MIX2 = 1, //!< 2-compartment model
|
EN_MIX2 = 1, //!< 2-compartment model
|
||||||
@@ -226,14 +331,20 @@ typedef enum {
|
|||||||
} EN_MixingModel;
|
} EN_MixingModel;
|
||||||
|
|
||||||
/// Hydraulic initialization options
|
/// Hydraulic initialization options
|
||||||
|
/**
|
||||||
|
These options are used to initialize a new hydraulic analysis when @ref EN_initH is called.
|
||||||
|
*/
|
||||||
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_InitHydOption;
|
||||||
|
|
||||||
/// Pump curve types
|
/// Types of pump curves
|
||||||
|
/**
|
||||||
|
@ref EN_getpumptype returns one of these values when it is called.
|
||||||
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
EN_CONST_HP = 0, //!< Constant horsepower
|
EN_CONST_HP = 0, //!< Constant horsepower
|
||||||
EN_POWER_FUNC = 1, //!< Power function
|
EN_POWER_FUNC = 1, //!< Power function
|
||||||
@@ -241,36 +352,49 @@ typedef enum {
|
|||||||
EN_NOCURVE = 3 //!< No curve
|
EN_NOCURVE = 3 //!< No curve
|
||||||
} EN_PumpType;
|
} EN_PumpType;
|
||||||
|
|
||||||
/// Data curve types
|
/// Types of data curves
|
||||||
|
/**
|
||||||
|
These are the different types of physical relationships that a data curve could
|
||||||
|
represent as returned by calling @ref EN_getcurvetype.
|
||||||
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
EN_VOLUME_CURVE = 0, //!< Tank volume curve
|
EN_VOLUME_CURVE = 0, //!< Tank volume v. depth curve
|
||||||
EN_PUMP_CURVE = 1, //!< Pump head curve
|
EN_PUMP_CURVE = 1, //!< Pump head v. flow curve
|
||||||
EN_EFFIC_CURVE = 2, //!< Pump efficiency curve
|
EN_EFFIC_CURVE = 2, //!< Pump efficiency v. flow curve
|
||||||
EN_HLOSS_CURVE = 3, //!< Valve head loss curve
|
EN_HLOSS_CURVE = 3, //!< Valve head loss v. flow curve
|
||||||
EN_GENERIC_CURVE = 4 //!< Generic curve
|
EN_GENERIC_CURVE = 4 //!< Generic curve
|
||||||
} EN_CurveType;
|
} EN_CurveType;
|
||||||
|
|
||||||
/// Deletion action codes
|
/// Deletion action codes
|
||||||
|
/**
|
||||||
|
These codes are used in @ref EN_deletenode and @ref EN_deletelink to indicate what action
|
||||||
|
should be taken if the node or link being deleted appears in any simple or rule-based
|
||||||
|
controls.
|
||||||
|
*/
|
||||||
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;
|
||||||
|
|
||||||
/// Options for reporting on the status of the hydraulic solver at each time period
|
/// Status reporting levels
|
||||||
|
/**
|
||||||
|
These choices specify the level of status reporting written to a project's report
|
||||||
|
file during a hydraulic analysis. The level is set using the @ref EN_setstatusreport function.
|
||||||
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
EN_NO_REPORT = 0, //!< No status reporting
|
EN_NO_REPORT = 0, //!< No status reporting
|
||||||
EN_NORMAL_REPORT = 1, //!< Normal level of status reporting
|
EN_NORMAL_REPORT = 1, //!< Normal level of status reporting
|
||||||
EN_FULL_REPORT = 2 //!< Full level of status reporting
|
EN_FULL_REPORT = 2 //!< Full level of status reporting
|
||||||
} EN_StatusReport;
|
} EN_StatusReport;
|
||||||
|
|
||||||
/// Codes for objects referred to in the clauses of rule-based controls
|
/// Network objects used in rule-based controls
|
||||||
typedef enum {
|
typedef enum {
|
||||||
EN_R_NODE = 6, //!< Clause refers to a node
|
EN_R_NODE = 6, //!< Clause refers to a node
|
||||||
EN_R_LINK = 7, //!< Clause refers to a link
|
EN_R_LINK = 7, //!< Clause refers to a link
|
||||||
EN_R_SYSTEM = 8 //!< Clause refers to a system parameter (e.g., time)
|
EN_R_SYSTEM = 8 //!< Clause refers to a system parameter (e.g., time)
|
||||||
} EN_RuleObject;
|
} EN_RuleObject;
|
||||||
|
|
||||||
/// Codes for variables used in the clauses of rule-based controls
|
/// Object variables used in rule-based controls
|
||||||
typedef enum {
|
typedef enum {
|
||||||
EN_R_DEMAND = 0, //!< Nodal demand
|
EN_R_DEMAND = 0, //!< Nodal demand
|
||||||
EN_R_HEAD = 1, //!< Nodal hydraulic head
|
EN_R_HEAD = 1, //!< Nodal hydraulic head
|
||||||
@@ -287,7 +411,7 @@ typedef enum {
|
|||||||
EN_R_DRAINTIME = 12 //!< Time to drain a tank
|
EN_R_DRAINTIME = 12 //!< Time to drain a tank
|
||||||
} EN_RuleVariable;
|
} EN_RuleVariable;
|
||||||
|
|
||||||
/// Comparison operators used in the premises of rule-based controls
|
/// Comparison operators used in rule-based controls
|
||||||
typedef enum {
|
typedef enum {
|
||||||
EN_R_EQ = 0, //!< Equal to
|
EN_R_EQ = 0, //!< Equal to
|
||||||
EN_R_NE = 1, //!< Not equal
|
EN_R_NE = 1, //!< Not equal
|
||||||
@@ -301,7 +425,7 @@ typedef enum {
|
|||||||
EN_R_ABOVE = 9 //!< Is above
|
EN_R_ABOVE = 9 //!< Is above
|
||||||
} EN_RuleOperator;
|
} EN_RuleOperator;
|
||||||
|
|
||||||
/// Status codes used in the clauses of rule-based controls
|
/// Link status codes used in rule-based controls
|
||||||
typedef enum {
|
typedef enum {
|
||||||
EN_R_IS_OPEN = 1, //!< Link is open
|
EN_R_IS_OPEN = 1, //!< Link is open
|
||||||
EN_R_IS_CLOSED = 2, //!< Link is closed
|
EN_R_IS_CLOSED = 2, //!< Link is closed
|
||||||
|
|||||||
220
src/epanet.c
220
src/epanet.c
@@ -123,8 +123,8 @@ int DLLEXPORT EN_init(EN_Project p, const char *rptFile, const char *outFile,
|
|||||||
/*----------------------------------------------------------------
|
/*----------------------------------------------------------------
|
||||||
** Input: rptFile = name of report file
|
** Input: rptFile = name of report file
|
||||||
** outFile = name of binary output file
|
** outFile = name of binary output file
|
||||||
** unitsType = type of flow units (see EN_FlowUnits)
|
** unitsType = type of flow units (see FlowUnitsType)
|
||||||
** headLossType = type of head loss formula (see EN_HeadLossType)
|
** headLossType = type of head loss formula (see HeadLossType)
|
||||||
** Output: none
|
** Output: none
|
||||||
** Returns: error code
|
** Returns: error code
|
||||||
** Purpose: initializes an EPANET project that isn't opened with
|
** Purpose: initializes an EPANET project that isn't opened with
|
||||||
@@ -255,7 +255,7 @@ int DLLEXPORT EN_close(EN_Project p)
|
|||||||
** Input: none
|
** Input: none
|
||||||
** Output: none
|
** Output: none
|
||||||
** Returns: error code
|
** Returns: error code
|
||||||
** Purpose: frees all memory & files used by EPANET
|
** Purpose: frees all memory & files used by a project
|
||||||
**----------------------------------------------------------------
|
**----------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
@@ -367,7 +367,7 @@ int DLLEXPORT EN_saveH(EN_Project p)
|
|||||||
**----------------------------------------------------------------
|
**----------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
char tmpflag;
|
int tmpflag;
|
||||||
int errcode;
|
int errcode;
|
||||||
|
|
||||||
// Check if hydraulic results exist
|
// Check if hydraulic results exist
|
||||||
@@ -392,7 +392,7 @@ int DLLEXPORT EN_openH(EN_Project p)
|
|||||||
** Input: none
|
** Input: none
|
||||||
** Output: none
|
** Output: none
|
||||||
** Returns: error code
|
** Returns: error code
|
||||||
** Purpose: opens EPANET's hydraulic solver
|
** Purpose: opens a project's hydraulic solver
|
||||||
**----------------------------------------------------------------
|
**----------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
@@ -421,7 +421,7 @@ int DLLEXPORT EN_initH(EN_Project p, int initFlag)
|
|||||||
** results should be saved to file (1) or not (0)
|
** results should be saved to file (1) or not (0)
|
||||||
** Output: none
|
** Output: none
|
||||||
** Returns: error code
|
** Returns: error code
|
||||||
** Purpose: initializes EPANET's hydraulic solver
|
** Purpose: initializes a project's hydraulic solver
|
||||||
**----------------------------------------------------------------
|
**----------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
@@ -500,7 +500,7 @@ int DLLEXPORT EN_closeH(EN_Project p)
|
|||||||
** Input: none
|
** Input: none
|
||||||
** Output: none
|
** Output: none
|
||||||
** Returns: error code
|
** Returns: error code
|
||||||
** Purpose: closes EPANET's hydraulic solver
|
** Purpose: closes a project's hydraulic solver
|
||||||
**----------------------------------------------------------------
|
**----------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
@@ -516,7 +516,7 @@ int DLLEXPORT EN_savehydfile(EN_Project p, char *filename)
|
|||||||
** Output: none
|
** Output: none
|
||||||
** Returns: error code
|
** Returns: error code
|
||||||
** Purpose: saves results from a scratch hydraulics file to a
|
** Purpose: saves results from a scratch hydraulics file to a
|
||||||
** permanent one.
|
** permanent one
|
||||||
**----------------------------------------------------------------
|
**----------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
@@ -543,8 +543,8 @@ int DLLEXPORT EN_usehydfile(EN_Project p, char *filename)
|
|||||||
** Input: filename = name of previously saved hydraulics file
|
** Input: filename = name of previously saved hydraulics file
|
||||||
** Output: none
|
** Output: none
|
||||||
** Returns: error code
|
** Returns: error code
|
||||||
** Purpose: uses contents of a previous saved hydraulics file to
|
** Purpose: uses contents of a previously saved hydraulics file to
|
||||||
** run a water quality analysis.
|
** run a water quality analysis
|
||||||
**----------------------------------------------------------------
|
**----------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
@@ -626,7 +626,7 @@ int DLLEXPORT EN_openQ(EN_Project p)
|
|||||||
** Input: none
|
** Input: none
|
||||||
** Output: none
|
** Output: none
|
||||||
** Returns: error code
|
** Returns: error code
|
||||||
** Purpose: opens EPANET's water quality solver
|
** Purpose: opens a project's water quality solver
|
||||||
**----------------------------------------------------------------
|
**----------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
@@ -694,7 +694,7 @@ int DLLEXPORT EN_nextQ(EN_Project p, long *tStep)
|
|||||||
** Output: tStep = time step over which water quality is updated (sec)
|
** Output: tStep = time step over which water quality is updated (sec)
|
||||||
** Returns: error code
|
** Returns: error code
|
||||||
** Purpose: updates water quality throughout the network until
|
** Purpose: updates water quality throughout the network until
|
||||||
** next hydraulic event occurs.
|
** next hydraulic event occurs
|
||||||
**----------------------------------------------------------------
|
**----------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
@@ -717,7 +717,7 @@ int DLLEXPORT EN_stepQ(EN_Project p, long *timeLeft)
|
|||||||
** Output: timeLeft = amount of simulation time remaining (sec)
|
** Output: timeLeft = amount of simulation time remaining (sec)
|
||||||
** Returns: error code
|
** Returns: error code
|
||||||
** Purpose: updates water quality throughout the network over
|
** Purpose: updates water quality throughout the network over
|
||||||
** fixed time step.
|
** fixed time step
|
||||||
**----------------------------------------------------------------
|
**----------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
@@ -739,7 +739,7 @@ int DLLEXPORT EN_closeQ(EN_Project p)
|
|||||||
** Input: none
|
** Input: none
|
||||||
** Output: none
|
** Output: none
|
||||||
** Returns: error code
|
** Returns: error code
|
||||||
** Purpose: closes EPANET's water quality solver
|
** Purpose: closes a project's water quality solver
|
||||||
**----------------------------------------------------------------
|
**----------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
@@ -760,7 +760,7 @@ int DLLEXPORT EN_writeline(EN_Project p, char *line)
|
|||||||
** Input: line = line of text
|
** Input: line = line of text
|
||||||
** Output: none
|
** Output: none
|
||||||
** Returns: error code
|
** Returns: error code
|
||||||
** Purpose: write a line of text to the project's report file
|
** Purpose: write a line of text to a project's report file
|
||||||
**----------------------------------------------------------------
|
**----------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
@@ -774,7 +774,7 @@ int DLLEXPORT EN_report(EN_Project p)
|
|||||||
** Input: none
|
** Input: none
|
||||||
** Output: none
|
** Output: none
|
||||||
** Returns: error code
|
** Returns: error code
|
||||||
** Purpose: writes formatted simulation results to the project's
|
** Purpose: writes formatted simulation results to a project's
|
||||||
** report file
|
** report file
|
||||||
**----------------------------------------------------------------
|
**----------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@@ -858,11 +858,11 @@ int DLLEXPORT EN_getversion(int *version)
|
|||||||
** Input: none
|
** Input: none
|
||||||
** Output: version = version number of the source code
|
** Output: version = version number of the source code
|
||||||
** Returns: error code (should always be 0)
|
** Returns: error code (should always be 0)
|
||||||
** Purpose: retrieves a number assigned to the most recent
|
** Purpose: retrieves the toolkit API version number
|
||||||
** update of the source code. This number, set by the
|
**
|
||||||
** constant CODEVERSION found in TYPES.H, is to be
|
** The version number is set by the constant CODEVERSION found in
|
||||||
** interpreted with implied decimals, i.e.,
|
** TYPES.H and is to be interpreted with implied decimals, i.e.,
|
||||||
** "20100" == "2(.)01(.)00"
|
** "20100" == "2(.)01(.)00".
|
||||||
**----------------------------------------------------------------
|
**----------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
@@ -875,7 +875,7 @@ int DLLEXPORT EN_getcount(EN_Project p, int object, int *count)
|
|||||||
** Input: object = type of object to count (see EN_CountType)
|
** Input: object = type of object to count (see EN_CountType)
|
||||||
** Output: count = number of objects of the specified type
|
** Output: count = number of objects of the specified type
|
||||||
** Returns: error code
|
** Returns: error code
|
||||||
** Purpose: Retrieves number of network objects of a given type.
|
** Purpose: Retrieves number of network objects of a given type
|
||||||
**----------------------------------------------------------------
|
**----------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
@@ -1283,7 +1283,7 @@ int DLLEXPORT EN_setflowunits(EN_Project p, int units)
|
|||||||
|
|
||||||
int DLLEXPORT EN_gettimeparam(EN_Project p, int param, long *value)
|
int DLLEXPORT EN_gettimeparam(EN_Project p, int param, long *value)
|
||||||
/*----------------------------------------------------------------
|
/*----------------------------------------------------------------
|
||||||
** Input: param = time parameter code (see EN_TimeProperty)
|
** Input: param = time parameter code (see EN_TimeParameter)
|
||||||
** Output: value = time parameter value
|
** Output: value = time parameter value
|
||||||
** Returns: error code
|
** Returns: error code
|
||||||
** Purpose: retrieves the value of a time parameter
|
** Purpose: retrieves the value of a time parameter
|
||||||
@@ -1297,7 +1297,7 @@ int DLLEXPORT EN_gettimeparam(EN_Project p, int param, long *value)
|
|||||||
|
|
||||||
*value = 0;
|
*value = 0;
|
||||||
if (!p->Openflag) return 102;
|
if (!p->Openflag) return 102;
|
||||||
if (param < EN_DURATION || param > EN_NEXTEVENTIDX) return 251;
|
if (param < EN_DURATION || param > EN_NEXTEVENTTANK) return 251;
|
||||||
switch (param)
|
switch (param)
|
||||||
{
|
{
|
||||||
case EN_DURATION:
|
case EN_DURATION:
|
||||||
@@ -1341,7 +1341,7 @@ int DLLEXPORT EN_gettimeparam(EN_Project p, int param, long *value)
|
|||||||
// or the time to next full/empty tank
|
// or the time to next full/empty tank
|
||||||
tanktimestep(p, value);
|
tanktimestep(p, value);
|
||||||
break;
|
break;
|
||||||
case EN_NEXTEVENTIDX:
|
case EN_NEXTEVENTTANK:
|
||||||
*value = time->Hstep;
|
*value = time->Hstep;
|
||||||
i = tanktimestep(p, value);
|
i = tanktimestep(p, value);
|
||||||
*value = i;
|
*value = i;
|
||||||
@@ -1352,7 +1352,7 @@ int DLLEXPORT EN_gettimeparam(EN_Project p, int param, long *value)
|
|||||||
|
|
||||||
int DLLEXPORT EN_settimeparam(EN_Project p, int param, long value)
|
int DLLEXPORT EN_settimeparam(EN_Project p, int param, long value)
|
||||||
/*----------------------------------------------------------------
|
/*----------------------------------------------------------------
|
||||||
** Input: param = time parameter code (see EN_TimeProperty)
|
** Input: param = time parameter code (see EN_TimeParameter)
|
||||||
** value = time parameter value
|
** value = time parameter value
|
||||||
** Output: none
|
** Output: none
|
||||||
** Returns: error code
|
** Returns: error code
|
||||||
@@ -1493,7 +1493,7 @@ int DLLEXPORT EN_setqualtype(EN_Project p, int qualType, char *chemName,
|
|||||||
** Input: qualType = type of quality analysis to run (see EN_QualityType)
|
** Input: qualType = type of quality analysis to run (see EN_QualityType)
|
||||||
** chemname = name of chemical constituent
|
** chemname = name of chemical constituent
|
||||||
** chemunits = concentration units of constituent
|
** chemunits = concentration units of constituent
|
||||||
** tracenode = index of node being traced (if applicable)
|
** tracenode = ID name of node being traced (if applicable)
|
||||||
** Output: none
|
** Output: none
|
||||||
** Returns: error code
|
** Returns: error code
|
||||||
** Purpose: sets water quality analysis options
|
** Purpose: sets water quality analysis options
|
||||||
@@ -1701,13 +1701,13 @@ int DLLEXPORT EN_deletenode(EN_Project p, int index, int actionCode)
|
|||||||
** its links appear in a control and returns an error code
|
** its links appear in a control and returns an error code
|
||||||
** Output: none
|
** Output: none
|
||||||
** Returns: error code
|
** Returns: error code
|
||||||
** Purpose: deletes a node from a project.
|
** Purpose: deletes a node from a project
|
||||||
**----------------------------------------------------------------
|
**----------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
Network *net = &p->network;
|
Network *net = &p->network;
|
||||||
|
|
||||||
int i, nodeType, tankindex, numControls = 0;
|
int i, nodeType, tankindex;
|
||||||
Snode *node;
|
Snode *node;
|
||||||
Pdemand demand, nextdemand;
|
Pdemand demand, nextdemand;
|
||||||
Psource source;
|
Psource source;
|
||||||
@@ -2350,7 +2350,7 @@ int DLLEXPORT EN_setjuncdata(EN_Project p, int index, double elev,
|
|||||||
** dmndpat = name of primary demand time pattern
|
** dmndpat = name of primary demand time pattern
|
||||||
** Output: none
|
** Output: none
|
||||||
** Returns: error code
|
** Returns: error code
|
||||||
** Purpose: sets several properties for a junction node.
|
** Purpose: sets several properties for a junction node
|
||||||
**----------------------------------------------------------------
|
**----------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
@@ -2406,7 +2406,7 @@ int DLLEXPORT EN_settankdata(EN_Project p, int index, double elev,
|
|||||||
** volCurve = name of curve for volume v. level
|
** volCurve = name of curve for volume v. level
|
||||||
** Output: none
|
** Output: none
|
||||||
** Returns: error code
|
** Returns: error code
|
||||||
** Purpose: sets several properties for a tank node.
|
** Purpose: sets several properties for a tank node
|
||||||
**----------------------------------------------------------------
|
**----------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
@@ -2415,7 +2415,6 @@ int DLLEXPORT EN_settankdata(EN_Project p, int index, double elev,
|
|||||||
int i, j, n, curveIndex = 0;
|
int i, j, n, curveIndex = 0;
|
||||||
double area, elevation = elev;
|
double area, elevation = elev;
|
||||||
double *Ucf = p->Ucf;
|
double *Ucf = p->Ucf;
|
||||||
Snode *Node = net->Node;
|
|
||||||
Stank *Tank = net->Tank;
|
Stank *Tank = net->Tank;
|
||||||
Scurve *curve;
|
Scurve *curve;
|
||||||
|
|
||||||
@@ -2823,8 +2822,8 @@ int DLLEXPORT EN_addlink(EN_Project p, char *id, int linkType,
|
|||||||
link = &net->Link[n];
|
link = &net->Link[n];
|
||||||
strncpy(link->ID, id, MAXID);
|
strncpy(link->ID, id, MAXID);
|
||||||
|
|
||||||
if (linkType <= EN_PIPE) net->Npipes++;
|
if (linkType <= PIPE) net->Npipes++;
|
||||||
else if (linkType == EN_PUMP)
|
else if (linkType == PUMP)
|
||||||
{
|
{
|
||||||
// Grow pump array to accomodate the new link
|
// Grow pump array to accomodate the new link
|
||||||
net->Npumps++;
|
net->Npumps++;
|
||||||
@@ -2860,13 +2859,13 @@ int DLLEXPORT EN_addlink(EN_Project p, char *id, int linkType,
|
|||||||
link->N2 = n2;
|
link->N2 = n2;
|
||||||
link->Status = OPEN;
|
link->Status = OPEN;
|
||||||
|
|
||||||
if (linkType == EN_PUMP)
|
if (linkType == PUMP)
|
||||||
{
|
{
|
||||||
link->Kc = 1.0; // Speed factor
|
link->Kc = 1.0; // Speed factor
|
||||||
link->Km = 0.0; // Horsepower
|
link->Km = 0.0; // Horsepower
|
||||||
link->Len = 0.0;
|
link->Len = 0.0;
|
||||||
}
|
}
|
||||||
else if (linkType <= EN_PIPE) // pipe or cvpipe
|
else if (linkType <= PIPE) // pipe or cvpipe
|
||||||
{
|
{
|
||||||
link->Diam = 10 / p->Ucf[DIAM];
|
link->Diam = 10 / p->Ucf[DIAM];
|
||||||
link->Kc = 100; // Rough. coeff
|
link->Kc = 100; // Rough. coeff
|
||||||
@@ -2901,7 +2900,7 @@ int DLLEXPORT EN_deletelink(EN_Project p, int index, int actionCode)
|
|||||||
** in a control and returns an error code
|
** in a control and returns an error code
|
||||||
** Output: none
|
** Output: none
|
||||||
** Returns: error code
|
** Returns: error code
|
||||||
** Purpose: deletes a link from a project.
|
** Purpose: deletes a link from a project
|
||||||
**----------------------------------------------------------------
|
**----------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
@@ -2918,7 +2917,7 @@ int DLLEXPORT EN_deletelink(EN_Project p, int index, int actionCode)
|
|||||||
if (p->hydraul.OpenHflag || p->quality.OpenQflag) return 262;
|
if (p->hydraul.OpenHflag || p->quality.OpenQflag) return 262;
|
||||||
|
|
||||||
// Check that link exists
|
// Check that link exists
|
||||||
if (index <= 0 || index > net->Nlinks) 204;
|
if (index <= 0 || index > net->Nlinks) return 204;
|
||||||
if (actionCode < EN_UNCONDITIONAL || actionCode > EN_CONDITIONAL) return 251;
|
if (actionCode < EN_UNCONDITIONAL || actionCode > EN_CONDITIONAL) return 251;
|
||||||
|
|
||||||
// Deletion will be cancelled if link appears in any controls
|
// Deletion will be cancelled if link appears in any controls
|
||||||
@@ -2964,7 +2963,7 @@ int DLLEXPORT EN_deletelink(EN_Project p, int index, int actionCode)
|
|||||||
net->Npumps--;
|
net->Npumps--;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete any valve (linkType > EN_PUMP) associated with the deleted link
|
// Delete any valve (linkType > PUMP) associated with the deleted link
|
||||||
if (linkType > PUMP)
|
if (linkType > PUMP)
|
||||||
{
|
{
|
||||||
valveindex = findvalve(net, index);
|
valveindex = findvalve(net, index);
|
||||||
@@ -3235,7 +3234,7 @@ int DLLEXPORT EN_getlinkvalue(EN_Project p, int index, int property, double *val
|
|||||||
switch (property)
|
switch (property)
|
||||||
{
|
{
|
||||||
case EN_DIAMETER:
|
case EN_DIAMETER:
|
||||||
if (Link[index].Type == EN_PUMP) v = 0.0;
|
if (Link[index].Type == PUMP) v = 0.0;
|
||||||
else v = Link[index].Diam * Ucf[DIAM];
|
else v = Link[index].Diam * Ucf[DIAM];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -3244,7 +3243,7 @@ int DLLEXPORT EN_getlinkvalue(EN_Project p, int index, int property, double *val
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EN_ROUGHNESS:
|
case EN_ROUGHNESS:
|
||||||
if (Link[index].Type <= EN_PIPE)
|
if (Link[index].Type <= PIPE)
|
||||||
{
|
{
|
||||||
if (hyd->Formflag == DW) v = Link[index].Kc * (1000.0 * Ucf[ELEV]);
|
if (hyd->Formflag == DW) v = Link[index].Kc * (1000.0 * Ucf[ELEV]);
|
||||||
else v = Link[index].Kc;
|
else v = Link[index].Kc;
|
||||||
@@ -3253,7 +3252,7 @@ int DLLEXPORT EN_getlinkvalue(EN_Project p, int index, int property, double *val
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EN_MINORLOSS:
|
case EN_MINORLOSS:
|
||||||
if (Link[index].Type != EN_PUMP)
|
if (Link[index].Type != PUMP)
|
||||||
{
|
{
|
||||||
v = Link[index].Km;
|
v = Link[index].Km;
|
||||||
v *= (SQR(Link[index].Diam) * SQR(Link[index].Diam) / 0.02517);
|
v *= (SQR(Link[index].Diam) * SQR(Link[index].Diam) / 0.02517);
|
||||||
@@ -3267,19 +3266,19 @@ int DLLEXPORT EN_getlinkvalue(EN_Project p, int index, int property, double *val
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EN_INITSETTING:
|
case EN_INITSETTING:
|
||||||
if (Link[index].Type == EN_PIPE || Link[index].Type == EN_CVPIPE)
|
if (Link[index].Type == PIPE || Link[index].Type == CVPIPE)
|
||||||
{
|
{
|
||||||
return EN_getlinkvalue(p, index, EN_ROUGHNESS, value);
|
return EN_getlinkvalue(p, index, EN_ROUGHNESS, value);
|
||||||
}
|
}
|
||||||
v = Link[index].Kc;
|
v = Link[index].Kc;
|
||||||
switch (Link[index].Type)
|
switch (Link[index].Type)
|
||||||
{
|
{
|
||||||
case EN_PRV:
|
case PRV:
|
||||||
case EN_PSV:
|
case PSV:
|
||||||
case EN_PBV:
|
case PBV:
|
||||||
v *= Ucf[PRESSURE];
|
v *= Ucf[PRESSURE];
|
||||||
break;
|
break;
|
||||||
case EN_FCV:
|
case FCV:
|
||||||
v *= Ucf[FLOW];
|
v *= Ucf[FLOW];
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -3300,7 +3299,7 @@ int DLLEXPORT EN_getlinkvalue(EN_Project p, int index, int property, double *val
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EN_VELOCITY:
|
case EN_VELOCITY:
|
||||||
if (Link[index].Type == EN_PUMP) v = 0.0;
|
if (Link[index].Type == PUMP) v = 0.0;
|
||||||
else if (hyd->LinkStatus[index] <= CLOSED) v = 0.0;
|
else if (hyd->LinkStatus[index] <= CLOSED) v = 0.0;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -3315,7 +3314,7 @@ int DLLEXPORT EN_getlinkvalue(EN_Project p, int index, int property, double *val
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
h = hyd->NodeHead[Link[index].N1] - hyd->NodeHead[Link[index].N2];
|
h = hyd->NodeHead[Link[index].N1] - hyd->NodeHead[Link[index].N2];
|
||||||
if (Link[index].Type != EN_PUMP) h = ABS(h);
|
if (Link[index].Type != PUMP) h = ABS(h);
|
||||||
v = h * Ucf[HEADLOSS];
|
v = h * Ucf[HEADLOSS];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -3326,7 +3325,7 @@ int DLLEXPORT EN_getlinkvalue(EN_Project p, int index, int property, double *val
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EN_SETTING:
|
case EN_SETTING:
|
||||||
if (Link[index].Type == EN_PIPE || Link[index].Type == EN_CVPIPE)
|
if (Link[index].Type == PIPE || Link[index].Type == CVPIPE)
|
||||||
{
|
{
|
||||||
return EN_getlinkvalue(p, index, EN_ROUGHNESS, value);
|
return EN_getlinkvalue(p, index, EN_ROUGHNESS, value);
|
||||||
}
|
}
|
||||||
@@ -3334,12 +3333,12 @@ int DLLEXPORT EN_getlinkvalue(EN_Project p, int index, int property, double *val
|
|||||||
else v = LinkSetting[index];
|
else v = LinkSetting[index];
|
||||||
switch (Link[index].Type)
|
switch (Link[index].Type)
|
||||||
{
|
{
|
||||||
case EN_PRV:
|
case PRV:
|
||||||
case EN_PSV:
|
case PSV:
|
||||||
case EN_PBV:
|
case PBV:
|
||||||
v *= Ucf[PRESSURE];
|
v *= Ucf[PRESSURE];
|
||||||
break;
|
break;
|
||||||
case EN_FCV:
|
case FCV:
|
||||||
v *= Ucf[FLOW];
|
v *= Ucf[FLOW];
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -3355,7 +3354,7 @@ int DLLEXPORT EN_getlinkvalue(EN_Project p, int index, int property, double *val
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EN_LINKPATTERN:
|
case EN_LINKPATTERN:
|
||||||
if (Link[index].Type == EN_PUMP)
|
if (Link[index].Type == PUMP)
|
||||||
{
|
{
|
||||||
v = (double)Pump[findpump(&p->network, index)].Upat;
|
v = (double)Pump[findpump(&p->network, index)].Upat;
|
||||||
}
|
}
|
||||||
@@ -3364,7 +3363,7 @@ int DLLEXPORT EN_getlinkvalue(EN_Project p, int index, int property, double *val
|
|||||||
case EN_PUMP_STATE:
|
case EN_PUMP_STATE:
|
||||||
v = hyd->LinkStatus[index];
|
v = hyd->LinkStatus[index];
|
||||||
|
|
||||||
if (Link[index].Type == EN_PUMP)
|
if (Link[index].Type == PUMP)
|
||||||
{
|
{
|
||||||
pmp = findpump(net, index);
|
pmp = findpump(net, index);
|
||||||
if (hyd->LinkStatus[index] >= OPEN)
|
if (hyd->LinkStatus[index] >= OPEN)
|
||||||
@@ -3384,7 +3383,7 @@ int DLLEXPORT EN_getlinkvalue(EN_Project p, int index, int property, double *val
|
|||||||
|
|
||||||
case EN_PUMP_POWER:
|
case EN_PUMP_POWER:
|
||||||
v = 0;
|
v = 0;
|
||||||
if (Link[index].Type == EN_PUMP)
|
if (Link[index].Type == PUMP)
|
||||||
{
|
{
|
||||||
pmp = findpump(net, index);
|
pmp = findpump(net, index);
|
||||||
if (Pump[pmp].Ptype == CONST_HP) v = Link[index].Km; // Power in HP or KW
|
if (Pump[pmp].Ptype == CONST_HP) v = Link[index].Km; // Power in HP or KW
|
||||||
@@ -3392,28 +3391,28 @@ int DLLEXPORT EN_getlinkvalue(EN_Project p, int index, int property, double *val
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EN_PUMP_HCURVE:
|
case EN_PUMP_HCURVE:
|
||||||
if (Link[index].Type == EN_PUMP)
|
if (Link[index].Type == PUMP)
|
||||||
{
|
{
|
||||||
v = (double)Pump[findpump(&p->network, index)].Hcurve;
|
v = (double)Pump[findpump(&p->network, index)].Hcurve;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EN_PUMP_ECURVE:
|
case EN_PUMP_ECURVE:
|
||||||
if (Link[index].Type == EN_PUMP)
|
if (Link[index].Type == PUMP)
|
||||||
{
|
{
|
||||||
v = (double)Pump[findpump(&p->network, index)].Ecurve;
|
v = (double)Pump[findpump(&p->network, index)].Ecurve;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EN_PUMP_ECOST:
|
case EN_PUMP_ECOST:
|
||||||
if (Link[index].Type == EN_PUMP)
|
if (Link[index].Type == PUMP)
|
||||||
{
|
{
|
||||||
v = (double)Pump[findpump(&p->network, index)].Ecost;
|
v = (double)Pump[findpump(&p->network, index)].Ecost;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EN_PUMP_EPAT:
|
case EN_PUMP_EPAT:
|
||||||
if (Link[index].Type == EN_PUMP)
|
if (Link[index].Type == PUMP)
|
||||||
{
|
{
|
||||||
v = (double)Pump[findpump(&p->network, index)].Epat;
|
v = (double)Pump[findpump(&p->network, index)].Epat;
|
||||||
}
|
}
|
||||||
@@ -3453,7 +3452,7 @@ int DLLEXPORT EN_setlinkvalue(EN_Project p, int index, int property, double valu
|
|||||||
switch (property)
|
switch (property)
|
||||||
{
|
{
|
||||||
case EN_DIAMETER:
|
case EN_DIAMETER:
|
||||||
if (Link[index].Type != EN_PUMP)
|
if (Link[index].Type != PUMP)
|
||||||
{
|
{
|
||||||
if (value <= 0.0) return 211;
|
if (value <= 0.0) return 211;
|
||||||
value /= Ucf[DIAM]; // Convert to feet
|
value /= Ucf[DIAM]; // Convert to feet
|
||||||
@@ -3465,7 +3464,7 @@ int DLLEXPORT EN_setlinkvalue(EN_Project p, int index, int property, double valu
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EN_LENGTH:
|
case EN_LENGTH:
|
||||||
if (Link[index].Type <= EN_PIPE)
|
if (Link[index].Type <= PIPE)
|
||||||
{
|
{
|
||||||
if (value <= 0.0) return 211;
|
if (value <= 0.0) return 211;
|
||||||
Link[index].Len = value / Ucf[ELEV];
|
Link[index].Len = value / Ucf[ELEV];
|
||||||
@@ -3474,7 +3473,7 @@ int DLLEXPORT EN_setlinkvalue(EN_Project p, int index, int property, double valu
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EN_ROUGHNESS:
|
case EN_ROUGHNESS:
|
||||||
if (Link[index].Type <= EN_PIPE)
|
if (Link[index].Type <= PIPE)
|
||||||
{
|
{
|
||||||
if (value <= 0.0) return 211;
|
if (value <= 0.0) return 211;
|
||||||
Link[index].Kc = value;
|
Link[index].Kc = value;
|
||||||
@@ -3484,7 +3483,7 @@ int DLLEXPORT EN_setlinkvalue(EN_Project p, int index, int property, double valu
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EN_MINORLOSS:
|
case EN_MINORLOSS:
|
||||||
if (Link[index].Type != EN_PUMP)
|
if (Link[index].Type != PUMP)
|
||||||
{
|
{
|
||||||
if (value <= 0.0) return 211;
|
if (value <= 0.0) return 211;
|
||||||
Link[index].Km = 0.02517 * value / SQR(Link[index].Diam) /
|
Link[index].Km = 0.02517 * value / SQR(Link[index].Diam) /
|
||||||
@@ -3495,7 +3494,7 @@ int DLLEXPORT EN_setlinkvalue(EN_Project p, int index, int property, double valu
|
|||||||
case EN_INITSTATUS:
|
case EN_INITSTATUS:
|
||||||
case EN_STATUS:
|
case EN_STATUS:
|
||||||
// Cannot set status for a check valve
|
// Cannot set status for a check valve
|
||||||
if (Link[index].Type == EN_CVPIPE) return 207;
|
if (Link[index].Type == CVPIPE) return 207;
|
||||||
s = (char)ROUND(value);
|
s = (char)ROUND(value);
|
||||||
if (s < 0 || s > 1) return 211;
|
if (s < 0 || s > 1) return 211;
|
||||||
if (property == EN_INITSTATUS)
|
if (property == EN_INITSTATUS)
|
||||||
@@ -3511,7 +3510,7 @@ int DLLEXPORT EN_setlinkvalue(EN_Project p, int index, int property, double valu
|
|||||||
case EN_INITSETTING:
|
case EN_INITSETTING:
|
||||||
case EN_SETTING:
|
case EN_SETTING:
|
||||||
if (value < 0.0) return 211;
|
if (value < 0.0) return 211;
|
||||||
if (Link[index].Type == EN_PIPE || Link[index].Type == EN_CVPIPE)
|
if (Link[index].Type == PIPE || Link[index].Type == CVPIPE)
|
||||||
{
|
{
|
||||||
return EN_setlinkvalue(p, index, EN_ROUGHNESS, value);
|
return EN_setlinkvalue(p, index, EN_ROUGHNESS, value);
|
||||||
}
|
}
|
||||||
@@ -3519,19 +3518,19 @@ int DLLEXPORT EN_setlinkvalue(EN_Project p, int index, int property, double valu
|
|||||||
{
|
{
|
||||||
switch (Link[index].Type)
|
switch (Link[index].Type)
|
||||||
{
|
{
|
||||||
case EN_PUMP:
|
case PUMP:
|
||||||
break;
|
break;
|
||||||
case EN_PRV:
|
case PRV:
|
||||||
case EN_PSV:
|
case PSV:
|
||||||
case EN_PBV:
|
case PBV:
|
||||||
value /= Ucf[PRESSURE];
|
value /= Ucf[PRESSURE];
|
||||||
break;
|
break;
|
||||||
case EN_FCV:
|
case FCV:
|
||||||
value /= Ucf[FLOW];
|
value /= Ucf[FLOW];
|
||||||
break;
|
break;
|
||||||
case EN_TCV:
|
case TCV:
|
||||||
break;
|
break;
|
||||||
case EN_GPV:
|
case GPV:
|
||||||
return 207; // Cannot modify setting for GPV
|
return 207; // Cannot modify setting for GPV
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
@@ -3549,7 +3548,7 @@ int DLLEXPORT EN_setlinkvalue(EN_Project p, int index, int property, double valu
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EN_KBULK:
|
case EN_KBULK:
|
||||||
if (Link[index].Type <= EN_PIPE)
|
if (Link[index].Type <= PIPE)
|
||||||
{
|
{
|
||||||
Link[index].Kb = value / SECperDAY;
|
Link[index].Kb = value / SECperDAY;
|
||||||
qual->Reactflag = 1;
|
qual->Reactflag = 1;
|
||||||
@@ -3557,7 +3556,7 @@ int DLLEXPORT EN_setlinkvalue(EN_Project p, int index, int property, double valu
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EN_KWALL:
|
case EN_KWALL:
|
||||||
if (Link[index].Type <= EN_PIPE)
|
if (Link[index].Type <= PIPE)
|
||||||
{
|
{
|
||||||
Link[index].Kw = value / SECperDAY;
|
Link[index].Kw = value / SECperDAY;
|
||||||
qual->Reactflag = 1;
|
qual->Reactflag = 1;
|
||||||
@@ -3565,7 +3564,7 @@ int DLLEXPORT EN_setlinkvalue(EN_Project p, int index, int property, double valu
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EN_LINKPATTERN:
|
case EN_LINKPATTERN:
|
||||||
if (Link[index].Type == EN_PUMP)
|
if (Link[index].Type == PUMP)
|
||||||
{
|
{
|
||||||
patIndex = ROUND(value);
|
patIndex = ROUND(value);
|
||||||
if (patIndex <= 0 || patIndex > net->Npats) return 205;
|
if (patIndex <= 0 || patIndex > net->Npats) return 205;
|
||||||
@@ -3575,7 +3574,7 @@ int DLLEXPORT EN_setlinkvalue(EN_Project p, int index, int property, double valu
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EN_PUMP_POWER:
|
case EN_PUMP_POWER:
|
||||||
if (Link[index].Type == EN_PUMP)
|
if (Link[index].Type == PUMP)
|
||||||
{
|
{
|
||||||
if (value <= 0.0) return 211;
|
if (value <= 0.0) return 211;
|
||||||
pumpIndex = findpump(&p->network, index);
|
pumpIndex = findpump(&p->network, index);
|
||||||
@@ -3591,14 +3590,14 @@ int DLLEXPORT EN_setlinkvalue(EN_Project p, int index, int property, double valu
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EN_PUMP_HCURVE:
|
case EN_PUMP_HCURVE:
|
||||||
if (Link[index].Type == EN_PUMP)
|
if (Link[index].Type == PUMP)
|
||||||
{
|
{
|
||||||
return EN_setheadcurveindex(p, index, ROUND(value));
|
return EN_setheadcurveindex(p, index, ROUND(value));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EN_PUMP_ECURVE:
|
case EN_PUMP_ECURVE:
|
||||||
if (Link[index].Type == EN_PUMP)
|
if (Link[index].Type == PUMP)
|
||||||
{
|
{
|
||||||
curveIndex = ROUND(value);
|
curveIndex = ROUND(value);
|
||||||
if (curveIndex <= 0 || curveIndex > net->Ncurves) return 205;
|
if (curveIndex <= 0 || curveIndex > net->Ncurves) return 205;
|
||||||
@@ -3608,7 +3607,7 @@ int DLLEXPORT EN_setlinkvalue(EN_Project p, int index, int property, double valu
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EN_PUMP_ECOST:
|
case EN_PUMP_ECOST:
|
||||||
if (Link[index].Type == EN_PUMP)
|
if (Link[index].Type == PUMP)
|
||||||
{
|
{
|
||||||
if (value < 0.0) return 211;
|
if (value < 0.0) return 211;
|
||||||
pumpIndex = findpump(&p->network, index);
|
pumpIndex = findpump(&p->network, index);
|
||||||
@@ -3617,7 +3616,7 @@ int DLLEXPORT EN_setlinkvalue(EN_Project p, int index, int property, double valu
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EN_PUMP_EPAT:
|
case EN_PUMP_EPAT:
|
||||||
if (Link[index].Type == EN_PUMP)
|
if (Link[index].Type == PUMP)
|
||||||
{
|
{
|
||||||
patIndex = ROUND(value);
|
patIndex = ROUND(value);
|
||||||
if (patIndex <= 0 || patIndex > net->Npats) return 205;
|
if (patIndex <= 0 || patIndex > net->Npats) return 205;
|
||||||
@@ -3642,7 +3641,7 @@ int DLLEXPORT EN_setpipedata(EN_Project p, int index, double length,
|
|||||||
** mloss = minor loss coefficient
|
** mloss = minor loss coefficient
|
||||||
** Output: none
|
** Output: none
|
||||||
** Returns: error code
|
** Returns: error code
|
||||||
** Purpose: sets several properties for a pipe link.
|
** Purpose: sets several properties for a pipe link
|
||||||
**----------------------------------------------------------------
|
**----------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
@@ -3655,7 +3654,7 @@ int DLLEXPORT EN_setpipedata(EN_Project p, int index, double length,
|
|||||||
// Check that pipe exists
|
// Check that pipe exists
|
||||||
if (!p->Openflag) return 102;
|
if (!p->Openflag) return 102;
|
||||||
if (index <= 0 || index > net->Nlinks) return 204;
|
if (index <= 0 || index > net->Nlinks) return 204;
|
||||||
if (Link[index].Type > EN_PIPE) return 0;
|
if (Link[index].Type > PIPE) return 0;
|
||||||
|
|
||||||
// Check for valid parameters
|
// Check for valid parameters
|
||||||
if (length <= 0.0 || diam <= 0.0 || rough <= 0.0 || mloss < 0.0) return 211;
|
if (length <= 0.0 || diam <= 0.0 || rough <= 0.0 || mloss < 0.0) return 211;
|
||||||
@@ -3698,7 +3697,7 @@ int DLLEXPORT EN_getpumptype(EN_Project p, int linkIndex, int *pumpType)
|
|||||||
*pumpType = -1;
|
*pumpType = -1;
|
||||||
if (!p->Openflag) return 102;
|
if (!p->Openflag) return 102;
|
||||||
if (linkIndex < 1 || linkIndex > Nlinks) return 204;
|
if (linkIndex < 1 || linkIndex > Nlinks) return 204;
|
||||||
if (EN_PUMP != Link[linkIndex].Type) return 216;
|
if (PUMP != Link[linkIndex].Type) return 216;
|
||||||
*pumpType = Pump[findpump(&p->network, linkIndex)].Ptype;
|
*pumpType = Pump[findpump(&p->network, linkIndex)].Ptype;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -3721,7 +3720,7 @@ int DLLEXPORT EN_getheadcurveindex(EN_Project p, int linkIndex, int *curveIndex)
|
|||||||
*curveIndex = 0;
|
*curveIndex = 0;
|
||||||
if (!p->Openflag) return 102;
|
if (!p->Openflag) return 102;
|
||||||
if (linkIndex < 1 || linkIndex > Nlinks) return 204;
|
if (linkIndex < 1 || linkIndex > Nlinks) return 204;
|
||||||
if (EN_PUMP != Link[linkIndex].Type) return 216;
|
if (PUMP != Link[linkIndex].Type) return 216;
|
||||||
*curveIndex = Pump[findpump(net, linkIndex)].Hcurve;
|
*curveIndex = Pump[findpump(net, linkIndex)].Hcurve;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -3738,9 +3737,6 @@ int DLLEXPORT EN_setheadcurveindex(EN_Project p, int linkIndex, int curveIndex)
|
|||||||
{
|
{
|
||||||
Network *net = &p->network;
|
Network *net = &p->network;
|
||||||
|
|
||||||
Slink *Link = net->Link;
|
|
||||||
const int Nlinks = net->Nlinks;
|
|
||||||
const int Ncurves = net->Ncurves;
|
|
||||||
double *Ucf = p->Ucf;
|
double *Ucf = p->Ucf;
|
||||||
int pumpIndex;
|
int pumpIndex;
|
||||||
Spump *pump;
|
Spump *pump;
|
||||||
@@ -3748,7 +3744,7 @@ int DLLEXPORT EN_setheadcurveindex(EN_Project p, int linkIndex, int curveIndex)
|
|||||||
// Check for valid parameters
|
// Check for valid parameters
|
||||||
if (!p->Openflag) return 102;
|
if (!p->Openflag) return 102;
|
||||||
if (linkIndex < 1 || linkIndex > net->Nlinks) return 204;
|
if (linkIndex < 1 || linkIndex > net->Nlinks) return 204;
|
||||||
if (EN_PUMP != net->Link[linkIndex].Type) return 0;
|
if (PUMP != net->Link[linkIndex].Type) return 0;
|
||||||
if (curveIndex <= 0 || curveIndex > net->Ncurves) return 206;
|
if (curveIndex <= 0 || curveIndex > net->Ncurves) return 206;
|
||||||
|
|
||||||
// Assign the new curve to the pump
|
// Assign the new curve to the pump
|
||||||
@@ -4275,7 +4271,7 @@ int DLLEXPORT EN_addcontrol(EN_Project p, int type, int linkIndex, double settin
|
|||||||
if (linkIndex <= 0 || linkIndex > net->Nlinks) return 204;
|
if (linkIndex <= 0 || linkIndex > net->Nlinks) return 204;
|
||||||
|
|
||||||
// Cannot control check valve
|
// Cannot control check valve
|
||||||
if (net->Link[linkIndex].Type == EN_CVPIPE) return 207;
|
if (net->Link[linkIndex].Type == CVPIPE) return 207;
|
||||||
|
|
||||||
// Check for valid parameters
|
// Check for valid parameters
|
||||||
if (type < 0 || type > EN_TIMEOFDAY) return 251;
|
if (type < 0 || type > EN_TIMEOFDAY) return 251;
|
||||||
@@ -4289,22 +4285,22 @@ int DLLEXPORT EN_addcontrol(EN_Project p, int type, int linkIndex, double settin
|
|||||||
// Adjust units of control parameters
|
// Adjust units of control parameters
|
||||||
switch (net->Link[linkIndex].Type)
|
switch (net->Link[linkIndex].Type)
|
||||||
{
|
{
|
||||||
case EN_PRV:
|
case PRV:
|
||||||
case EN_PSV:
|
case PSV:
|
||||||
case EN_PBV:
|
case PBV:
|
||||||
s /= Ucf[PRESSURE];
|
s /= Ucf[PRESSURE];
|
||||||
break;
|
break;
|
||||||
case EN_FCV:
|
case FCV:
|
||||||
s /= Ucf[FLOW];
|
s /= Ucf[FLOW];
|
||||||
break;
|
break;
|
||||||
case EN_GPV:
|
case GPV:
|
||||||
if (s == 0.0) status = CLOSED;
|
if (s == 0.0) status = CLOSED;
|
||||||
else if (s == 1.0) status = OPEN;
|
else if (s == 1.0) status = OPEN;
|
||||||
else return 202;
|
else return 202;
|
||||||
s = net->Link[linkIndex].Kc;
|
s = net->Link[linkIndex].Kc;
|
||||||
break;
|
break;
|
||||||
case EN_PIPE:
|
case PIPE:
|
||||||
case EN_PUMP:
|
case PUMP:
|
||||||
status = OPEN;
|
status = OPEN;
|
||||||
if (s == 0.0) status = CLOSED;
|
if (s == 0.0) status = CLOSED;
|
||||||
default:
|
default:
|
||||||
@@ -4407,12 +4403,12 @@ int DLLEXPORT EN_getcontrol(EN_Project p, int index, int *type, int *linkIndex,
|
|||||||
{
|
{
|
||||||
switch (net->Link[*linkIndex].Type)
|
switch (net->Link[*linkIndex].Type)
|
||||||
{
|
{
|
||||||
case EN_PRV:
|
case PRV:
|
||||||
case EN_PSV:
|
case PSV:
|
||||||
case EN_PBV:
|
case PBV:
|
||||||
s *= Ucf[PRESSURE];
|
s *= Ucf[PRESSURE];
|
||||||
break;
|
break;
|
||||||
case EN_FCV:
|
case FCV:
|
||||||
s *= Ucf[FLOW];
|
s *= Ucf[FLOW];
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -4487,7 +4483,7 @@ int DLLEXPORT EN_setcontrol(EN_Project p, int index, int type, int linkIndex,
|
|||||||
if (linkIndex < 0 || linkIndex > net->Nlinks) return 204;
|
if (linkIndex < 0 || linkIndex > net->Nlinks) return 204;
|
||||||
|
|
||||||
// Cannot control check valve
|
// Cannot control check valve
|
||||||
if (net->Link[linkIndex].Type == EN_CVPIPE) return 207;
|
if (net->Link[linkIndex].Type == CVPIPE) return 207;
|
||||||
|
|
||||||
// Check for valid control properties
|
// Check for valid control properties
|
||||||
if (type < 0 || type > EN_TIMEOFDAY) return 251;
|
if (type < 0 || type > EN_TIMEOFDAY) return 251;
|
||||||
@@ -4502,22 +4498,22 @@ int DLLEXPORT EN_setcontrol(EN_Project p, int index, int type, int linkIndex,
|
|||||||
link = &net->Link[linkIndex];
|
link = &net->Link[linkIndex];
|
||||||
switch (link->Type)
|
switch (link->Type)
|
||||||
{
|
{
|
||||||
case EN_PRV:
|
case PRV:
|
||||||
case EN_PSV:
|
case PSV:
|
||||||
case EN_PBV:
|
case PBV:
|
||||||
s /= Ucf[PRESSURE];
|
s /= Ucf[PRESSURE];
|
||||||
break;
|
break;
|
||||||
case EN_FCV:
|
case FCV:
|
||||||
s /= Ucf[FLOW];
|
s /= Ucf[FLOW];
|
||||||
break;
|
break;
|
||||||
case EN_GPV:
|
case GPV:
|
||||||
if (s == 0.0) status = CLOSED;
|
if (s == 0.0) status = CLOSED;
|
||||||
else if (s == 1.0) status = OPEN;
|
else if (s == 1.0) status = OPEN;
|
||||||
else return 202;
|
else return 202;
|
||||||
s = link->Kc;
|
s = link->Kc;
|
||||||
break;
|
break;
|
||||||
case EN_PIPE:
|
case PIPE:
|
||||||
case EN_PUMP:
|
case PUMP:
|
||||||
status = OPEN;
|
status = OPEN;
|
||||||
if (s == 0.0) status = CLOSED;
|
if (s == 0.0) status = CLOSED;
|
||||||
default:
|
default:
|
||||||
@@ -4609,7 +4605,7 @@ int DLLEXPORT EN_deleterule(EN_Project p, int index)
|
|||||||
** Input: index = rule index
|
** Input: index = rule index
|
||||||
** Output: none
|
** Output: none
|
||||||
** Returns: error code
|
** Returns: error code
|
||||||
** Purpose: deletes a rule from a project.
|
** Purpose: deletes a rule from a project
|
||||||
**----------------------------------------------------------------
|
**----------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
@@ -4810,7 +4806,7 @@ int DLLEXPORT EN_setpremisestatus(EN_Project p, int ruleIndex, int premiseIndex,
|
|||||||
if (ruleIndex < 1 || ruleIndex > p->network.Nrules) return 257;
|
if (ruleIndex < 1 || ruleIndex > p->network.Nrules) return 257;
|
||||||
|
|
||||||
premises = p->network.Rule[ruleIndex].Premises;
|
premises = p->network.Rule[ruleIndex].Premises;
|
||||||
premise = getpremise(premises, ruleIndex);
|
premise = getpremise(premises, premiseIndex);
|
||||||
if (premise == NULL) return 258;
|
if (premise == NULL) return 258;
|
||||||
|
|
||||||
premise->status = status;
|
premise->status = status;
|
||||||
|
|||||||
@@ -100,6 +100,8 @@ int hydsolve(Project *pr, int *iter, double *relerr)
|
|||||||
// Initialize status checking & relaxation factor
|
// Initialize status checking & relaxation factor
|
||||||
nextcheck = hyd->CheckFreq;
|
nextcheck = hyd->CheckFreq;
|
||||||
hyd->RelaxFactor = 1.0;
|
hyd->RelaxFactor = 1.0;
|
||||||
|
hydbal.maxheaderror = 0.0;
|
||||||
|
hydbal.maxflowchange = 0.0;
|
||||||
|
|
||||||
// Repeat iterations until convergence or trial limit is exceeded.
|
// Repeat iterations until convergence or trial limit is exceeded.
|
||||||
// (ExtraIter used to increase trials in case of status cycling.)
|
// (ExtraIter used to increase trials in case of status cycling.)
|
||||||
@@ -360,7 +362,6 @@ double newflows(Project *pr, Hydbalance *hbal)
|
|||||||
**----------------------------------------------------------------
|
**----------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
Network *net = &pr->network;
|
|
||||||
Hydraul *hyd = &pr->hydraul;
|
Hydraul *hyd = &pr->hydraul;
|
||||||
|
|
||||||
double dqsum, // Network flow change
|
double dqsum, // Network flow change
|
||||||
|
|||||||
@@ -102,7 +102,6 @@ int saveinpfile(Project *pr, const char *fname)
|
|||||||
Times *time = &pr->times;
|
Times *time = &pr->times;
|
||||||
|
|
||||||
int i, j, n;
|
int i, j, n;
|
||||||
int errcode;
|
|
||||||
double d, kc, ke, km, ucf;
|
double d, kc, ke, km, ucf;
|
||||||
char s[MAXLINE + 1], s1[MAXLINE + 1], s2[MAXLINE + 1];
|
char s[MAXLINE + 1], s1[MAXLINE + 1], s2[MAXLINE + 1];
|
||||||
Pdemand demand;
|
Pdemand demand;
|
||||||
@@ -451,7 +450,7 @@ int saveinpfile(Project *pr, const char *fname)
|
|||||||
for (i = 1; i <= net->Nrules; i++)
|
for (i = 1; i <= net->Nrules; i++)
|
||||||
{
|
{
|
||||||
fprintf(f, "\nRULE %s", pr->network.Rule[i].label);
|
fprintf(f, "\nRULE %s", pr->network.Rule[i].label);
|
||||||
errcode = writerule(pr, f, i); // see RULES.C
|
writerule(pr, f, i); // see RULES.C
|
||||||
fprintf(f, "\n");
|
fprintf(f, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -489,7 +488,7 @@ int saveinpfile(Project *pr, const char *fname)
|
|||||||
fprintf(f, s_MIXING);
|
fprintf(f, s_MIXING);
|
||||||
for (i = 1; i <= net->Ntanks; i++)
|
for (i = 1; i <= net->Ntanks; i++)
|
||||||
{
|
{
|
||||||
Stank *tank = &net->Tank[i];
|
tank = &net->Tank[i];
|
||||||
if (tank->A == 0.0) continue;
|
if (tank->A == 0.0) continue;
|
||||||
fprintf(f, "\n %-31s %-8s %12.4f", net->Node[tank->Node].ID,
|
fprintf(f, "\n %-31s %-8s %12.4f", net->Node[tank->Node].ID,
|
||||||
MixTxt[tank->MixModel], (tank->V1max / tank->Vmax));
|
MixTxt[tank->MixModel], (tank->V1max / tank->Vmax));
|
||||||
@@ -719,7 +718,7 @@ int saveinpfile(Project *pr, const char *fname)
|
|||||||
j = 0;
|
j = 0;
|
||||||
for (i = 1; i <= net->Nlinks; i++)
|
for (i = 1; i <= net->Nlinks; i++)
|
||||||
{
|
{
|
||||||
Slink *link = &net->Link[i];
|
link = &net->Link[i];
|
||||||
if (link->Rpt == 1)
|
if (link->Rpt == 1)
|
||||||
{
|
{
|
||||||
if (j % 5 == 0) fprintf(f, "\n LINKS ");
|
if (j % 5 == 0) fprintf(f, "\n LINKS ");
|
||||||
|
|||||||
@@ -499,7 +499,7 @@ int valvedata(Project *pr)
|
|||||||
else if (match(parser->Tok[4], w_GPV)) type = GPV;
|
else if (match(parser->Tok[4], w_GPV)) type = GPV;
|
||||||
else return setError(parser, 4, 213);
|
else return setError(parser, 4, 213);
|
||||||
|
|
||||||
if (!getfloat(parser->Tok[3], &diam)) return setError(parser, 3, 202); 202;
|
if (!getfloat(parser->Tok[3], &diam)) return setError(parser, 3, 202);
|
||||||
if (diam <= 0.0) return setError(parser, 3, 211);
|
if (diam <= 0.0) return setError(parser, 3, 211);
|
||||||
|
|
||||||
// Find headloss curve for GPV
|
// Find headloss curve for GPV
|
||||||
|
|||||||
@@ -579,7 +579,6 @@ int incontrols(Project *pr, int objType, int index)
|
|||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
Network *net = &pr->network;
|
Network *net = &pr->network;
|
||||||
Rules *rules = &pr->rules;
|
|
||||||
|
|
||||||
int i, ruleObject;
|
int i, ruleObject;
|
||||||
Spremise *premise;
|
Spremise *premise;
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ const double Q_STAGNANT = 0.005 / GPMperCFS; // 0.005 gpm = 1.114e-5 cfs
|
|||||||
//int stepqual(Project *, long *);
|
//int stepqual(Project *, long *);
|
||||||
//int closequal(Project *);
|
//int closequal(Project *);
|
||||||
//double avgqual(Project *, int);
|
//double avgqual(Project *, int);
|
||||||
double findsourcequal(Project *, int, double, double, long);
|
double findsourcequal(Project *, int, double, long);
|
||||||
|
|
||||||
// Imported functions
|
// Imported functions
|
||||||
extern char setreactflag(Project *);
|
extern char setreactflag(Project *);
|
||||||
@@ -202,8 +202,8 @@ int runqual(Project *pr, long *t)
|
|||||||
Quality *qual = &pr->quality;
|
Quality *qual = &pr->quality;
|
||||||
Times *time = &pr->times;
|
Times *time = &pr->times;
|
||||||
|
|
||||||
long hydtime; // Hydraulic solution time
|
long hydtime = 0; // Hydraulic solution time
|
||||||
long hydstep; // Hydraulic time step
|
long hydstep = 0; // Hydraulic time step
|
||||||
int errcode = 0;
|
int errcode = 0;
|
||||||
|
|
||||||
// Update reported simulation time
|
// Update reported simulation time
|
||||||
@@ -452,11 +452,10 @@ double avgqual(Project *pr, int k)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
double findsourcequal(Project *pr, int n, double volin, double volout, long tstep)
|
double findsourcequal(Project *pr, int n, double volout, long tstep)
|
||||||
/*
|
/*
|
||||||
**---------------------------------------------------------------------
|
**---------------------------------------------------------------------
|
||||||
** Input: n = node index
|
** Input: n = node index
|
||||||
** volin = volume of node inflow over time step
|
|
||||||
** volout = volume of node outflow over time step
|
** volout = volume of node outflow over time step
|
||||||
** tstep = current quality time step
|
** tstep = current quality time step
|
||||||
** Output: returns concentration added by an external quality source.
|
** Output: returns concentration added by an external quality source.
|
||||||
@@ -543,7 +542,6 @@ double sourcequal(Project *pr, Psource source)
|
|||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
Network *net = &pr->network;
|
Network *net = &pr->network;
|
||||||
Quality *qual = &pr->quality;
|
|
||||||
Times *time = &pr->times;
|
Times *time = &pr->times;
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|||||||
@@ -445,7 +445,6 @@ double mixtank(Project *pr, int n, double volin, double massin, double volout)
|
|||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
Network *net = &pr->network;
|
Network *net = &pr->network;
|
||||||
Quality *qual = &pr->quality;
|
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
double vnet;
|
double vnet;
|
||||||
@@ -475,7 +474,6 @@ void tankmix1(Project *pr, int i, double vin, double win, double vnet)
|
|||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
Network *net = &pr->network;
|
Network *net = &pr->network;
|
||||||
Hydraul *hyd = &pr->hydraul;
|
|
||||||
Quality *qual = &pr->quality;
|
Quality *qual = &pr->quality;
|
||||||
|
|
||||||
int k;
|
int k;
|
||||||
@@ -589,7 +587,6 @@ void tankmix3(Project *pr, int i, double vin, double win, double vnet)
|
|||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
Network *net = &pr->network;
|
Network *net = &pr->network;
|
||||||
Hydraul *hyd = &pr->hydraul;
|
|
||||||
Quality *qual = &pr->quality;
|
Quality *qual = &pr->quality;
|
||||||
|
|
||||||
int k;
|
int k;
|
||||||
@@ -662,7 +659,7 @@ void tankmix4(Project *pr, int i, double vin, double win, double vnet)
|
|||||||
Network *net = &pr->network;
|
Network *net = &pr->network;
|
||||||
Quality *qual = &pr->quality;
|
Quality *qual = &pr->quality;
|
||||||
|
|
||||||
int k, n;
|
int k;
|
||||||
double cin, vsum, wsum, vseg;
|
double cin, vsum, wsum, vseg;
|
||||||
Pseg seg;
|
Pseg seg;
|
||||||
Stank *tank = &pr->network.Tank[i];
|
Stank *tank = &pr->network.Tank[i];
|
||||||
@@ -671,7 +668,6 @@ void tankmix4(Project *pr, int i, double vin, double win, double vnet)
|
|||||||
if (qual->LastSeg[k] == NULL || qual->FirstSeg[k] == NULL) return;
|
if (qual->LastSeg[k] == NULL || qual->FirstSeg[k] == NULL) return;
|
||||||
|
|
||||||
// Find inflows & outflows
|
// Find inflows & outflows
|
||||||
n = tank->Node;
|
|
||||||
if (vin > 0.0) cin = win / vin;
|
if (vin > 0.0) cin = win / vin;
|
||||||
else cin = 0.0;
|
else cin = 0.0;
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ void reversesegs(Project *, int);
|
|||||||
void addseg(Project *, int, double, double);
|
void addseg(Project *, int, double, double);
|
||||||
|
|
||||||
// Imported functions
|
// Imported functions
|
||||||
extern double findsourcequal(Project *, int, double, double, long);
|
extern double findsourcequal(Project *, int, double, long);
|
||||||
extern void reactpipes(Project *, long);
|
extern void reactpipes(Project *, long);
|
||||||
extern void reacttanks(Project *, long);
|
extern void reacttanks(Project *, long);
|
||||||
extern double mixtank(Project *, int, double, double, double);
|
extern double mixtank(Project *, int, double, double, double);
|
||||||
@@ -147,7 +147,6 @@ void evalnodeinflow(Project *pr, int k, long tstep, double *volin,
|
|||||||
**--------------------------------------------------------------
|
**--------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
Network *net = &pr->network;
|
|
||||||
Hydraul *hyd = &pr->hydraul;
|
Hydraul *hyd = &pr->hydraul;
|
||||||
Quality *qual = &pr->quality;
|
Quality *qual = &pr->quality;
|
||||||
|
|
||||||
@@ -251,7 +250,7 @@ double findnodequal(Project *pr, int n, double volin,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Find quality contribued by any external chemical source
|
// Find quality contribued by any external chemical source
|
||||||
else qual->SourceQual = findsourcequal(pr, n, volin, volout, tstep);
|
else qual->SourceQual = findsourcequal(pr, n, volout, tstep);
|
||||||
if (qual->SourceQual == 0.0) return qual->NodeQual[n];
|
if (qual->SourceQual == 0.0) return qual->NodeQual[n];
|
||||||
|
|
||||||
// Combine source quality with node quality
|
// Combine source quality with node quality
|
||||||
@@ -285,7 +284,6 @@ double noflowqual(Project *pr, int n)
|
|||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
Network *net = &pr->network;
|
Network *net = &pr->network;
|
||||||
Hydraul *hyd = &pr->hydraul;
|
|
||||||
Quality *qual = &pr->quality;
|
Quality *qual = &pr->quality;
|
||||||
|
|
||||||
int k, inflow, kount = 0;
|
int k, inflow, kount = 0;
|
||||||
@@ -428,7 +426,6 @@ int sortnodes(Project *pr)
|
|||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
Network *net = &pr->network;
|
Network *net = &pr->network;
|
||||||
Hydraul *hyd = &pr->hydraul;
|
|
||||||
Quality *qual = &pr->quality;
|
Quality *qual = &pr->quality;
|
||||||
|
|
||||||
int i, j, k, n;
|
int i, j, k, n;
|
||||||
@@ -578,7 +575,6 @@ void initsegs(Project *pr)
|
|||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
Network *net = &pr->network;
|
Network *net = &pr->network;
|
||||||
Hydraul *hyd = &pr->hydraul;
|
|
||||||
Quality *qual = &pr->quality;
|
Quality *qual = &pr->quality;
|
||||||
|
|
||||||
int j, k;
|
int j, k;
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ int writereport(Project *pr)
|
|||||||
Report *rpt = &pr->report;
|
Report *rpt = &pr->report;
|
||||||
Parser *parser = &pr->parser;
|
Parser *parser = &pr->parser;
|
||||||
|
|
||||||
char tflag;
|
int tflag;
|
||||||
FILE *tfile;
|
FILE *tfile;
|
||||||
int errcode = 0;
|
int errcode = 0;
|
||||||
|
|
||||||
@@ -399,7 +399,7 @@ void writemassbalance(Project *pr)
|
|||||||
writeline(pr, s1);
|
writeline(pr, s1);
|
||||||
snprintf(s1, MAXMSG, "Final Mass: %12.5e", qual->MassBalance.final);
|
snprintf(s1, MAXMSG, "Final Mass: %12.5e", qual->MassBalance.final);
|
||||||
writeline(pr, s1);
|
writeline(pr, s1);
|
||||||
snprintf(s1, MAXMSG, "Mass Ratio: %-0.5f", qual->MassBalance.ratio);
|
snprintf(s1, MAXMSG, "Mass Ratio: %-.5f", qual->MassBalance.ratio);
|
||||||
writeline(pr, s1);
|
writeline(pr, s1);
|
||||||
snprintf(s1, MAXMSG, "================================\n");
|
snprintf(s1, MAXMSG, "================================\n");
|
||||||
writeline(pr, s1);
|
writeline(pr, s1);
|
||||||
@@ -1001,7 +1001,7 @@ int writehydwarn(Project *pr, int iter, double relerr)
|
|||||||
|
|
||||||
int i, j;
|
int i, j;
|
||||||
char flag = 0;
|
char flag = 0;
|
||||||
char s;
|
int s;
|
||||||
Snode *Node = net->Node;
|
Snode *Node = net->Node;
|
||||||
Slink *Link = net->Link;
|
Slink *Link = net->Link;
|
||||||
Spump *Pump = net->Pump;
|
Spump *Pump = net->Pump;
|
||||||
|
|||||||
@@ -328,7 +328,6 @@ void adjustrules(Project *pr, int objtype, int index)
|
|||||||
//-----------------------------------------------------------
|
//-----------------------------------------------------------
|
||||||
{
|
{
|
||||||
Network *net = &pr->network;
|
Network *net = &pr->network;
|
||||||
Rules *rules = &pr->rules;
|
|
||||||
|
|
||||||
int i, delete;
|
int i, delete;
|
||||||
Spremise *p;
|
Spremise *p;
|
||||||
@@ -453,7 +452,6 @@ int writerule(Project *pr, FILE *f, int ruleIndex)
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
Network *net = &pr->network;
|
Network *net = &pr->network;
|
||||||
Rules *rules = &pr->rules;
|
|
||||||
|
|
||||||
Srule *rule = &net->Rule[ruleIndex];
|
Srule *rule = &net->Rule[ruleIndex];
|
||||||
Spremise *p;
|
Spremise *p;
|
||||||
|
|||||||
@@ -198,7 +198,6 @@ void freesparse(Project *pr)
|
|||||||
**----------------------------------------------------------------
|
**----------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
Network *net = &pr->network;
|
|
||||||
Smatrix *sm = &pr->hydraul.smatrix;
|
Smatrix *sm = &pr->hydraul.smatrix;
|
||||||
|
|
||||||
// stoptimer(SmatrixTimer);
|
// stoptimer(SmatrixTimer);
|
||||||
|
|||||||
58
src/types.h
58
src/types.h
@@ -384,7 +384,7 @@ typedef struct // Node Object
|
|||||||
Psource S; // source pointer
|
Psource S; // source pointer
|
||||||
double C0; // initial quality
|
double C0; // initial quality
|
||||||
double Ke; // emitter coeff.
|
double Ke; // emitter coeff.
|
||||||
char Rpt; // reporting flag
|
int Rpt; // reporting flag
|
||||||
NodeType Type; // node type
|
NodeType Type; // node type
|
||||||
char Comment[MAXMSG+1]; // node comment
|
char Comment[MAXMSG+1]; // node comment
|
||||||
} Snode;
|
} Snode;
|
||||||
@@ -405,7 +405,7 @@ typedef struct // Link Object
|
|||||||
double Qa; // low flow limit
|
double Qa; // low flow limit
|
||||||
LinkType Type; // link type
|
LinkType Type; // link type
|
||||||
StatusType Status; // initial status
|
StatusType Status; // initial status
|
||||||
char Rpt; // reporting flag
|
int Rpt; // reporting flag
|
||||||
char Comment[MAXMSG+1]; // link Comment
|
char Comment[MAXMSG+1]; // link Comment
|
||||||
} Slink;
|
} Slink;
|
||||||
|
|
||||||
@@ -466,7 +466,7 @@ typedef struct // Field Object of Report Table
|
|||||||
{
|
{
|
||||||
char Name[MAXID+1]; // name of reported variable
|
char Name[MAXID+1]; // name of reported variable
|
||||||
char Units[MAXID+1]; // units of reported variable
|
char Units[MAXID+1]; // units of reported variable
|
||||||
char Enabled; // enabled if in table
|
int Enabled; // enabled if in table
|
||||||
int Precision; // number of decimal places
|
int Precision; // number of decimal places
|
||||||
double RptLim[2]; // lower/upper report limits
|
double RptLim[2]; // lower/upper report limits
|
||||||
} SField;
|
} SField;
|
||||||
@@ -544,9 +544,6 @@ typedef struct {
|
|||||||
FILE *InFile; // Input file handle
|
FILE *InFile; // Input file handle
|
||||||
|
|
||||||
char
|
char
|
||||||
Unitsflag, // Unit system flag
|
|
||||||
Flowflag, // Flow units flag
|
|
||||||
Pressflag, // Pressure units flag
|
|
||||||
DefPatID[MAXID+1], // Default demand pattern ID
|
DefPatID[MAXID+1], // Default demand pattern ID
|
||||||
InpFname[MAXFNAME+1], // Input file name
|
InpFname[MAXFNAME+1], // Input file name
|
||||||
*Tok[MAXTOKS], // Array of token strings
|
*Tok[MAXTOKS], // Array of token strings
|
||||||
@@ -566,7 +563,10 @@ typedef struct {
|
|||||||
MaxCurves, // Curve count " " "
|
MaxCurves, // Curve count " " "
|
||||||
Ntokens, // Number of tokens in line of input
|
Ntokens, // Number of tokens in line of input
|
||||||
Ntitle, // Number of title lines
|
Ntitle, // Number of title lines
|
||||||
ErrTok; // Index of error-producing token
|
ErrTok, // Index of error-producing token
|
||||||
|
Unitsflag, // Unit system flag
|
||||||
|
Flowflag, // Flow units flag
|
||||||
|
Pressflag; // Pressure units flag
|
||||||
|
|
||||||
STmplist
|
STmplist
|
||||||
*Patlist, // Temporary time pattern list
|
*Patlist, // Temporary time pattern list
|
||||||
@@ -605,13 +605,7 @@ typedef struct {
|
|||||||
|
|
||||||
int
|
int
|
||||||
Nperiods, // Number of reporting periods
|
Nperiods, // Number of reporting periods
|
||||||
PageSize; // Lines/page in output report/
|
PageSize, // Lines/page in output report/
|
||||||
|
|
||||||
long
|
|
||||||
LineNum, // Current line number
|
|
||||||
PageNum; // Current page number
|
|
||||||
|
|
||||||
char
|
|
||||||
Rptflag, // Report flag
|
Rptflag, // Report flag
|
||||||
Tstatflag, // Report time series statistic flag
|
Tstatflag, // Report time series statistic flag
|
||||||
Summaryflag, // Report summary flag
|
Summaryflag, // Report summary flag
|
||||||
@@ -620,11 +614,17 @@ typedef struct {
|
|||||||
Energyflag, // Energy report flag
|
Energyflag, // Energy report flag
|
||||||
Nodeflag, // Node report flag
|
Nodeflag, // Node report flag
|
||||||
Linkflag, // Link report flag
|
Linkflag, // Link report flag
|
||||||
|
Fprinterr; // File write error flag
|
||||||
|
|
||||||
|
long
|
||||||
|
LineNum, // Current line number
|
||||||
|
PageNum; // Current page number
|
||||||
|
|
||||||
|
char
|
||||||
Atime[13], // Clock time (hrs:min:sec)
|
Atime[13], // Clock time (hrs:min:sec)
|
||||||
Rpt1Fname[MAXFNAME+1], // Primary report file name
|
Rpt1Fname[MAXFNAME+1], // Primary report file name
|
||||||
Rpt2Fname[MAXFNAME+1], // Secondary report file name
|
Rpt2Fname[MAXFNAME+1], // Secondary report file name
|
||||||
DateStamp[26], // Current date & time
|
DateStamp[26]; // Current date & time
|
||||||
Fprinterr; // File write error flag
|
|
||||||
|
|
||||||
SField Field[MAXVAR]; // Output reporting fields
|
SField Field[MAXVAR]; // Output reporting fields
|
||||||
|
|
||||||
@@ -635,7 +635,9 @@ typedef struct {
|
|||||||
|
|
||||||
char
|
char
|
||||||
HydFname[MAXFNAME+1], // Hydraulics file name
|
HydFname[MAXFNAME+1], // Hydraulics file name
|
||||||
OutFname[MAXFNAME+1], // Binary output file name
|
OutFname[MAXFNAME+1]; // Binary output file name
|
||||||
|
|
||||||
|
int
|
||||||
Outflag, // Output file flag
|
Outflag, // Output file flag
|
||||||
Hydflag, // Hydraulics flag
|
Hydflag, // Hydraulics flag
|
||||||
SaveHflag, // Hydraulic results saved flag
|
SaveHflag, // Hydraulic results saved flag
|
||||||
@@ -732,21 +734,19 @@ typedef struct {
|
|||||||
DefPat, // Default demand pattern
|
DefPat, // Default demand pattern
|
||||||
Epat, // Energy cost time pattern
|
Epat, // Energy cost time pattern
|
||||||
DemandModel, // Fixed or pressure dependent
|
DemandModel, // Fixed or pressure dependent
|
||||||
|
Formflag, // Head loss formula flag
|
||||||
Iterations, // Number of hydraulic trials taken
|
Iterations, // Number of hydraulic trials taken
|
||||||
MaxIter, // Max. hydraulic trials allowed
|
MaxIter, // Max. hydraulic trials allowed
|
||||||
ExtraIter, // Extra hydraulic trials
|
ExtraIter, // Extra hydraulic trials
|
||||||
CheckFreq, // Hydraulic trials between status checks
|
CheckFreq, // Hydraulic trials between status checks
|
||||||
MaxCheck, // Hydraulic trials limit on status checks
|
MaxCheck, // Hydraulic trials limit on status checks
|
||||||
|
OpenHflag, // Hydraulic system opened flag
|
||||||
Haltflag; // Flag to halt simulation
|
Haltflag; // Flag to halt simulation
|
||||||
|
|
||||||
StatusType
|
StatusType
|
||||||
*LinkStatus, // Link status
|
*LinkStatus, // Link status
|
||||||
*OldStatus; // Previous link/tank status
|
*OldStatus; // Previous link/tank status
|
||||||
|
|
||||||
char
|
|
||||||
OpenHflag, // Hydraulic system opened flag
|
|
||||||
Formflag; // Head loss formula flag
|
|
||||||
|
|
||||||
Smatrix smatrix; // Sparse matrix storage
|
Smatrix smatrix; // Sparse matrix storage
|
||||||
|
|
||||||
} Hydraul;
|
} Hydraul;
|
||||||
@@ -757,20 +757,18 @@ struct Mempool;
|
|||||||
// Water Quality Solver Wrapper
|
// Water Quality Solver Wrapper
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
char
|
int
|
||||||
Qualflag, // Water quality analysis flag
|
Qualflag, // Water quality analysis flag
|
||||||
OpenQflag, // Quality system opened flag
|
OpenQflag, // Quality system opened flag
|
||||||
Reactflag, // Reaction indicator
|
Reactflag, // Reaction indicator
|
||||||
OutOfMemory; // Out of memory indicator
|
OutOfMemory, // Out of memory indicator
|
||||||
|
TraceNode, // Source node for flow tracing
|
||||||
|
*SortedNodes; // Topologically sorted node indexes
|
||||||
|
|
||||||
char
|
char
|
||||||
ChemName[MAXID + 1], // Name of chemical
|
ChemName[MAXID + 1], // Name of chemical
|
||||||
ChemUnits[MAXID + 1]; // Units of chemical
|
ChemUnits[MAXID + 1]; // Units of chemical
|
||||||
|
|
||||||
int
|
|
||||||
TraceNode, // Source node for flow tracing
|
|
||||||
*SortedNodes; // Topologically sorted node indexes
|
|
||||||
|
|
||||||
double
|
double
|
||||||
Ctol, // Water quality tolerance
|
Ctol, // Water quality tolerance
|
||||||
Diffus, // Diffusivity (sq ft/sec)
|
Diffus, // Diffusivity (sq ft/sec)
|
||||||
@@ -854,9 +852,11 @@ typedef struct Project {
|
|||||||
|
|
||||||
double Ucf[MAXVAR]; // Unit conversion factors
|
double Ucf[MAXVAR]; // Unit conversion factors
|
||||||
|
|
||||||
char
|
int
|
||||||
Openflag, // Project open flag
|
Openflag, // Project open flag
|
||||||
Warnflag, // Warning flag
|
Warnflag; // Warning flag
|
||||||
|
|
||||||
|
char
|
||||||
Msg[MAXMSG+1], // General-purpose string: errors, messages
|
Msg[MAXMSG+1], // General-purpose string: errors, messages
|
||||||
Title[MAXTITLE][TITLELEN+1], // Project title
|
Title[MAXTITLE][TITLELEN+1], // Project title
|
||||||
MapFname[MAXFNAME+1], // Map file name
|
MapFname[MAXFNAME+1], // Map file name
|
||||||
|
|||||||
@@ -45,14 +45,14 @@ int main(int argc, char *argv[])
|
|||||||
EN_init(ph, "", "", EN_GPM, EN_HW);
|
EN_init(ph, "", "", EN_GPM, EN_HW);
|
||||||
|
|
||||||
// Build a network
|
// Build a network
|
||||||
EN_addnode(ph, "N1", EN_JUNCTION);
|
EN_addnode(ph, (char *)"N1", EN_JUNCTION);
|
||||||
EN_addnode(ph, "N2", EN_JUNCTION);
|
EN_addnode(ph, (char *)"N2", EN_JUNCTION);
|
||||||
EN_addnode(ph, "N3", EN_RESERVOIR);
|
EN_addnode(ph, (char *)"N3", EN_RESERVOIR);
|
||||||
EN_addnode(ph, "N4", EN_TANK);
|
EN_addnode(ph, (char *)"N4", EN_TANK);
|
||||||
EN_addlink(ph, "L1", EN_PUMP, "N3", "N1");
|
EN_addlink(ph, (char *)"L1", EN_PUMP, (char *)"N3", (char *)"N1");
|
||||||
EN_addlink(ph, "L2", EN_PIPE, "N1", "N3");
|
EN_addlink(ph, (char *)"L2", EN_PIPE, (char *)"N1", (char *)"N3");
|
||||||
EN_addlink(ph, "L3", EN_PIPE, "N1", "N2");
|
EN_addlink(ph, (char *)"L3", EN_PIPE, (char *)"N1", (char *)"N2");
|
||||||
EN_addcurve(ph, "C1");
|
EN_addcurve(ph, (char *)"C1");
|
||||||
|
|
||||||
// Set network data using the new helper functions
|
// Set network data using the new helper functions
|
||||||
EN_setcurvevalue(ph, 1, 1, 1500, 250);
|
EN_setcurvevalue(ph, 1, 1, 1500, 250);
|
||||||
@@ -88,9 +88,9 @@ int main(int argc, char *argv[])
|
|||||||
// Save these new results
|
// Save these new results
|
||||||
EN_getnodevalue(ph, 1, EN_PRESSURE, &p1_2);
|
EN_getnodevalue(ph, 1, EN_PRESSURE, &p1_2);
|
||||||
EN_getnodevalue(ph, 2, EN_PRESSURE, &p2_2);
|
EN_getnodevalue(ph, 2, EN_PRESSURE, &p2_2);
|
||||||
EN_getlinkindex(ph, "L1", &index);
|
EN_getlinkindex(ph, (char *)"L1", &index);
|
||||||
EN_getlinkvalue(ph, index, EN_FLOW, &q1_2);
|
EN_getlinkvalue(ph, index, EN_FLOW, &q1_2);
|
||||||
EN_getlinkindex(ph, "L2", &index);
|
EN_getlinkindex(ph, (char *)"L2", &index);
|
||||||
EN_getlinkvalue(ph, index, EN_FLOW, &q2_2);
|
EN_getlinkvalue(ph, index, EN_FLOW, &q2_2);
|
||||||
|
|
||||||
// Display old & new results
|
// Display old & new results
|
||||||
|
|||||||
Reference in New Issue
Block a user