|
SWMM
5.2.0
Documentation
|
Main module of the computational engine for Version 5 of the U.S. Environmental Protection Agency's Storm Water Management Model (SWMM). More...
#include <unistd.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <math.h>#include <time.h>#include <float.h>#include "macros.h"#include "objects.h"#include "globals.h"#include "funcs.h"#include "error.h"#include "text.h"#include "swmm5.h"Macros | |
| #define | _CRT_SECURE_NO_DEPRECATE |
| Define to prevent deprecation warnings from MS Visual C++ compilers. | |
| #define | EXTERN |
| Define for 'extern' in headers.h. | |
| #define | MAX_EXCEPTIONS 100 |
| Maximum number of exceptions handled. | |
Functions | |
| int | omp_get_max_threads (void) |
| Dummy function for getting threads available for OpenMP to prevent compiler errors. | |
| int EXPORT_SWMM_SOLVER_API | swmm_run (const char *inputFile, const char *reportFile, const char *outputFile) |
| Run a SWMM simulation with the given input file, report file, and output file. | |
| int EXPORT_SWMM_SOLVER_API | swmm_run_with_callback (const char *inputFile, const char *reportFile, const char *outputFile, progress_callback callback) |
| Run a SWMM simulation with the given input file, report file, and output file with a progress callback. | |
| int EXPORT_SWMM_SOLVER_API | swmm_open (const char *inputFile, const char *reportFile, const char *outputFile) |
| Open a SWMM simulation with the given input file, report file, and output file. | |
| int EXPORT_SWMM_SOLVER_API | swmm_start (int saveFlag) |
| Start a SWMM simulation with the given save flag. | |
| int EXPORT_SWMM_SOLVER_API | swmm_step (double *elapsedTime) |
| End a SWMM simulation. | |
| int EXPORT_SWMM_SOLVER_API | swmm_stride (int strideStep, double *elapsedTime) |
| Perform a SWMM simulation step with a stride step and return the elapsed time. | |
| int EXPORT_SWMM_SOLVER_API | swmm_useHotStart (const char *hotStartFile) |
| Set hotstart file for SWMM simulation. | |
| int EXPORT_SWMM_SOLVER_API | swmm_saveHotStart (const char *hotStartFile) |
| Save hotstart file for SWMM simulation at current time. | |
| int EXPORT_SWMM_SOLVER_API | swmm_end (void) |
| End a SWMM simulation. | |
| int EXPORT_SWMM_SOLVER_API | swmm_report () |
| Writes simulation results to the report file. | |
| void EXPORT_SWMM_SOLVER_API | swmm_writeLine (const char *line) |
| Write a line of text to the SWMM report file. | |
| int EXPORT_SWMM_SOLVER_API | swmm_close () |
| Close a SWMM simulation. | |
| int EXPORT_SWMM_SOLVER_API | swmm_getMassBalErr (float *runoffErr, float *flowErr, float *qualErr) |
| Get the mass balance errors for a SWMM simulation. | |
| int EXPORT_SWMM_SOLVER_API | swmm_getVersion () |
| Get the version of the SWMM engine. | |
| int EXPORT_SWMM_SOLVER_API | swmm_getWarnings () |
| Gets the number of warnings issued during a simulation. | |
| int EXPORT_SWMM_SOLVER_API | swmm_getError (char *errMsg, int msgLen) |
| Retrieves the code number and text of the error condition that caused SWMM to abort its analysis. | |
| int EXPORT_SWMM_SOLVER_API | swmm_getErrorFromCode (int errorCode, char *outErrMsg[1024]) |
| Retrieves the text of the error message that corresponds to the error code number. | |
| int EXPORT_SWMM_SOLVER_API | swmm_getCount (int objType) |
| Retrieves the number of objects of a specific type. | |
| int EXPORT_SWMM_SOLVER_API | swmm_getName (int objType, int index, char *name, int size) |
| Retrieves the ID name of an object. | |
| int EXPORT_SWMM_SOLVER_API | swmm_getIndex (int objType, const char *name) |
| Retrieves the index of a named object. | |
| double EXPORT_SWMM_SOLVER_API | swmm_getValue (int property, int index) |
| Get the value of a property for an object of a given property in the SWMM model. | |
| double EXPORT_SWMM_SOLVER_API | swmm_getValueExpanded (int objType, int property, int index, int subIndex) |
| Get the value of a property for an object given property, index, and subindex in the SWMM model. | |
| int EXPORT_SWMM_SOLVER_API | swmm_setValue (int property, int index, double value) |
| Set the value of a property for an object of a given property and index in the SWMM model. | |
| int EXPORT_SWMM_SOLVER_API | swmm_setValueExpanded (int objType, int property, int index, int subIndex, double value) |
| Set the value of a property for an object given property, index, and subindex in the SWMM model. | |
| double EXPORT_SWMM_SOLVER_API | swmm_getSavedValue (int property, int index, int period) |
| Get saved value of. | |
| void EXPORT_SWMM_SOLVER_API | swmm_decodeDate (double date, int *year, int *month, int *day, int *hour, int *minute, int *second, int *dayOfWeek) |
| Decode double date value into year, month, day, hour, minute, second, and day of week. | |
| double EXPORT_SWMM_SOLVER_API | swmm_encodeDate (int year, int month, int day, int hour, int minute, int second) |
| Encode date values into a double date value. | |
| double | UCF (int u) |
| Computes a conversion factor from SWMM's internal units to user's units. | |
| size_t | sstrncpy (char *dest, const char *src, size_t n) |
| Copies a string to a new memory location in a safe way. | |
| size_t | sstrcat (char *dest, const char *src, size_t destsize) |
| Safe string concatenation. | |
| int | strcomp (const char *s1, const char *s2) |
| Compares two strings (case insensitive). | |
| char * | getTempFileName (char *fname) |
| Creates a temporary file name with path prepended to it. | |
| void | getElapsedTime (DateTime aDate, int *days, int *hrs, int *mins) |
| Finds elapsed simulation time for a given calendar date. | |
| DateTime | getDateTime (double elapsedMsec) |
| Finds calendar date/time value for elapsed milliseconds of simulation time. | |
| char * | addAbsolutePath (char *fname) |
| Adds an absolute path name to a file name. | |
| void | writecon (const char *s) |
| Writes string to console. | |
Variables | |
| const double | Ucf [10][2] |
| Unit conversion factors for different units used in SWMM. | |
| const double | Qcf [6] |
| Flow conversion factors for different flow units used in SWMM. | |
Main module of the computational engine for Version 5 of the U.S. Environmental Protection Agency's Storm Water Management Model (SWMM).
This is the main module of the computational engine for Version 5 of the U.S. Environmental Protection Agency's Storm Water Management Model (SWMM). It contains functions that control the flow of computations.
This engine should be compiled into a shared object library whose API functions are listed in swmm5.h.
| #define _CRT_SECURE_NO_DEPRECATE |
Define to prevent deprecation warnings from MS Visual C++ compilers.
| #define EXTERN |
Define for 'extern' in headers.h.
| #define MAX_EXCEPTIONS 100 |
Maximum number of exceptions handled.
| int omp_get_max_threads | ( | void | ) |
Dummy function for getting threads available for OpenMP to prevent compiler errors.
| int EXPORT_SWMM_SOLVER_API swmm_close | ( | void | ) |
Close a SWMM simulation.
Close a SWMM simulation.
Close a SWMM simulation.
| void EXPORT_SWMM_SOLVER_API swmm_decodeDate | ( | double | date, |
| int * | year, | ||
| int * | month, | ||
| int * | day, | ||
| int * | hour, | ||
| int * | minute, | ||
| int * | second, | ||
| int * | dayOfWeek | ||
| ) |
Decode double date value into year, month, day, hour, minute, second, and day of week.
Decode double date value into year, month, day, hour, minute, second, and day of week.
| [in] | date | Date value |
| [out] | year | Year |
| [out] | month | Month |
| [out] | day | Day |
| [out] | hour | Hour |
| [out] | minute | Minute |
| [out] | second | Second |
| [out] | dayOfWeek | Day of week (0=Sunday, 1=Monday, ..., 6=Saturday) |
Decode double date value into year, month, day, hour, minute, second, and day of week.
| double EXPORT_SWMM_SOLVER_API swmm_encodeDate | ( | int | year, |
| int | month, | ||
| int | day, | ||
| int | hour, | ||
| int | minute, | ||
| int | second | ||
| ) |
Encode date values into a double date value.
Encode date values into a double date value.
| [in] | year | Year |
| [in] | month | Month |
| [in] | day | Day |
| [in] | hour | Hour |
| [in] | minute | Minute |
| [in] | second | Second |
Encode date values into a double date value.
| int EXPORT_SWMM_SOLVER_API swmm_end | ( | void | ) |
End a SWMM simulation.
End a SWMM simulation.
End a SWMM simulation.
| int EXPORT_SWMM_SOLVER_API swmm_getCount | ( | int | objType | ) |
Retrieves the number of objects of a specific type.
Retrieves the number of objects of a specific type.
| [in] | objType | Type of SWMM object |
Retrieves the number of objects of a specific type.
| int EXPORT_SWMM_SOLVER_API swmm_getError | ( | char * | errMsg, |
| int | msgLen | ||
| ) |
Retrieves the code number and text of the error condition that caused SWMM to abort its analysis.
Retrieves the code number and text of the error condition that caused SWMM to abort its analysis.
| [out] | errMsg | Error message text |
| [in] | msgLen | Maximum size of errMsg |
Retrieves the code number and text of the error condition that caused SWMM to abort its analysis.
| int EXPORT_SWMM_SOLVER_API swmm_getErrorFromCode | ( | int | errorCode, |
| char * | outErrMsg[1024] | ||
| ) |
Retrieves the text of the error message that corresponds to the error code number.
Retrieves the text of the error message that corresponds to the error code number.
| [in] | errorCode | Error code number |
| [out] | outErrMsg | Error message text |
Retrieves the text of the error message that corresponds to the error code number.
| int EXPORT_SWMM_SOLVER_API swmm_getIndex | ( | int | objType, |
| const char * | name | ||
| ) |
Retrieves the index of a named object.
Retrieves the index of a named object.
| [in] | objType | Type of SWMM object |
| [in] | name | Object name |
Retrieves the index of a named object.
| int EXPORT_SWMM_SOLVER_API swmm_getMassBalErr | ( | float * | runoffErr, |
| float * | flowErr, | ||
| float * | qualErr | ||
| ) |
Get the mass balance errors for a SWMM simulation.
Get the mass balance errors for a SWMM simulation.
| [out] | runoffErr | Runoff error (percent) |
| [out] | flowErr | Flow error (percent) |
| [out] | qualErr | Quality error (percent) |
Get the mass balance errors for a SWMM simulation.
| int EXPORT_SWMM_SOLVER_API swmm_getName | ( | int | objType, |
| int | index, | ||
| char * | name, | ||
| int | size | ||
| ) |
Retrieves the ID name of an object.
Retrieves the ID name of an object.
| [in] | objType | Type of SWMM object |
| [in] | index | Object index |
| [out] | name | Object name |
| [in] | size | Size of the name array |
Retrieves the ID name of an object.
| double EXPORT_SWMM_SOLVER_API swmm_getSavedValue | ( | int | property, |
| int | index, | ||
| int | period | ||
| ) |
Get saved value of.
Get saved value of.
| [in] | property | Property type |
| [in] | index | Object index |
| [in] | period | Time period index |
Get saved value of.
| double EXPORT_SWMM_SOLVER_API swmm_getValue | ( | int | property, |
| int | index | ||
| ) |
Get the value of a property for an object of a given property in the SWMM model.
Get the value of a property for an object of a given property in the SWMM model.
| [in] | property | Property type |
| [in] | index | Object index |
Get the value of a property for an object of a given property in the SWMM model.
| double EXPORT_SWMM_SOLVER_API swmm_getValueExpanded | ( | int | objType, |
| int | property, | ||
| int | index, | ||
| int | subIndex | ||
| ) |
Get the value of a property for an object given property, index, and subindex in the SWMM model.
Get the value of a property for an object given property, index, and subindex in the SWMM model.
| [in] | objType | Object type |
| [in] | property | Property type |
| [in] | index | Object index |
| [in] | subIndex | Optional Subindex for the property |
Get the value of a property for an object given property, index, and subindex in the SWMM model.
| int EXPORT_SWMM_SOLVER_API swmm_getVersion | ( | void | ) |
Get the version of the SWMM engine.
Get the version of the SWMM engine.
Get the version of the SWMM engine.
| int EXPORT_SWMM_SOLVER_API swmm_getWarnings | ( | void | ) |
Gets the number of warnings issued during a simulation.
Gets the number of warnings issued during a simulation.
Gets the number of warnings issued during a simulation.
| int EXPORT_SWMM_SOLVER_API swmm_open | ( | const char * | inputFile, |
| const char * | reportFile, | ||
| const char * | outputFile | ||
| ) |
Open a SWMM simulation with the given input file, report file, and output file.
Open a SWMM simulation with the given input file, report file, and output file.
| [in] | inputFile | Path to the input file |
| [in] | reportFile | Path to the report file |
| [in] | outputFile | Path to the output file |
Open a SWMM simulation with the given input file, report file, and output file.
| int EXPORT_SWMM_SOLVER_API swmm_report | ( | void | ) |
Writes simulation results to the report file.
Writes simulation results to the report file.
Writes simulation results to the report file.
| int EXPORT_SWMM_SOLVER_API swmm_run | ( | const char * | inputFile, |
| const char * | reportFile, | ||
| const char * | outputFile | ||
| ) |
Run a SWMM simulation with the given input file, report file, and output file.
Run a SWMM simulation with the given input file, report file, and output file.
| [in] | inputFile | Path to the input file |
| [in] | reportFile | Path to the report file |
| [in] | outputFile | Path to the output file |
Run a SWMM simulation with the given input file, report file, and output file.
| int EXPORT_SWMM_SOLVER_API swmm_run_with_callback | ( | const char * | inputFile, |
| const char * | reportFile, | ||
| const char * | outputFile, | ||
| progress_callback | callback | ||
| ) |
Run a SWMM simulation with the given input file, report file, and output file with a progress callback.
Run a SWMM simulation with the given input file, report file, and output file with a progress callback.
| [in] | inputFile | Path to the input file |
| [in] | reportFile | Path to the report file |
| [in] | outputFile | Path to the output file |
| [in] | callback | Progress callback function |
Run a SWMM simulation with the given input file, report file, and output file with a progress callback.
| int EXPORT_SWMM_SOLVER_API swmm_saveHotStart | ( | const char * | hotStartFile | ) |
Save hotstart file for SWMM simulation at current time.
Save hotstart file for SWMM simulation at current time.
| [in] | hotStartFile | Path to the hotstart file |
Save hotstart file for SWMM simulation at current time.
| int EXPORT_SWMM_SOLVER_API swmm_setValue | ( | int | property, |
| int | index, | ||
| double | value | ||
| ) |
Set the value of a property for an object of a given property and index in the SWMM model.
Set the value of a property for an object of a given property and index in the SWMM model.
| [in] | property | Property type |
| [in] | index | Object index |
| [in] | value | Property value |
Set the value of a property for an object of a given property and index in the SWMM model.
| int EXPORT_SWMM_SOLVER_API swmm_setValueExpanded | ( | int | objType, |
| int | property, | ||
| int | index, | ||
| int | subIndex, | ||
| double | value | ||
| ) |
Set the value of a property for an object given property, index, and subindex in the SWMM model.
Set the value of a property for an object given property, index, and subindex in the SWMM model.
| [in] | objType | Object type |
| [in] | property | Property type |
| [in] | index | Object index |
| [in] | subIndex | Optional Subindex for the property |
| [in] | value | Property value |
Set the value of a property for an object given property, index, and subindex in the SWMM model.
| int EXPORT_SWMM_SOLVER_API swmm_start | ( | int | saveFlag | ) |
Start a SWMM simulation with the given save flag.
Start a SWMM simulation with the given save flag.
| [in] | saveFlag | Flag to save simulation |
Start a SWMM simulation with the given save flag.
| int EXPORT_SWMM_SOLVER_API swmm_step | ( | double * | elapsedTime | ) |
End a SWMM simulation.
Perform a SWMM simulation step and return the elapsed time.
End a SWMM simulation.
| int EXPORT_SWMM_SOLVER_API swmm_stride | ( | int | strideStep, |
| double * | elapsedTime | ||
| ) |
Perform a SWMM simulation step with a stride step and return the elapsed time.
Perform a SWMM simulation step with a stride step and return the elapsed time.
| [in] | strideStep | Stride step |
| [out] | elapsedTime | Elapsed time |
Perform a SWMM simulation step with a stride step and return the elapsed time.
| int EXPORT_SWMM_SOLVER_API swmm_useHotStart | ( | const char * | hotStartFile | ) |
Set hotstart file for SWMM simulation.
Set hotstart file for SWMM simulation.
Sets the hotstart file to use for simulation. Errors does not terminate simulation unless there is a prior terminating error.
| [in] | hotStartFile | Path to the hotstart file |
Set hotstart file for SWMM simulation.
| void EXPORT_SWMM_SOLVER_API swmm_writeLine | ( | const char * | line | ) |
Write a line of text to the SWMM report file.
Write a line of text to the SWMM report file.
| [in] | line | Line of text |
Write a line of text to the SWMM report file.