Added support for cubic meters per second (CMS)
This commit is contained in:
@@ -278,7 +278,7 @@ Defines various simulation options.
|
|||||||
__Formats:__
|
__Formats:__
|
||||||
<table style = "border: 0px solid black">
|
<table style = "border: 0px solid black">
|
||||||
<tr><td><B>UNITS</B></td><td><B>CFS / GPM / MGD / IMGD / AFD /</B></td></tr>
|
<tr><td><B>UNITS</B></td><td><B>CFS / GPM / MGD / IMGD / AFD /</B></td></tr>
|
||||||
<tr><td> </td><td><B>LPS / LPM / MLD / CMH / CMD</B></td></tr>
|
<tr><td> </td><td><B>LPS / LPM / MLD / CMS / CMH / CMD</B></td></tr>
|
||||||
<tr><td><B>HEADLOSS</B></td><td><B>H-W / D-W / C-M</B></td></tr>
|
<tr><td><B>HEADLOSS</B></td><td><B>H-W / D-W / C-M</B></td></tr>
|
||||||
<tr><td><B>HYDRAULICS</B></td><td><B>USE / SAVE </B><I> filename</I></td></tr>
|
<tr><td><B>HYDRAULICS</B></td><td><B>USE / SAVE </B><I> filename</I></td></tr>
|
||||||
<tr><td><B>VISCOSITY</B></td><td><I>value</I></td></tr>
|
<tr><td><B>VISCOSITY</B></td><td><I>value</I></td></tr>
|
||||||
@@ -315,6 +315,7 @@ __Definitions:__
|
|||||||
- \b LPS = liters per second
|
- \b LPS = liters per second
|
||||||
- \b LPM = liters per minute
|
- \b LPM = liters per minute
|
||||||
- \b MLD = million liters per day
|
- \b MLD = million liters per day
|
||||||
|
- \b CMS = cubic meters per second
|
||||||
- \b CMH = cubic meters per hour
|
- \b CMH = cubic meters per hour
|
||||||
- \b CMD = cubic meters per day
|
- \b CMD = cubic meters per day
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,9 @@ The toolkit can use data expressed in either US Customary of SI Metric units. A
|
|||||||
|Flow | CFS (cubic feet / sec) | LPS (liters / sec) |
|
|Flow | CFS (cubic feet / sec) | LPS (liters / sec) |
|
||||||
| | GPM (gallons / min) | LPM (liters / min) |
|
| | GPM (gallons / min) | LPM (liters / min) |
|
||||||
| | MGD (million gal / day) | MLD (megaliters / day) |
|
| | MGD (million gal / day) | MLD (megaliters / day) |
|
||||||
| | IMGD (Imperial MGD) | CMH (cubic meters / hr) |
|
| | IMGD (Imperial MGD) | CMS (cubic meters / sec) |
|
||||||
| | AFD (acre-feet / day) | CMD (cubic meters / day) |
|
| | AFD (acre-feet / day) | CMH (cubic meters / hr) |
|
||||||
|
| | | CMD (cubic meters / day) |
|
||||||
|Friction Factor | unitless | unitless |
|
|Friction Factor | unitless | unitless |
|
||||||
|Head | feet | meters |
|
|Head | feet | meters |
|
||||||
|Length | feet | meters |
|
|Length | feet | meters |
|
||||||
|
|||||||
@@ -155,6 +155,7 @@ namespace EpanetCSharpLibrary
|
|||||||
public const int EN_MLD = 7;
|
public const int EN_MLD = 7;
|
||||||
public const int EN_CMH = 8;
|
public const int EN_CMH = 8;
|
||||||
public const int EN_CMD = 9;
|
public const int EN_CMD = 9;
|
||||||
|
public const int EN_CMS = 10;
|
||||||
|
|
||||||
public const int EN_DDA = 0; //Demand driven analysis
|
public const int EN_DDA = 0; //Demand driven analysis
|
||||||
public const int EN_PDA = 1; //Pressure driven analysis
|
public const int EN_PDA = 1; //Pressure driven analysis
|
||||||
|
|||||||
@@ -152,6 +152,7 @@ Public Const EN_LPM = 6
|
|||||||
Public Const EN_MLD = 7
|
Public Const EN_MLD = 7
|
||||||
Public Const EN_CMH = 8
|
Public Const EN_CMH = 8
|
||||||
Public Const EN_CMD = 9
|
Public Const EN_CMD = 9
|
||||||
|
Public Const EN_CMS = 10
|
||||||
|
|
||||||
Public Const EN_DDA = 0 ' Demand driven analysis
|
Public Const EN_DDA = 0 ' Demand driven analysis
|
||||||
Public Const EN_PDA = 1 ' Pressure driven analysis
|
Public Const EN_PDA = 1 ' Pressure driven analysis
|
||||||
|
|||||||
@@ -158,6 +158,7 @@ const
|
|||||||
EN_MLD = 7;
|
EN_MLD = 7;
|
||||||
EN_CMH = 8;
|
EN_CMH = 8;
|
||||||
EN_CMD = 9;
|
EN_CMD = 9;
|
||||||
|
EN_CMS = 10;
|
||||||
|
|
||||||
EN_DDA = 0; { Demand model types }
|
EN_DDA = 0; { Demand model types }
|
||||||
EN_PDA = 1;
|
EN_PDA = 1;
|
||||||
|
|||||||
@@ -147,6 +147,7 @@ Public Const EN_LPM = 6
|
|||||||
Public Const EN_MLD = 7
|
Public Const EN_MLD = 7
|
||||||
Public Const EN_CMH = 8
|
Public Const EN_CMH = 8
|
||||||
Public Const EN_CMD = 9
|
Public Const EN_CMD = 9
|
||||||
|
Public Const EN_CMS = 10
|
||||||
|
|
||||||
Public Const EN_DDA = 0 ' Demand driven analysis
|
Public Const EN_DDA = 0 ' Demand driven analysis
|
||||||
Public Const EN_PDA = 1 ' Pressure driven analysis
|
Public Const EN_PDA = 1 ' Pressure driven analysis
|
||||||
|
|||||||
@@ -287,7 +287,8 @@ typedef enum {
|
|||||||
EN_LPM = 6, //!< Liters per minute
|
EN_LPM = 6, //!< Liters per minute
|
||||||
EN_MLD = 7, //!< Million liters per day
|
EN_MLD = 7, //!< Million liters per day
|
||||||
EN_CMH = 8, //!< Cubic meters per hour
|
EN_CMH = 8, //!< Cubic meters per hour
|
||||||
EN_CMD = 9 //!< Cubic meters per day
|
EN_CMD = 9, //!< Cubic meters per day
|
||||||
|
EN_CMS = 10 //!< Cubic meters per second
|
||||||
} EN_FlowUnits;
|
} EN_FlowUnits;
|
||||||
|
|
||||||
/// Demand models
|
/// Demand models
|
||||||
|
|||||||
@@ -59,7 +59,8 @@ char *RptFlowUnitsTxt[] = {u_CFS,
|
|||||||
u_LPM,
|
u_LPM,
|
||||||
u_MLD,
|
u_MLD,
|
||||||
u_CMH,
|
u_CMH,
|
||||||
u_CMD};
|
u_CMD,
|
||||||
|
u_CMS};
|
||||||
|
|
||||||
char *FlowUnitsTxt[] = {w_CFS,
|
char *FlowUnitsTxt[] = {w_CFS,
|
||||||
w_GPM,
|
w_GPM,
|
||||||
@@ -70,7 +71,8 @@ char *FlowUnitsTxt[] = {w_CFS,
|
|||||||
w_LPM,
|
w_LPM,
|
||||||
w_MLD,
|
w_MLD,
|
||||||
w_CMH,
|
w_CMH,
|
||||||
w_CMD};
|
w_CMD,
|
||||||
|
w_CMS};
|
||||||
|
|
||||||
char *PressUnitsTxt[] = {w_PSI,
|
char *PressUnitsTxt[] = {w_PSI,
|
||||||
w_KPA,
|
w_KPA,
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ int DLLEXPORT EN_init(EN_Project p, const char *rptFile, const char *outFile,
|
|||||||
p->report.Rptflag = 1;
|
p->report.Rptflag = 1;
|
||||||
|
|
||||||
// Check for valid arguments
|
// Check for valid arguments
|
||||||
if (unitsType < 0 || unitsType > CMD) return 251;
|
if (unitsType < 0 || unitsType > CMS) return 251;
|
||||||
if (headLossType < 0 || headLossType > CM) return 251;
|
if (headLossType < 0 || headLossType > CM) return 251;
|
||||||
|
|
||||||
// Open files
|
// Open files
|
||||||
@@ -1427,6 +1427,7 @@ int DLLEXPORT EN_setflowunits(EN_Project p, int units)
|
|||||||
case MLD:
|
case MLD:
|
||||||
case CMH:
|
case CMH:
|
||||||
case CMD:
|
case CMD:
|
||||||
|
case CMS:
|
||||||
p->parser.Unitsflag = SI;
|
p->parser.Unitsflag = SI;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -254,6 +254,7 @@ void adjustdata(Project *pr)
|
|||||||
case MLD: // megaliters/day
|
case MLD: // megaliters/day
|
||||||
case CMH: // cubic meters/hr
|
case CMH: // cubic meters/hr
|
||||||
case CMD: // cubic meters/day
|
case CMD: // cubic meters/day
|
||||||
|
case CMS: // cubic meters/second
|
||||||
parser->Unitsflag = SI;
|
parser->Unitsflag = SI;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -436,6 +437,7 @@ void initunits(Project *pr)
|
|||||||
if (parser->Flowflag == MLD) qcf = MLDperCFS;
|
if (parser->Flowflag == MLD) qcf = MLDperCFS;
|
||||||
if (parser->Flowflag == CMH) qcf = CMHperCFS;
|
if (parser->Flowflag == CMH) qcf = CMHperCFS;
|
||||||
if (parser->Flowflag == CMD) qcf = CMDperCFS;
|
if (parser->Flowflag == CMD) qcf = CMDperCFS;
|
||||||
|
if (parser->Flowflag == CMS) qcf = CMSperCFS;
|
||||||
|
|
||||||
hcf = MperFT;
|
hcf = MperFT;
|
||||||
if (parser->Pressflag == METERS) pcf = MperFT * hyd->SpGrav;
|
if (parser->Pressflag == METERS) pcf = MperFT * hyd->SpGrav;
|
||||||
|
|||||||
@@ -1750,7 +1750,7 @@ int optionchoice(Project *pr, int n)
|
|||||||
** those listed below, or -1 otherwise
|
** those listed below, or -1 otherwise
|
||||||
** Purpose: processes fixed choice [OPTIONS] data
|
** Purpose: processes fixed choice [OPTIONS] data
|
||||||
** Formats:
|
** Formats:
|
||||||
** UNITS CFS/GPM/MGD/IMGD/AFD/LPS/LPM/MLD/CMH/CMD/SI
|
** UNITS CFS/GPM/MGD/IMGD/AFD/LPS/LPM/MLD/CMH/CMD/CMS/SI
|
||||||
** PRESSURE PSI/KPA/M
|
** PRESSURE PSI/KPA/M
|
||||||
** HEADLOSS H-W/D-W/C-M
|
** HEADLOSS H-W/D-W/C-M
|
||||||
** HYDRAULICS USE/SAVE filename
|
** HYDRAULICS USE/SAVE filename
|
||||||
@@ -1790,6 +1790,7 @@ int optionchoice(Project *pr, int n)
|
|||||||
else if (match(parser->Tok[1], w_CMH)) parser->Flowflag = CMH;
|
else if (match(parser->Tok[1], w_CMH)) parser->Flowflag = CMH;
|
||||||
else if (match(parser->Tok[1], w_CMD)) parser->Flowflag = CMD;
|
else if (match(parser->Tok[1], w_CMD)) parser->Flowflag = CMD;
|
||||||
else if (match(parser->Tok[1], w_MLD)) parser->Flowflag = MLD;
|
else if (match(parser->Tok[1], w_MLD)) parser->Flowflag = MLD;
|
||||||
|
else if (match(parser->Tok[1], w_CMS)) parser->Flowflag = CMS;
|
||||||
else if (match(parser->Tok[1], w_SI)) parser->Flowflag = LPS;
|
else if (match(parser->Tok[1], w_SI)) parser->Flowflag = LPS;
|
||||||
else return setError(parser, 1, 213);
|
else return setError(parser, 1, 213);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,6 +87,7 @@
|
|||||||
#define w_MLD "MLD"
|
#define w_MLD "MLD"
|
||||||
#define w_CMH "CMH"
|
#define w_CMH "CMH"
|
||||||
#define w_CMD "CMD"
|
#define w_CMD "CMD"
|
||||||
|
#define w_CMS "CMS"
|
||||||
#define w_SI "SI"
|
#define w_SI "SI"
|
||||||
|
|
||||||
#define w_PSI "PSI"
|
#define w_PSI "PSI"
|
||||||
@@ -236,6 +237,7 @@
|
|||||||
#define u_IMGD "Imgd"
|
#define u_IMGD "Imgd"
|
||||||
#define u_LPS "L/s"
|
#define u_LPS "L/s"
|
||||||
#define u_LPM "Lpm"
|
#define u_LPM "Lpm"
|
||||||
|
#define u_CMS "m3/s"
|
||||||
#define u_CMH "m3/h"
|
#define u_CMH "m3/h"
|
||||||
#define u_CMD "m3/d"
|
#define u_CMD "m3/d"
|
||||||
#define u_MLD "ML/d"
|
#define u_MLD "ML/d"
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ typedef int INT4;
|
|||||||
#define IMGDperCFS 0.5382
|
#define IMGDperCFS 0.5382
|
||||||
#define LPSperCFS 28.317
|
#define LPSperCFS 28.317
|
||||||
#define LPMperCFS 1699.0
|
#define LPMperCFS 1699.0
|
||||||
|
#define CMSperCFS 0.028317
|
||||||
#define CMHperCFS 101.94
|
#define CMHperCFS 101.94
|
||||||
#define CMDperCFS 2446.6
|
#define CMDperCFS 2446.6
|
||||||
#define MLDperCFS 2.4466
|
#define MLDperCFS 2.4466
|
||||||
@@ -227,7 +228,8 @@ typedef enum {
|
|||||||
LPM, // liters per minute
|
LPM, // liters per minute
|
||||||
MLD, // megaliters per day
|
MLD, // megaliters per day
|
||||||
CMH, // cubic meters per hour
|
CMH, // cubic meters per hour
|
||||||
CMD // cubic meters per day
|
CMD, // cubic meters per day
|
||||||
|
CMS // cubic meters per second
|
||||||
} FlowUnitsType;
|
} FlowUnitsType;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
|||||||
@@ -122,5 +122,31 @@ BOOST_FIXTURE_TEST_CASE(test_adddemand, FixtureSingleNode)
|
|||||||
BOOST_CHECK(nD1 - nD2 == 1);
|
BOOST_CHECK(nD1 - nD2 == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(test_cms_unit)
|
||||||
|
{
|
||||||
|
int flowType;
|
||||||
|
|
||||||
|
EN_Project ph = NULL;
|
||||||
|
EN_createproject(&ph);
|
||||||
|
|
||||||
|
int error = EN_init(ph, DATA_PATH_RPT, DATA_PATH_OUT, EN_CMS, EN_HW);
|
||||||
|
BOOST_REQUIRE(error == 0);
|
||||||
|
|
||||||
|
error = EN_setflowunits(ph, EN_CMS);
|
||||||
|
BOOST_REQUIRE(error == 0);
|
||||||
|
|
||||||
|
error = EN_getflowunits(ph, &flowType );
|
||||||
|
BOOST_REQUIRE(error == 0);
|
||||||
|
BOOST_REQUIRE(flowType == EN_CMS);
|
||||||
|
|
||||||
|
error = EN_close(ph);
|
||||||
|
BOOST_REQUIRE(error == 0);
|
||||||
|
|
||||||
|
int error = EN_init(ph, DATA_PATH_RPT, DATA_PATH_OUT, EN_CMS+1, EN_HW);
|
||||||
|
BOOST_REQUIRE(error == 251);
|
||||||
|
|
||||||
|
EN_deleteproject(ph);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
|||||||
Reference in New Issue
Block a user