How to add a volume variable to SWMM 5
The purpose of this email is to explain how to add another print variable to the DOS version of SWMM 5 so that it can saved in a table in the text output file (after you recompile the modified C code). The changes have no impact on the SWMM 5 GUI or the SWMM 5 DLL engine.
It is relatively simple five step procedure:
Step 1: Add a new variable LINK_VOLUME at the end of the link variables in enums.h This is much easier if you just add a report variable that already is part of the link or node structure in objects.h Your only restriction is that is should be added before the water quality variables.
// increase by 1 the value of Max Results in enums.h
#define MAX_LINK_RESULTS 7
LINK_FLOW, // flow rate
LINK_DEPTH, // flow depth
LINK_VELOCITY, // flow velocity
LINK_FROUDE, // Froude number
LINK_CAPACITY, // ratio of depth to full depth
LINK_VOLUME, // current volume of the conduit - august 2007
LINK_QUAL}; // concentration of each pollutant
k = LINK_VOLUME;
fwrite(&k, sizeof(int), 1, Fout.file);
for (j=0; j<nPolluts; j++)
Step 3: Save the link new volume to the binary output file in procedure link_get_results in link.c. The new volume of the link has already been saved in the already existing variable newVolume in the Link Structure.
x[LINK_CAPACITY] = (float)c;
x[LINK_VOLUME] = (float)Link[j].newVolume;
Step 4. Modify report.c to include the new report variable in procedure report_links
fprintf(Frpt.file, "\n %11s %8s %9.3f %9.3f %9.3f %9.1f %9.1f", theDate, theTime, LinkResults[LINK_FLOW], LinkResults[LINK_VELOCITY], LinkResults[LINK_DEPTH] LinkResults[LINK_CAPACITY]* 100.0,LinkResults[LINK_VOLUME]);
"\n Flow Velocity Depth Percent Volume");