SWMM-Docs
5.2.0.dev5
Stormwater Management Model
|
Exportable Functions for Toolkit API. More...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "headers.h"
#include "swmm5.h"
#include "toolkitAPI.h"
#include "hash.h"
Go to the source code of this file.
Functions | |
double * | newDoubleArray (int n) |
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_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_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_getObjectIndex (SM_ObjectType type, char *id, int *index) |
Gets Object Index. More... | |
int DLLEXPORT | swmm_getObjectId (int type, int index, char *id) |
Gets Object ID. 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_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_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_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_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_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_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.c.
void DLLEXPORT freeArray | ( | void ** | array | ) |
Helper function to free memory array allocated in SWMM.
Helper function used to free array allocated memory by API.
Definition at line 2502 of file toolkitAPI.c.
double * newDoubleArray | ( | int | n | ) |
Warning: Caller must free memory allocated by this function.
Definition at line 2493 of file toolkitAPI.c.
int DLLEXPORT swmm_getGagePrecip | ( | int | index, |
double ** | GageArray | ||
) |
Get precipitation rates for a gage.
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.
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.
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.
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.
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_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.