OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
funcs.h
Go to the documentation of this file.
1
41
42#ifndef FUNCS_H
43#define FUNCS_H
44
50
57
64void project_open(const char* inp_file, const char* rpt_file, const char* out_file);
65
69void project_close(void);
70
74void project_readInput(void);
75
83int project_readOption(char* s1, char* s2);
84
88void project_validate(void);
89
93int project_init(void);
94
102int project_addObject(int type, char* id, int n);
103
110int project_findObject(int type, const char* id);
111
118char* project_findID(int type, char* id);
119
126double** project_createMatrix(int nrows, int ncols);
127
131void project_freeMatrix(double** m);
135
142
147int input_countObjects(void);
148
153int input_readData(void);
157
164
171int report_readOptions(char* tok[], int ntoks);
172
177void report_writeLine(const char* line);
178
182void report_writeSysTime(void);
183
187void report_writeLogo(void);
188
192void report_writeTitle(void);
193
197void report_writeOptions(void);
198
202void report_writeReport(void);
203
209void report_writeRainStats(int i, TRainStats* r);
210
216void report_writeRdiiStats(double rainVol, double rdiiVol);
217
222
230void report_writeControlAction(DateTime aDate, char* linkID, double value, char* ruleID);
231
237void report_writeRunoffError(TRunoffTotals* totals, double totalArea);
238
244
250void report_writeGwaterError(TGwaterTotals* totals, double gwArea);
251
257
263
271void report_writeMaxStats(TMaxStats maxMassBalErrs[], TMaxStats maxCourantCrit[], int nMaxStats);
272
280void report_writeMaxFlowTurns(TMaxStats flowTurns[], int nMaxStats);
281
287void report_writeNonconvergedStats(TMaxStats maxNonconverged[], int nMaxStats);
288
293void report_writeTimeStepStats(TTimeStepStats* timeStepStats);
294
300void report_writeErrorMsg(int code, char* s);
301
305void report_writeErrorCode(void);
306
314void report_writeInputErrorMsg(int k, int sect, char* line, long lineCount);
315
321void report_writeWarningMsg(char* msg, char* id);
322
331void report_invokeWarningCallback(const char* msg);
332
338void report_writeTseriesErrorMsg(int code, TTable* tseries);
339
343void inputrpt_writeInput(void);
344
348void statsrpt_writeReport(void);
352
359
374int climate_readParams(char* tok[], int ntoks);
375
391int climate_readEvapParams(char* tok[], int ntoks);
392
408int climate_readAdjustments(char* tok[], int ntoks);
409
413void climate_validate(void);
414
418void climate_openFile(void);
419
423void climate_initState(void);
424
429void climate_setState(DateTime theDate);
430
436
440
447
451void rain_open(void);
452
456void rain_close(void);
457
461
468
479int snow_readMeltParams(char* tok[], int ntoks);
480
487int snow_createSnowpack(int subcatchIndex, int snowIndex);
488
493void snow_validateSnowmelt(int snowIndex);
494
499void snow_initSnowpack(int subcatchIndex);
500
505void snow_initSnowmelt(int snowIndex);
506
513void snow_getState(int i, int j, double x[]);
514
521void snow_setState(int subcatchIndex, int subAreaIndex, double x[]);
522
528void snow_setMeltCoeffs(int snowIndex, double season);
529
535void snow_plowSnow(int subcatchIndex, double tStep);
536
547double snow_getSnowMelt(int subcatchIndex, double rainfall, double snowfall, double tStep,
548 double netPrecip[]);
549
555double snow_getSnowCover(int subcatchIndex);
559
570int runoff_open(void);
571
575void runoff_execute(void);
576
580void runoff_close(void);
584
591
596int routing_open(void);
597
604double routing_getRoutingStep(int routingModel, double fixedStep);
605
611void routing_execute(int routingModel, double routingStep);
612
617void routing_close(int routingModel);
621
628
632int output_open(void);
633
637void output_end(void);
638
642void output_close(void);
643
648void output_saveResults(double reportTime);
649
653void output_updateAvgResults(void);
654
661void output_readDateTime(long period, DateTime* days);
662
669void output_readSubcatchResults(long period, int index);
670
676void output_readNodeResults(long period, int index);
677
683void output_readLinkResults(long period, int index);
687
694
707int gwater_readAquiferParams(int aquiferIndex, char* tok[], int ntoks);
708
719int gwater_readGroundwaterParams(char* tok[], int ntoks);
720
732int gwater_readFlowExpression(char* tok[], int ntoks);
733
738void gwater_deleteFlowExpression(int subcatchIndex);
739
744void gwater_validateAquifer(int aquiferIndex);
745
750void gwater_validate(int subcatchIndex);
751
756void gwater_initState(int subcatchIndex);
757
763void gwater_getState(int subcatchIndex, double x[]);
764
770void gwater_setState(int subcatchIndex, double x[]);
771
779void gwater_getGroundwater(int j, double evap, double infil, double tStep);
780
786double gwater_getVolume(int subcatchIndex);
790
797
804int rdii_readRdiiInflow(char* tok[], int ntoks);
805
810void rdii_deleteRdiiInflow(int nodeIndex);
811
816void rdii_initUnitHyd(int unitHydIndex);
817
824int rdii_readUnitHydParams(char* tok[], int ntoks);
825
829void rdii_openRdii(void);
830
834void rdii_closeRdii(void);
835
842
849void rdii_getRdiiFlow(int index, int* nodeIndex, double* q);
853
860
870int landuse_readParams(int landuseIndex, char* tok[], int ntoks);
871
881int landuse_readPollutParams(int pollutIndex, char* tok[], int ntoks);
882
891int landuse_readBuildupParams(char* tok[], int ntoks);
892
901int landuse_readWashoffParams(char* tok[], int ntoks);
902
913void landuse_getInitBuildup(TLandFactor* landFactor, double* initBuildup, double area, double curb);
914
925double landuse_getBuildup(int landuseIndex, int pollutIndex, double area, double curb,
926 double buildup, double tStep);
927
938double landuse_getWashoffLoad(int i, int p, double area, TLandFactor landFactor[], double runoff,
939 double vOutflow);
940
948double landuse_getAvgBmpEffic(int subcatchIndex, int pollutIndex);
949
956double landuse_getCoPollutLoad(int p, double washoff[]);
960
967
972void flowrout_init(int routingModel);
973
978void flowrout_close(int routingModel);
979
986double flowrout_getRoutingStep(int routingModel, double fixedStep);
987
995int flowrout_execute(int links[], int routingModel, double tStep);
996
1001void toposort_sortLinks(int sortedLinks[]);
1002
1020int kinwave_execute(int linkIndex, double* qinflow, double* qoutflow, double tStep);
1021
1025void dynwave_validate(void);
1026
1030void dynwave_init(void);
1031
1035void dynwave_close(void);
1036
1042double dynwave_getRoutingStep(double fixedStep);
1043
1048int dynwave_execute(double tStep);
1049
1058void dwflow_findConduitFlow(int linkIndex, int steps, double omega, double dt);
1059
1063void qualrout_init(void);
1064
1070void qualrout_execute(double tStep);
1074
1081
1086int treatmnt_open(void);
1087
1091void treatmnt_close(void);
1092
1099int treatmnt_readExpression(char* tok[], int ntoks);
1100
1105void treatmnt_delete(int nodeIndex);
1106
1114void treatmnt_treat(int j, double q, double v, double tStep);
1115
1121void treatmnt_setInflow(double qIn, double wIn[]);
1125
1132
1137int massbal_open(void);
1138
1142void massbal_close(void);
1143
1147void massbal_report(void);
1148
1154void massbal_updateRunoffTotals(int flowType, double v);
1155
1162void massbal_updateLoadingTotals(int type, int p, double w);
1163
1172void massbal_updateGwaterTotals(double vInfil, double vUpperEvap, double vLowerEvap,
1173 double vLowerPerc, double vGwater);
1174
1179void massbal_updateRoutingTotals(double tStep);
1180
1185
1191void massbal_addInflowFlow(int type, double q);
1192
1199void massbal_addInflowQual(int type, int pollutIndex, double w);
1200
1206void massbal_addOutflowFlow(double q, int isFlooded);
1207
1214void massbal_addOutflowQual(int p, double w, int isFlooded);
1215
1221void massbal_addNodeLosses(double evapLoss, double seepLoss);
1222
1228void massbal_addLinkLosses(double evapLoss, double seepLoss);
1229
1235void massbal_addReactedMass(int pollutIndex, double w);
1236
1242void massbal_addSeepageLoss(int pollutIndex, double w);
1243
1249void massbal_addToFinalStorage(int pollutIndex, double w);
1250
1255double massbal_getStepFlowError(void);
1256
1261double massbal_getRunoffError(void);
1262
1267double massbal_getFlowError(void);
1271
1282int stats_open(void);
1283
1287void stats_close(void);
1288
1292void stats_report(void);
1293
1299void stats_updateCriticalTimeCount(int nodeIndex, int linkIndex);
1300
1306void stats_updateFlowStats(double tStep, DateTime aDate);
1307
1314void stats_updateTimeStepStats(double tStep, int trialsCount, int steadyState);
1315
1328void stats_updateSubcatchStats(int subcatchIndex, double rainVol, double runonVol, double evapVol,
1329 double infilVol, double impervVol, double pervVol, double runoffVol,
1330 double runoff);
1331
1343void stats_updateGwaterStats(int subcatchIndex, double infil, double evap, double latFlow,
1344 double deepFlow, double theta, double waterTable, double tStep);
1345
1350void stats_updateMaxRunoff(void);
1351
1357void stats_updateMaxNodeDepth(int j, double depth);
1358
1364void stats_updateConvergenceStats(int node, int converged);
1368
1385int gage_readParams(int gageIndex, char* tok[], int ntoks);
1386
1392void gage_validate(int gageIndex);
1393
1398void gage_initState(int j);
1399
1405void gage_setState(int j, DateTime t);
1406
1414double gage_getPrecip(int gageIndex, double* rainfall, double* snowfall);
1415
1421void gage_setReportRainfall(int gageIndex, DateTime reportDate);
1422
1429DateTime gage_getNextRainDate(int gageIndex, DateTime aDate);
1430
1440void gage_updatePastRain(int gageIndex, int tStep);
1441
1448double gage_getPastRain(int j, int n);
1452
1468int subcatch_readParams(int subcatchIndex, char* tok[], int ntoks);
1469
1479int subcatch_readSubareaParams(char* tok[], int ntoks);
1480
1490int subcatch_readLanduseParams(char* tok[], int ntoks);
1491
1501int subcatch_readInitBuildup(char* tok[], int ntoks);
1502
1507void subcatch_validate(int subcatchIndex);
1508
1513void subcatch_initState(int subcatchIndex);
1514
1519void subcatch_setOldState(int subcatchIndex);
1520
1527double subcatch_getFracPerv(int j);
1528
1535double subcatch_getEvapRate(int subcatchIndex);
1536
1543double subcatch_getStorage(int subcatchIndex);
1544
1551double subcatch_getDepth(int j);
1552
1558void subcatch_getRunon(int subcatchIndex);
1559
1566void subcatch_addRunonFlow(int subcatchIndex, double flow);
1567
1581double subcatch_getRunoff(int subcatchIndex, double tStep);
1582
1589double subcatch_getWtdOutflow(int subcatchIndex, double f);
1590
1597void subcatch_getResults(int subcatchIndex, double wt, float x[]);
1601
1612void surfqual_initState(int subcatchIndex);
1613
1628void surfqual_getWashoff(int subcatchIndex, double runoff, double tStep);
1629
1635void surfqual_getBuildup(int subcatchIndex, double tStep);
1636
1645void surfqual_applyAPIBuildup(int subcatchIndex);
1646
1652void surfqual_sweepBuildup(int subcatchIndex, DateTime aDate);
1653
1661double surfqual_getWtdWashoff(int j, int p, double f);
1665
1672
1682int node_readParams(int nodeIndex, int type, int k, char* tok[], int ntoks);
1683
1688void node_validate(int nodeIndex);
1689
1694void node_initState(int nodeIndex);
1695
1701void node_initFlows(int nodeIndex, double tStep);
1702
1707void node_setOldHydState(int nodeIndex);
1708
1713void node_setOldQualState(int nodeIndex);
1714
1722void node_setOutletDepth(int j, double yNorm, double yCrit, double z);
1723
1730double node_getSurfArea(int j, double d);
1731
1738double node_getDepth(int nodeIndex, double v);
1739
1746double node_getVolume(int nodeIndex, double depth);
1747
1754double node_getPondedArea(int nodeIndex, double depth);
1755
1762double node_getOutflow(int nodeIndex, int linkIndex);
1763
1771double node_getLosses(int nodeIndex, double tStep);
1772
1780double node_getMaxOutflow(int nodeIndex, double q, double tStep);
1781
1788double node_getSystemOutflow(int j, int* isFlooded);
1789
1796void node_getResults(int nodeIndex, double wt, float x[]);
1800
1816int inflow_readExtInflow(char* tok[], int ntoks);
1817
1826int inflow_readDwfInflow(char* tok[], int ntoks);
1827
1837int inflow_readDwfPattern(char* tok[], int ntoks);
1838
1851int inflow_setExtInflow(int nodeIndex, int param, int type, int tseries, int basePat, double cf,
1852 double baseline, double sf);
1853
1861void inflow_initDwfInflow(TDwfInflow* inflow);
1862
1867void inflow_initDwfPattern(int patternIndex);
1868
1876double inflow_getExtInflow(TExtInflow* inflow, DateTime aDate);
1877
1886double inflow_getDwfInflow(TDwfInflow* inflow, int month, int day, int hour);
1887
1892void inflow_deleteExtInflows(int nodeIndex);
1893
1898void inflow_deleteDwfInflows(int nodeIndex);
1902
1903//-----------------------------------------------------------------------------
1904// Routing Interface File Methods
1905//-----------------------------------------------------------------------------
1906int iface_readFileParams(char* tok[], int ntoks);
1907void iface_openRoutingFiles(void);
1908void iface_closeRoutingFiles(void);
1910int iface_getIfaceNode(int index);
1911double iface_getIfaceFlow(int index);
1912double iface_getIfaceQual(int index, int pollut);
1913void iface_saveOutletResults(DateTime reportDate, FILE* file);
1917
1918//-----------------------------------------------------------------------------
1919// Hot Start File Methods
1920//-----------------------------------------------------------------------------
1921int hotstart_open(void);
1922void hotstart_save(void);
1923int hotstart_save_to_file(const char* hotstartFile);
1924int hotstart_is_valid(const char* hotstartFile, int* inputFileVersion);
1925void hotstart_close(void);
1926
1927//-----------------------------------------------------------------------------
1928// Conveyance System Link Methods
1929//-----------------------------------------------------------------------------
1930int link_readParams(int link, int type, int subIndex, char* tok[], int ntoks);
1931int link_readXsectParams(char* tok[], int ntoks);
1932int link_readLossParams(char* tok[], int ntoks);
1933
1934void link_validate(int link);
1935void link_initState(int link);
1936void link_setOldHydState(int link);
1937void link_setOldQualState(int link);
1938
1939void link_setTargetSetting(int j);
1940void link_setSetting(int j, double tstep);
1941int link_setFlapGate(int link, int n1, int n2, double q);
1942
1943double link_getInflow(int link);
1944void link_setOutfallDepth(int link);
1945double link_getLength(int link);
1946double link_getYcrit(int link, double q);
1947double link_getYnorm(int link, double q);
1948double link_getVelocity(int link, double q, double y);
1949double link_getFroude(int link, double v, double y);
1950double link_getPower(int link);
1951double link_getLossRate(int link, int routeModel, double q, double tstep);
1952char link_getFullState(double a1, double a2, double aFull);
1953
1954void link_getResults(int link, double wt, float x[]);
1955
1956//-----------------------------------------------------------------------------
1957// Link Cross-Section Methods
1958//-----------------------------------------------------------------------------
1959int xsect_isOpen(int type);
1960int xsect_setParams(TXsect* xsect, int type, double p[], double ucf);
1964double xsect_getAmax(TXsect* xsect);
1965
1966double xsect_getSofA(TXsect* xsect, double area);
1967double xsect_getYofA(TXsect* xsect, double area);
1968double xsect_getRofA(TXsect* xsect, double area);
1969double xsect_getAofS(TXsect* xsect, double sFactor);
1970double xsect_getdSdA(TXsect* xsect, double area);
1971double xsect_getAofY(TXsect* xsect, double y);
1972double xsect_getRofY(TXsect* xsect, double y);
1973double xsect_getWofY(TXsect* xsect, double y);
1974double xsect_getYcrit(TXsect* xsect, double q);
1975
1976//-----------------------------------------------------------------------------
1977// Culvert/Roadway Methods
1978//-----------------------------------------------------------------------------
1979double culvert_getInflow(int link, double q, double h);
1980double roadway_getInflow(int link, double dir, double hcrest, double h1, double h2);
1981
1982//-----------------------------------------------------------------------------
1983// Force Main Methods
1984//-----------------------------------------------------------------------------
1985double forcemain_getEquivN(int j, int k);
1986double forcemain_getRoughFactor(int j, double lengthFactor);
1987double forcemain_getFricSlope(int j, double v, double hrad);
1988
1989//-----------------------------------------------------------------------------
1990// Cross-Section Transect Methods
1991//-----------------------------------------------------------------------------
1992int transect_create(int n);
1993void transect_delete(void);
1994int transect_readParams(int* count, char* tok[], int ntoks);
1995void transect_validate(int j);
1997
1998//-----------------------------------------------------------------------------
1999// Street Cross-Section Methods
2000//-----------------------------------------------------------------------------
2001int street_create(int nStreets);
2002void street_delete();
2003int street_readParams(char* tok[], int ntoks);
2004double street_getExtentFilled(int link);
2005
2006//-----------------------------------------------------------------------------
2007// Custom Shape Cross-Section Methods
2008//-----------------------------------------------------------------------------
2009int shape_validate(TShape* shape, TTable* curve);
2010
2017
2021void controls_init(void);
2022
2028void controls_addToCount(char* s);
2029
2035int controls_create(int n);
2036
2040void controls_delete(void);
2041
2052int controls_addVariable(char* tok[], int nToks);
2053
2062int controls_addExpression(char* tok[], int nToks);
2063
2072int controls_addRuleClause(int r, int keyword, char* tok[], int nToks);
2073
2081int controls_evaluate(DateTime currentTime, DateTime elapsedTime, double tStep);
2085
2086//-----------------------------------------------------------------------------
2087// Table & Time Series Methods
2088//-----------------------------------------------------------------------------
2089int table_readCurve(char* tok[], int ntoks);
2090int table_readTimeseries(char* tok[], int ntoks);
2091
2092int table_addEntry(TTable* table, double x, double y);
2093int table_getFirstEntry(TTable* table, double* x, double* y);
2094int table_getNextEntry(TTable* table, double* x, double* y);
2095void table_deleteEntries(TTable* table);
2096
2097void table_init(TTable* table);
2098int table_validate(TTable* table);
2099
2100double table_lookup(TTable* table, double x);
2101double table_lookupEx(TTable* table, double x);
2102double table_intervalLookup(TTable* table, double x);
2103double table_inverseLookup(TTable* table, double y);
2104
2105double table_getSlope(TTable* table, double x);
2106double table_getMaxY(TTable* table, double x);
2107double table_getStorageVolume(TTable* table, double x);
2108double table_getStorageDepth(TTable* table, double v);
2109
2110void table_tseriesInit(TTable* table);
2111double table_tseriesLookup(TTable* table, double t, char extend);
2112
2119
2125double UCF(int u);
2126
2133int getInt(char* s, int* y);
2134
2141int getFloat(char* s, float* y);
2142
2149int getDouble(char* s, double* y);
2150
2156char* getTempFileName(char* fname);
2157
2164int findmatch(char* s, char* keyword[]);
2165
2173int match(char* str, char* substr);
2174
2181int strcomp(const char* s1, const char* s2);
2182
2191size_t sstrncpy(char* dest, const char* src, size_t n);
2192
2200size_t sstrcat(char* dest, const char* src, size_t destsize);
2201
2206void writecon(const char* s);
2207
2216void getElapsedTime(DateTime aDate, int* days, int* hrs, int* mins);
2217
2224DateTime getDateTime(double elapsedMsec);
2225
2232char* addAbsolutePath(char* fname); // add full path to a file name
2236
2237#endif // FUNCS_H
double DateTime
Type for storing date and time values.
Definition datetime.h:34
int table_getNextEntry(TTable *table, double *x, double *y)
Retrieves the next x/y entry in a table.
Definition table.c:399
double link_getYnorm(int link, double q)
Computes normal depth for given flow rate.
Definition link.c:794
double table_intervalLookup(TTable *table, double x)
Retrieves the y-value corresponding to the first table entry whose x-value is > x.
Definition table.c:537
void link_validate(int link)
Validates a link's properties.
Definition link.c:419
double forcemain_getFricSlope(int j, double v, double hrad)
Computes the headloss per unit length used in dynamic wave flow routing for a pressurized force main ...
Definition forcmain.c:106
int table_addEntry(TTable *table, double x, double y)
Adds a new x/y entry to a table.
Definition table.c:244
double forcemain_getRoughFactor(int j, double lengthFactor)
Computes an adjustment factor for a force main that compensates for any artificial lengthening the pi...
Definition forcmain.c:81
double link_getLossRate(int link, int routeModel, double q, double tstep)
Computes rate at which flow volume is lost in a link due to evaporation and seepage.
Definition link.c:913
double culvert_getInflow(int link, double q, double h)
Uses FHWA HEC-5 equations to find flow through inlet controlled culverts.
Definition culvert.c:191
double xsect_getSofA(TXsect *xsect, double area)
Computes xsection's section factor at a given area.
Definition xsect.c:744
int link_readLossParams(char *tok[], int ntoks)
Reads local loss parameters for a link from a tokenized line of input data. Format: LinkID cInlet cOu...
Definition link.c:295
double table_inverseLookup(TTable *table, double y)
Retrieves the x-value corresponding to an y-value in a table, using interploation if necessary.
Definition table.c:565
double table_lookup(TTable *table, double x)
Retrieves the y-value corresponding to an x-value in a table, using interploation if necessary.
Definition table.c:427
double table_lookupEx(TTable *table, double x)
Retrieves the y-value corresponding to an x-value in a table, using interploation if necessary within...
Definition table.c:496
void link_getResults(int link, double wt, float x[])
Retrieves time-weighted average of old and new results for a link.
Definition link.c:690
void street_delete()
Deletes the collection of Street objects.
Definition street.c:69
double table_tseriesLookup(TTable *table, double t, char extend)
Retrieves the y-value corresponding to a time series date, using interploation if necessary.
Definition table.c:782
double xsect_getRofA(TXsect *xsect, double area)
Computes xsection's hydraulic radius at a given area.
Definition xsect.c:1158
void table_init(TTable *table)
Initializes properties when table is first created.
Definition table.c:293
double table_getMaxY(TTable *table, double x)
Finds the largest y value in the initial non-decreasing portion of a table that appear before value x...
Definition table.c:598
double xsect_getYcrit(TXsect *xsect, double q)
Computes critical depth at a specific flow rate.
Definition xsect.c:1328
double link_getPower(int link)
Computes power consumed by head loss (or head gain) of water flowing through a link.
Definition link.c:893
void link_setOldQualState(int link)
Replaces link's old water quality state values with current ones.
Definition link.c:605
void hotstart_close(void)
Saves and closes hotstart files that are to be written at end of simulation.
Definition hotstart.c:233
int table_readTimeseries(char *tok[], int ntoks)
Reads a tokenized line of data for a time series table.
Definition table.c:147
int transect_readParams(int *count, char *tok[], int ntoks)
Parse an NC, X1 or GR transect input record.
Definition transect.c:130
double street_getExtentFilled(int link)
Inspect the high-end depth or area of a street conduit.
Definition street.c:180
double xsect_getdSdA(TXsect *xsect, double area)
Computes xsection's derivative of its section factor with respect to area at a given area.
Definition xsect.c:1266
double xsect_getAofY(TXsect *xsect, double y)
Computes xsection's area at a given depth.
Definition xsect.c:896
double link_getLength(int link)
Finds true length of a link.
Definition link.c:822
double xsect_getAofS(TXsect *xsect, double sFactor)
Computes xsection's area at a given section factor.
Definition xsect.c:1216
double roadway_getInflow(int link, double dir, double hcrest, double h1, double h2)
Compute signed roadway overtopping discharge and its head derivative.
Definition roadway.c:101
double link_getInflow(int link)
Finds total flow entering a link during current time step.
Definition link.c:558
void transect_validate(int j)
Validates transect data and creates its geometry tables.
Definition transect.c:227
void link_setSetting(int j, double tstep)
Updates a link's setting as a result of a control action.
Definition link.c:641
double xsect_getAmax(TXsect *xsect)
Finds xsection area at maximum flow depth.
Definition xsect.c:726
void xsect_setIrregXsectParams(TXsect *xsect)
Assigns transect parameters to an irregular shaped cross section.
Definition xsect.c:666
double table_getStorageDepth(TTable *table, double v)
Finds depth for a given volume in a Storage Curve table.
Definition table.c:683
void link_setTargetSetting(int j)
Updates a link's target setting.
Definition link.c:620
int link_setFlapGate(int link, int n1, int n2, double q)
Based on the sign of the flow, determines if a flap gate associated with the link should close or not...
Definition link.c:662
double table_getStorageVolume(TTable *table, double x)
Finds volume for a given depth in a Storage Curve table.
Definition table.c:622
double link_getYcrit(int link, double q)
Computes critical depth for given flow rate.
Definition link.c:781
double forcemain_getEquivN(int j, int k)
Computes a Mannng's n that results in the same normal flow value for a force main flowing full under ...
Definition forcmain.c:57
int street_create(int nStreets)
Allocate zero-initialized street cross-section definitions.
Definition street.c:48
void link_setOldHydState(int link)
Replaces link's old hydraulic state values with current ones.
Definition link.c:584
int xsect_isOpen(int type)
Determines if a xsection type is open or closed.
Definition xsect.c:223
int table_getFirstEntry(TTable *table, double *x, double *y)
Retrieves the first x/y entry in a table.
Definition table.c:366
void transect_delete(void)
Deletes memory allocated for all transects.
Definition transect.c:107
int hotstart_save_to_file(const char *hotstartFile)
Save the current runoff and routing state to a named version-4 hotstart file.
Definition hotstart.c:144
double link_getVelocity(int link, double q, double y)
Finds flow velocity given flow and depth.
Definition link.c:838
void transect_createStreetTransect(TStreet *street)
Construct hydraulic geometry tables from a one- or two-sided street section.
Definition transect.c:673
int hotstart_open(void)
Restore configured input state and initialize configured hotstart outputs.
Definition hotstart.c:96
int street_readParams(char *tok[], int ntoks)
Parse a street cross section and construct its hydraulic transect tables.
Definition street.c:87
void link_setOutfallDepth(int link)
Sets depth at outfall node connected to link j.
Definition link.c:742
int link_readParams(int link, int type, int subIndex, char *tok[], int ntoks)
Reads parameters for a specific type of link from a tokenized line of input data.
Definition link.c:158
int transect_create(int n)
Creates an array of cross-section transects.
Definition transect.c:88
int hotstart_is_valid(const char *hotstartFile, int *inputFileVersion)
Recognize a hotstart file's header and version.
Definition hotstart.c:187
void xsect_setStreetXsectParams(TXsect *xsect)
Assigns transect parameters to a street cross section.
Definition xsect.c:678
void xsect_setCustomXsectParams(TXsect *xsect)
Assigns parameters to a custom-shaped cross section.
Definition xsect.c:690
void table_deleteEntries(TTable *table)
Deletes all x/y entries in a table.
Definition table.c:267
int table_readCurve(char *tok[], int ntoks)
Reads a tokenized line of data for a curve table.
Definition table.c:98
int link_readXsectParams(char *tok[], int ntoks)
Reads a link's cross section parameters from a tokenized line of input data. Formats: Link Shape Geom...
Definition link.c:186
int xsect_setParams(TXsect *xsect, int type, double p[], double ucf)
Assigns parameters to a cross section's data structure.
Definition xsect.c:238
double link_getFroude(int link, double v, double y)
Computes Froude Number for given velocity and flow depth.
Definition link.c:865
double table_getSlope(TTable *table, double x)
Retrieves the slope of the curve at the line segment containing x.
Definition table.c:459
void link_initState(int link)
Initializes a link's state variables at start of simulation.
Definition link.c:522
int shape_validate(TShape *shape, TTable *curve)
Computes the entries in a custom x-section shape's geometry tables from its user-supplied width v....
Definition shape.c:60
void table_tseriesInit(TTable *table)
Initializes the time bracket within a time series table.
Definition table.c:762
double xsect_getWofY(TXsect *xsect, double y)
Computes xsection's top width at a given depth.
Definition xsect.c:990
double xsect_getYofA(TXsect *xsect, double area)
Computes xsection's depth at a given area.
Definition xsect.c:804
double xsect_getRofY(TXsect *xsect, double y)
Computes xsection's hydraulic radius at a given depth.
Definition xsect.c:1085
char link_getFullState(double a1, double a2, double aFull)
Determines if a link is upstream, downstream or completely full.
Definition link.c:930
void hotstart_save(void)
Saves hotstart files whose specified save time has arrived.
Definition hotstart.c:119
int table_validate(TTable *table)
Checks that table's x-values are in ascending order.
Definition table.c:318
DateTime climate_getNextEvapDate(void)
Gets the next date when evaporation rate changes.
Definition climate.c:976
int climate_readEvapParams(char *tok[], int ntoks)
Reads evaporation parameters from input line of data.
Definition climate.c:643
void climate_initState(void)
Initializes climate state variables.
Definition climate.c:921
int climate_readAdjustments(char *tok[], int ntoks)
Reads adjustments to monthly evaporation or rainfall from input line of data.
Definition climate.c:726
void climate_setState(DateTime theDate)
Sets climate variables for current date.
Definition climate.c:958
int climate_readParams(char *tok[], int ntoks)
Reads climate/temperature parameters from input line of data.
Definition climate.c:523
void climate_validate(void)
Validates climatological variables.
Definition climate.c:818
void climate_openFile(void)
Opens a climate file and reads in first set of values.
Definition climate.c:863
int controls_addExpression(char *tok[], int nToks)
Adds a math expression to the control rule system from a a tokenized line of input with format: EXPRE...
Definition controls.c:850
int controls_addRuleClause(int r, int keyword, char *tok[], int nToks)
Adds a new clause to a control rule.
Definition controls.c:884
int controls_evaluate(DateTime currentTime, DateTime elapsedTime, double tStep)
Evaluates all control rules at the current time of the simulation.
Definition controls.c:941
void controls_addToCount(char *s)
Updates the number of named variables or math expressions used by control rules.
Definition controls.c:749
void controls_delete(void)
Deletes all control rules.
Definition controls.c:797
int controls_addVariable(char *tok[], int nToks)
Adds a named variable to the control rule system from a tokenized line of input with formats:
Definition controls.c:820
int controls_create(int n)
Creates an array of control rules.
Definition controls.c:759
void controls_init(void)
Initializes the control rule system.
Definition controls.c:737
int inflow_readDwfPattern(char *tok[], int ntoks)
Reads values of a time pattern from a line of input data.
Definition inflow.c:426
void inflow_initDwfInflow(TDwfInflow *inflow)
Initialzes a dry weather inflow by ordering its time patterns.
Definition inflow.c:348
int inflow_readDwfInflow(char *tok[], int ntoks)
Reads dry weather inflow parameters from line of input data.
Definition inflow.c:243
double inflow_getExtInflow(TExtInflow *inflow, DateTime aDate)
Retrieves the value of an external inflow at a specific date and time.
Definition inflow.c:214
void inflow_initDwfPattern(int patternIndex)
Initialzes a dry weather inflow time pattern.
Definition inflow.c:407
void inflow_deleteExtInflows(int nodeIndex)
Deletes all time series inflow data for a node.
Definition inflow.c:195
int inflow_setExtInflow(int nodeIndex, int param, int type, int tseries, int basePat, double cf, double baseline, double sf)
This function assigns property values to the inflow object.
Definition inflow.c:157
void inflow_deleteDwfInflows(int nodeIndex)
Deletes all dry weather inflow data for a node.
Definition inflow.c:323
double inflow_getDwfInflow(TDwfInflow *inflow, int month, int day, int hour)
Computes dry weather inflow value at a specific point in time.
Definition inflow.c:380
int inflow_readExtInflow(char *tok[], int ntoks)
Reads parameters of a direct external inflow from a line of input.
Definition inflow.c:61
void node_validate(int nodeIndex)
Validates a node's properties.
Definition node.c:218
int node_readParams(int nodeIndex, int type, int k, char *tok[], int ntoks)
Reads node properties from a tokenized line of input.
Definition node.c:126
double node_getSurfArea(int j, double d)
Computes surface area of water stored at a node from water depth.
Definition node.c:392
void node_getResults(int nodeIndex, double wt, float x[])
Computes weighted average of old and new results at a node.
Definition node.c:502
void node_setOldQualState(int nodeIndex)
Replaces a node's old water quality state values with new ones.
Definition node.c:319
double node_getVolume(int nodeIndex, double depth)
Computes volume stored at a node from its water depth.
Definition node.c:370
double node_getLosses(int nodeIndex, double tStep)
Computes the rates of evaporation and infiltration over a given time step for a node.
Definition node.c:585
double node_getMaxOutflow(int nodeIndex, double q, double tStep)
Limits outflow rate from a node with storage volume.
Definition node.c:429
void node_setOutletDepth(int j, double yNorm, double yCrit, double z)
Sets water depth at a node that serves as an outlet point.
Definition node.c:535
void node_initState(int nodeIndex)
Initializes a node's state variables at start of simulation.
Definition node.c:256
double node_getOutflow(int nodeIndex, int linkIndex)
Computes outflow from node available for inflow into a link.
Definition node.c:410
double node_getDepth(int nodeIndex, double v)
Computes a node's water depth from its volume.
Definition node.c:352
double node_getPondedArea(int nodeIndex, double depth)
Computes surface area of water at a node based on depth.
Definition node.c:559
void node_initFlows(int nodeIndex, double tStep)
Initializes a node's inflow/outflow/overflow at start of time step.
Definition node.c:333
void node_setOldHydState(int nodeIndex)
Replaces a node's old hydraulic state values with new ones.
Definition node.c:307
double node_getSystemOutflow(int j, int *isFlooded)
Computes flow rate at outfalls and flooded nodes.
Definition node.c:449
void flowrout_init(int routingModel)
Initializes flow routing system.
Definition flowrout.c:90
void toposort_sortLinks(int sortedLinks[])
Sorts links from upstream to downstream.
Definition toposort.c:72
void dynwave_close(void)
Frees memory allocated for dynamic wave routing method.
Definition dynwave.c:204
int flowrout_execute(int links[], int routingModel, double tStep)
Routes flow through conveyance network over current time step.
Definition flowrout.c:152
int dynwave_execute(double tStep)
Routes flows through drainage network over current time step.
Definition dynwave.c:263
void flowrout_close(int routingModel)
Closes down flow routing system.
Definition flowrout.c:120
double dynwave_getRoutingStep(double fixedStep)
Computes variable routing time step if applicable.
Definition dynwave.c:235
double flowrout_getRoutingStep(int routingModel, double fixedStep)
Finds variable time step for dynamic wave routing.
Definition flowrout.c:134
void qualrout_execute(double tStep)
Routes water quality constituents through the drainage network over the current time step.
Definition qualrout.c:112
void qualrout_init(void)
Initializes water quality concentrations in all nodes and links.
Definition qualrout.c:77
void dynwave_validate(void)
Adjusts dynamic wave routing options.
Definition dynwave.c:212
int kinwave_execute(int linkIndex, double *qinflow, double *qoutflow, double tStep)
Finds outflow over time step tStep given flow entering a conduit using Kinematic Wave flow routing.
Definition kinwave.c:84
void dwflow_findConduitFlow(int linkIndex, int steps, double omega, double dt)
Updates flow in conduit link by solving finite difference form of continuity and momentum equations.
Definition dwflow.c:97
void dynwave_init(void)
Initializes dynamic wave routing method.
Definition dynwave.c:137
double iface_getIfaceFlow(int index)
Finds interface flow for particular node index.
Definition iface.c:273
void iface_saveOutletResults(DateTime reportDate, FILE *file)
Saves system outflows to routing interface file.
Definition iface.c:321
void iface_closeRoutingFiles(void)
Closes routing interface files.
Definition iface.c:205
int iface_getNumIfaceNodes(DateTime aDate)
Reads inflow data from interface file at current date.
Definition iface.c:226
int iface_readFileParams(char *tok[], int ntoks)
Reads interface file information from a line of input data. Data format is: USE/SAVE FileType FileNam...
Definition iface.c:87
void iface_openRoutingFiles(void)
Opens routing interface files.
Definition iface.c:176
double iface_getIfaceQual(int index, int pollut)
Finds interface concentration for particular node index & pollutant.
Definition iface.c:294
int iface_getIfaceNode(int index)
Finds index of project node associated with interface node index.
Definition iface.c:258
int gwater_readFlowExpression(char *tok[], int ntoks)
Reads mathematical expression for lateral or deep groundwater flow for a subcatchment from a line of ...
Definition gwater.c:305
void gwater_validate(int subcatchIndex)
Validates groundwater parameters for a subcatchment.
Definition gwater.c:396
void gwater_initState(int subcatchIndex)
Initializes state of subcatchment's groundwater.
Definition gwater.c:423
int gwater_readAquiferParams(int aquiferIndex, char *tok[], int ntoks)
Reads aquifer parameter values from line of input data.
Definition gwater.c:149
void gwater_getState(int subcatchIndex, double x[])
Retrieves state of subcatchment's groundwater.
Definition gwater.c:460
double gwater_getVolume(int subcatchIndex)
Finds volume of groundwater stored in upper & lower zones.
Definition gwater.c:491
void gwater_validateAquifer(int aquiferIndex)
Validates groundwater aquifer properties.
Definition gwater.c:371
int gwater_readGroundwaterParams(char *tok[], int ntoks)
Reads groundwater inflow parameters for a subcatchment from a line of input data.
Definition gwater.c:224
void gwater_deleteFlowExpression(int subcatchIndex)
Veletes a subcatchment's custom groundwater flow expressions.
Definition gwater.c:361
void gwater_getGroundwater(int j, double evap, double infil, double tStep)
Computes groundwater flow for a subcatchment.
Definition gwater.c:514
void gwater_setState(int subcatchIndex, double x[])
Assigns values to a subcatchment's groundwater state.
Definition gwater.c:474
int input_countObjects(void)
Reads input file to determine number of system objects.
Definition input.c:85
int input_readData(void)
Reads input file to determine number of system objects.
Definition input.c:167
int landuse_readPollutParams(int pollutIndex, char *tok[], int ntoks)
Reads pollutant parameters from a tokenized line of input.
Definition landuse.c:106
void landuse_getInitBuildup(TLandFactor *landFactor, double *initBuildup, double area, double curb)
Determines the initial buildup of each pollutant on each land use for a given subcatchment.
Definition landuse.c:383
int landuse_readBuildupParams(char *tok[], int ntoks)
Reads pollutant buildup parameters from a tokenized line of input.
Definition landuse.c:202
double landuse_getBuildup(int landuseIndex, int pollutIndex, double area, double curb, double buildup, double tStep)
Computes new pollutant buildup on a landuse after a time increment.
Definition landuse.c:450
double landuse_getCoPollutLoad(int p, double washoff[])
Finds washoff mass added by a co-pollutant of a given pollutant.
Definition landuse.c:725
double landuse_getWashoffLoad(int i, int p, double area, TLandFactor landFactor[], double runoff, double vOutflow)
Computes pollutant load generated by a land use over a time step.
Definition landuse.c:620
int landuse_readWashoffParams(char *tok[], int ntoks)
Reads pollutant washoff parameters from a tokenized line of input.
Definition landuse.c:299
double landuse_getAvgBmpEffic(int subcatchIndex, int pollutIndex)
Finds the overall average BMP removal achieved for pollutant pollutIndex treated in subcatchment j.
Definition landuse.c:588
int landuse_readParams(int landuseIndex, char *tok[], int ntoks)
Reads landuse parameters from a tokenized line of input.
Definition landuse.c:69
void massbal_addReactedMass(int pollutIndex, double w)
Adds mass reacted during current time step to routing totals.
Definition massbal.c:522
void massbal_addSeepageLoss(int pollutIndex, double w)
Adds mass lost to seepage during current time step to routing totals.
Definition massbal.c:534
double massbal_getRunoffError(void)
Computes runoff mass balance error.
Definition massbal.c:687
double massbal_getStepFlowError(void)
Computes flow routing mass balance error at current time step.
Definition massbal.c:982
void massbal_close(void)
Frees memory used by mass balance system.
Definition massbal.c:248
void massbal_addToFinalStorage(int pollutIndex, double w)
Adds mass remaining on dry surface to routing totals.
Definition massbal.c:546
void massbal_updateLoadingTotals(int type, int p, double w)
Adds inflow mass loading to loading totals for current time step.
Definition massbal.c:429
int massbal_open(void)
Opens and initializes mass balance continuity checking.
Definition massbal.c:115
void massbal_addInflowFlow(int type, double q)
Adds flow inflow to routing totals for current time step.
Definition massbal.c:402
void massbal_addLinkLosses(double evapLoss, double seepLoss)
Adds link losses over current time step to routing totals.
Definition massbal.c:569
void massbal_updateRoutingTotals(double tStep)
Updates overall routing totals with totals from current time step.
Definition massbal.c:581
void massbal_updateRunoffTotals(int flowType, double v)
Updates runoff totals after current time step.
Definition massbal.c:324
void massbal_updateGwaterTotals(double vInfil, double vUpperEvap, double vLowerEvap, double vLowerPerc, double vGwater)
Updates groundwater totals after current time step.
Definition massbal.c:356
void massbal_addInflowQual(int type, int pollutIndex, double w)
Adds quality inflow to routing totals for current time step.
Definition massbal.c:462
void massbal_addNodeLosses(double evapLoss, double seepLoss)
Adds node losses over current time step to routing totals.
Definition massbal.c:558
void massbal_report(void)
Reports mass balance results.
Definition massbal.c:261
void massbal_initTimeStepTotals(void)
Initializes routing totals for current time step.
Definition massbal.c:368
double massbal_getFlowError(void)
Computes flow routing mass balance error.
Definition massbal.c:843
void massbal_addOutflowQual(int p, double w, int isFlooded)
Adds pollutant outflow over current time step to routing totals.
Definition massbal.c:504
void massbal_addOutflowFlow(double q, int isFlooded)
Adds flow outflow over current time step to routing totals.
Definition massbal.c:490
void output_readNodeResults(long period, int index)
Reads computed results for a node at a specific time period.
Definition output.c:727
void output_readLinkResults(long period, int index)
Reads computed results for a link at a specific time period.
Definition output.c:742
int output_open(void)
Writes basic project data to binary output file.
Definition output.c:144
void output_updateAvgResults(void)
Updates average results for current time period.
Definition output.c:864
void output_close(void)
Frees memory used for accessing the binary file.
Definition output.c:551
void output_end(void)
Writes closing records to binary file.
Definition output.c:533
void output_readSubcatchResults(long period, int index)
Reads computed results for a subcatchment at a specific time period.
Definition output.c:712
void output_saveResults(double reportTime)
Writes computed results for current report time to binary file.
Definition output.c:476
void output_readDateTime(long period, DateTime *days)
Retrieves the date/time for a specific reporting period from the binary output file.
Definition output.c:697
double ** project_createMatrix(int nrows, int ncols)
Allocates memory for a matrix of doubles.
Definition project.c:420
int project_readOption(char *s1, char *s2)
Reads a project option from a pair of string tokens.
Definition project.c:475
int project_findObject(int type, const char *id)
Uses hash table to find index of an object with a given ID.
Definition project.c:392
void project_freeMatrix(double **m)
Frees memory allocated for a matrix of doubles.
Definition project.c:456
void project_close(void)
Close project.
Definition project.c:302
int project_addObject(int type, char *id, int n)
Adds an object Id to a hash table.
Definition project.c:360
void project_readInput(void)
Read project inputs.
Definition project.c:156
int project_init(void)
Initializes the internal state of the project.
Definition project.c:314
char * project_findID(int type, char *id)
Uses hash table to find address of a given string entry.
Definition project.c:406
void project_validate(void)
Checks validity of project data.
Definition project.c:205
void project_open(const char *inp_file, const char *rpt_file, const char *out_file)
Opens a new SWMM project.
Definition project.c:145
void rdii_openRdii(void)
Opens an exisiting RDII interface file or creates a new one.
Definition rdii.c:462
int rdii_readRdiiInflow(char *tok[], int ntoks)
Reads properties of an RDII inflow from a line of input.
Definition rdii.c:171
int rdii_readUnitHydParams(char *tok[], int ntoks)
Reads parameters of an RDII unit hydrograph from a line of input.
Definition rdii.c:243
void rdii_closeRdii(void)
Closes the RDII interface file.
Definition rdii.c:545
int rdii_getNumRdiiFlows(DateTime aDate)
Finds number of RDII inflows at a specified date.
Definition rdii.c:560
void rdii_initUnitHyd(int unitHydIndex)
Initializes properties of a unit hydrograph group.
Definition rdii.c:216
void rdii_getRdiiFlow(int index, int *nodeIndex, double *q)
Finds index and current RDII inflow for an RDII node.
Definition rdii.c:594
void rdii_deleteRdiiInflow(int nodeIndex)
Deletes RDII inflow data for a node.
Definition rdii.c:443
void rain_close(void)
Closes rain interface file and RDII processor.
Definition rain.c:195
void rain_open(void)
Opens binary rainfall interface file and RDII processor.
Definition rain.c:136
DateTime gage_getNextRainDate(int gageIndex, DateTime aDate)
Finds the next date from specified date when rainfall occurs.
Definition gage.c:527
void gage_setReportRainfall(int gageIndex, DateTime reportDate)
Sets the rainfall value reported at the current reporting time.
Definition gage.c:562
int gage_readParams(int gageIndex, char *tok[], int ntoks)
Reads rain gage parameters from a line of input data.
Definition gage.c:80
void gage_initState(int j)
Initializes state of a rain gage.
Definition gage.c:321
double gage_getPrecip(int gageIndex, double *rainfall, double *snowfall)
Determines whether gage's recorded rainfall is rain or snow.
Definition gage.c:546
double gage_getPastRain(int j, int n)
Retrieves rainfall total over some previous number of hours.
Definition gage.c:510
void gage_validate(int gageIndex)
Checks for valid rain gage parameters.
Definition gage.c:270
void gage_setState(int j, DateTime t)
Updates state of rain gage for specified date.
Definition gage.c:374
void gage_updatePastRain(int gageIndex, int tStep)
Updates past MAXPASTRAIN hourly rain totals.
Definition gage.c:467
void report_writeSysTime(void)
Writes starting/ending processing times to the report file.
Definition report.c:221
void report_writeReport(void)
Writes project title to report file.
Definition report.c:1138
void report_writeLogo(void)
Writes report header lines to report file.
Definition report.c:252
void report_writeTitle(void)
Writes project title to report file.
Definition report.c:264
void report_writeRunoffError(TRunoffTotals *totals, double totalArea)
Writes runoff continuity error to report file.
Definition report.c:510
void report_writeFlowError(TRoutingTotals *totals)
Writes flow routing continuity error to report file.
Definition report.c:758
void report_writeQualError(TRoutingTotals *QualTotals)
Writes quality routing continuity error to report file.
Definition report.c:822
void statsrpt_writeReport(void)
Reports simulation summary statistics.
Definition statsrpt.c:101
void report_writeTseriesErrorMsg(int code, TTable *tseries)
Writes the date where a time series' data is out of order.
Definition report.c:1534
void report_writeLine(const char *line)
Writes a line of text to the report file.
Definition report.c:211
void report_writeLoadingError(TLoadingTotals *totals)
Writes runoff loading continuity error to report file.
Definition report.c:600
void report_writeGwaterError(TGwaterTotals *totals, double gwArea)
Writes groundwater continuity error to report file.
Definition report.c:712
void report_writeNonconvergedStats(TMaxStats maxNonconverged[], int nMaxStats)
Writes non-converging nodes to report file.
Definition report.c:1047
void report_writeRainStats(int i, TRainStats *r)
Writes summary of rain data read from input file to report file.
Definition report.c:384
void report_writeInputErrorMsg(int k, int sect, char *line, long lineCount)
Writes input error message to report file.
Definition report.c:1475
void report_writeMaxStats(TMaxStats maxMassBalErrs[], TMaxStats maxCourantCrit[], int nMaxStats)
Lists nodes and links with highest mass balance errors and courant time step violations to report fil...
Definition report.c:949
void report_writeErrorMsg(int code, char *s)
Writes error message to report file.
Definition report.c:1438
void report_writeRdiiStats(double rainVol, double rdiiVol)
Writes summary of RDII inflow to report file.
Definition report.c:426
void report_writeControlActionsHeading(void)
Writes summary control actions heading to report file.
Definition report.c:468
void inputrpt_writeInput(void)
Writes summary of input data to report file.
Definition inputrpt.c:41
void report_writeMaxFlowTurns(TMaxStats flowTurns[], int nMaxStats)
Lists links with highest number of flow turns to report (i.e., fraction of time periods where the flo...
Definition report.c:1013
void report_writeOptions(void)
Writes analysis options in use to report file.
Definition report.c:281
void report_writeErrorCode(void)
Writes error message to report file.
Definition report.c:1456
void report_writeWarningMsg(char *msg, char *id)
Writes a warning message to report file.
Definition report.c:1512
void report_writeTimeStepStats(TTimeStepStats *timeStepStats)
Writes routing time step statistics to report file.
Definition report.c:1077
void report_invokeWarningCallback(const char *msg)
Invokes the registered warning callback (if any) with a message.
Definition report.c:1495
void report_writeControlAction(DateTime aDate, char *linkID, double value, char *ruleID)
Writes control action to report file.
Definition report.c:487
int report_readOptions(char *tok[], int ntoks)
Reads reporting options from a line of input data.
Definition report.c:107
int routing_open(void)
Initializes the routing analyzer.
Definition routing.c:111
double routing_getRoutingStep(int routingModel, double fixedStep)
Determines time step used for flow routing at current time period.
Definition routing.c:173
void routing_execute(int routingModel, double routingStep)
Executes the routing process at the current time period.
Definition routing.c:219
void routing_close(int routingModel)
Closes down the routing analyzer.
Definition routing.c:154
int runoff_open(void)
Opens the runoff analyzer.
Definition runoff.c:97
void runoff_close(void)
Closes the runoff analyzer.
Definition runoff.c:138
void runoff_execute(void)
Computes runoff for each subcatchment at the current runoff time.
Definition runoff.c:165
void stats_updateMaxRunoff(void)
Updates value of maximum system runoff rate.
Definition stats.c:397
void stats_close(void)
Closes the simulation statistics system.
Definition stats.c:305
void stats_updateFlowStats(double tStep, DateTime aDate)
Updates various flow routing statistics at current time period.
Definition stats.c:423
int stats_open(void)
Opens the simulation statistics system.
Definition stats.c:115
void stats_updateTimeStepStats(double tStep, int trialsCount, int steadyState)
Updates flow routing time step statistics.
Definition stats.c:457
void stats_updateMaxNodeDepth(int j, double depth)
Updates a node's maximum depth recorded at reporting times.
Definition stats.c:412
void stats_updateCriticalTimeCount(int nodeIndex, int linkIndex)
Updates count of times a node or link was time step-critical.
Definition stats.c:488
void stats_report(void)
Reports simulation statistics.
Definition stats.c:323
void stats_updateGwaterStats(int subcatchIndex, double infil, double evap, double latFlow, double deepFlow, double theta, double waterTable, double tStep)
Updates groundwater statistics for a specific subcatchment.
Definition stats.c:378
void stats_updateConvergenceStats(int node, int converged)
Updates convergence statistics node.
Definition stats.c:501
void stats_updateSubcatchStats(int subcatchIndex, double rainVol, double runonVol, double evapVol, double infilVol, double impervVol, double pervVol, double runoffVol, double runoff)
Updates totals of runoff components for a specific subcatchment.
Definition stats.c:353
int snow_createSnowpack(int subcatchIndex, int snowIndex)
Creates a snowpack object for a subcatchment.
Definition snow.c:148
double snow_getSnowCover(int subcatchIndex)
Computes volume of snow on a subcatchment.
Definition snow.c:621
void snow_getState(int i, int j, double x[])
Retrieves the current state of a snowpack object.
Definition snow.c:303
void snow_initSnowmelt(int snowIndex)
Initializes values in a snowmelt parameter set.
Definition snow.c:226
void snow_setMeltCoeffs(int snowIndex, double season)
Sets values of snowmelt coefficients for a particular time of year.
Definition snow.c:411
double snow_getSnowMelt(int subcatchIndex, double rainfall, double snowfall, double tStep, double netPrecip[])
Modifies rainfall input to subcatchment's subareas based on possible snow melt and updates snow depth...
Definition snow.c:548
void snow_setState(int subcatchIndex, int subAreaIndex, double x[])
Sets the current state of a snowpack object.
Definition snow.c:331
void snow_validateSnowmelt(int snowIndex)
Checks for valid values in a snowmelt parameter set.
Definition snow.c:258
int snow_readMeltParams(char *tok[], int ntoks)
Reads snowmelt parameters from a tokenized line of input data.
Definition snow.c:89
void snow_initSnowpack(int subcatchIndex)
Initializes state of a subcatchment's snowpack.
Definition snow.c:174
void snow_plowSnow(int subcatchIndex, double tStep)
Adds new snow to subcatchment and plows it between sub-areas.
Definition snow.c:437
void subcatch_setOldState(int subcatchIndex)
Replaces old state of subcatchment with new state.
Definition subcatch.c:491
int subcatch_readParams(int subcatchIndex, char *tok[], int ntoks)
Reads subcatchment parameters from a tokenized line of input data.
Definition subcatch.c:145
double subcatch_getWtdOutflow(int subcatchIndex, double f)
Computes weighted combination of old and new subcatchment runoff.
Definition subcatch.c:869
void subcatch_getResults(int subcatchIndex, double wt, float x[])
Computes wtd. combination of old and new subcatchment results.
Definition subcatch.c:888
void subcatch_validate(int subcatchIndex)
Checks for valid subcatchment input parameters.
Definition subcatch.c:397
double subcatch_getStorage(int subcatchIndex)
Finds total volume of water stored on a subcatchment's surface and its LIDs at the current time.
Definition subcatch.c:530
int subcatch_readInitBuildup(char *tok[], int ntoks)
Reads initial pollutant buildup on subcatchment from tokenized line of input data.
Definition subcatch.c:359
void subcatch_addRunonFlow(int subcatchIndex, double flow)
Updates the total runon flow (ft/s) seen by a subcatchment that receives runon flow from an upstream ...
Definition subcatch.c:618
double subcatch_getEvapRate(int subcatchIndex)
Returns the potential evaporation rate for a subcatchment.
Definition subcatch.c:650
double subcatch_getDepth(int j)
Finds average depth of water over the non-LID portion of a subcatchment.
Definition subcatch.c:849
void subcatch_getRunon(int subcatchIndex)
Routes runoff from a subcatchment to its outlet subcatchment or between its subareas.
Definition subcatch.c:547
void subcatch_initState(int subcatchIndex)
Initializes state of a subcatchment.
Definition subcatch.c:451
double subcatch_getRunoff(int subcatchIndex, double tStep)
Computes runoff & new storage depth for subcatchment.
Definition subcatch.c:672
int subcatch_readSubareaParams(char *tok[], int ntoks)
Rreads subcatchment's subarea parameters from a tokenized line of input data.
Definition subcatch.c:236
int subcatch_readLanduseParams(char *tok[], int ntoks)
Reads assignment of landuses to subcatchment from a tokenized line of input data.
Definition subcatch.c:319
double subcatch_getFracPerv(int j)
Determines what fraction of subcatchment area, including any LID area, is pervious.
Definition subcatch.c:512
double surfqual_getWtdWashoff(int j, int p, double f)
Finds wtd. combination of old and new washoff for a pollutant.
Definition surfqual.c:381
void surfqual_getBuildup(int subcatchIndex, double tStep)
Adds to pollutant buildup on subcatchment surface.
Definition surfqual.c:124
void surfqual_sweepBuildup(int subcatchIndex, DateTime aDate)
Reduces pollutant buildup over a subcatchment if sweeping occurs.
Definition surfqual.c:206
void surfqual_getWashoff(int subcatchIndex, double runoff, double tStep)
Computes new runoff quality for a subcatchment.
Definition surfqual.c:265
void surfqual_initState(int subcatchIndex)
Initializes pollutant buildup, ponded mass, and washoff.
Definition surfqual.c:99
void surfqual_applyAPIBuildup(int subcatchIndex)
Applies the buildup of a pollutant over a subcatchment for a given time step.
Definition surfqual.c:165
void treatmnt_treat(int j, double q, double v, double tStep)
Updates pollutant concentrations at a node after treatment.
Definition treatmnt.c:221
void treatmnt_close(void)
Frees memory used for computing pollutant removals by treatment.
Definition treatmnt.c:103
void treatmnt_delete(int nodeIndex)
Deletes the treatment objects for each pollutant at a node.
Definition treatmnt.c:181
int treatmnt_open(void)
Allocates memory for computing pollutant removals by treatment.
Definition treatmnt.c:86
int treatmnt_readExpression(char *tok[], int ntoks)
Reads a treatment expression from a tokenized line of input.
Definition treatmnt.c:115
void treatmnt_setInflow(double qIn, double wIn[])
Computes and saves array of inflow concentrations to a node.
Definition treatmnt.c:203
void getElapsedTime(DateTime aDate, int *days, int *hrs, int *mins)
Finds elapsed simulation time for a given calendar date.
size_t sstrcat(char *dest, const char *src, size_t destsize)
Safe string concatenation.
int findmatch(char *s, char *keyword[])
Finds match between string and array of keyword strings.
Definition input.c:820
double UCF(int u)
Computes a conversion factor from SWMM's internal units to user's units.
int getDouble(char *s, double *y)
Converts a string to a double precision floating point number.
Definition input.c:885
char * getTempFileName(char *fname)
Creates a temporary file name with path prepended to it.
size_t sstrncpy(char *dest, const char *src, size_t n)
Copies a string to a new memory location in a safe way.
int getInt(char *s, int *y)
Converts a string to an int value.
Definition input.c:857
int match(char *str, char *substr)
Sees if a sub-string of characters appears in a string (not case sensitive). (not case sensitive).
Definition input.c:833
DateTime getDateTime(double elapsedMsec)
Finds calendar date/time value for elapsed milliseconds of simulation time.
int getFloat(char *s, float *y)
Converts a string to a float value.
Definition input.c:874
int strcomp(const char *s1, const char *s2)
Compares two strings (case insensitive).
char * addAbsolutePath(char *fname)
Adds an absolute path name to a file name.
void writecon(const char *s)
Writes string to console.
TRoutingTotals * QualTotals
Definition massbal.c:63
struct DwfInflow TDwfInflow
Definition objects.h:454
struct ExtInflow TExtInflow
Definition objects.h:443
double * y
Definition odesolve.c:37
Definition objects.h:885
Definition objects.h:366
Definition objects.h:870
Definition objects.h:1041
Definition objects.h:933
Definition objects.h:899
Definition objects.h:852
Definition objects.h:640
Definition objects.h:621
Definition objects.h:108
Definition objects.h:919
Definition objects.h:577