SWMM-Docs
5.2.0.dev5
Stormwater Management Model
|
Exportable Functions for Toolkit API. More...
#include "../src/datetime.h"
Go to the source code of this file.
Data Structures | |
struct | SM_NodeStats |
Node stats structure. More... | |
struct | SM_StorageStats |
Storage Statatistics. More... | |
struct | SM_OutfallStats |
Outfall Statatistics. More... | |
struct | SM_LinkStats |
Link Statatistics. More... | |
struct | SM_PumpStats |
Pump Statistics. More... | |
struct | SM_SubcatchStats |
Subcatchment Statistics. More... | |
struct | SM_RoutingTotals |
System Flow Routing Statistics. More... | |
struct | SM_RunoffTotals |
System runoff stats structure. More... | |
Functions | |
void DLLEXPORT | swmm_getAPIError (int errcode, char *s) |
Get the text of an error code. More... | |
int DLLEXPORT | swmm_project_findObject (int type, char *id, int *index) |
Finds the index of an object given its ID. More... | |
int DLLEXPORT | swmm_getSimulationUnit (int type, int *value) |
Gets Simulation Unit. More... | |
int DLLEXPORT | swmm_getSimulationAnalysisSetting (int type, int *value) |
Gets Simulation Analysis Setting. More... | |
int DLLEXPORT | swmm_getSimulationParam (int type, double *value) |
Gets Simulation Analysis Setting. More... | |
int DLLEXPORT | swmm_countObjects (int type, int *count) |
Gets Object Count. More... | |
int DLLEXPORT | swmm_getObjectId (int type, int index, char *id) |
Gets Object ID. More... | |
int DLLEXPORT | swmm_getObjectIndex (SM_ObjectType type, char *id, int *index) |
Gets Object Index. More... | |
int DLLEXPORT | swmm_getNodeType (int index, int *Ntype) |
Get the type of node with specified index. More... | |
int DLLEXPORT | swmm_getLinkType (int index, int *Ltype) |
Get the type of link with specified index. More... | |
int DLLEXPORT | swmm_getLinkConnections (int index, int *Node1, int *Node2) |
Get the link Connection Node Indeces. If the conduit has a negative slope, the dynamic wave solver will automatically reverse the nodes. To check the direction, call swmm_getLinkDirection(). More... | |
int DLLEXPORT | swmm_getLinkDirection (int index, signed char *value) |
Get the link flow direction (see swmm_getLinkType() for notes. More... | |
int DLLEXPORT | swmm_getSubcatchOutConnection (int index, int *type, int *out_index) |
Get the Subcatchment connection. Subcatchments can load to a node, another subcatchment, or itself. More... | |
int DLLEXPORT | swmm_getLidUCount (int index, int *value) |
Get the number of lid units on a subcatchment. More... | |
int DLLEXPORT | swmm_getLidUParam (int index, int lidIndex, int Param, double *value) |
Get a property value for a specified lid unit on a specified subcatchment. More... | |
int DLLEXPORT | swmm_setLidUParam (int index, int lidIndex, int Param, double value) |
Set a property value for a specified lid unit on a specified subcatchment. More... | |
int DLLEXPORT | swmm_getLidUOption (int index, int lidIndex, int Param, int *value) |
Get the lid option for a specified lid unit on a specified subcatchment. More... | |
int DLLEXPORT | swmm_setLidUOption (int index, int lidIndex, int Param, int value) |
Set the lid option for a specified lid unit on a specified subcatchment. More... | |
int DLLEXPORT | swmm_getLidCOverflow (int lidControlIndex, char *condition) |
Get the lid control surface immediate overflow condition. More... | |
int DLLEXPORT | swmm_setLidCOverflow (int lidControlIndex, char condition) |
Set the lid control's surface immediate overflow condition. More... | |
int DLLEXPORT | swmm_getLidCParam (int lidControlIndex, int layerIndex, int Param, double *value) |
Get a property value for specified lid control. More... | |
int DLLEXPORT | swmm_setLidCParam (int lidControlIndex, int layerIndex, int Param, double value) |
Set a property value for specified lid control. More... | |
int DLLEXPORT | swmm_getLidUFluxRates (int index, int lidIndex, int layerIndex, double *result) |
Get the lid unit water balance simulated value at current time. More... | |
int DLLEXPORT | swmm_getLidGResult (int index, int type, double *result) |
Get the lid group of a specified subcatchment result at current time. More... | |
int DLLEXPORT | swmm_getLidUResult (int index, int lidIndex, int type, double *result) |
Get the lid unit of a specified subcatchment result at current time. More... | |
int DLLEXPORT | swmm_getNodeParam (int index, int Param, double *value) |
Get a property value for specified node. More... | |
int DLLEXPORT | swmm_setNodeParam (int index, int Param, double value) |
Set a property value for specified node. More... | |
int DLLEXPORT | swmm_getLinkParam (int index, int Param, double *value) |
Get a property value for specified link. More... | |
int DLLEXPORT | swmm_setLinkParam (int index, int Param, double value) |
Set a property value for specified link. More... | |
int DLLEXPORT | swmm_getSubcatchParam (int index, int Param, double *value) |
Get a property value for specified subcatchment. More... | |
int DLLEXPORT | swmm_setSubcatchParam (int index, int Param, double value) |
Set a property value for specified subcatchment. More... | |
int DLLEXPORT | swmm_getSimulationDateTime (int timetype, int *year, int *month, int *day, int *hour, int *minute, int *second) |
Get the current simulation datetime information. More... | |
int DLLEXPORT | swmm_setSimulationDateTime (int timetype, char *dtimestr) |
Set simulation datetime information. More... | |
int DLLEXPORT | swmm_getCurrentDateTimeStr (char *dtimestr) |
Get the simulation current datetime as a string. More... | |
int DLLEXPORT | swmm_getNodeResult (int index, int type, double *result) |
Get a result value for specified node. More... | |
int DLLEXPORT | swmm_getLinkResult (int index, int type, double *result) |
Get a result value for specified link. More... | |
int DLLEXPORT | swmm_getSubcatchResult (int index, int type, double *result) |
Get a result value for specified subcatchment. More... | |
int DLLEXPORT | swmm_getSubcatchPollut (int index, int type, double **PollutArray) |
Gets pollutant values for a specified subcatchment. More... | |
int DLLEXPORT | swmm_getGagePrecip (int index, double **GageArray) |
Get precipitation rates for a gage. More... | |
int DLLEXPORT | swmm_getNodeStats (int index, SM_NodeStats *nodeStats) |
Get a node statistics. More... | |
int DLLEXPORT | swmm_getNodeTotalInflow (int index, double *value) |
Get the cumulative inflow for a node. More... | |
int DLLEXPORT | swmm_getStorageStats (int index, SM_StorageStats *storageStats) |
Get a storage statistics. More... | |
int DLLEXPORT | swmm_getOutfallStats (int index, SM_OutfallStats *outfallStats) |
Get outfall statistics. More... | |
void DLLEXPORT | swmm_freeOutfallStats (SM_OutfallStats *outfallStats) |
Free outfall statistics structure. More... | |
int DLLEXPORT | swmm_getLinkStats (int index, SM_LinkStats *linkStats) |
Get link statistics. More... | |
int DLLEXPORT | swmm_getPumpStats (int index, SM_PumpStats *pumpStats) |
Get pump statistics. More... | |
int DLLEXPORT | swmm_getSubcatchStats (int index, SM_SubcatchStats **subcatchStats) |
Get subcatchment statistics. More... | |
int DLLEXPORT | swmm_getSystemRoutingStats (SM_RoutingTotals *routingTot) |
Get system routing statistics. More... | |
int DLLEXPORT | swmm_getSystemRunoffStats (SM_RunoffTotals *runoffTot) |
Get system runoff statistics. More... | |
int DLLEXPORT | swmm_setLinkSetting (int index, double setting) |
Set a link setting (pump, orifice, or weir). Setting for an orifice and a weir should be [0, 1]. A setting for a pump can range from [0, inf). However, if a pump is set to 1, it will pump at its maximum curve setting. More... | |
int DLLEXPORT | swmm_setNodeInflow (int index, double flowrate) |
Set an inflow rate to a node. The inflow rate is held constant until the caller changes it. More... | |
int DLLEXPORT | swmm_setOutfallStage (int index, double stage) |
Set outfall stage. More... | |
int DLLEXPORT | swmm_setGagePrecip (int index, double total_precip) |
Set a total precipitation intensity to the gage. More... | |
void DLLEXPORT | freeArray (void **array) |
Helper function to free memory array allocated in SWMM. More... | |
Exportable Functions for Toolkit API.
Definition in file toolkitAPI.h.
enum SM_GagePrecip |
Gage precip array property codes.
Enumerator | |
---|---|
SM_TOTALPRECIP | Total Precipitation Rate |
SM_RAINFALL | Rainfall Rate |
SM_SNOWFALL | Snowfall Rate |
Definition at line 182 of file toolkitAPI.h.
enum SM_LidLayer |
Lid control layer codes.
Enumerator | |
---|---|
SM_SURFACE | Lid Surface Layer |
SM_SOIL | Lid Soil Layer |
SM_STOR | Lid Storage Layer |
SM_PAVE | Lid Pavement Layer |
SM_DRAIN | Lid Underdrain Layer |
SM_DRAINMAT | Lid Drainage Mat Layer |
Definition at line 189 of file toolkitAPI.h.
enum SM_LidLayerProperty |
Lid control layer property codes.
Definition at line 199 of file toolkitAPI.h.
enum SM_LidResult |
Lid unit result codes.
Definition at line 245 of file toolkitAPI.h.
enum SM_LidUOptions |
Lid unit option codes.
Enumerator | |
---|---|
SM_INDEX | Lid Process Index |
SM_NUMBER | Number of Replicate Units |
SM_TOPERV | Outflow to Pervious Area |
SM_DRAINSUB | Subcatchment Recieving Drain Flow |
SM_DRAINNODE | Node Recieving Drain Flow |
Definition at line 236 of file toolkitAPI.h.
enum SM_LidUProperty |
Lid unit property codes.
Definition at line 226 of file toolkitAPI.h.
enum SM_LinkProperty |
Link property codes.
Enumerator | |
---|---|
SM_OFFSET1 | Inlet Offset |
SM_OFFSET2 | Outlet Offset |
SM_INITFLOW | Initial Flow Rate |
SM_FLOWLIMIT | Flow limit |
SM_INLETLOSS | Inlet Loss |
SM_OUTLETLOSS | Outles Loss |
SM_AVELOSS | Average Loss |
Definition at line 122 of file toolkitAPI.h.
enum SM_LinkResult |
Link result property codes.
Definition at line 154 of file toolkitAPI.h.
enum SM_LinkType |
Link object type codes.
Enumerator | |
---|---|
SM_CONDUIT | Conduit |
SM_PUMP | Pump |
SM_ORIFICE | Orifice |
SM_WEIR | Weir |
SM_OUTLET | Outlet |
Definition at line 61 of file toolkitAPI.h.
enum SM_NodeProperty |
Node property codes.
Enumerator | |
---|---|
SM_INVERTEL | Invert Elevation |
SM_FULLDEPTH | Full Depth |
SM_SURCHDEPTH | Surcharge Depth |
SM_PONDAREA | Ponding Area |
SM_INITDEPTH | Initial Depth |
Definition at line 113 of file toolkitAPI.h.
enum SM_NodeResult |
Node result property codes.
Definition at line 142 of file toolkitAPI.h.
enum SM_NodeType |
Node object type codes.
Enumerator | |
---|---|
SM_JUNCTION | Manhole Junction |
SM_OUTFALL | Outfall |
SM_STORAGE | Storage |
SM_DIVIDER | Divider |
Definition at line 53 of file toolkitAPI.h.
enum SM_ObjectType |
Object type codes.
Definition at line 33 of file toolkitAPI.h.
enum SM_SimOption |
Simulation Options.
Definition at line 83 of file toolkitAPI.h.
enum SM_SimSetting |
Simulation Settings.
Definition at line 95 of file toolkitAPI.h.
enum SM_SubcPollut |
Subcatchment pollutant result property codes.
Enumerator | |
---|---|
SM_BUILDUP | Pollutant Buildup Load |
SM_CPONDED | Ponded Pollutant Concentration |
Definition at line 176 of file toolkitAPI.h.
enum SM_SubcProperty |
Subcatchment property codes.
Enumerator | |
---|---|
SM_WIDTH | Width |
SM_AREA | Area |
SM_FRACIMPERV | Impervious Fraction |
SM_SLOPE | Slope |
SM_CURBLEN | Curb Length |
Definition at line 133 of file toolkitAPI.h.
enum SM_SubcResult |
Subcatchment result property codes.
Enumerator | |
---|---|
SM_SUBCRAIN | Rainfall Rate |
SM_SUBCEVAP | Evaporation Loss |
SM_SUBCINFIL | Infiltration Loss |
SM_SUBCRUNON | Runon Rate |
SM_SUBCRUNOFF | Runoff Rate |
SM_SUBCSNOW | Snow Depth |
Definition at line 166 of file toolkitAPI.h.
enum SM_TimePropety |
Simulation Option codes.
Enumerator | |
---|---|
SM_STARTDATE | Simulation Start Date |
SM_ENDDATE | Simulation End Date |
SM_REPORTDATE | Simulation Report Start Date |
Definition at line 70 of file toolkitAPI.h.
enum SM_Units |
Simulation Unit Codes.
Enumerator | |
---|---|
SM_SYSTEMUNIT | System Units |
SM_FLOWUNIT | Flow Units |
Definition at line 77 of file toolkitAPI.h.
void DLLEXPORT freeArray | ( | void ** | array | ) |
Helper function to free memory array allocated in SWMM.
array | The pointer to the array |
Helper function used to free array allocated memory by API.
Definition at line 2502 of file toolkitAPI.c.
int DLLEXPORT swmm_getGagePrecip | ( | int | index, |
double ** | GageArray | ||
) |
Get precipitation rates for a gage.
index | The index of gage | |
[out] | GageArray | precipitation rates array [total, rainfall, snowfall] |
Input: index = Index of desired ID Output: GageArray pointer (three elements) Return: API Error Purpose: Gets the precipitation value in the gage.
Definition at line 1741 of file toolkitAPI.c.
int DLLEXPORT swmm_getLidCOverflow | ( | int | lidControlIndex, |
char * | condition | ||
) |
Get the lid control surface immediate overflow condition.
lidControlIndex | The index of specified lid control | |
[out] | condition | The value of surface immediate overflow condition |
Definition at line 1089 of file toolkitAPI.c.
int DLLEXPORT swmm_getLidCParam | ( | int | lidControlIndex, |
int | layerIndex, | ||
int | Param, | ||
double * | value | ||
) |
Get a property value for specified lid control.
lidControlIndex | The index of specified lid control | |
layerIndex | The index of specified lid layer (See SM_LidLayer) | |
Param | The property type code (See SM_LidLayerProperty) | |
[out] | value | The value of lid control's property |
Definition at line 1121 of file toolkitAPI.c.
int DLLEXPORT swmm_getLidGResult | ( | int | index, |
int | type, | ||
double * | result | ||
) |
Get the lid group of a specified subcatchment result at current time.
index | The index of a subcatchment | |
type | The result type code (See SM_LidResult) | |
[out] | result | The result for the specified lid group |
Definition at line 2160 of file toolkitAPI.c.
int DLLEXPORT swmm_getLidUCount | ( | int | index, |
int * | value | ||
) |
Get the number of lid units on a subcatchment.
index | The index of a subcatchment | |
[out] | value | The number of lid units on a subcatchment |
Definition at line 824 of file toolkitAPI.c.
int DLLEXPORT swmm_getLidUFluxRates | ( | int | index, |
int | lidIndex, | ||
int | layerIndex, | ||
double * | result | ||
) |
Get the lid unit water balance simulated value at current time.
index | The index of a subcatchment | |
lidIndex | The index of specified lid unit | |
layerIndex | The index of specified lid layer (See SM_LidLayer) | |
Param | The result type code (See SM_LidResult) | |
[out] | result | The result for the specified lid unit |
Definition at line 2109 of file toolkitAPI.c.
int DLLEXPORT swmm_getLidUOption | ( | int | index, |
int | lidIndex, | ||
int | Param, | ||
int * | value | ||
) |
Get the lid option for a specified lid unit on a specified subcatchment.
index | The index of a subcatchment | |
lidIndex | The index of specified lid unit | |
Param | The lid option type code (See SM_LidUOptions) | |
[out] | value | The value of the option for the lid unit |
Definition at line 970 of file toolkitAPI.c.
int DLLEXPORT swmm_getLidUParam | ( | int | index, |
int | lidIndex, | ||
int | Param, | ||
double * | value | ||
) |
Get a property value for a specified lid unit on a specified subcatchment.
index | The index of a subcatchment | |
lidIndex | The index of specified lid unit | |
Param | The property type code (See SM_LidUProperty) | |
[out] | value | The value of the lid unit's property |
Definition at line 851 of file toolkitAPI.c.
int DLLEXPORT swmm_getLidUResult | ( | int | index, |
int | lidIndex, | ||
int | type, | ||
double * | result | ||
) |
Get the lid unit of a specified subcatchment result at current time.
index | The index of a subcatchment | |
lidIndex | The index of specified lid unit | |
type | The result type code (See SM_LidResult) | |
[out] | result | The result for the specified lid unit |
Definition at line 2209 of file toolkitAPI.c.
int DLLEXPORT swmm_getObjectIndex | ( | SM_ObjectType | type, |
char * | id, | ||
int * | index | ||
) |
Gets Object Index.
type | Option code (see SM_ObjectType) | |
[in] | id | of the Object |
[out] | index | of the Object |
Input: type = object type (Based on SM_ObjectType enum) char* = ID name Output: object index Return: error Purpose: Gets object id index
Definition at line 310 of file toolkitAPI.c.
int DLLEXPORT swmm_getSubcatchPollut | ( | int | index, |
int | type, | ||
double ** | PollutArray | ||
) |
Gets pollutant values for a specified subcatchment.
index | The index of a subcatchment | |
type | The property type code (see SM_SubcPollut) | |
[out] | PollutArray | result array |
Input: index = Index of desired ID type = Result Type (SM_SubcPollut) Output: PollutArray pointer (pollutant data desired, byref) Return: API Error Purpose: Gets Subcatchment Simulated Pollutant Value at Current Time
Definition at line 1687 of file toolkitAPI.c.
int DLLEXPORT swmm_getSubcatchStats | ( | int | index, |
SM_SubcatchStats ** | subcatchStats | ||
) |
Get subcatchment statistics.
index | The index of a subcatchment | |
[out] | subcatchStats | The link Stats struct (see SM_SubcatchStats). pre-allocated by the caller. Caller is also responsible for freeing the SM_SubcatchStats structure using swmm_freeSubcatchStats(). This frees any pollutants array. |
Output: Subcatchment Stats Structure (SM_SubcatchStats) Return: API Error Purpose: Gets Subcatchment Stats and Converts Units
Definition at line 1981 of file toolkitAPI.c.
int DLLEXPORT swmm_project_findObject | ( | int | type, |
char * | id, | ||
int * | index | ||
) |
Finds the index of an object given its ID.
type | An object type | |
id | The object ID | |
[out] | index | The objects index |
Definition at line 54 of file toolkitAPI.c.
int DLLEXPORT swmm_setGagePrecip | ( | int | index, |
double | total_precip | ||
) |
Set a total precipitation intensity to the gage.
index | The gage index. |
total_precip | The new total precipitation intensity. |
Input: index = Index of desired ID total_precip = rainfall intensity to be set Return: API Error Purpose: Sets the precipitation in from the external database
Definition at line 2451 of file toolkitAPI.c.
int DLLEXPORT swmm_setLidCOverflow | ( | int | lidControlIndex, |
char | condition | ||
) |
Set the lid control's surface immediate overflow condition.
lidControlIndex | The index of specified lid control |
condition | The new value for the surface immediate overflow condition |
int DLLEXPORT swmm_setLidCParam | ( | int | lidControlIndex, |
int | layerIndex, | ||
int | Param, | ||
double | value | ||
) |
Set a property value for specified lid control.
lidControlIndex | The index of specified lid control |
layerIndex | The index of specified lid layer (See SM_LidLayer) |
Param | The property type code (See SM_LidLayerProperty) |
value | The new value for the lid control's property |
Definition at line 1304 of file toolkitAPI.c.
int DLLEXPORT swmm_setLidUOption | ( | int | index, |
int | lidIndex, | ||
int | Param, | ||
int | value | ||
) |
Set the lid option for a specified lid unit on a specified subcatchment.
index | The index of a subcatchment |
lidIndex | The index of specified lid unit |
Param | The lid option type code (See SM_LidUOptions) |
value | The new value of the option for the lid unit |
Definition at line 1022 of file toolkitAPI.c.
int DLLEXPORT swmm_setLidUParam | ( | int | index, |
int | lidIndex, | ||
int | Param, | ||
double | value | ||
) |
Set a property value for a specified lid unit on a specified subcatchment.
index | The index of a subcatchment |
lidIndex | The index of specified lid unit |
Param | The property type code (See SM_LidUProperty) |
value | The new value of the lid unit's property |
Definition at line 905 of file toolkitAPI.c.