Hi,
I am now working with SWMM engine in C++.. I want to get all routed pollutant in my network to be written in file or shown on the screen..For, that reason, I am a bit confused in using the syntax explained in SWMM5 interfacing guide as shown below.
· Number of node variables (currently 6 + number of pollutants)
· Code number of each node variable:
0 for depth of water above invert (ft or m),
1 for hydraulic head (ft or m),
2 for volume of stored + ponded water (ft3 or m3),
3 for lateral inflow (flow units),
4 for total inflow (lateral + upstream) (flow units),
5 for flow lost to flooding (flow units),
6 for concentration of first pollutant,
...
5 + N for concentration of N-th pollutant.
let say, I have this following code
GetSwmmResult(1, j-1, 6, i, &z);
the syntax above shows that my code is working on node which start from 0-j..this moment, I only have the first routed pollutant called through varIndex=6..
Can somebody help me to get the second and third pollutants?
You need to be a member of SWMM 5 or SWMM or EPASWMM and SWMM5 in ICM_SWMM to add comments!
Comments
static const int SUBCATCH = 0;
static const int NODE = 1;
static const int LINK = 2;
static const int SYS = 3;
//-------------------------------------
// Computed subcatchment quantities
//-------------------------------------
#define MAX_SUBCATCH_RESULTS 7
enum SubcatchResultType {
SUBCATCH_RAINFALL, // rainfall intensity
SUBCATCH_SNOWDEPTH, // snow depth
SUBCATCH_LOSSES, // total losses (evap + infil)
SUBCATCH_RUNOFF, // runoff flow rate
SUBCATCH_GW_FLOW, // groundwater flow rate to node
SUBCATCH_GW_ELEV, // elevation of saturated gw table
SUBCATCH_WASHOFF}; // pollutant washoff concentration
//-------------------------------------
// Computed node quantities
//-------------------------------------
#define MAX_NODE_RESULTS 7
enum NodeResultType {
NODE_DEPTH, // water depth above invert
NODE_HEAD, // hydraulic head
NODE_VOLUME, // volume stored & ponded
NODE_LATFLOW, // lateral inflow rate
NODE_INFLOW, // total inflow rate
NODE_OVERFLOW, // overflow rate
NODE_QUAL}; // concentration of each pollutant
//-------------------------------------
// Computed link quantities
//-------------------------------------
#define MAX_LINK_RESULTS 6
enum LinkResultType {
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_QUAL}; // concentration of each pollutant
So in your call you should have the following:
GetSwmmResult(1, j-1, 6, i, &z) 1st Pollutant
GetSwmmResult(1, j-1, 7, i, &z) 2nd Pollutant
GetSwmmResult(1, j-1, 8, i, &z) 3rd Pollutant
printf("\nTime Total Total Total");
printf("\nPeriod Rainfall Runoff Outflow");
printf("\n====================================");
for (i=1; i<=SWMM_Nperiods; i++)
{
GetSwmmResult(3, 0, 1, i, &x);
GetSwmmResult(3, 0, 4, i, &y);
GetSwmmResult(3, 0, 11, i, &z);
printf("\n%6d %8.2f %8.2f %8.2f", i, x, y, z);
fprintf(Frpt.file, "\n %11s %8s %9.3f %9.3f %9.3f %9.1f", //(5.0.010 - LR)
theDate, theTime, LinkResults[LINK_FLOW],
LinkResults[LINK_VELOCITY], LinkResults[LINK_DEPTH],
LinkResults[LINK_CAPACITY]*100.0);
for (p = 0; p < Nobjects[POLLUT]; p++)
fprintf(Frpt.file, " %9.3f", LinkResults[LINK_QUAL + p]);
or for Nodes
fprintf(Frpt.file, "\n %11s %8s %9.3f %9.3f %9.3f %9.3f %9.3f %9.3f %9.3f %9.3f %9.3f %9.3f %9.3f %9.3f", //(5.0.022 - RED)
theDate, theTime, NodeResults[NODE_INFLOW],
NodeResults[NODE_OVERFLOW], NodeResults[NODE_DEPTH],
NodeResults[NODE_HEAD], //(5.0.022 - RED)
NodeResults[NODE_VOLUME], //(5.0.022 - RED)
NodeResults[NODE_LATFLOW], //(5.0.022 - RED)
NodeResults[NODE_CE], //(5.0.022 - RED)
NodeResults[NODE_AREA], //(5.0.022 - RED)
NodeResults[NODE_DQDH], //(5.0.022 - RED)
NodeResults[NODE_ITERATIONS], //(5.0.022 - RED)
NodeResults[NODE_TIMESTEP], //(5.0.022 - RED)
NodeResults[NODE_CONVERGENCE]); //(5.0.022 - RED)
for (p = 0; p < Nobjects[POLLUT]; p++)
fprintf(Frpt.file, " %9.3f", NodeResults[NODE_QUAL + p]);