Merge pull request #353 from michaeltryby/dev
epanet toolkit api versioning
This commit is contained in:
@@ -75,18 +75,18 @@ source_group("Library" FILES ${EPANET_LIB_ALL})
|
|||||||
|
|
||||||
|
|
||||||
# the shared library
|
# the shared library
|
||||||
add_library(epanet SHARED ${EPANET_LIB_ALL})
|
add_library(epanet2 SHARED ${EPANET_LIB_ALL})
|
||||||
target_include_directories(epanet PUBLIC ${PROJECT_SOURCE_DIR}/include)
|
target_include_directories(epanet2 PUBLIC ${PROJECT_SOURCE_DIR}/include)
|
||||||
|
|
||||||
|
|
||||||
# create export lib so we can link against dll using Visual Studio
|
# create export lib so we can link against dll using Visual Studio
|
||||||
add_definitions(-DWITH_GENX)
|
add_definitions(-DWITH_GENX)
|
||||||
include(GenerateExportHeader)
|
include(GenerateExportHeader)
|
||||||
GENERATE_EXPORT_HEADER(epanet
|
GENERATE_EXPORT_HEADER(epanet2
|
||||||
BASE_NAME epanet
|
BASE_NAME epanet2
|
||||||
EXPORT_MACRO_NAME DLLEXPORT
|
EXPORT_MACRO_NAME DLLEXPORT
|
||||||
EXPORT_FILE_NAME epanet_export.h
|
EXPORT_FILE_NAME epanet2_export.h
|
||||||
STATIC_DEFINE SHARED_EXPORTS_BUILT_AS_STATIC)
|
STATIC_DEFINE SHARED_EXPORTS_BUILT_AS_STATIC)
|
||||||
|
|
||||||
file(COPY ${CMAKE_CURRENT_BINARY_DIR}/epanet_export.h
|
file(COPY ${CMAKE_CURRENT_BINARY_DIR}/epanet2_export.h
|
||||||
DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||||
|
|||||||
@@ -1,23 +1,21 @@
|
|||||||
/** @file epanet2.h
|
|
||||||
@see http://github.com/openwateranalytics/epanet
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
Project: OWA EPANET
|
Project: OWA EPANET
|
||||||
Version: 2.2
|
Version: 2.2
|
||||||
Module: epanet2.h
|
Module: epanet2.h
|
||||||
Description: symbolic constants and function declarations for the EPANET API
|
Description: declarations for the legacy EPANET 2 API functions
|
||||||
Authors: see AUTHORS
|
Authors: see AUTHORS
|
||||||
Copyright: see AUTHORS
|
Copyright: see AUTHORS
|
||||||
License: see LICENSE
|
License: see LICENSE
|
||||||
Last Updated: 11/27/2018
|
Last Updated: 11/29/2018
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef EPANET2_H
|
#ifndef EPANET2_H
|
||||||
#define EPANET2_H
|
#define EPANET2_H
|
||||||
|
|
||||||
|
|
||||||
// the toolkit can be compiled with support for double-precision as well.
|
// the toolkit can be compiled with support for double-precision as well.
|
||||||
// just make sure that you use the correct #define in your client code.
|
// just make sure that you use the correct #define in your client code.
|
||||||
#ifndef EN_API_FLOAT_TYPE
|
#ifndef EN_API_FLOAT_TYPE
|
||||||
@@ -25,7 +23,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WITH_GENX
|
#ifdef WITH_GENX
|
||||||
#include "epanet_export.h"
|
#include "epanet2_export.h"
|
||||||
#else
|
#else
|
||||||
// --- define WINDOWS
|
// --- define WINDOWS
|
||||||
#undef WINDOWS
|
#undef WINDOWS
|
||||||
@@ -58,301 +56,14 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "epanet2_enums.h"
|
||||||
|
|
||||||
// --- Define the EPANET toolkit constants
|
|
||||||
|
|
||||||
#define EN_MAXID 31 //!< Max. # characters in ID name
|
|
||||||
#define EN_MAXMSG 255 //!< Max. # characters in message text
|
|
||||||
|
|
||||||
/// Node property codes
|
|
||||||
typedef enum {
|
|
||||||
EN_ELEVATION = 0, //!< Elevation
|
|
||||||
EN_BASEDEMAND = 1, //!< Junction baseline demand, from last demand category
|
|
||||||
EN_PATTERN = 2, //!< Junction baseline demand pattern
|
|
||||||
EN_EMITTER = 3, //!< Junction emitter coefficient
|
|
||||||
EN_INITQUAL = 4, //!< Initial quality
|
|
||||||
EN_SOURCEQUAL = 5, //!< Quality source strength
|
|
||||||
EN_SOURCEPAT = 6, //!< Quality source pattern
|
|
||||||
EN_SOURCETYPE = 7, //!< Qualiy source type
|
|
||||||
EN_TANKLEVEL = 8, //!< Tank water level
|
|
||||||
EN_DEMAND = 9, //!< Current simulated demand
|
|
||||||
EN_HEAD = 10, //!< Current hydraulic head
|
|
||||||
EN_PRESSURE = 11, //!< Current pressure
|
|
||||||
EN_QUALITY = 12, //!< Current quality
|
|
||||||
EN_SOURCEMASS = 13, //!< Current source mass inflow
|
|
||||||
EN_INITVOLUME = 14, //!< Tank initial volume
|
|
||||||
EN_MIXMODEL = 15, //!< Tank mixing model
|
|
||||||
EN_MIXZONEVOL = 16, //!< Tank mixing zone volume
|
|
||||||
EN_TANKDIAM = 17, //!< Tank diameter
|
|
||||||
EN_MINVOLUME = 18, //!< Tank minimum volume
|
|
||||||
EN_VOLCURVE = 19, //!< Tank volume curve
|
|
||||||
EN_MINLEVEL = 20, //!< Tank minimum level
|
|
||||||
EN_MAXLEVEL = 21, //!< Tank maximum level
|
|
||||||
EN_MIXFRACTION = 22, //!< Tank mixing fraction
|
|
||||||
EN_TANK_KBULK = 23, //!< Tank bulk decay coefficient
|
|
||||||
EN_TANKVOLUME = 24, //!< Tank current volume
|
|
||||||
EN_MAXVOLUME = 25 //!< Tank maximum volume
|
|
||||||
} EN_NodeProperty;
|
|
||||||
|
|
||||||
/// Link property codes
|
|
||||||
typedef enum {
|
|
||||||
EN_DIAMETER = 0, //!< Pipe/valve diameter
|
|
||||||
EN_LENGTH = 1, //!> Pipe length
|
|
||||||
EN_ROUGHNESS = 2, //!> Pipe roughness coefficient
|
|
||||||
EN_MINORLOSS = 3, //!> Pipe/valve minor loss coefficient
|
|
||||||
EN_INITSTATUS = 4, //!> Initial status (e.g., OPEN/CLOSED)
|
|
||||||
EN_INITSETTING = 5, //!> Initial pump speed or valve setting
|
|
||||||
EN_KBULK = 6, //!> Bulk chemical reaction coefficient
|
|
||||||
EN_KWALL = 7, //!> Pipe wall chemical reaction coefficient
|
|
||||||
EN_FLOW = 8, //!> Current link flow rate
|
|
||||||
EN_VELOCITY = 9, //!> Current link flow velocity
|
|
||||||
EN_HEADLOSS = 10, //!> Current head loss across link
|
|
||||||
EN_STATUS = 11, //!> Current link status
|
|
||||||
EN_SETTING = 12, //!> Current link setting
|
|
||||||
EN_ENERGY = 13, //!> Current pump energy usage
|
|
||||||
EN_LINKQUAL = 14, //!> Current link quality
|
|
||||||
EN_LINKPATTERN = 15, //!> Pump speed time pattern
|
|
||||||
EN_EFFICIENCY = 16, //!> Current pump efficiency
|
|
||||||
EN_HEADCURVE = 17, //!> Pump head v. flow curve
|
|
||||||
EN_EFFICIENCYCURVE = 18, //!> Pump efficiency v. flow curve
|
|
||||||
EN_PRICEPATTERN = 19, //!> Pump energy price time pattern
|
|
||||||
EN_STATE = 20, //!> Current pump status
|
|
||||||
EN_CONST_POWER = 21, //!> Horsepower of constant horsepower pump
|
|
||||||
EN_SPEED = 22 //!> Current pump speed setting
|
|
||||||
} EN_LinkProperty;
|
|
||||||
|
|
||||||
/// Time parameter codes
|
|
||||||
typedef enum {
|
|
||||||
EN_DURATION = 0, //!> Total simulation duration
|
|
||||||
EN_HYDSTEP = 1, //!> Hydraulic time step
|
|
||||||
EN_QUALSTEP = 2, //!> Water quality time step
|
|
||||||
EN_PATTERNSTEP = 3, //!> Time pattern period
|
|
||||||
EN_PATTERNSTART = 4, //!> Time when time patterns begin
|
|
||||||
EN_REPORTSTEP = 5, //!> Reporting time step
|
|
||||||
EN_REPORTSTART = 6, //!> Time when reporting starts
|
|
||||||
EN_RULESTEP = 7, //!> Rule evaluation time step
|
|
||||||
EN_STATISTIC = 8, //!> Reporting statistic code
|
|
||||||
EN_PERIODS = 9, //!> Number of reporting time periods
|
|
||||||
EN_STARTTIME = 10, //!> Simulation starting time of day
|
|
||||||
EN_HTIME = 11, //!> Elapsed time of current hydraulic solution
|
|
||||||
EN_QTIME = 12, //!> Elapsed time of current quality solution
|
|
||||||
EN_HALTFLAG = 13, //!> Flag indicating if simulation halted
|
|
||||||
EN_NEXTEVENT = 14, //!> Next time until a tank becomes empty or full
|
|
||||||
EN_NEXTEVENTIDX = 15 //!> Index of next tank that becomes empty or full
|
|
||||||
} EN_TimeProperty;
|
|
||||||
|
|
||||||
/// Analysis statistic codes
|
|
||||||
typedef enum {
|
|
||||||
EN_ITERATIONS = 0, //!< Number of hydraulic iterations
|
|
||||||
EN_RELATIVEERROR = 1, //!< Sum of all flow changes / total flow
|
|
||||||
EN_MAXHEADERROR = 2, //!< Largest head loss error for links
|
|
||||||
EN_MAXFLOWCHANGE = 3, //!< Largest flow change in links
|
|
||||||
EN_MASSBALANCE = 4 //!< Water quality mass balance ratio
|
|
||||||
} EN_AnalysisStatistic;
|
|
||||||
|
|
||||||
/// Object count codes
|
|
||||||
typedef enum {
|
|
||||||
EN_NODECOUNT = 0, //!< Number of nodes (Juntions + Tanks + Reservoirs)
|
|
||||||
EN_TANKCOUNT = 1, //!< Number of tanks and Reservoirs
|
|
||||||
EN_LINKCOUNT = 2, //!< Number of links (Pipes + Pumps + Valves)
|
|
||||||
EN_PATCOUNT = 3, //!< Number of time patterns
|
|
||||||
EN_CURVECOUNT = 4, //!< Number of curves
|
|
||||||
EN_CONTROLCOUNT = 5, //!< Number of simple controls
|
|
||||||
EN_RULECOUNT = 6 //!< Number of rule-based controls
|
|
||||||
} EN_CountType;
|
|
||||||
|
|
||||||
/// Node type codes
|
|
||||||
typedef enum {
|
|
||||||
EN_JUNCTION = 0, //!< Junction node
|
|
||||||
EN_RESERVOIR = 1, //!< Reservoir node
|
|
||||||
EN_TANK = 2 //!< Storage tank node
|
|
||||||
} EN_NodeType;
|
|
||||||
|
|
||||||
/// Link type codes
|
|
||||||
typedef enum {
|
|
||||||
EN_CVPIPE = 0, //!< Pipe with check valve
|
|
||||||
EN_PIPE = 1, //!< Pipe
|
|
||||||
EN_PUMP = 2, //!< Pump
|
|
||||||
EN_PRV = 3, //!< Pressure reducing valve
|
|
||||||
EN_PSV = 4, //!< Pressure sustaining valve
|
|
||||||
EN_PBV = 5, //!< Pressure breaker valve
|
|
||||||
EN_FCV = 6, //!< Flow control valve
|
|
||||||
EN_TCV = 7, //!< Throttle control valve
|
|
||||||
EN_GPV = 8 //!< General purpose valve
|
|
||||||
} EN_LinkType;
|
|
||||||
|
|
||||||
/// Water quality analysis types
|
|
||||||
typedef enum {
|
|
||||||
EN_NONE = 0, //!< No quality analysis
|
|
||||||
EN_CHEM = 1, //!< Chemical fate and transport
|
|
||||||
EN_AGE = 2, //!< Water age analysis
|
|
||||||
EN_TRACE = 3 //!< Source tracing analysis
|
|
||||||
} EN_QualityType;
|
|
||||||
|
|
||||||
/// Water quality source types
|
|
||||||
typedef enum {
|
|
||||||
EN_CONCEN = 0, //!< Concentration inflow source
|
|
||||||
EN_MASS = 1, //!< Mass inflow source
|
|
||||||
EN_SETPOINT = 2, //!< Concentration setpoint source
|
|
||||||
EN_FLOWPACED = 3 //!< Concentration flow paced source
|
|
||||||
} EN_SourceType;
|
|
||||||
|
|
||||||
/// Head loss formulas
|
|
||||||
typedef enum {
|
|
||||||
EN_HW = 0, //!< Hazen-Williams
|
|
||||||
EN_DW = 1, //!< Darcy-Weisbach
|
|
||||||
EN_CM = 2 //!< Chezy-Manning
|
|
||||||
} EN_HeadLossType;
|
|
||||||
|
|
||||||
/// Flow units types
|
|
||||||
typedef enum {
|
|
||||||
EN_CFS = 0,
|
|
||||||
EN_GPM = 1,
|
|
||||||
EN_MGD = 2,
|
|
||||||
EN_IMGD = 3,
|
|
||||||
EN_AFD = 4,
|
|
||||||
EN_LPS = 5,
|
|
||||||
EN_LPM = 6,
|
|
||||||
EN_MLD = 7,
|
|
||||||
EN_CMH = 8,
|
|
||||||
EN_CMD = 9
|
|
||||||
} EN_FlowUnits;
|
|
||||||
|
|
||||||
/// Demand model types
|
|
||||||
typedef enum {
|
|
||||||
EN_DDA = 0, //!< Demand driven analysis
|
|
||||||
EN_PDA = 1 //!< Pressure driven analysis
|
|
||||||
} EN_DemandModel;
|
|
||||||
|
|
||||||
/// Simulation Option codes
|
|
||||||
typedef enum {
|
|
||||||
EN_TRIALS = 0, //!> Maximum hydraulic trials allowed
|
|
||||||
EN_ACCURACY = 1, //!> Hydraulic convergence accuracy
|
|
||||||
EN_TOLERANCE = 2, //!> Water quality tolerance
|
|
||||||
EN_EMITEXPON = 3, //!> Exponent for emitter head loss formula
|
|
||||||
EN_DEMANDMULT = 4, //!> Global demand multiplier
|
|
||||||
EN_HEADERROR = 5, //!> Maximum allowable head loss error
|
|
||||||
EN_FLOWCHANGE = 6, //!> Maximum allowable flow change
|
|
||||||
EN_DEMANDDEFPAT = 7, //!> Default demand time pattern
|
|
||||||
EN_HEADLOSSFORM = 8 //!> Head loss formula code
|
|
||||||
} EN_Option;
|
|
||||||
|
|
||||||
/// Simple control types
|
|
||||||
typedef enum {
|
|
||||||
EN_LOWLEVEL = 0,
|
|
||||||
EN_HILEVEL = 1,
|
|
||||||
EN_TIMER = 2,
|
|
||||||
EN_TIMEOFDAY = 3
|
|
||||||
} EN_ControlType;
|
|
||||||
|
|
||||||
/// Reporting statistic types
|
|
||||||
typedef enum {
|
|
||||||
EN_AVERAGE = 1, //!> Report average value over simulation period
|
|
||||||
EN_MINIMUM = 2, //!> Report minimum value over simulation period
|
|
||||||
EN_MAXIMUM = 3, //!> Report maximum value over simulation period
|
|
||||||
EN_RANGE = 4 //!> Report maximum - minimum over simulation period
|
|
||||||
} EN_StatisticType;
|
|
||||||
|
|
||||||
/// Tank mixing models
|
|
||||||
typedef enum {
|
|
||||||
EN_MIX1 = 0, //!< Complete mix model
|
|
||||||
EN_MIX2 = 1, //!< 2-compartment model
|
|
||||||
EN_FIFO = 2, //!< First in, first out model
|
|
||||||
EN_LIFO = 3 //!< Last in, first out model
|
|
||||||
} EN_MixingModel;
|
|
||||||
|
|
||||||
/// Hydraulic initialization options
|
|
||||||
typedef enum {
|
|
||||||
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_INITFLOW = 10, //!> Don't save hydraulics; re-initialize flows
|
|
||||||
EN_SAVE_AND_INIT = 11 //!> Save hydraulics; re-initialize flows
|
|
||||||
} EN_SaveOption;
|
|
||||||
|
|
||||||
/// Pump curve types
|
|
||||||
typedef enum {
|
|
||||||
EN_CONST_HP = 0, //!< Constant horsepower
|
|
||||||
EN_POWER_FUNC = 1, //!< Power function
|
|
||||||
EN_CUSTOM = 2, //!< User-defined custom curve
|
|
||||||
EN_NOCURVE = 3 //!< No curve
|
|
||||||
} EN_PumpType;
|
|
||||||
|
|
||||||
/// Data curve types
|
|
||||||
typedef enum {
|
|
||||||
EN_V_CURVE = 0, //!< Tank volume curve
|
|
||||||
EN_P_CURVE = 1, //!< Pump characteristic curve
|
|
||||||
EN_E_CURVE = 2, //!< Pump efficiency curve
|
|
||||||
EN_H_CURVE = 3, //!< Valve head loss curve
|
|
||||||
EN_G_CURVE = 4 //!< General\default curve
|
|
||||||
} EN_CurveType;
|
|
||||||
|
|
||||||
/// Deletion action types
|
|
||||||
typedef enum {
|
|
||||||
EN_UNCONDITIONAL = 0, //!> Delete all controls that contain object
|
|
||||||
EN_CONDITIONAL = 1 //!> Cancel object deletion if contained in controls
|
|
||||||
} EN_ActionCodeType;
|
|
||||||
|
|
||||||
/// Rule object codes
|
|
||||||
typedef enum {
|
|
||||||
EN_R_NODE = 6,
|
|
||||||
EN_R_LINK = 7,
|
|
||||||
EN_R_SYSTEM = 8
|
|
||||||
} EN_RuleObject;
|
|
||||||
|
|
||||||
/// Rule variable codes
|
|
||||||
typedef enum {
|
|
||||||
EN_R_DEMAND = 0,
|
|
||||||
EN_R_HEAD = 1,
|
|
||||||
EN_R_GRADE = 2,
|
|
||||||
EN_R_LEVEL = 3,
|
|
||||||
EN_R_PRESSURE = 4,
|
|
||||||
EN_R_FLOW = 5,
|
|
||||||
EN_R_STATUS = 6,
|
|
||||||
EN_R_SETTING = 7,
|
|
||||||
EN_R_POWER = 8,
|
|
||||||
EN_R_TIME = 9,
|
|
||||||
EN_R_CLOCKTIME = 10,
|
|
||||||
EN_R_FILLTIME = 11,
|
|
||||||
EN_R_DRAINTIME = 12
|
|
||||||
} EN_RuleVariable;
|
|
||||||
|
|
||||||
/// Rule operator types
|
|
||||||
typedef enum {
|
|
||||||
EN_R_EQ = 0,
|
|
||||||
EN_R_NE = 1,
|
|
||||||
EN_R_LE = 2,
|
|
||||||
EN_R_GE = 3,
|
|
||||||
EN_R_LT = 4,
|
|
||||||
EN_R_GT = 5,
|
|
||||||
EN_R_IS = 6,
|
|
||||||
EN_R_NOT = 7,
|
|
||||||
EN_R_BELOW = 8,
|
|
||||||
EN_R_ABOVE = 9
|
|
||||||
} EN_RuleOperator;
|
|
||||||
|
|
||||||
/// Rule status types
|
|
||||||
typedef enum {
|
|
||||||
EN_R_IS_OPEN = 1,
|
|
||||||
EN_R_IS_CLOSED = 2,
|
|
||||||
EN_R_IS_ACTIVE = 3
|
|
||||||
} EN_RuleStatus;
|
|
||||||
|
|
||||||
/// Status report types
|
|
||||||
typedef enum {
|
|
||||||
EN_NO_REPORT = 0,
|
|
||||||
EN_NORMAL_REPORT = 1,
|
|
||||||
EN_FULL_REPORT = 2
|
|
||||||
} EN_StatusReport;
|
|
||||||
|
|
||||||
// --- Declare the EPANET toolkit functions
|
// --- Declare the EPANET toolkit functions
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
@brief The EPANET Project wrapper object
|
|
||||||
*/
|
|
||||||
typedef struct Project *EN_Project;
|
|
||||||
|
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
|
|
||||||
@@ -1451,174 +1162,9 @@ typedef struct Project *EN_Project;
|
|||||||
*/
|
*/
|
||||||
int DLLEXPORT ENsetrulepriority(int index, EN_API_FLOAT_TYPE priority);
|
int DLLEXPORT ENsetrulepriority(int index, EN_API_FLOAT_TYPE priority);
|
||||||
|
|
||||||
/********************************************************************
|
|
||||||
|
|
||||||
Threadsafe versions of all EPANET functions
|
#if defined(__cplusplus)
|
||||||
|
}
|
||||||
********************************************************************/
|
#endif
|
||||||
|
|
||||||
int DLLEXPORT EN_createproject(EN_Project *ph);
|
|
||||||
int DLLEXPORT EN_deleteproject(EN_Project *ph);
|
|
||||||
int DLLEXPORT EN_runproject(EN_Project ph, const char *f1, const char *f2, const char *f3,
|
|
||||||
void (*pviewprog)(char *));
|
|
||||||
int DLLEXPORT EN_init(EN_Project ph, const char *rptFile, const char *outFile,
|
|
||||||
EN_FlowUnits unitsType, EN_HeadLossType headLossType);
|
|
||||||
int DLLEXPORT EN_open(EN_Project ph, const char *inpFile,
|
|
||||||
const char *rptFile, const char *binOutFile);
|
|
||||||
int DLLEXPORT EN_saveinpfile(EN_Project ph, const char *filename);
|
|
||||||
int DLLEXPORT EN_close(EN_Project ph);
|
|
||||||
|
|
||||||
int DLLEXPORT EN_solveH(EN_Project ph);
|
|
||||||
int DLLEXPORT EN_saveH(EN_Project ph);
|
|
||||||
int DLLEXPORT EN_openH(EN_Project ph);
|
|
||||||
int DLLEXPORT EN_initH(EN_Project ph, int saveFlag);
|
|
||||||
int DLLEXPORT EN_runH(EN_Project ph, long *currentTime);
|
|
||||||
int DLLEXPORT EN_nextH(EN_Project ph, long *tStep);
|
|
||||||
int DLLEXPORT EN_closeH(EN_Project ph);
|
|
||||||
int DLLEXPORT EN_savehydfile(EN_Project ph, char *filename);
|
|
||||||
int DLLEXPORT EN_usehydfile(EN_Project ph, char *filename);
|
|
||||||
|
|
||||||
int DLLEXPORT EN_solveQ(EN_Project ph);
|
|
||||||
int DLLEXPORT EN_openQ(EN_Project ph);
|
|
||||||
int DLLEXPORT EN_initQ(EN_Project ph, int saveFlag);
|
|
||||||
int DLLEXPORT EN_runQ(EN_Project ph, long *currentTime);
|
|
||||||
int DLLEXPORT EN_nextQ(EN_Project ph, long *tStep);
|
|
||||||
int DLLEXPORT EN_stepQ(EN_Project ph, long *timeLeft);
|
|
||||||
int DLLEXPORT EN_closeQ(EN_Project ph);
|
|
||||||
|
|
||||||
int DLLEXPORT EN_writeline(EN_Project ph, char *line);
|
|
||||||
int DLLEXPORT EN_report(EN_Project ph);
|
|
||||||
int DLLEXPORT EN_resetreport(EN_Project ph);
|
|
||||||
int DLLEXPORT EN_setreport(EN_Project ph, char *reportCommand);
|
|
||||||
int DLLEXPORT EN_setstatusreport(EN_Project ph, int code);
|
|
||||||
int DLLEXPORT EN_getversion(int *version);
|
|
||||||
int DLLEXPORT EN_getcount(EN_Project ph, EN_CountType code, int *count);
|
|
||||||
int DLLEXPORT EN_geterror(int errcode, char *errmsg, int maxLen);
|
|
||||||
int DLLEXPORT EN_getstatistic(EN_Project ph, int code, EN_API_FLOAT_TYPE* value);
|
|
||||||
|
|
||||||
int DLLEXPORT EN_getoption(EN_Project ph, EN_Option opt, EN_API_FLOAT_TYPE *value);
|
|
||||||
int DLLEXPORT EN_setoption(EN_Project ph, int code, EN_API_FLOAT_TYPE v);
|
|
||||||
int DLLEXPORT EN_getflowunits(EN_Project ph, int *code);
|
|
||||||
int DLLEXPORT EN_setflowunits(EN_Project ph, int code);
|
|
||||||
int DLLEXPORT EN_gettimeparam(EN_Project ph, int code, long *value);
|
|
||||||
int DLLEXPORT EN_settimeparam(EN_Project ph, int code, long value);
|
|
||||||
int DLLEXPORT EN_getqualinfo(EN_Project ph, int *qualcode, char *chemname,
|
|
||||||
char *chemunits, int *tracenode);
|
|
||||||
int DLLEXPORT EN_getqualtype(EN_Project ph, int *qualcode, int *tracenode);
|
|
||||||
int DLLEXPORT EN_setqualtype(EN_Project ph, int qualcode, char *chemname,
|
|
||||||
char *chemunits, char *tracenode);
|
|
||||||
|
|
||||||
int DLLEXPORT EN_addnode(EN_Project ph, char *id, EN_NodeType nodeType);
|
|
||||||
int DLLEXPORT EN_deletenode(EN_Project ph, int index, int actionCode);
|
|
||||||
int DLLEXPORT EN_getnodeindex(EN_Project ph, char *id, int *index);
|
|
||||||
int DLLEXPORT EN_getnodeid(EN_Project ph, int index, char *id);
|
|
||||||
int DLLEXPORT EN_setnodeid(EN_Project ph, int index, char *newid);
|
|
||||||
int DLLEXPORT EN_getnodetype(EN_Project ph, int index, int *code);
|
|
||||||
int DLLEXPORT EN_getnodevalue(EN_Project ph, int index, int code, EN_API_FLOAT_TYPE *value);
|
|
||||||
int DLLEXPORT EN_setnodevalue(EN_Project ph, int index, int code, EN_API_FLOAT_TYPE v);
|
|
||||||
int DLLEXPORT EN_getcoord(EN_Project ph, int index, EN_API_FLOAT_TYPE *x,
|
|
||||||
EN_API_FLOAT_TYPE *y);
|
|
||||||
int DLLEXPORT EN_setcoord(EN_Project ph, int index, EN_API_FLOAT_TYPE x,
|
|
||||||
EN_API_FLOAT_TYPE y);
|
|
||||||
|
|
||||||
int DLLEXPORT EN_getdemandmodel(EN_Project ph, int *type, EN_API_FLOAT_TYPE *pmin,
|
|
||||||
EN_API_FLOAT_TYPE *preq, EN_API_FLOAT_TYPE *pexp);
|
|
||||||
int DLLEXPORT EN_setdemandmodel(EN_Project ph, int type, EN_API_FLOAT_TYPE pmin,
|
|
||||||
EN_API_FLOAT_TYPE preq, EN_API_FLOAT_TYPE pexp);
|
|
||||||
int DLLEXPORT EN_getnumdemands(EN_Project ph, int nodeIndex, int *numDemands);
|
|
||||||
int DLLEXPORT EN_getbasedemand(EN_Project ph, int nodeIndex,
|
|
||||||
int demandIndex, EN_API_FLOAT_TYPE *baseDemand);
|
|
||||||
int DLLEXPORT EN_setbasedemand(EN_Project ph, int nodeIndex,
|
|
||||||
int demandIndex, EN_API_FLOAT_TYPE baseDemand);
|
|
||||||
int DLLEXPORT EN_getdemandpattern(EN_Project ph, int nodeIndex, int demandIndex,
|
|
||||||
int *pattIndex);
|
|
||||||
int DLLEXPORT EN_setdemandpattern(EN_Project ph, int nodeIndex, int demandIndex,
|
|
||||||
int patIndex);
|
|
||||||
int DLLEXPORT EN_getdemandname(EN_Project ph, int nodeIndex, int demandIdx,
|
|
||||||
char *demandName);
|
|
||||||
int DLLEXPORT EN_setdemandname(EN_Project ph, int nodeIndex, int demandIdx,
|
|
||||||
char *demandName);
|
|
||||||
|
|
||||||
int DLLEXPORT EN_addlink(EN_Project ph, char *id, EN_LinkType linkType,
|
|
||||||
char *fromNode, char *toNode);
|
|
||||||
int DLLEXPORT EN_deletelink(EN_Project ph, int index, int actionCode);
|
|
||||||
int DLLEXPORT EN_getlinkindex(EN_Project ph, char *id, int *index);
|
|
||||||
int DLLEXPORT EN_getlinkid(EN_Project ph, int index, char *id);
|
|
||||||
int DLLEXPORT EN_setlinkid(EN_Project ph, int index, char *newid);
|
|
||||||
int DLLEXPORT EN_getlinktype(EN_Project ph, int index, EN_LinkType *code);
|
|
||||||
int DLLEXPORT EN_setlinktype(EN_Project ph, int *index, EN_LinkType type, int actionCode);
|
|
||||||
int DLLEXPORT EN_getlinknodes(EN_Project ph, int index, int *node1, int *node2);
|
|
||||||
int DLLEXPORT EN_setlinknodes(EN_Project ph, int index, int node1, int node2);
|
|
||||||
int DLLEXPORT EN_getlinkvalue(EN_Project ph, int index, EN_LinkProperty code,
|
|
||||||
EN_API_FLOAT_TYPE *value);
|
|
||||||
int DLLEXPORT EN_setlinkvalue(EN_Project ph, int index, int code, EN_API_FLOAT_TYPE v);
|
|
||||||
|
|
||||||
int DLLEXPORT EN_getpumptype(EN_Project ph, int linkIndex, int *outType);
|
|
||||||
int DLLEXPORT EN_getheadcurveindex(EN_Project ph, int pumpIndex, int *curveIndex);
|
|
||||||
int DLLEXPORT EN_setheadcurveindex(EN_Project ph, int pumpIndex, int curveIndex);
|
|
||||||
|
|
||||||
int DLLEXPORT EN_addpattern(EN_Project ph, char *id);
|
|
||||||
int DLLEXPORT EN_getpatternindex(EN_Project ph, char *id, int *index);
|
|
||||||
int DLLEXPORT EN_getpatternid(EN_Project ph, int index, char *id);
|
|
||||||
int DLLEXPORT EN_getpatternlen(EN_Project ph, int index, int *len);
|
|
||||||
int DLLEXPORT EN_getpatternvalue(EN_Project ph, int index, int period, EN_API_FLOAT_TYPE *value);
|
|
||||||
int DLLEXPORT EN_setpatternvalue(EN_Project ph, int index, int period, EN_API_FLOAT_TYPE value);
|
|
||||||
int DLLEXPORT EN_getaveragepatternvalue(EN_Project ph, int index, EN_API_FLOAT_TYPE *value);
|
|
||||||
int DLLEXPORT EN_setpattern(EN_Project ph, int index, EN_API_FLOAT_TYPE *f, int len);
|
|
||||||
|
|
||||||
int DLLEXPORT EN_addcurve(EN_Project ph, char *id);
|
|
||||||
int DLLEXPORT EN_getcurveindex(EN_Project ph, char *id, int *index);
|
|
||||||
int DLLEXPORT EN_getcurveid(EN_Project ph, int index, char *id);
|
|
||||||
int DLLEXPORT EN_getcurvelen(EN_Project ph, int index, int *len);
|
|
||||||
int DLLEXPORT EN_getcurvetype(EN_Project ph, int curveIndex, int *outType);
|
|
||||||
int DLLEXPORT EN_getcurvevalue(EN_Project ph, int curveIndex, int pointIndex,
|
|
||||||
EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y);
|
|
||||||
int DLLEXPORT EN_setcurvevalue(EN_Project ph, int curveIndex, int pointIndex,
|
|
||||||
EN_API_FLOAT_TYPE x, EN_API_FLOAT_TYPE y);
|
|
||||||
int DLLEXPORT EN_getcurve(EN_Project ph, int curveIndex, char* id,
|
|
||||||
int *nValues, EN_API_FLOAT_TYPE **xValues,
|
|
||||||
EN_API_FLOAT_TYPE **yValues);
|
|
||||||
int DLLEXPORT EN_setcurve(EN_Project ph, int index, EN_API_FLOAT_TYPE *x,
|
|
||||||
EN_API_FLOAT_TYPE *y, int len);
|
|
||||||
|
|
||||||
int DLLEXPORT EN_addcontrol(EN_Project ph, int *cindex, int ctype, int lindex,
|
|
||||||
EN_API_FLOAT_TYPE setting, int nindex, EN_API_FLOAT_TYPE level);
|
|
||||||
int DLLEXPORT EN_deletecontrol(EN_Project ph, int index);
|
|
||||||
int DLLEXPORT EN_getcontrol(EN_Project ph, int controlIndex,
|
|
||||||
int *controlType, int *linkIndex, EN_API_FLOAT_TYPE *setting,
|
|
||||||
int *nodeIndex, EN_API_FLOAT_TYPE *level);
|
|
||||||
int DLLEXPORT EN_setcontrol(EN_Project ph, int cindex, int ctype, int lindex,
|
|
||||||
EN_API_FLOAT_TYPE setting, int nindex, EN_API_FLOAT_TYPE level);
|
|
||||||
|
|
||||||
int DLLEXPORT EN_addrule(EN_Project ph, char *rule);
|
|
||||||
int DLLEXPORT EN_deleterule(EN_Project ph, int index);
|
|
||||||
int DLLEXPORT EN_getrule(EN_Project ph, int index, int *nPremises,
|
|
||||||
int *nThenActions, int *nElseActions, EN_API_FLOAT_TYPE *priority);
|
|
||||||
int DLLEXPORT EN_getruleID(EN_Project ph, int index, char* id);
|
|
||||||
int DLLEXPORT EN_getpremise(EN_Project ph, int ruleIndex, int premiseIndex,
|
|
||||||
int *logop, int *object, int *objIndex, int *variable, int *relop,
|
|
||||||
int *status, EN_API_FLOAT_TYPE *value);
|
|
||||||
int DLLEXPORT EN_setpremise(EN_Project ph, int ruleIndex, int premiseIndex,
|
|
||||||
int logop, int object, int objIndex, int variable, int relop,
|
|
||||||
int status, EN_API_FLOAT_TYPE value);
|
|
||||||
int DLLEXPORT EN_setpremiseindex(EN_Project ph, int ruleIndex,
|
|
||||||
int premiseIndex, int objIndex);
|
|
||||||
int DLLEXPORT EN_setpremisestatus(EN_Project ph, int ruleIndex,
|
|
||||||
int premiseIndex, int status);
|
|
||||||
int DLLEXPORT EN_setpremisevalue(EN_Project ph, int ruleIndex,
|
|
||||||
int premiseIndex, EN_API_FLOAT_TYPE value);
|
|
||||||
int DLLEXPORT EN_getthenaction(EN_Project ph, int ruleIndex, int actionIndex,
|
|
||||||
int *linkIndex, int *status, EN_API_FLOAT_TYPE *setting);
|
|
||||||
int DLLEXPORT EN_setthenaction(EN_Project ph, int ruleIndex, int actionIndex,
|
|
||||||
int linkIndex, int status, EN_API_FLOAT_TYPE setting);
|
|
||||||
int DLLEXPORT EN_getelseaction(EN_Project ph, int ruleIndex, int actionIndex,
|
|
||||||
int *linkIndex, int *status, EN_API_FLOAT_TYPE *setting);
|
|
||||||
int DLLEXPORT EN_setelseaction(EN_Project ph, int ruleIndex, int actionIndex,
|
|
||||||
int linkIndex, int status, EN_API_FLOAT_TYPE setting);
|
|
||||||
int DLLEXPORT EN_setrulepriority(EN_Project ph, int index, EN_API_FLOAT_TYPE priority);
|
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif //EPANET2_H
|
#endif //EPANET2_H
|
||||||
|
|||||||
246
include/epanet2_2.h
Normal file
246
include/epanet2_2.h
Normal file
@@ -0,0 +1,246 @@
|
|||||||
|
/** @file epanet2.h
|
||||||
|
@see http://github.com/openwateranalytics/epanet
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
******************************************************************************
|
||||||
|
Project: OWA EPANET
|
||||||
|
Version: 2.2
|
||||||
|
Module: epanet2.h
|
||||||
|
Description: symbolic constants and function declarations for the EPANET API
|
||||||
|
Authors: see AUTHORS
|
||||||
|
Copyright: see AUTHORS
|
||||||
|
License: see LICENSE
|
||||||
|
Last Updated: 11/29/2018
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef EPANET2_2_H
|
||||||
|
#define EPANET2_2_H
|
||||||
|
|
||||||
|
// the toolkit can be compiled with support for double-precision as well.
|
||||||
|
// just make sure that you use the correct #define in your client code.
|
||||||
|
#ifndef EN_API_FLOAT_TYPE
|
||||||
|
#define EN_API_FLOAT_TYPE float
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef WITH_GENX
|
||||||
|
#include "epanet2_export.h"
|
||||||
|
#else
|
||||||
|
// --- define WINDOWS
|
||||||
|
#undef WINDOWS
|
||||||
|
#ifdef _WIN32
|
||||||
|
#define WINDOWS
|
||||||
|
#endif
|
||||||
|
#ifdef __WIN32__
|
||||||
|
#define WINDOWS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// --- define DLLEXPORT
|
||||||
|
#ifndef DLLEXPORT
|
||||||
|
#ifdef WINDOWS
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#define DLLEXPORT __declspec(dllexport)
|
||||||
|
#else
|
||||||
|
#define DLLEXPORT __declspec(dllexport) __stdcall
|
||||||
|
#endif // __cplusplus
|
||||||
|
#elif defined(CYGWIN)
|
||||||
|
#define DLLEXPORT __stdcall
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#define DLLEXPORT
|
||||||
|
#else
|
||||||
|
#define DLLEXPORT
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#define DLLEXPORT
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#include "epanet2_enums.h"
|
||||||
|
|
||||||
|
|
||||||
|
// --- Declare the EPANET toolkit functions
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief The EPANET Project wrapper object
|
||||||
|
*/
|
||||||
|
typedef struct Project *EN_Project;
|
||||||
|
|
||||||
|
/********************************************************************
|
||||||
|
|
||||||
|
Threadsafe versions of all EPANET functions
|
||||||
|
|
||||||
|
********************************************************************/
|
||||||
|
|
||||||
|
int DLLEXPORT EN_createproject(EN_Project *ph);
|
||||||
|
int DLLEXPORT EN_deleteproject(EN_Project *ph);
|
||||||
|
int DLLEXPORT EN_runproject(EN_Project ph, const char *f1, const char *f2, const char *f3,
|
||||||
|
void (*pviewprog)(char *));
|
||||||
|
int DLLEXPORT EN_init(EN_Project ph, const char *rptFile, const char *outFile,
|
||||||
|
EN_FlowUnits unitsType, EN_HeadLossType headLossType);
|
||||||
|
int DLLEXPORT EN_open(EN_Project ph, const char *inpFile,
|
||||||
|
const char *rptFile, const char *binOutFile);
|
||||||
|
int DLLEXPORT EN_saveinpfile(EN_Project ph, const char *filename);
|
||||||
|
int DLLEXPORT EN_close(EN_Project ph);
|
||||||
|
|
||||||
|
int DLLEXPORT EN_solveH(EN_Project ph);
|
||||||
|
int DLLEXPORT EN_saveH(EN_Project ph);
|
||||||
|
int DLLEXPORT EN_openH(EN_Project ph);
|
||||||
|
int DLLEXPORT EN_initH(EN_Project ph, int saveFlag);
|
||||||
|
int DLLEXPORT EN_runH(EN_Project ph, long *currentTime);
|
||||||
|
int DLLEXPORT EN_nextH(EN_Project ph, long *tStep);
|
||||||
|
int DLLEXPORT EN_closeH(EN_Project ph);
|
||||||
|
int DLLEXPORT EN_savehydfile(EN_Project ph, char *filename);
|
||||||
|
int DLLEXPORT EN_usehydfile(EN_Project ph, char *filename);
|
||||||
|
|
||||||
|
int DLLEXPORT EN_solveQ(EN_Project ph);
|
||||||
|
int DLLEXPORT EN_openQ(EN_Project ph);
|
||||||
|
int DLLEXPORT EN_initQ(EN_Project ph, int saveFlag);
|
||||||
|
int DLLEXPORT EN_runQ(EN_Project ph, long *currentTime);
|
||||||
|
int DLLEXPORT EN_nextQ(EN_Project ph, long *tStep);
|
||||||
|
int DLLEXPORT EN_stepQ(EN_Project ph, long *timeLeft);
|
||||||
|
int DLLEXPORT EN_closeQ(EN_Project ph);
|
||||||
|
|
||||||
|
int DLLEXPORT EN_writeline(EN_Project ph, char *line);
|
||||||
|
int DLLEXPORT EN_report(EN_Project ph);
|
||||||
|
int DLLEXPORT EN_resetreport(EN_Project ph);
|
||||||
|
int DLLEXPORT EN_setreport(EN_Project ph, char *reportCommand);
|
||||||
|
int DLLEXPORT EN_setstatusreport(EN_Project ph, int code);
|
||||||
|
int DLLEXPORT EN_getversion(int *version);
|
||||||
|
int DLLEXPORT EN_getcount(EN_Project ph, EN_CountType code, int *count);
|
||||||
|
int DLLEXPORT EN_geterror(int errcode, char *errmsg, int maxLen);
|
||||||
|
int DLLEXPORT EN_getstatistic(EN_Project ph, int code, EN_API_FLOAT_TYPE* value);
|
||||||
|
|
||||||
|
int DLLEXPORT EN_getoption(EN_Project ph, EN_Option opt, EN_API_FLOAT_TYPE *value);
|
||||||
|
int DLLEXPORT EN_setoption(EN_Project ph, int code, EN_API_FLOAT_TYPE v);
|
||||||
|
int DLLEXPORT EN_getflowunits(EN_Project ph, int *code);
|
||||||
|
int DLLEXPORT EN_setflowunits(EN_Project ph, int code);
|
||||||
|
int DLLEXPORT EN_gettimeparam(EN_Project ph, int code, long *value);
|
||||||
|
int DLLEXPORT EN_settimeparam(EN_Project ph, int code, long value);
|
||||||
|
int DLLEXPORT EN_getqualinfo(EN_Project ph, int *qualcode, char *chemname,
|
||||||
|
char *chemunits, int *tracenode);
|
||||||
|
int DLLEXPORT EN_getqualtype(EN_Project ph, int *qualcode, int *tracenode);
|
||||||
|
int DLLEXPORT EN_setqualtype(EN_Project ph, int qualcode, char *chemname,
|
||||||
|
char *chemunits, char *tracenode);
|
||||||
|
|
||||||
|
int DLLEXPORT EN_addnode(EN_Project ph, char *id, EN_NodeType nodeType);
|
||||||
|
int DLLEXPORT EN_deletenode(EN_Project ph, int index, int actionCode);
|
||||||
|
int DLLEXPORT EN_getnodeindex(EN_Project ph, char *id, int *index);
|
||||||
|
int DLLEXPORT EN_getnodeid(EN_Project ph, int index, char *id);
|
||||||
|
int DLLEXPORT EN_setnodeid(EN_Project ph, int index, char *newid);
|
||||||
|
int DLLEXPORT EN_getnodetype(EN_Project ph, int index, int *code);
|
||||||
|
int DLLEXPORT EN_getnodevalue(EN_Project ph, int index, int code, EN_API_FLOAT_TYPE *value);
|
||||||
|
int DLLEXPORT EN_setnodevalue(EN_Project ph, int index, int code, EN_API_FLOAT_TYPE v);
|
||||||
|
int DLLEXPORT EN_getcoord(EN_Project ph, int index, EN_API_FLOAT_TYPE *x,
|
||||||
|
EN_API_FLOAT_TYPE *y);
|
||||||
|
int DLLEXPORT EN_setcoord(EN_Project ph, int index, EN_API_FLOAT_TYPE x,
|
||||||
|
EN_API_FLOAT_TYPE y);
|
||||||
|
|
||||||
|
int DLLEXPORT EN_getdemandmodel(EN_Project ph, int *type, EN_API_FLOAT_TYPE *pmin,
|
||||||
|
EN_API_FLOAT_TYPE *preq, EN_API_FLOAT_TYPE *pexp);
|
||||||
|
int DLLEXPORT EN_setdemandmodel(EN_Project ph, int type, EN_API_FLOAT_TYPE pmin,
|
||||||
|
EN_API_FLOAT_TYPE preq, EN_API_FLOAT_TYPE pexp);
|
||||||
|
int DLLEXPORT EN_getnumdemands(EN_Project ph, int nodeIndex, int *numDemands);
|
||||||
|
int DLLEXPORT EN_getbasedemand(EN_Project ph, int nodeIndex,
|
||||||
|
int demandIndex, EN_API_FLOAT_TYPE *baseDemand);
|
||||||
|
int DLLEXPORT EN_setbasedemand(EN_Project ph, int nodeIndex,
|
||||||
|
int demandIndex, EN_API_FLOAT_TYPE baseDemand);
|
||||||
|
int DLLEXPORT EN_getdemandpattern(EN_Project ph, int nodeIndex, int demandIndex,
|
||||||
|
int *pattIndex);
|
||||||
|
int DLLEXPORT EN_setdemandpattern(EN_Project ph, int nodeIndex, int demandIndex,
|
||||||
|
int patIndex);
|
||||||
|
int DLLEXPORT EN_getdemandname(EN_Project ph, int nodeIndex, int demandIdx,
|
||||||
|
char *demandName);
|
||||||
|
int DLLEXPORT EN_setdemandname(EN_Project ph, int nodeIndex, int demandIdx,
|
||||||
|
char *demandName);
|
||||||
|
|
||||||
|
int DLLEXPORT EN_addlink(EN_Project ph, char *id, EN_LinkType linkType,
|
||||||
|
char *fromNode, char *toNode);
|
||||||
|
int DLLEXPORT EN_deletelink(EN_Project ph, int index, int actionCode);
|
||||||
|
int DLLEXPORT EN_getlinkindex(EN_Project ph, char *id, int *index);
|
||||||
|
int DLLEXPORT EN_getlinkid(EN_Project ph, int index, char *id);
|
||||||
|
int DLLEXPORT EN_setlinkid(EN_Project ph, int index, char *newid);
|
||||||
|
int DLLEXPORT EN_getlinktype(EN_Project ph, int index, EN_LinkType *code);
|
||||||
|
int DLLEXPORT EN_setlinktype(EN_Project ph, int *index, EN_LinkType type, int actionCode);
|
||||||
|
int DLLEXPORT EN_getlinknodes(EN_Project ph, int index, int *node1, int *node2);
|
||||||
|
int DLLEXPORT EN_setlinknodes(EN_Project ph, int index, int node1, int node2);
|
||||||
|
int DLLEXPORT EN_getlinkvalue(EN_Project ph, int index, EN_LinkProperty code,
|
||||||
|
EN_API_FLOAT_TYPE *value);
|
||||||
|
int DLLEXPORT EN_setlinkvalue(EN_Project ph, int index, int code, EN_API_FLOAT_TYPE v);
|
||||||
|
|
||||||
|
int DLLEXPORT EN_getpumptype(EN_Project ph, int linkIndex, int *outType);
|
||||||
|
int DLLEXPORT EN_getheadcurveindex(EN_Project ph, int pumpIndex, int *curveIndex);
|
||||||
|
int DLLEXPORT EN_setheadcurveindex(EN_Project ph, int pumpIndex, int curveIndex);
|
||||||
|
|
||||||
|
int DLLEXPORT EN_addpattern(EN_Project ph, char *id);
|
||||||
|
int DLLEXPORT EN_getpatternindex(EN_Project ph, char *id, int *index);
|
||||||
|
int DLLEXPORT EN_getpatternid(EN_Project ph, int index, char *id);
|
||||||
|
int DLLEXPORT EN_getpatternlen(EN_Project ph, int index, int *len);
|
||||||
|
int DLLEXPORT EN_getpatternvalue(EN_Project ph, int index, int period, EN_API_FLOAT_TYPE *value);
|
||||||
|
int DLLEXPORT EN_setpatternvalue(EN_Project ph, int index, int period, EN_API_FLOAT_TYPE value);
|
||||||
|
int DLLEXPORT EN_getaveragepatternvalue(EN_Project ph, int index, EN_API_FLOAT_TYPE *value);
|
||||||
|
int DLLEXPORT EN_setpattern(EN_Project ph, int index, EN_API_FLOAT_TYPE *f, int len);
|
||||||
|
|
||||||
|
int DLLEXPORT EN_addcurve(EN_Project ph, char *id);
|
||||||
|
int DLLEXPORT EN_getcurveindex(EN_Project ph, char *id, int *index);
|
||||||
|
int DLLEXPORT EN_getcurveid(EN_Project ph, int index, char *id);
|
||||||
|
int DLLEXPORT EN_getcurvelen(EN_Project ph, int index, int *len);
|
||||||
|
int DLLEXPORT EN_getcurvetype(EN_Project ph, int curveIndex, int *outType);
|
||||||
|
int DLLEXPORT EN_getcurvevalue(EN_Project ph, int curveIndex, int pointIndex,
|
||||||
|
EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y);
|
||||||
|
int DLLEXPORT EN_setcurvevalue(EN_Project ph, int curveIndex, int pointIndex,
|
||||||
|
EN_API_FLOAT_TYPE x, EN_API_FLOAT_TYPE y);
|
||||||
|
int DLLEXPORT EN_getcurve(EN_Project ph, int curveIndex, char* id,
|
||||||
|
int *nValues, EN_API_FLOAT_TYPE **xValues,
|
||||||
|
EN_API_FLOAT_TYPE **yValues);
|
||||||
|
int DLLEXPORT EN_setcurve(EN_Project ph, int index, EN_API_FLOAT_TYPE *x,
|
||||||
|
EN_API_FLOAT_TYPE *y, int len);
|
||||||
|
|
||||||
|
int DLLEXPORT EN_addcontrol(EN_Project ph, int *cindex, int ctype, int lindex,
|
||||||
|
EN_API_FLOAT_TYPE setting, int nindex, EN_API_FLOAT_TYPE level);
|
||||||
|
int DLLEXPORT EN_deletecontrol(EN_Project ph, int index);
|
||||||
|
int DLLEXPORT EN_getcontrol(EN_Project ph, int controlIndex,
|
||||||
|
int *controlType, int *linkIndex, EN_API_FLOAT_TYPE *setting,
|
||||||
|
int *nodeIndex, EN_API_FLOAT_TYPE *level);
|
||||||
|
int DLLEXPORT EN_setcontrol(EN_Project ph, int cindex, int ctype, int lindex,
|
||||||
|
EN_API_FLOAT_TYPE setting, int nindex, EN_API_FLOAT_TYPE level);
|
||||||
|
|
||||||
|
int DLLEXPORT EN_addrule(EN_Project ph, char *rule);
|
||||||
|
int DLLEXPORT EN_deleterule(EN_Project ph, int index);
|
||||||
|
int DLLEXPORT EN_getrule(EN_Project ph, int index, int *nPremises,
|
||||||
|
int *nThenActions, int *nElseActions, EN_API_FLOAT_TYPE *priority);
|
||||||
|
int DLLEXPORT EN_getruleID(EN_Project ph, int index, char* id);
|
||||||
|
int DLLEXPORT EN_getpremise(EN_Project ph, int ruleIndex, int premiseIndex,
|
||||||
|
int *logop, int *object, int *objIndex, int *variable, int *relop,
|
||||||
|
int *status, EN_API_FLOAT_TYPE *value);
|
||||||
|
int DLLEXPORT EN_setpremise(EN_Project ph, int ruleIndex, int premiseIndex,
|
||||||
|
int logop, int object, int objIndex, int variable, int relop,
|
||||||
|
int status, EN_API_FLOAT_TYPE value);
|
||||||
|
int DLLEXPORT EN_setpremiseindex(EN_Project ph, int ruleIndex,
|
||||||
|
int premiseIndex, int objIndex);
|
||||||
|
int DLLEXPORT EN_setpremisestatus(EN_Project ph, int ruleIndex,
|
||||||
|
int premiseIndex, int status);
|
||||||
|
int DLLEXPORT EN_setpremisevalue(EN_Project ph, int ruleIndex,
|
||||||
|
int premiseIndex, EN_API_FLOAT_TYPE value);
|
||||||
|
int DLLEXPORT EN_getthenaction(EN_Project ph, int ruleIndex, int actionIndex,
|
||||||
|
int *linkIndex, int *status, EN_API_FLOAT_TYPE *setting);
|
||||||
|
int DLLEXPORT EN_setthenaction(EN_Project ph, int ruleIndex, int actionIndex,
|
||||||
|
int linkIndex, int status, EN_API_FLOAT_TYPE setting);
|
||||||
|
int DLLEXPORT EN_getelseaction(EN_Project ph, int ruleIndex, int actionIndex,
|
||||||
|
int *linkIndex, int *status, EN_API_FLOAT_TYPE *setting);
|
||||||
|
int DLLEXPORT EN_setelseaction(EN_Project ph, int ruleIndex, int actionIndex,
|
||||||
|
int linkIndex, int status, EN_API_FLOAT_TYPE setting);
|
||||||
|
int DLLEXPORT EN_setrulepriority(EN_Project ph, int index, EN_API_FLOAT_TYPE priority);
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif //EPANET2_2_H
|
||||||
305
include/epanet2_enums.h
Normal file
305
include/epanet2_enums.h
Normal file
@@ -0,0 +1,305 @@
|
|||||||
|
/*
|
||||||
|
******************************************************************************
|
||||||
|
Project: OWA EPANET
|
||||||
|
Version: 2.2
|
||||||
|
Module: epanet2_enums.h
|
||||||
|
Description: enums shared between API versions
|
||||||
|
Authors: see AUTHORS
|
||||||
|
Copyright: see AUTHORS
|
||||||
|
License: see LICENSE
|
||||||
|
Last Updated: 11/29/2018
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef EPANET2_ENUMS_H
|
||||||
|
#define EPANET2_ENUMS_H
|
||||||
|
|
||||||
|
|
||||||
|
// --- Define the EPANET toolkit constants
|
||||||
|
|
||||||
|
#define EN_MAXID 31 //!< Max. # characters in ID name
|
||||||
|
#define EN_MAXMSG 255 //!< Max. # characters in message text
|
||||||
|
|
||||||
|
/// Node property codes
|
||||||
|
typedef enum {
|
||||||
|
EN_ELEVATION = 0, //!< Elevation
|
||||||
|
EN_BASEDEMAND = 1, //!< Junction baseline demand, from last demand category
|
||||||
|
EN_PATTERN = 2, //!< Junction baseline demand pattern
|
||||||
|
EN_EMITTER = 3, //!< Junction emitter coefficient
|
||||||
|
EN_INITQUAL = 4, //!< Initial quality
|
||||||
|
EN_SOURCEQUAL = 5, //!< Quality source strength
|
||||||
|
EN_SOURCEPAT = 6, //!< Quality source pattern
|
||||||
|
EN_SOURCETYPE = 7, //!< Qualiy source type
|
||||||
|
EN_TANKLEVEL = 8, //!< Tank water level
|
||||||
|
EN_DEMAND = 9, //!< Current simulated demand
|
||||||
|
EN_HEAD = 10, //!< Current hydraulic head
|
||||||
|
EN_PRESSURE = 11, //!< Current pressure
|
||||||
|
EN_QUALITY = 12, //!< Current quality
|
||||||
|
EN_SOURCEMASS = 13, //!< Current source mass inflow
|
||||||
|
EN_INITVOLUME = 14, //!< Tank initial volume
|
||||||
|
EN_MIXMODEL = 15, //!< Tank mixing model
|
||||||
|
EN_MIXZONEVOL = 16, //!< Tank mixing zone volume
|
||||||
|
EN_TANKDIAM = 17, //!< Tank diameter
|
||||||
|
EN_MINVOLUME = 18, //!< Tank minimum volume
|
||||||
|
EN_VOLCURVE = 19, //!< Tank volume curve
|
||||||
|
EN_MINLEVEL = 20, //!< Tank minimum level
|
||||||
|
EN_MAXLEVEL = 21, //!< Tank maximum level
|
||||||
|
EN_MIXFRACTION = 22, //!< Tank mixing fraction
|
||||||
|
EN_TANK_KBULK = 23, //!< Tank bulk decay coefficient
|
||||||
|
EN_TANKVOLUME = 24, //!< Tank current volume
|
||||||
|
EN_MAXVOLUME = 25 //!< Tank maximum volume
|
||||||
|
} EN_NodeProperty;
|
||||||
|
|
||||||
|
/// Link property codes
|
||||||
|
typedef enum {
|
||||||
|
EN_DIAMETER = 0, //!< Pipe/valve diameter
|
||||||
|
EN_LENGTH = 1, //!> Pipe length
|
||||||
|
EN_ROUGHNESS = 2, //!> Pipe roughness coefficient
|
||||||
|
EN_MINORLOSS = 3, //!> Pipe/valve minor loss coefficient
|
||||||
|
EN_INITSTATUS = 4, //!> Initial status (e.g., OPEN/CLOSED)
|
||||||
|
EN_INITSETTING = 5, //!> Initial pump speed or valve setting
|
||||||
|
EN_KBULK = 6, //!> Bulk chemical reaction coefficient
|
||||||
|
EN_KWALL = 7, //!> Pipe wall chemical reaction coefficient
|
||||||
|
EN_FLOW = 8, //!> Current link flow rate
|
||||||
|
EN_VELOCITY = 9, //!> Current link flow velocity
|
||||||
|
EN_HEADLOSS = 10, //!> Current head loss across link
|
||||||
|
EN_STATUS = 11, //!> Current link status
|
||||||
|
EN_SETTING = 12, //!> Current link setting
|
||||||
|
EN_ENERGY = 13, //!> Current pump energy usage
|
||||||
|
EN_LINKQUAL = 14, //!> Current link quality
|
||||||
|
EN_LINKPATTERN = 15, //!> Pump speed time pattern
|
||||||
|
EN_EFFICIENCY = 16, //!> Current pump efficiency
|
||||||
|
EN_HEADCURVE = 17, //!> Pump head v. flow curve
|
||||||
|
EN_EFFICIENCYCURVE = 18, //!> Pump efficiency v. flow curve
|
||||||
|
EN_PRICEPATTERN = 19, //!> Pump energy price time pattern
|
||||||
|
EN_STATE = 20, //!> Current pump status
|
||||||
|
EN_CONST_POWER = 21, //!> Horsepower of constant horsepower pump
|
||||||
|
EN_SPEED = 22 //!> Current pump speed setting
|
||||||
|
} EN_LinkProperty;
|
||||||
|
|
||||||
|
/// Time parameter codes
|
||||||
|
typedef enum {
|
||||||
|
EN_DURATION = 0, //!> Total simulation duration
|
||||||
|
EN_HYDSTEP = 1, //!> Hydraulic time step
|
||||||
|
EN_QUALSTEP = 2, //!> Water quality time step
|
||||||
|
EN_PATTERNSTEP = 3, //!> Time pattern period
|
||||||
|
EN_PATTERNSTART = 4, //!> Time when time patterns begin
|
||||||
|
EN_REPORTSTEP = 5, //!> Reporting time step
|
||||||
|
EN_REPORTSTART = 6, //!> Time when reporting starts
|
||||||
|
EN_RULESTEP = 7, //!> Rule evaluation time step
|
||||||
|
EN_STATISTIC = 8, //!> Reporting statistic code
|
||||||
|
EN_PERIODS = 9, //!> Number of reporting time periods
|
||||||
|
EN_STARTTIME = 10, //!> Simulation starting time of day
|
||||||
|
EN_HTIME = 11, //!> Elapsed time of current hydraulic solution
|
||||||
|
EN_QTIME = 12, //!> Elapsed time of current quality solution
|
||||||
|
EN_HALTFLAG = 13, //!> Flag indicating if simulation halted
|
||||||
|
EN_NEXTEVENT = 14, //!> Next time until a tank becomes empty or full
|
||||||
|
EN_NEXTEVENTIDX = 15 //!> Index of next tank that becomes empty or full
|
||||||
|
} EN_TimeProperty;
|
||||||
|
|
||||||
|
/// Analysis statistic codes
|
||||||
|
typedef enum {
|
||||||
|
EN_ITERATIONS = 0, //!< Number of hydraulic iterations
|
||||||
|
EN_RELATIVEERROR = 1, //!< Sum of all flow changes / total flow
|
||||||
|
EN_MAXHEADERROR = 2, //!< Largest head loss error for links
|
||||||
|
EN_MAXFLOWCHANGE = 3, //!< Largest flow change in links
|
||||||
|
EN_MASSBALANCE = 4 //!< Water quality mass balance ratio
|
||||||
|
} EN_AnalysisStatistic;
|
||||||
|
|
||||||
|
/// Object count codes
|
||||||
|
typedef enum {
|
||||||
|
EN_NODECOUNT = 0, //!< Number of nodes (Juntions + Tanks + Reservoirs)
|
||||||
|
EN_TANKCOUNT = 1, //!< Number of tanks and Reservoirs
|
||||||
|
EN_LINKCOUNT = 2, //!< Number of links (Pipes + Pumps + Valves)
|
||||||
|
EN_PATCOUNT = 3, //!< Number of time patterns
|
||||||
|
EN_CURVECOUNT = 4, //!< Number of curves
|
||||||
|
EN_CONTROLCOUNT = 5, //!< Number of simple controls
|
||||||
|
EN_RULECOUNT = 6 //!< Number of rule-based controls
|
||||||
|
} EN_CountType;
|
||||||
|
|
||||||
|
/// Node type codes
|
||||||
|
typedef enum {
|
||||||
|
EN_JUNCTION = 0, //!< Junction node
|
||||||
|
EN_RESERVOIR = 1, //!< Reservoir node
|
||||||
|
EN_TANK = 2 //!< Storage tank node
|
||||||
|
} EN_NodeType;
|
||||||
|
|
||||||
|
/// Link type codes
|
||||||
|
typedef enum {
|
||||||
|
EN_CVPIPE = 0, //!< Pipe with check valve
|
||||||
|
EN_PIPE = 1, //!< Pipe
|
||||||
|
EN_PUMP = 2, //!< Pump
|
||||||
|
EN_PRV = 3, //!< Pressure reducing valve
|
||||||
|
EN_PSV = 4, //!< Pressure sustaining valve
|
||||||
|
EN_PBV = 5, //!< Pressure breaker valve
|
||||||
|
EN_FCV = 6, //!< Flow control valve
|
||||||
|
EN_TCV = 7, //!< Throttle control valve
|
||||||
|
EN_GPV = 8 //!< General purpose valve
|
||||||
|
} EN_LinkType;
|
||||||
|
|
||||||
|
/// Water quality analysis types
|
||||||
|
typedef enum {
|
||||||
|
EN_NONE = 0, //!< No quality analysis
|
||||||
|
EN_CHEM = 1, //!< Chemical fate and transport
|
||||||
|
EN_AGE = 2, //!< Water age analysis
|
||||||
|
EN_TRACE = 3 //!< Source tracing analysis
|
||||||
|
} EN_QualityType;
|
||||||
|
|
||||||
|
/// Water quality source types
|
||||||
|
typedef enum {
|
||||||
|
EN_CONCEN = 0, //!< Concentration inflow source
|
||||||
|
EN_MASS = 1, //!< Mass inflow source
|
||||||
|
EN_SETPOINT = 2, //!< Concentration setpoint source
|
||||||
|
EN_FLOWPACED = 3 //!< Concentration flow paced source
|
||||||
|
} EN_SourceType;
|
||||||
|
|
||||||
|
/// Head loss formulas
|
||||||
|
typedef enum {
|
||||||
|
EN_HW = 0, //!< Hazen-Williams
|
||||||
|
EN_DW = 1, //!< Darcy-Weisbach
|
||||||
|
EN_CM = 2 //!< Chezy-Manning
|
||||||
|
} EN_HeadLossType;
|
||||||
|
|
||||||
|
/// Flow units types
|
||||||
|
typedef enum {
|
||||||
|
EN_CFS = 0,
|
||||||
|
EN_GPM = 1,
|
||||||
|
EN_MGD = 2,
|
||||||
|
EN_IMGD = 3,
|
||||||
|
EN_AFD = 4,
|
||||||
|
EN_LPS = 5,
|
||||||
|
EN_LPM = 6,
|
||||||
|
EN_MLD = 7,
|
||||||
|
EN_CMH = 8,
|
||||||
|
EN_CMD = 9
|
||||||
|
} EN_FlowUnits;
|
||||||
|
|
||||||
|
/// Demand model types
|
||||||
|
typedef enum {
|
||||||
|
EN_DDA = 0, //!< Demand driven analysis
|
||||||
|
EN_PDA = 1 //!< Pressure driven analysis
|
||||||
|
} EN_DemandModel;
|
||||||
|
|
||||||
|
/// Simulation Option codes
|
||||||
|
typedef enum {
|
||||||
|
EN_TRIALS = 0, //!> Maximum hydraulic trials allowed
|
||||||
|
EN_ACCURACY = 1, //!> Hydraulic convergence accuracy
|
||||||
|
EN_TOLERANCE = 2, //!> Water quality tolerance
|
||||||
|
EN_EMITEXPON = 3, //!> Exponent for emitter head loss formula
|
||||||
|
EN_DEMANDMULT = 4, //!> Global demand multiplier
|
||||||
|
EN_HEADERROR = 5, //!> Maximum allowable head loss error
|
||||||
|
EN_FLOWCHANGE = 6, //!> Maximum allowable flow change
|
||||||
|
EN_DEMANDDEFPAT = 7, //!> Default demand time pattern
|
||||||
|
EN_HEADLOSSFORM = 8 //!> Head loss formula code
|
||||||
|
} EN_Option;
|
||||||
|
|
||||||
|
/// Simple control types
|
||||||
|
typedef enum {
|
||||||
|
EN_LOWLEVEL = 0,
|
||||||
|
EN_HILEVEL = 1,
|
||||||
|
EN_TIMER = 2,
|
||||||
|
EN_TIMEOFDAY = 3
|
||||||
|
} EN_ControlType;
|
||||||
|
|
||||||
|
/// Reporting statistic types
|
||||||
|
typedef enum {
|
||||||
|
EN_AVERAGE = 1, //!> Report average value over simulation period
|
||||||
|
EN_MINIMUM = 2, //!> Report minimum value over simulation period
|
||||||
|
EN_MAXIMUM = 3, //!> Report maximum value over simulation period
|
||||||
|
EN_RANGE = 4 //!> Report maximum - minimum over simulation period
|
||||||
|
} EN_StatisticType;
|
||||||
|
|
||||||
|
/// Tank mixing models
|
||||||
|
typedef enum {
|
||||||
|
EN_MIX1 = 0, //!< Complete mix model
|
||||||
|
EN_MIX2 = 1, //!< 2-compartment model
|
||||||
|
EN_FIFO = 2, //!< First in, first out model
|
||||||
|
EN_LIFO = 3 //!< Last in, first out model
|
||||||
|
} EN_MixingModel;
|
||||||
|
|
||||||
|
/// Hydraulic initialization options
|
||||||
|
typedef enum {
|
||||||
|
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_INITFLOW = 10, //!> Don't save hydraulics; re-initialize flows
|
||||||
|
EN_SAVE_AND_INIT = 11 //!> Save hydraulics; re-initialize flows
|
||||||
|
} EN_SaveOption;
|
||||||
|
|
||||||
|
/// Pump curve types
|
||||||
|
typedef enum {
|
||||||
|
EN_CONST_HP = 0, //!< Constant horsepower
|
||||||
|
EN_POWER_FUNC = 1, //!< Power function
|
||||||
|
EN_CUSTOM = 2, //!< User-defined custom curve
|
||||||
|
EN_NOCURVE = 3 //!< No curve
|
||||||
|
} EN_PumpType;
|
||||||
|
|
||||||
|
/// Data curve types
|
||||||
|
typedef enum {
|
||||||
|
EN_V_CURVE = 0, //!< Tank volume curve
|
||||||
|
EN_P_CURVE = 1, //!< Pump characteristic curve
|
||||||
|
EN_E_CURVE = 2, //!< Pump efficiency curve
|
||||||
|
EN_H_CURVE = 3, //!< Valve head loss curve
|
||||||
|
EN_G_CURVE = 4 //!< General\default curve
|
||||||
|
} EN_CurveType;
|
||||||
|
|
||||||
|
/// Deletion action types
|
||||||
|
typedef enum {
|
||||||
|
EN_UNCONDITIONAL = 0, //!> Delete all controls that contain object
|
||||||
|
EN_CONDITIONAL = 1 //!> Cancel object deletion if contained in controls
|
||||||
|
} EN_ActionCodeType;
|
||||||
|
|
||||||
|
/// Rule object codes
|
||||||
|
typedef enum {
|
||||||
|
EN_R_NODE = 6,
|
||||||
|
EN_R_LINK = 7,
|
||||||
|
EN_R_SYSTEM = 8
|
||||||
|
} EN_RuleObject;
|
||||||
|
|
||||||
|
/// Rule variable codes
|
||||||
|
typedef enum {
|
||||||
|
EN_R_DEMAND = 0,
|
||||||
|
EN_R_HEAD = 1,
|
||||||
|
EN_R_GRADE = 2,
|
||||||
|
EN_R_LEVEL = 3,
|
||||||
|
EN_R_PRESSURE = 4,
|
||||||
|
EN_R_FLOW = 5,
|
||||||
|
EN_R_STATUS = 6,
|
||||||
|
EN_R_SETTING = 7,
|
||||||
|
EN_R_POWER = 8,
|
||||||
|
EN_R_TIME = 9,
|
||||||
|
EN_R_CLOCKTIME = 10,
|
||||||
|
EN_R_FILLTIME = 11,
|
||||||
|
EN_R_DRAINTIME = 12
|
||||||
|
} EN_RuleVariable;
|
||||||
|
|
||||||
|
/// Rule operator types
|
||||||
|
typedef enum {
|
||||||
|
EN_R_EQ = 0,
|
||||||
|
EN_R_NE = 1,
|
||||||
|
EN_R_LE = 2,
|
||||||
|
EN_R_GE = 3,
|
||||||
|
EN_R_LT = 4,
|
||||||
|
EN_R_GT = 5,
|
||||||
|
EN_R_IS = 6,
|
||||||
|
EN_R_NOT = 7,
|
||||||
|
EN_R_BELOW = 8,
|
||||||
|
EN_R_ABOVE = 9
|
||||||
|
} EN_RuleOperator;
|
||||||
|
|
||||||
|
/// Rule status types
|
||||||
|
typedef enum {
|
||||||
|
EN_R_IS_OPEN = 1,
|
||||||
|
EN_R_IS_CLOSED = 2,
|
||||||
|
EN_R_IS_ACTIVE = 3
|
||||||
|
} EN_RuleStatus;
|
||||||
|
|
||||||
|
/// Status report types
|
||||||
|
typedef enum {
|
||||||
|
EN_NO_REPORT = 0,
|
||||||
|
EN_NORMAL_REPORT = 1,
|
||||||
|
EN_FULL_REPORT = 2
|
||||||
|
} EN_StatusReport;
|
||||||
|
|
||||||
|
|
||||||
|
#endif //EPANET2_ENUMS_H
|
||||||
@@ -22,7 +22,7 @@ add_definitions(-DWITH_GENX)
|
|||||||
# Creates the EPANET command line executable
|
# Creates the EPANET command line executable
|
||||||
add_executable(runepanet ${EPANET_CLI_SOURCES})
|
add_executable(runepanet ${EPANET_CLI_SOURCES})
|
||||||
if(NOT WIN32)
|
if(NOT WIN32)
|
||||||
target_link_libraries(runepanet LINK_PUBLIC epanet m)
|
target_link_libraries(runepanet LINK_PUBLIC epanet2 m)
|
||||||
else(NOT WIN32)
|
else(NOT WIN32)
|
||||||
target_link_libraries(runepanet LINK_PUBLIC epanet)
|
target_link_libraries(runepanet LINK_PUBLIC epanet2)
|
||||||
endif(NOT WIN32)
|
endif(NOT WIN32)
|
||||||
|
|||||||
16
run/main.c
16
run/main.c
@@ -1,5 +1,21 @@
|
|||||||
|
/*
|
||||||
|
******************************************************************************
|
||||||
|
Project: OWA EPANET
|
||||||
|
Version: 2.2
|
||||||
|
Module: main.c
|
||||||
|
Description: implementation of the CLI for EPANET
|
||||||
|
Authors: see AUTHORS
|
||||||
|
Copyright: see AUTHORS
|
||||||
|
License: see LICENSE
|
||||||
|
Last Updated: 11/27/2018
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "epanet2.h"
|
#include "epanet2.h"
|
||||||
|
|
||||||
#define MAXMSG 255 /* Max. # characters in message text */
|
#define MAXMSG 255 /* Max. # characters in message text */
|
||||||
|
|||||||
633
src/epanet.c
633
src/epanet.c
@@ -20,644 +20,13 @@
|
|||||||
#include <float.h>
|
#include <float.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "epanet2.h"
|
#include "epanet2_2.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "funcs.h"
|
#include "funcs.h"
|
||||||
#include "text.h"
|
#include "text.h"
|
||||||
#include "enumstxt.h"
|
#include "enumstxt.h"
|
||||||
|
|
||||||
// This single global variable is used only when the library is called
|
|
||||||
// in "legacy mode" with the 2.1-style API.
|
|
||||||
Project __defaultProject;
|
|
||||||
Project *_defaultProject = &__defaultProject;
|
|
||||||
|
|
||||||
// Functions for creating and removing default temporary files
|
|
||||||
void createtmpfiles()
|
|
||||||
{
|
|
||||||
getTmpName(_defaultProject->TmpHydFname);
|
|
||||||
getTmpName(_defaultProject->TmpOutFname);
|
|
||||||
getTmpName(_defaultProject->TmpStatFname);
|
|
||||||
}
|
|
||||||
void removetmpfiles()
|
|
||||||
{
|
|
||||||
remove(_defaultProject->TmpHydFname);
|
|
||||||
remove(_defaultProject->TmpOutFname);
|
|
||||||
remove(_defaultProject->TmpStatFname);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************
|
|
||||||
|
|
||||||
System Functions
|
|
||||||
|
|
||||||
********************************************************************/
|
|
||||||
|
|
||||||
int DLLEXPORT ENepanet(const char *f1, const char *f2, const char *f3,
|
|
||||||
void (*pviewprog)(char *))
|
|
||||||
{
|
|
||||||
/*------------------------------------------------------------------------
|
|
||||||
** Input: f1 = name of EPANET formatted input file
|
|
||||||
** f2 = name of report file
|
|
||||||
** f3 = name of binary output file
|
|
||||||
** pviewprog = see note below
|
|
||||||
** Output: none
|
|
||||||
** Returns: error code
|
|
||||||
** Purpose: runs a complete EPANET simulation
|
|
||||||
**
|
|
||||||
** The pviewprog() argument is a pointer to a callback function
|
|
||||||
** that takes a character string (char *) as its only parameter.
|
|
||||||
** The function would reside in and be used by the calling
|
|
||||||
** program to display the progress messages that EPANET generates
|
|
||||||
** as it carries out its computations. If this feature is not
|
|
||||||
** needed then the argument should be NULL.
|
|
||||||
**-------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
int errcode = 0;
|
|
||||||
int warncode = 0;
|
|
||||||
|
|
||||||
// Run the project and record any warning
|
|
||||||
createtmpfiles();
|
|
||||||
errcode = EN_runproject(_defaultProject, f1, f2, f3, pviewprog);
|
|
||||||
if (errcode < 100) warncode = errcode;
|
|
||||||
removetmpfiles();
|
|
||||||
|
|
||||||
// Return the warning code if the run had no errors
|
|
||||||
if (warncode) errcode = MAX(errcode, warncode);
|
|
||||||
return errcode;
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENinit(const char *f2, const char *f3, int UnitsType,
|
|
||||||
int HeadlossFormula)
|
|
||||||
{
|
|
||||||
int errcode = 0;
|
|
||||||
createtmpfiles();
|
|
||||||
errcode = EN_init(_defaultProject, f2, f3, UnitsType, HeadlossFormula);
|
|
||||||
return errcode;
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENopen(const char *f1, const char *f2, const char *f3)
|
|
||||||
{
|
|
||||||
int errcode = 0;
|
|
||||||
createtmpfiles();
|
|
||||||
errcode = EN_open(_defaultProject, f1, f2, f3);
|
|
||||||
return errcode;
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENsaveinpfile(const char *filename)
|
|
||||||
{
|
|
||||||
return EN_saveinpfile(_defaultProject, filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENclose()
|
|
||||||
{
|
|
||||||
EN_close(_defaultProject);
|
|
||||||
removetmpfiles();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/********************************************************************
|
|
||||||
|
|
||||||
Hydraulic Analysis Functions
|
|
||||||
|
|
||||||
********************************************************************/
|
|
||||||
|
|
||||||
int DLLEXPORT ENsolveH() { return EN_solveH(_defaultProject); }
|
|
||||||
|
|
||||||
int DLLEXPORT ENsaveH() { return EN_saveH(_defaultProject); }
|
|
||||||
|
|
||||||
int DLLEXPORT ENopenH() { return EN_openH(_defaultProject); }
|
|
||||||
|
|
||||||
int DLLEXPORT ENinitH(int flag) { return EN_initH(_defaultProject, flag); }
|
|
||||||
|
|
||||||
int DLLEXPORT ENrunH(long *t) { return EN_runH(_defaultProject, t); }
|
|
||||||
|
|
||||||
int DLLEXPORT ENnextH(long *tstep) { return EN_nextH(_defaultProject, tstep); }
|
|
||||||
|
|
||||||
int DLLEXPORT ENcloseH() { return EN_closeH(_defaultProject); }
|
|
||||||
|
|
||||||
int DLLEXPORT ENsavehydfile(char *filename)
|
|
||||||
{
|
|
||||||
return EN_savehydfile(_defaultProject, filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENusehydfile(char *filename)
|
|
||||||
{
|
|
||||||
return EN_usehydfile(_defaultProject, filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
/********************************************************************
|
|
||||||
|
|
||||||
Water Quality Analysis Functions
|
|
||||||
|
|
||||||
********************************************************************/
|
|
||||||
|
|
||||||
int DLLEXPORT ENsolveQ() { return EN_solveQ(_defaultProject); }
|
|
||||||
|
|
||||||
int DLLEXPORT ENopenQ() { return EN_openQ(_defaultProject); }
|
|
||||||
|
|
||||||
int DLLEXPORT ENinitQ(int saveflag) { return EN_initQ(_defaultProject, saveflag); }
|
|
||||||
|
|
||||||
int DLLEXPORT ENrunQ(long *t) { return EN_runQ(_defaultProject, t); }
|
|
||||||
|
|
||||||
int DLLEXPORT ENnextQ(long *tstep) { return EN_nextQ(_defaultProject, tstep); }
|
|
||||||
|
|
||||||
int DLLEXPORT ENstepQ(long *tleft) { return EN_stepQ(_defaultProject, tleft); }
|
|
||||||
|
|
||||||
int DLLEXPORT ENcloseQ() { return EN_closeQ(_defaultProject); }
|
|
||||||
|
|
||||||
/********************************************************************
|
|
||||||
|
|
||||||
Reporting Functions
|
|
||||||
|
|
||||||
********************************************************************/
|
|
||||||
|
|
||||||
int DLLEXPORT ENwriteline(char *line) { return EN_writeline(_defaultProject, line); }
|
|
||||||
|
|
||||||
int DLLEXPORT ENreport() { return EN_report(_defaultProject); }
|
|
||||||
|
|
||||||
int DLLEXPORT ENresetreport() { return EN_resetreport(_defaultProject); }
|
|
||||||
|
|
||||||
int DLLEXPORT ENsetreport(char *s) { return EN_setreport(_defaultProject, s); }
|
|
||||||
|
|
||||||
int DLLEXPORT ENsetstatusreport(int code)
|
|
||||||
{
|
|
||||||
return EN_setstatusreport(_defaultProject, code);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetversion(int *v) { return EN_getversion(v); }
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetcount(int code, int *count)
|
|
||||||
{
|
|
||||||
return EN_getcount(_defaultProject, (EN_CountType)code, count);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENgeterror(int errcode, char *errmsg, int n)
|
|
||||||
{
|
|
||||||
return EN_geterror(errcode, errmsg, n);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetstatistic(int code, EN_API_FLOAT_TYPE *value)
|
|
||||||
{
|
|
||||||
return EN_getstatistic(_defaultProject, code, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/********************************************************************
|
|
||||||
|
|
||||||
Analysis Options Functions
|
|
||||||
|
|
||||||
********************************************************************/
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetoption(int code, EN_API_FLOAT_TYPE *value)
|
|
||||||
{
|
|
||||||
return EN_getoption(_defaultProject, (EN_Option)code, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENsetoption(int code, EN_API_FLOAT_TYPE v)
|
|
||||||
{
|
|
||||||
return EN_setoption(_defaultProject, code, v);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetflowunits(int *code) { return EN_getflowunits(_defaultProject, code); }
|
|
||||||
|
|
||||||
int DLLEXPORT ENsetflowunits(int code) { return EN_setflowunits(_defaultProject, code); }
|
|
||||||
|
|
||||||
int DLLEXPORT ENgettimeparam(int code, long *value)
|
|
||||||
{
|
|
||||||
return EN_gettimeparam(_defaultProject, code, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENsettimeparam(int code, long value)
|
|
||||||
{
|
|
||||||
return EN_settimeparam(_defaultProject, code, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetqualinfo(int *qualcode, char *chemname, char *chemunits,
|
|
||||||
int *tracenode)
|
|
||||||
{
|
|
||||||
return EN_getqualinfo(_defaultProject, qualcode, chemname, chemunits, tracenode);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetqualtype(int *qualcode, int *tracenode)
|
|
||||||
{
|
|
||||||
return EN_getqualtype(_defaultProject, qualcode, tracenode);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENsetqualtype(int qualcode, char *chemname, char *chemunits,
|
|
||||||
char *tracenode)
|
|
||||||
{
|
|
||||||
return EN_setqualtype(_defaultProject, qualcode, chemname, chemunits, tracenode);
|
|
||||||
}
|
|
||||||
|
|
||||||
/********************************************************************
|
|
||||||
|
|
||||||
Node Functions
|
|
||||||
|
|
||||||
********************************************************************/
|
|
||||||
|
|
||||||
int DLLEXPORT ENaddnode(char *id, EN_NodeType nodeType)
|
|
||||||
{
|
|
||||||
return EN_addnode(_defaultProject, id, nodeType);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENdeletenode(int index, int actionCode)
|
|
||||||
{
|
|
||||||
return EN_deletenode(_defaultProject, index, actionCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetnodeindex(char *id, int *index)
|
|
||||||
{
|
|
||||||
return EN_getnodeindex(_defaultProject, id, index);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetnodeid(int index, char *id)
|
|
||||||
{
|
|
||||||
return EN_getnodeid(_defaultProject, index, id);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENsetnodeid(int index, char *newid)
|
|
||||||
{
|
|
||||||
return EN_setnodeid(_defaultProject, index, newid);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetnodetype(int index, int *code)
|
|
||||||
{
|
|
||||||
return EN_getnodetype(_defaultProject, index, code);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetnodevalue(int index, int code, EN_API_FLOAT_TYPE *value)
|
|
||||||
{
|
|
||||||
return EN_getnodevalue(_defaultProject, index, code, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENsetnodevalue(int index, int code, EN_API_FLOAT_TYPE v)
|
|
||||||
{
|
|
||||||
return EN_setnodevalue(_defaultProject, index, code, v);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetcoord(int index, EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y)
|
|
||||||
{
|
|
||||||
return EN_getcoord(_defaultProject, index, x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENsetcoord(int index, EN_API_FLOAT_TYPE x, EN_API_FLOAT_TYPE y)
|
|
||||||
{
|
|
||||||
return EN_setcoord(_defaultProject, index, x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
/********************************************************************
|
|
||||||
|
|
||||||
Nodal Demand Functions
|
|
||||||
|
|
||||||
********************************************************************/
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetdemandmodel(int *type, EN_API_FLOAT_TYPE *pmin,
|
|
||||||
EN_API_FLOAT_TYPE *preq, EN_API_FLOAT_TYPE *pexp)
|
|
||||||
{
|
|
||||||
return EN_getdemandmodel(_defaultProject, type, pmin, preq, pexp);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENsetdemandmodel(int type, EN_API_FLOAT_TYPE pmin,
|
|
||||||
EN_API_FLOAT_TYPE preq, EN_API_FLOAT_TYPE pexp)
|
|
||||||
{
|
|
||||||
return EN_setdemandmodel(_defaultProject, type, pmin, preq, pexp);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetnumdemands(int nodeIndex, int *numDemands)
|
|
||||||
{
|
|
||||||
return EN_getnumdemands(_defaultProject, nodeIndex, numDemands);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetbasedemand(int nodeIndex, int demandIdx, EN_API_FLOAT_TYPE *baseDemand)
|
|
||||||
{
|
|
||||||
return EN_getbasedemand(_defaultProject, nodeIndex, demandIdx, baseDemand);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENsetbasedemand(int nodeIndex, int demandIdx, EN_API_FLOAT_TYPE baseDemand)
|
|
||||||
{
|
|
||||||
return EN_setbasedemand(_defaultProject, nodeIndex, demandIdx, baseDemand);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENsetdemandpattern(int nodeIndex, int demandIdx, int patIndex)
|
|
||||||
{
|
|
||||||
return EN_setdemandpattern(_defaultProject, nodeIndex, demandIdx, patIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetdemandpattern(int nodeIndex, int demandIdx, int *pattIdx)
|
|
||||||
{
|
|
||||||
return EN_getdemandpattern(_defaultProject, nodeIndex, demandIdx, pattIdx);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetdemandname(int nodeIndex, int demandIdx, char *demandName)
|
|
||||||
{
|
|
||||||
return EN_getdemandname(_defaultProject, nodeIndex, demandIdx, demandName);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENsetdemandname(int nodeIndex, int demandIdx, char *demandName)
|
|
||||||
{
|
|
||||||
return EN_setdemandname(_defaultProject, nodeIndex, demandIdx, demandName);
|
|
||||||
}
|
|
||||||
|
|
||||||
/********************************************************************
|
|
||||||
|
|
||||||
Link Functions
|
|
||||||
|
|
||||||
********************************************************************/
|
|
||||||
|
|
||||||
int DLLEXPORT ENaddlink(char *id, EN_LinkType linkType, char *fromNode, char *toNode)
|
|
||||||
{
|
|
||||||
return EN_addlink(_defaultProject, id, linkType, fromNode, toNode);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENdeletelink(int index, int actionCode)
|
|
||||||
{
|
|
||||||
return EN_deletelink(_defaultProject, index, actionCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetlinkindex(char *id, int *index)
|
|
||||||
{
|
|
||||||
return EN_getlinkindex(_defaultProject, id, index);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetlinkid(int index, char *id)
|
|
||||||
{
|
|
||||||
return EN_getlinkid(_defaultProject, index, id);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENsetlinkid(int index, char *newid)
|
|
||||||
{
|
|
||||||
return EN_setlinkid(_defaultProject, index, newid);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetlinktype(int index, EN_LinkType *code)
|
|
||||||
{
|
|
||||||
return EN_getlinktype(_defaultProject, index, code);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENsetlinktype(int *index, EN_LinkType type, int actionCode)
|
|
||||||
{
|
|
||||||
return EN_setlinktype(_defaultProject, index, type, actionCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetlinknodes(int index, int *node1, int *node2)
|
|
||||||
{
|
|
||||||
return EN_getlinknodes(_defaultProject, index, node1, node2);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENsetlinknodes(int index, int node1, int node2)
|
|
||||||
{
|
|
||||||
return EN_setlinknodes(_defaultProject, index, node1, node2);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetlinkvalue(int index, int code, EN_API_FLOAT_TYPE *value)
|
|
||||||
{
|
|
||||||
return EN_getlinkvalue(_defaultProject, index, (EN_LinkProperty)code, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENsetlinkvalue(int index, int code, EN_API_FLOAT_TYPE v)
|
|
||||||
{
|
|
||||||
return EN_setlinkvalue(_defaultProject, index, code, v);
|
|
||||||
}
|
|
||||||
|
|
||||||
/********************************************************************
|
|
||||||
|
|
||||||
Pump Functions
|
|
||||||
|
|
||||||
********************************************************************/
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetpumptype(int index, int *type)
|
|
||||||
{
|
|
||||||
return EN_getpumptype(_defaultProject, index, type);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetheadcurveindex(int index, int *curveindex)
|
|
||||||
{
|
|
||||||
return EN_getheadcurveindex(_defaultProject, index, curveindex);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENsetheadcurveindex(int index, int curveindex)
|
|
||||||
{
|
|
||||||
return EN_setheadcurveindex(_defaultProject, index, curveindex);
|
|
||||||
}
|
|
||||||
|
|
||||||
/********************************************************************
|
|
||||||
|
|
||||||
Time Pattern Functions
|
|
||||||
|
|
||||||
********************************************************************/
|
|
||||||
|
|
||||||
int DLLEXPORT ENaddpattern(char *id)
|
|
||||||
{
|
|
||||||
return EN_addpattern(_defaultProject, id);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetpatternindex(char *id, int *index)
|
|
||||||
{
|
|
||||||
return EN_getpatternindex(_defaultProject, id, index);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetpatternid(int index, char *id)
|
|
||||||
{
|
|
||||||
return EN_getpatternid(_defaultProject, index, id);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetpatternlen(int index, int *len)
|
|
||||||
{
|
|
||||||
return EN_getpatternlen(_defaultProject, index, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetpatternvalue(int index, int period, EN_API_FLOAT_TYPE *value)
|
|
||||||
{
|
|
||||||
return EN_getpatternvalue(_defaultProject, index, period, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENsetpatternvalue(int index, int period, EN_API_FLOAT_TYPE value)
|
|
||||||
{
|
|
||||||
return EN_setpatternvalue(_defaultProject, index, period, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetaveragepatternvalue(int index, EN_API_FLOAT_TYPE *value)
|
|
||||||
{
|
|
||||||
return EN_getaveragepatternvalue(_defaultProject, index, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENsetpattern(int index, EN_API_FLOAT_TYPE *f, int n)
|
|
||||||
{
|
|
||||||
return EN_setpattern(_defaultProject, index, f, n);
|
|
||||||
}
|
|
||||||
|
|
||||||
/********************************************************************
|
|
||||||
|
|
||||||
Data Curve Functions
|
|
||||||
|
|
||||||
********************************************************************/
|
|
||||||
|
|
||||||
int DLLEXPORT ENaddcurve(char *id)
|
|
||||||
{
|
|
||||||
return EN_addcurve(_defaultProject, id);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetcurveindex(char *id, int *index)
|
|
||||||
{
|
|
||||||
return EN_getcurveindex(_defaultProject, id, index);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetcurveid(int index, char *id)
|
|
||||||
{
|
|
||||||
return EN_getcurveid(_defaultProject, index, id);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetcurvelen(int index, int *len)
|
|
||||||
{
|
|
||||||
return EN_getcurvelen(_defaultProject, index, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetcurvetype(int curveindex, int *type)
|
|
||||||
{
|
|
||||||
return EN_getcurvetype(_defaultProject, curveindex, type);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetcurvevalue(int index, int pnt, EN_API_FLOAT_TYPE *x,
|
|
||||||
EN_API_FLOAT_TYPE *y)
|
|
||||||
{
|
|
||||||
return EN_getcurvevalue(_defaultProject, index, pnt, x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENsetcurvevalue(int index, int pnt, EN_API_FLOAT_TYPE x,
|
|
||||||
EN_API_FLOAT_TYPE y)
|
|
||||||
{
|
|
||||||
return EN_setcurvevalue(_defaultProject, index, pnt, x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetcurve(int curveIndex, char *id, int *nValues,
|
|
||||||
EN_API_FLOAT_TYPE **xValues, EN_API_FLOAT_TYPE **yValues)
|
|
||||||
{
|
|
||||||
return EN_getcurve(_defaultProject, curveIndex, id, nValues, xValues, yValues);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENsetcurve(int index, EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y, int n)
|
|
||||||
{
|
|
||||||
return EN_setcurve(_defaultProject, index, x, y, n);
|
|
||||||
}
|
|
||||||
|
|
||||||
/********************************************************************
|
|
||||||
|
|
||||||
Simple Controls Functions
|
|
||||||
|
|
||||||
********************************************************************/
|
|
||||||
|
|
||||||
int DLLEXPORT ENaddcontrol(int *cindex, int ctype, int lindex, EN_API_FLOAT_TYPE setting,
|
|
||||||
int nindex, EN_API_FLOAT_TYPE level)
|
|
||||||
{
|
|
||||||
return EN_addcontrol(_defaultProject, cindex, ctype, lindex, setting, nindex, level);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENdeletecontrol(int cindex)
|
|
||||||
{
|
|
||||||
return EN_deletecontrol(_defaultProject, cindex);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetcontrol(int cindex, int *ctype, int *lindex, EN_API_FLOAT_TYPE *setting,
|
|
||||||
int *nindex, EN_API_FLOAT_TYPE *level)
|
|
||||||
{
|
|
||||||
return EN_getcontrol(_defaultProject, cindex, ctype, lindex, setting, nindex, level);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENsetcontrol(int cindex, int ctype, int lindex, EN_API_FLOAT_TYPE setting,
|
|
||||||
int nindex, EN_API_FLOAT_TYPE level)
|
|
||||||
{
|
|
||||||
return EN_setcontrol(_defaultProject, cindex, ctype, lindex, setting, nindex, level);
|
|
||||||
}
|
|
||||||
|
|
||||||
/********************************************************************
|
|
||||||
|
|
||||||
Rule-Based Controls Functions
|
|
||||||
|
|
||||||
********************************************************************/
|
|
||||||
|
|
||||||
int DLLEXPORT ENaddrule(char *rule)
|
|
||||||
{
|
|
||||||
return EN_addrule(_defaultProject, rule);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENdeleterule(int index)
|
|
||||||
{
|
|
||||||
return EN_deleterule(_defaultProject, index);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetrule(int index, int *nPremises, int *nThenActions, int *nElseActions,
|
|
||||||
EN_API_FLOAT_TYPE *priority)
|
|
||||||
{
|
|
||||||
return EN_getrule(_defaultProject, index, nPremises, nThenActions, nElseActions, priority);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetruleID(int index, char* id)
|
|
||||||
{
|
|
||||||
return EN_getruleID(_defaultProject, index, id);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetpremise(int ruleIndex, int premiseIndex, int *logop,
|
|
||||||
int *object, int *objIndex, int *variable,
|
|
||||||
int *relop, int *status, EN_API_FLOAT_TYPE *value)
|
|
||||||
{
|
|
||||||
return EN_getpremise(_defaultProject, ruleIndex, premiseIndex, logop, object,
|
|
||||||
objIndex, variable, relop, status, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENsetpremise(int ruleIndex, int premiseIndex, int logop,
|
|
||||||
int object, int objIndex, int variable, int relop,
|
|
||||||
int status, EN_API_FLOAT_TYPE value)
|
|
||||||
{
|
|
||||||
return EN_setpremise(_defaultProject, ruleIndex, premiseIndex, logop, object,
|
|
||||||
objIndex, variable, relop, status, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENsetpremiseindex(int ruleIndex, int premiseIndex, int objIndex)
|
|
||||||
{
|
|
||||||
return EN_setpremiseindex(_defaultProject, ruleIndex, premiseIndex, objIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENsetpremisestatus(int ruleIndex, int premiseIndex, int status)
|
|
||||||
{
|
|
||||||
return EN_setpremisestatus(_defaultProject, ruleIndex, premiseIndex, status);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENsetpremisevalue(int ruleIndex, int premiseIndex, EN_API_FLOAT_TYPE value)
|
|
||||||
{
|
|
||||||
return EN_setpremisevalue(_defaultProject, ruleIndex, premiseIndex, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetthenaction(int ruleIndex, int actionIndex, int *linkIndex,
|
|
||||||
int *status, EN_API_FLOAT_TYPE *setting)
|
|
||||||
{
|
|
||||||
return EN_getthenaction(_defaultProject, ruleIndex, actionIndex, linkIndex,
|
|
||||||
status, setting);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENsetthenaction(int ruleIndex, int actionIndex, int linkIndex,
|
|
||||||
int status, EN_API_FLOAT_TYPE setting)
|
|
||||||
{
|
|
||||||
return EN_setthenaction(_defaultProject, ruleIndex, actionIndex, linkIndex,
|
|
||||||
status, setting);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetelseaction(int ruleIndex, int actionIndex, int *linkIndex,
|
|
||||||
int *status, EN_API_FLOAT_TYPE *setting)
|
|
||||||
{
|
|
||||||
return EN_getelseaction(_defaultProject, ruleIndex, actionIndex, linkIndex,
|
|
||||||
status, setting);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENsetelseaction(int ruleIndex, int actionIndex, int linkIndex,
|
|
||||||
int status, EN_API_FLOAT_TYPE setting)
|
|
||||||
{
|
|
||||||
return EN_setelseaction(_defaultProject, ruleIndex, actionIndex, linkIndex,
|
|
||||||
status, setting);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENsetrulepriority(int index, EN_API_FLOAT_TYPE priority)
|
|
||||||
{
|
|
||||||
return EN_setrulepriority(_defaultProject, index, priority);
|
|
||||||
}
|
|
||||||
|
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
|
|
||||||
|
|||||||
654
src/epanet2.c
Normal file
654
src/epanet2.c
Normal file
@@ -0,0 +1,654 @@
|
|||||||
|
/*
|
||||||
|
******************************************************************************
|
||||||
|
Project: OWA EPANET
|
||||||
|
Version: 2.2
|
||||||
|
Module: epanet2.c
|
||||||
|
Description: implementation of the legacy EPANET API functions
|
||||||
|
Authors: see AUTHORS
|
||||||
|
Copyright: see AUTHORS
|
||||||
|
License: see LICENSE
|
||||||
|
Last Updated: 11/29/2018
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "types.h"
|
||||||
|
#include "funcs.h"
|
||||||
|
|
||||||
|
#include "epanet2.h"
|
||||||
|
#include "epanet2_2.h"
|
||||||
|
|
||||||
|
|
||||||
|
// This single global variable is used only when the library is called
|
||||||
|
// in "legacy mode" with the 2.1-style API.
|
||||||
|
Project __defaultProject;
|
||||||
|
Project *_defaultProject = &__defaultProject;
|
||||||
|
|
||||||
|
// Functions for creating and removing default temporary files
|
||||||
|
void createtmpfiles()
|
||||||
|
{
|
||||||
|
getTmpName(_defaultProject->TmpHydFname);
|
||||||
|
getTmpName(_defaultProject->TmpOutFname);
|
||||||
|
getTmpName(_defaultProject->TmpStatFname);
|
||||||
|
}
|
||||||
|
|
||||||
|
void removetmpfiles()
|
||||||
|
{
|
||||||
|
remove(_defaultProject->TmpHydFname);
|
||||||
|
remove(_defaultProject->TmpOutFname);
|
||||||
|
remove(_defaultProject->TmpStatFname);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/********************************************************************
|
||||||
|
|
||||||
|
System Functions
|
||||||
|
|
||||||
|
********************************************************************/
|
||||||
|
|
||||||
|
int DLLEXPORT ENepanet(const char *f1, const char *f2, const char *f3,
|
||||||
|
void (*pviewprog)(char *))
|
||||||
|
{
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
** Input: f1 = name of EPANET formatted input file
|
||||||
|
** f2 = name of report file
|
||||||
|
** f3 = name of binary output file
|
||||||
|
** pviewprog = see note below
|
||||||
|
** Output: none
|
||||||
|
** Returns: error code
|
||||||
|
** Purpose: runs a complete EPANET simulation
|
||||||
|
**
|
||||||
|
** The pviewprog() argument is a pointer to a callback function
|
||||||
|
** that takes a character string (char *) as its only parameter.
|
||||||
|
** The function would reside in and be used by the calling
|
||||||
|
** program to display the progress messages that EPANET generates
|
||||||
|
** as it carries out its computations. If this feature is not
|
||||||
|
** needed then the argument should be NULL.
|
||||||
|
**-------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
int errcode = 0;
|
||||||
|
int warncode = 0;
|
||||||
|
|
||||||
|
// Run the project and record any warning
|
||||||
|
createtmpfiles();
|
||||||
|
errcode = EN_runproject(_defaultProject, f1, f2, f3, pviewprog);
|
||||||
|
if (errcode < 100) warncode = errcode;
|
||||||
|
removetmpfiles();
|
||||||
|
|
||||||
|
// Return the warning code if the run had no errors
|
||||||
|
if (warncode) errcode = MAX(errcode, warncode);
|
||||||
|
return errcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENinit(const char *f2, const char *f3, int UnitsType,
|
||||||
|
int HeadlossFormula)
|
||||||
|
{
|
||||||
|
int errcode = 0;
|
||||||
|
createtmpfiles();
|
||||||
|
errcode = EN_init(_defaultProject, f2, f3, UnitsType, HeadlossFormula);
|
||||||
|
return errcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENopen(const char *f1, const char *f2, const char *f3)
|
||||||
|
{
|
||||||
|
int errcode = 0;
|
||||||
|
createtmpfiles();
|
||||||
|
errcode = EN_open(_defaultProject, f1, f2, f3);
|
||||||
|
return errcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENsaveinpfile(const char *filename)
|
||||||
|
{
|
||||||
|
return EN_saveinpfile(_defaultProject, filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENclose()
|
||||||
|
{
|
||||||
|
EN_close(_defaultProject);
|
||||||
|
removetmpfiles();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/********************************************************************
|
||||||
|
|
||||||
|
Hydraulic Analysis Functions
|
||||||
|
|
||||||
|
********************************************************************/
|
||||||
|
|
||||||
|
int DLLEXPORT ENsolveH() { return EN_solveH(_defaultProject); }
|
||||||
|
|
||||||
|
int DLLEXPORT ENsaveH() { return EN_saveH(_defaultProject); }
|
||||||
|
|
||||||
|
int DLLEXPORT ENopenH() { return EN_openH(_defaultProject); }
|
||||||
|
|
||||||
|
int DLLEXPORT ENinitH(int flag) { return EN_initH(_defaultProject, flag); }
|
||||||
|
|
||||||
|
int DLLEXPORT ENrunH(long *t) { return EN_runH(_defaultProject, t); }
|
||||||
|
|
||||||
|
int DLLEXPORT ENnextH(long *tstep) { return EN_nextH(_defaultProject, tstep); }
|
||||||
|
|
||||||
|
int DLLEXPORT ENcloseH() { return EN_closeH(_defaultProject); }
|
||||||
|
|
||||||
|
int DLLEXPORT ENsavehydfile(char *filename)
|
||||||
|
{
|
||||||
|
return EN_savehydfile(_defaultProject, filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENusehydfile(char *filename)
|
||||||
|
{
|
||||||
|
return EN_usehydfile(_defaultProject, filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
/********************************************************************
|
||||||
|
|
||||||
|
Water Quality Analysis Functions
|
||||||
|
|
||||||
|
********************************************************************/
|
||||||
|
|
||||||
|
int DLLEXPORT ENsolveQ() { return EN_solveQ(_defaultProject); }
|
||||||
|
|
||||||
|
int DLLEXPORT ENopenQ() { return EN_openQ(_defaultProject); }
|
||||||
|
|
||||||
|
int DLLEXPORT ENinitQ(int saveflag) { return EN_initQ(_defaultProject, saveflag); }
|
||||||
|
|
||||||
|
int DLLEXPORT ENrunQ(long *t) { return EN_runQ(_defaultProject, t); }
|
||||||
|
|
||||||
|
int DLLEXPORT ENnextQ(long *tstep) { return EN_nextQ(_defaultProject, tstep); }
|
||||||
|
|
||||||
|
int DLLEXPORT ENstepQ(long *tleft) { return EN_stepQ(_defaultProject, tleft); }
|
||||||
|
|
||||||
|
int DLLEXPORT ENcloseQ() { return EN_closeQ(_defaultProject); }
|
||||||
|
|
||||||
|
/********************************************************************
|
||||||
|
|
||||||
|
Reporting Functions
|
||||||
|
|
||||||
|
********************************************************************/
|
||||||
|
|
||||||
|
int DLLEXPORT ENwriteline(char *line) { return EN_writeline(_defaultProject, line); }
|
||||||
|
|
||||||
|
int DLLEXPORT ENreport() { return EN_report(_defaultProject); }
|
||||||
|
|
||||||
|
int DLLEXPORT ENresetreport() { return EN_resetreport(_defaultProject); }
|
||||||
|
|
||||||
|
int DLLEXPORT ENsetreport(char *s) { return EN_setreport(_defaultProject, s); }
|
||||||
|
|
||||||
|
int DLLEXPORT ENsetstatusreport(int code)
|
||||||
|
{
|
||||||
|
return EN_setstatusreport(_defaultProject, code);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENgetversion(int *v) { return EN_getversion(v); }
|
||||||
|
|
||||||
|
int DLLEXPORT ENgetcount(int code, int *count)
|
||||||
|
{
|
||||||
|
return EN_getcount(_defaultProject, (EN_CountType)code, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENgeterror(int errcode, char *errmsg, int n)
|
||||||
|
{
|
||||||
|
return EN_geterror(errcode, errmsg, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENgetstatistic(int code, EN_API_FLOAT_TYPE *value)
|
||||||
|
{
|
||||||
|
return EN_getstatistic(_defaultProject, code, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/********************************************************************
|
||||||
|
|
||||||
|
Analysis Options Functions
|
||||||
|
|
||||||
|
********************************************************************/
|
||||||
|
|
||||||
|
int DLLEXPORT ENgetoption(int code, EN_API_FLOAT_TYPE *value)
|
||||||
|
{
|
||||||
|
return EN_getoption(_defaultProject, (EN_Option)code, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENsetoption(int code, EN_API_FLOAT_TYPE v)
|
||||||
|
{
|
||||||
|
return EN_setoption(_defaultProject, code, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENgetflowunits(int *code) { return EN_getflowunits(_defaultProject, code); }
|
||||||
|
|
||||||
|
int DLLEXPORT ENsetflowunits(int code) { return EN_setflowunits(_defaultProject, code); }
|
||||||
|
|
||||||
|
int DLLEXPORT ENgettimeparam(int code, long *value)
|
||||||
|
{
|
||||||
|
return EN_gettimeparam(_defaultProject, code, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENsettimeparam(int code, long value)
|
||||||
|
{
|
||||||
|
return EN_settimeparam(_defaultProject, code, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENgetqualinfo(int *qualcode, char *chemname, char *chemunits,
|
||||||
|
int *tracenode)
|
||||||
|
{
|
||||||
|
return EN_getqualinfo(_defaultProject, qualcode, chemname, chemunits, tracenode);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENgetqualtype(int *qualcode, int *tracenode)
|
||||||
|
{
|
||||||
|
return EN_getqualtype(_defaultProject, qualcode, tracenode);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENsetqualtype(int qualcode, char *chemname, char *chemunits,
|
||||||
|
char *tracenode)
|
||||||
|
{
|
||||||
|
return EN_setqualtype(_defaultProject, qualcode, chemname, chemunits, tracenode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/********************************************************************
|
||||||
|
|
||||||
|
Node Functions
|
||||||
|
|
||||||
|
********************************************************************/
|
||||||
|
|
||||||
|
int DLLEXPORT ENaddnode(char *id, EN_NodeType nodeType)
|
||||||
|
{
|
||||||
|
return EN_addnode(_defaultProject, id, nodeType);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENdeletenode(int index, int actionCode)
|
||||||
|
{
|
||||||
|
return EN_deletenode(_defaultProject, index, actionCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENgetnodeindex(char *id, int *index)
|
||||||
|
{
|
||||||
|
return EN_getnodeindex(_defaultProject, id, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENgetnodeid(int index, char *id)
|
||||||
|
{
|
||||||
|
return EN_getnodeid(_defaultProject, index, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENsetnodeid(int index, char *newid)
|
||||||
|
{
|
||||||
|
return EN_setnodeid(_defaultProject, index, newid);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENgetnodetype(int index, int *code)
|
||||||
|
{
|
||||||
|
return EN_getnodetype(_defaultProject, index, code);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENgetnodevalue(int index, int code, EN_API_FLOAT_TYPE *value)
|
||||||
|
{
|
||||||
|
return EN_getnodevalue(_defaultProject, index, code, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENsetnodevalue(int index, int code, EN_API_FLOAT_TYPE v)
|
||||||
|
{
|
||||||
|
return EN_setnodevalue(_defaultProject, index, code, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENgetcoord(int index, EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y)
|
||||||
|
{
|
||||||
|
return EN_getcoord(_defaultProject, index, x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENsetcoord(int index, EN_API_FLOAT_TYPE x, EN_API_FLOAT_TYPE y)
|
||||||
|
{
|
||||||
|
return EN_setcoord(_defaultProject, index, x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
/********************************************************************
|
||||||
|
|
||||||
|
Nodal Demand Functions
|
||||||
|
|
||||||
|
********************************************************************/
|
||||||
|
|
||||||
|
int DLLEXPORT ENgetdemandmodel(int *type, EN_API_FLOAT_TYPE *pmin,
|
||||||
|
EN_API_FLOAT_TYPE *preq, EN_API_FLOAT_TYPE *pexp)
|
||||||
|
{
|
||||||
|
return EN_getdemandmodel(_defaultProject, type, pmin, preq, pexp);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENsetdemandmodel(int type, EN_API_FLOAT_TYPE pmin,
|
||||||
|
EN_API_FLOAT_TYPE preq, EN_API_FLOAT_TYPE pexp)
|
||||||
|
{
|
||||||
|
return EN_setdemandmodel(_defaultProject, type, pmin, preq, pexp);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENgetnumdemands(int nodeIndex, int *numDemands)
|
||||||
|
{
|
||||||
|
return EN_getnumdemands(_defaultProject, nodeIndex, numDemands);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENgetbasedemand(int nodeIndex, int demandIdx, EN_API_FLOAT_TYPE *baseDemand)
|
||||||
|
{
|
||||||
|
return EN_getbasedemand(_defaultProject, nodeIndex, demandIdx, baseDemand);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENsetbasedemand(int nodeIndex, int demandIdx, EN_API_FLOAT_TYPE baseDemand)
|
||||||
|
{
|
||||||
|
return EN_setbasedemand(_defaultProject, nodeIndex, demandIdx, baseDemand);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENsetdemandpattern(int nodeIndex, int demandIdx, int patIndex)
|
||||||
|
{
|
||||||
|
return EN_setdemandpattern(_defaultProject, nodeIndex, demandIdx, patIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENgetdemandpattern(int nodeIndex, int demandIdx, int *pattIdx)
|
||||||
|
{
|
||||||
|
return EN_getdemandpattern(_defaultProject, nodeIndex, demandIdx, pattIdx);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENgetdemandname(int nodeIndex, int demandIdx, char *demandName)
|
||||||
|
{
|
||||||
|
return EN_getdemandname(_defaultProject, nodeIndex, demandIdx, demandName);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENsetdemandname(int nodeIndex, int demandIdx, char *demandName)
|
||||||
|
{
|
||||||
|
return EN_setdemandname(_defaultProject, nodeIndex, demandIdx, demandName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/********************************************************************
|
||||||
|
|
||||||
|
Link Functions
|
||||||
|
|
||||||
|
********************************************************************/
|
||||||
|
|
||||||
|
int DLLEXPORT ENaddlink(char *id, EN_LinkType linkType, char *fromNode, char *toNode)
|
||||||
|
{
|
||||||
|
return EN_addlink(_defaultProject, id, linkType, fromNode, toNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENdeletelink(int index, int actionCode)
|
||||||
|
{
|
||||||
|
return EN_deletelink(_defaultProject, index, actionCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENgetlinkindex(char *id, int *index)
|
||||||
|
{
|
||||||
|
return EN_getlinkindex(_defaultProject, id, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENgetlinkid(int index, char *id)
|
||||||
|
{
|
||||||
|
return EN_getlinkid(_defaultProject, index, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENsetlinkid(int index, char *newid)
|
||||||
|
{
|
||||||
|
return EN_setlinkid(_defaultProject, index, newid);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENgetlinktype(int index, EN_LinkType *code)
|
||||||
|
{
|
||||||
|
return EN_getlinktype(_defaultProject, index, code);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENsetlinktype(int *index, EN_LinkType type, int actionCode)
|
||||||
|
{
|
||||||
|
return EN_setlinktype(_defaultProject, index, type, actionCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENgetlinknodes(int index, int *node1, int *node2)
|
||||||
|
{
|
||||||
|
return EN_getlinknodes(_defaultProject, index, node1, node2);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENsetlinknodes(int index, int node1, int node2)
|
||||||
|
{
|
||||||
|
return EN_setlinknodes(_defaultProject, index, node1, node2);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENgetlinkvalue(int index, int code, EN_API_FLOAT_TYPE *value)
|
||||||
|
{
|
||||||
|
return EN_getlinkvalue(_defaultProject, index, (EN_LinkProperty)code, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENsetlinkvalue(int index, int code, EN_API_FLOAT_TYPE v)
|
||||||
|
{
|
||||||
|
return EN_setlinkvalue(_defaultProject, index, code, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
/********************************************************************
|
||||||
|
|
||||||
|
Pump Functions
|
||||||
|
|
||||||
|
********************************************************************/
|
||||||
|
|
||||||
|
int DLLEXPORT ENgetpumptype(int index, int *type)
|
||||||
|
{
|
||||||
|
return EN_getpumptype(_defaultProject, index, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENgetheadcurveindex(int index, int *curveindex)
|
||||||
|
{
|
||||||
|
return EN_getheadcurveindex(_defaultProject, index, curveindex);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENsetheadcurveindex(int index, int curveindex)
|
||||||
|
{
|
||||||
|
return EN_setheadcurveindex(_defaultProject, index, curveindex);
|
||||||
|
}
|
||||||
|
|
||||||
|
/********************************************************************
|
||||||
|
|
||||||
|
Time Pattern Functions
|
||||||
|
|
||||||
|
********************************************************************/
|
||||||
|
|
||||||
|
int DLLEXPORT ENaddpattern(char *id)
|
||||||
|
{
|
||||||
|
return EN_addpattern(_defaultProject, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENgetpatternindex(char *id, int *index)
|
||||||
|
{
|
||||||
|
return EN_getpatternindex(_defaultProject, id, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENgetpatternid(int index, char *id)
|
||||||
|
{
|
||||||
|
return EN_getpatternid(_defaultProject, index, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENgetpatternlen(int index, int *len)
|
||||||
|
{
|
||||||
|
return EN_getpatternlen(_defaultProject, index, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENgetpatternvalue(int index, int period, EN_API_FLOAT_TYPE *value)
|
||||||
|
{
|
||||||
|
return EN_getpatternvalue(_defaultProject, index, period, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENsetpatternvalue(int index, int period, EN_API_FLOAT_TYPE value)
|
||||||
|
{
|
||||||
|
return EN_setpatternvalue(_defaultProject, index, period, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENgetaveragepatternvalue(int index, EN_API_FLOAT_TYPE *value)
|
||||||
|
{
|
||||||
|
return EN_getaveragepatternvalue(_defaultProject, index, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENsetpattern(int index, EN_API_FLOAT_TYPE *f, int n)
|
||||||
|
{
|
||||||
|
return EN_setpattern(_defaultProject, index, f, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
/********************************************************************
|
||||||
|
|
||||||
|
Data Curve Functions
|
||||||
|
|
||||||
|
********************************************************************/
|
||||||
|
|
||||||
|
int DLLEXPORT ENaddcurve(char *id)
|
||||||
|
{
|
||||||
|
return EN_addcurve(_defaultProject, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENgetcurveindex(char *id, int *index)
|
||||||
|
{
|
||||||
|
return EN_getcurveindex(_defaultProject, id, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENgetcurveid(int index, char *id)
|
||||||
|
{
|
||||||
|
return EN_getcurveid(_defaultProject, index, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENgetcurvelen(int index, int *len)
|
||||||
|
{
|
||||||
|
return EN_getcurvelen(_defaultProject, index, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENgetcurvetype(int curveindex, int *type)
|
||||||
|
{
|
||||||
|
return EN_getcurvetype(_defaultProject, curveindex, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENgetcurvevalue(int index, int pnt, EN_API_FLOAT_TYPE *x,
|
||||||
|
EN_API_FLOAT_TYPE *y)
|
||||||
|
{
|
||||||
|
return EN_getcurvevalue(_defaultProject, index, pnt, x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENsetcurvevalue(int index, int pnt, EN_API_FLOAT_TYPE x,
|
||||||
|
EN_API_FLOAT_TYPE y)
|
||||||
|
{
|
||||||
|
return EN_setcurvevalue(_defaultProject, index, pnt, x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENgetcurve(int curveIndex, char *id, int *nValues,
|
||||||
|
EN_API_FLOAT_TYPE **xValues, EN_API_FLOAT_TYPE **yValues)
|
||||||
|
{
|
||||||
|
return EN_getcurve(_defaultProject, curveIndex, id, nValues, xValues, yValues);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENsetcurve(int index, EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y, int n)
|
||||||
|
{
|
||||||
|
return EN_setcurve(_defaultProject, index, x, y, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
/********************************************************************
|
||||||
|
|
||||||
|
Simple Controls Functions
|
||||||
|
|
||||||
|
********************************************************************/
|
||||||
|
|
||||||
|
int DLLEXPORT ENaddcontrol(int *cindex, int ctype, int lindex, EN_API_FLOAT_TYPE setting,
|
||||||
|
int nindex, EN_API_FLOAT_TYPE level)
|
||||||
|
{
|
||||||
|
return EN_addcontrol(_defaultProject, cindex, ctype, lindex, setting, nindex, level);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENdeletecontrol(int cindex)
|
||||||
|
{
|
||||||
|
return EN_deletecontrol(_defaultProject, cindex);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENgetcontrol(int cindex, int *ctype, int *lindex, EN_API_FLOAT_TYPE *setting,
|
||||||
|
int *nindex, EN_API_FLOAT_TYPE *level)
|
||||||
|
{
|
||||||
|
return EN_getcontrol(_defaultProject, cindex, ctype, lindex, setting, nindex, level);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENsetcontrol(int cindex, int ctype, int lindex, EN_API_FLOAT_TYPE setting,
|
||||||
|
int nindex, EN_API_FLOAT_TYPE level)
|
||||||
|
{
|
||||||
|
return EN_setcontrol(_defaultProject, cindex, ctype, lindex, setting, nindex, level);
|
||||||
|
}
|
||||||
|
|
||||||
|
/********************************************************************
|
||||||
|
|
||||||
|
Rule-Based Controls Functions
|
||||||
|
|
||||||
|
********************************************************************/
|
||||||
|
|
||||||
|
int DLLEXPORT ENaddrule(char *rule)
|
||||||
|
{
|
||||||
|
return EN_addrule(_defaultProject, rule);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENdeleterule(int index)
|
||||||
|
{
|
||||||
|
return EN_deleterule(_defaultProject, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENgetrule(int index, int *nPremises, int *nThenActions, int *nElseActions,
|
||||||
|
EN_API_FLOAT_TYPE *priority)
|
||||||
|
{
|
||||||
|
return EN_getrule(_defaultProject, index, nPremises, nThenActions, nElseActions, priority);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENgetruleID(int index, char* id)
|
||||||
|
{
|
||||||
|
return EN_getruleID(_defaultProject, index, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENgetpremise(int ruleIndex, int premiseIndex, int *logop,
|
||||||
|
int *object, int *objIndex, int *variable,
|
||||||
|
int *relop, int *status, EN_API_FLOAT_TYPE *value)
|
||||||
|
{
|
||||||
|
return EN_getpremise(_defaultProject, ruleIndex, premiseIndex, logop, object,
|
||||||
|
objIndex, variable, relop, status, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENsetpremise(int ruleIndex, int premiseIndex, int logop,
|
||||||
|
int object, int objIndex, int variable, int relop,
|
||||||
|
int status, EN_API_FLOAT_TYPE value)
|
||||||
|
{
|
||||||
|
return EN_setpremise(_defaultProject, ruleIndex, premiseIndex, logop, object,
|
||||||
|
objIndex, variable, relop, status, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENsetpremiseindex(int ruleIndex, int premiseIndex, int objIndex)
|
||||||
|
{
|
||||||
|
return EN_setpremiseindex(_defaultProject, ruleIndex, premiseIndex, objIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENsetpremisestatus(int ruleIndex, int premiseIndex, int status)
|
||||||
|
{
|
||||||
|
return EN_setpremisestatus(_defaultProject, ruleIndex, premiseIndex, status);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENsetpremisevalue(int ruleIndex, int premiseIndex, EN_API_FLOAT_TYPE value)
|
||||||
|
{
|
||||||
|
return EN_setpremisevalue(_defaultProject, ruleIndex, premiseIndex, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENgetthenaction(int ruleIndex, int actionIndex, int *linkIndex,
|
||||||
|
int *status, EN_API_FLOAT_TYPE *setting)
|
||||||
|
{
|
||||||
|
return EN_getthenaction(_defaultProject, ruleIndex, actionIndex, linkIndex,
|
||||||
|
status, setting);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENsetthenaction(int ruleIndex, int actionIndex, int linkIndex,
|
||||||
|
int status, EN_API_FLOAT_TYPE setting)
|
||||||
|
{
|
||||||
|
return EN_setthenaction(_defaultProject, ruleIndex, actionIndex, linkIndex,
|
||||||
|
status, setting);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENgetelseaction(int ruleIndex, int actionIndex, int *linkIndex,
|
||||||
|
int *status, EN_API_FLOAT_TYPE *setting)
|
||||||
|
{
|
||||||
|
return EN_getelseaction(_defaultProject, ruleIndex, actionIndex, linkIndex,
|
||||||
|
status, setting);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENsetelseaction(int ruleIndex, int actionIndex, int linkIndex,
|
||||||
|
int status, EN_API_FLOAT_TYPE setting)
|
||||||
|
{
|
||||||
|
return EN_setelseaction(_defaultProject, ruleIndex, actionIndex, linkIndex,
|
||||||
|
status, setting);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENsetrulepriority(int index, EN_API_FLOAT_TYPE priority)
|
||||||
|
{
|
||||||
|
return EN_setrulepriority(_defaultProject, index, priority);
|
||||||
|
}
|
||||||
@@ -44,7 +44,7 @@ foreach(testSrc ${TEST_SRCS})
|
|||||||
add_executable(${testName} ${testSrc})
|
add_executable(${testName} ${testSrc})
|
||||||
|
|
||||||
#link to Boost libraries AND your targets and dependencies
|
#link to Boost libraries AND your targets and dependencies
|
||||||
target_link_libraries(${testName} ${Boost_LIBRARIES} epanet epanet-output)
|
target_link_libraries(${testName} ${Boost_LIBRARIES} epanet2 epanet-output)
|
||||||
|
|
||||||
#Finally add it to test execution
|
#Finally add it to test execution
|
||||||
#Notice the WORKING_DIRECTORY and COMMAND
|
#Notice the WORKING_DIRECTORY and COMMAND
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ node or link appearing in any simple or rule-based controls.
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "epanet2.h"
|
#include "epanet2_2.h"
|
||||||
|
|
||||||
#define DATA_PATH_INP "./net1.inp"
|
#define DATA_PATH_INP "./net1.inp"
|
||||||
#define DATA_PATH_RPT "./test.rpt"
|
#define DATA_PATH_RPT "./test.rpt"
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ A demand category name is set, the network is saved, reopened and the new demand
|
|||||||
#include <boost/test/included/unit_test.hpp>
|
#include <boost/test/included/unit_test.hpp>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "epanet2.h"
|
#include "epanet2_2.h"
|
||||||
|
|
||||||
// NOTE: Project Home needs to be updated to run unit test
|
// NOTE: Project Home needs to be updated to run unit test
|
||||||
#define DATA_PATH_INP "./net1.inp"
|
#define DATA_PATH_INP "./net1.inp"
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ The test ends with a check that the three head values are equal.
|
|||||||
#include <boost/test/included/unit_test.hpp>
|
#include <boost/test/included/unit_test.hpp>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "epanet2.h"
|
#include "epanet2_2.h"
|
||||||
|
|
||||||
// NOTE: Project Home needs to be updated to run unit test
|
// NOTE: Project Home needs to be updated to run unit test
|
||||||
#define DATA_PATH_INP "./net1.inp"
|
#define DATA_PATH_INP "./net1.inp"
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
#include <boost/thread.hpp>
|
#include <boost/thread.hpp>
|
||||||
|
|
||||||
#include "epanet2.h"
|
#include "epanet2_2.h"
|
||||||
|
|
||||||
#define NUM_THREADS 2
|
#define NUM_THREADS 2
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ A node and link name are changed, the network is saved, reopened and the new nam
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "epanet2.h"
|
#include "epanet2_2.h"
|
||||||
|
|
||||||
#define DATA_PATH_INP "./net1.inp"
|
#define DATA_PATH_INP "./net1.inp"
|
||||||
#define DATA_PATH_RPT "./test.rpt"
|
#define DATA_PATH_RPT "./test.rpt"
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ of the PRV 121 should be 100.
|
|||||||
#include <boost/test/included/unit_test.hpp>
|
#include <boost/test/included/unit_test.hpp>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "epanet2.h"
|
#include "epanet2_2.h"
|
||||||
|
|
||||||
#define DATA_PATH_INP "./net1.inp"
|
#define DATA_PATH_INP "./net1.inp"
|
||||||
#define DATA_PATH_RPT "./test.rpt"
|
#define DATA_PATH_RPT "./test.rpt"
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
#include <boost/test/included/unit_test.hpp>
|
#include <boost/test/included/unit_test.hpp>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "epanet2.h"
|
#include "epanet2_2.h"
|
||||||
|
|
||||||
// NOTE: Project Home needs to be updated to run unit test
|
// NOTE: Project Home needs to be updated to run unit test
|
||||||
#define DATA_PATH_INP "./net1.inp"
|
#define DATA_PATH_INP "./net1.inp"
|
||||||
@@ -100,8 +100,14 @@ BOOST_AUTO_TEST_CASE(test_epanet)
|
|||||||
string path_rpt(DATA_PATH_RPT);
|
string path_rpt(DATA_PATH_RPT);
|
||||||
string path_out(DATA_PATH_OUT);
|
string path_out(DATA_PATH_OUT);
|
||||||
|
|
||||||
int error = ENepanet(path_inp.c_str(), path_rpt.c_str(), path_out.c_str(), NULL);
|
EN_Project ph;
|
||||||
|
|
||||||
|
EN_createproject(&ph);
|
||||||
|
|
||||||
|
int error = EN_runproject(ph, path_inp.c_str(), path_rpt.c_str(), path_out.c_str(), NULL);
|
||||||
BOOST_REQUIRE(error == 0);
|
BOOST_REQUIRE(error == 0);
|
||||||
|
|
||||||
|
EN_deleteproject(&ph);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
|||||||
@@ -21,9 +21,9 @@ Find /i "x86" < checkOS.tmp > StringCheck.tmp
|
|||||||
If %ERRORLEVEL% == 1 (
|
If %ERRORLEVEL% == 1 (
|
||||||
CALL "%SDK_PATH%bin\"SetEnv.cmd /x64 /release
|
CALL "%SDK_PATH%bin\"SetEnv.cmd /x64 /release
|
||||||
rem : create EPANET2.DLL
|
rem : create EPANET2.DLL
|
||||||
cl -o epanet2.dll epanet.c hash.c hydraul.c hydcoeffs.c hydstatus.c hydsolver.c inpfile.c input1.c input2.c input3.c mempool.c output.c project.c quality.c qualroute.c qualreact.c report.c rules.c smatrix.c genmmd.c /I ..\include /I ..\run /link /DLL
|
cl -o epanet2.dll epanet.c epanet2.c hash.c hydraul.c hydcoeffs.c hydstatus.c hydsolver.c inpfile.c input1.c input2.c input3.c mempool.c output.c project.c quality.c qualroute.c qualreact.c report.c rules.c smatrix.c genmmd.c /I ..\include /I ..\run /link /DLL
|
||||||
rem : create EPANET2.EXE
|
rem : create EPANET2.EXE
|
||||||
cl -o epanet2.exe epanet.c ..\run\main.c hash.c hydraul.c hydcoeffs.c hydstatus.c hydsolver.c inpfile.c input1.c input2.c input3.c mempool.c output.c project.c quality.c qualroute.c qualreact.c report.c rules.c smatrix.c genmmd.c /I ..\include /I ..\run /I ..\src /link
|
cl -o epanet2.exe epanet.c epanet2.c ..\run\main.c hash.c hydraul.c hydcoeffs.c hydstatus.c hydsolver.c inpfile.c input1.c input2.c input3.c mempool.c output.c project.c quality.c qualroute.c qualreact.c report.c rules.c smatrix.c genmmd.c /I ..\include /I ..\run /I ..\src /link
|
||||||
md "%Build_PATH%"\64bit
|
md "%Build_PATH%"\64bit
|
||||||
move /y "%SRC_PATH%"\*.dll "%Build_PATH%"\64bit
|
move /y "%SRC_PATH%"\*.dll "%Build_PATH%"\64bit
|
||||||
move /y "%SRC_PATH%"\*.exe "%Build_PATH%"\64bit
|
move /y "%SRC_PATH%"\*.exe "%Build_PATH%"\64bit
|
||||||
@@ -35,9 +35,9 @@ rem : 32 bit with DEF
|
|||||||
CALL "%SDK_PATH%bin\"SetEnv.cmd /x86 /release
|
CALL "%SDK_PATH%bin\"SetEnv.cmd /x86 /release
|
||||||
echo "32 bit with epanet2.def mapping"
|
echo "32 bit with epanet2.def mapping"
|
||||||
rem : create EPANET2.DLL
|
rem : create EPANET2.DLL
|
||||||
cl -o epanet2.dll epanet.c hash.c hydraul.c hydcoeffs.c hydstatus.c hydsolver.c inpfile.c input1.c input2.c input3.c mempool.c output.c project.c quality.c qualroute.c qualreact.c report.c rules.c smatrix.c genmmd.c /I ..\include /I ..\run /link /DLL /def:..\win_build\WinSDK\epanet2.def /MAP
|
cl -o epanet2.dll epanet.c epanet2.c hash.c hydraul.c hydcoeffs.c hydstatus.c hydsolver.c inpfile.c input1.c input2.c input3.c mempool.c output.c project.c quality.c qualroute.c qualreact.c report.c rules.c smatrix.c genmmd.c /I ..\include /I ..\run /link /DLL /def:..\win_build\WinSDK\epanet2.def /MAP
|
||||||
rem : create EPANET2.EXE
|
rem : create EPANET2.EXE
|
||||||
cl -o epanet2.exe epanet.c ..\run\main.c hash.c hydraul.c hydcoeffs.c hydstatus.c hydsolver.c inpfile.c input1.c input2.c input3.c mempool.c output.c project.c quality.c qualroute.c qualreact.c report.c rules.c smatrix.c genmmd.c /I ..\include /I ..\run /I ..\src /link
|
cl -o epanet2.exe epanet.c epanet2.c ..\run\main.c hash.c hydraul.c hydcoeffs.c hydstatus.c hydsolver.c inpfile.c input1.c input2.c input3.c mempool.c output.c project.c quality.c qualroute.c qualreact.c report.c rules.c smatrix.c genmmd.c /I ..\include /I ..\run /I ..\src /link
|
||||||
md "%Build_PATH%"\32bit
|
md "%Build_PATH%"\32bit
|
||||||
move /y "%SRC_PATH%"\*.dll "%Build_PATH%"\32bit
|
move /y "%SRC_PATH%"\*.dll "%Build_PATH%"\32bit
|
||||||
move /y "%SRC_PATH%"\*.exe "%Build_PATH%"\32bit
|
move /y "%SRC_PATH%"\*.exe "%Build_PATH%"\32bit
|
||||||
|
|||||||
Reference in New Issue
Block a user