Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add surfaceArea to node parameters #118

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/node.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ double node_getVolume(int j, double d)

default:
if ( Node[j].fullDepth > 0.0 )
return Node[j].fullVolume * (d / Node[j].fullDepth);
return Node[j].surfaceArea * d;
else return 0.0;
}
}
Expand All @@ -381,7 +381,7 @@ double node_getSurfArea(int j, double d)
switch (Node[j].type)
{
case STORAGE: return storage_getSurfArea(j, d);
default: return 0.0;
default: return Node[j].surfaceArea;
}
}

Expand Down
1 change: 1 addition & 0 deletions src/objects.h
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ typedef struct
double fullDepth; // dist. from invert to surface (ft)
double surDepth; // added depth under surcharge (ft)
double pondedArea; // area filled by ponded water (ft2)
double surfaceArea; // area used to calculate node's volume (ft2)
TExtInflow* extInflow; // pointer to external inflow data
TDwfInflow* dwfInflow; // pointer to dry weather flow inflow data
TRdiiInflow* rdiiInflow; // pointer to RDII inflow data
Expand Down
9 changes: 8 additions & 1 deletion src/toolkitAPI.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,8 @@ int DLLEXPORT swmm_getNodeParam(int index, int Param, double *value)
case 3: *value = Node[index].pondedArea * UCF(LENGTH) * UCF(LENGTH); break;
// initDepth
case 4: *value = Node[index].initDepth * UCF(LENGTH); break;
// surfaceArea
case 5: *value = Node[index].surfaceArea * UCF(LENGTH) * UCF(LENGTH); break;
// Type not available
default: return(ERR_API_OUTBOUNDS);
}
Expand Down Expand Up @@ -404,6 +406,11 @@ int DLLEXPORT swmm_setNodeParam(int index, int Param, double value)
case 3: Node[index].pondedArea = value / ( UCF(LENGTH) * UCF(LENGTH) ); break;
// initDepth
case 4: Node[index].initDepth = value / UCF(LENGTH); break;
// surfaceArea
case 5:
Node[index].surfaceArea = value / UCF(LENGTH) * UCF(LENGTH);
Node[index].fullVolume = node_getVolume(index, Node[index].fullDepth);
break;
// Type not available
default: return(ERR_API_OUTBOUNDS);
}
Expand Down Expand Up @@ -1232,4 +1239,4 @@ int DLLEXPORT swmm_setOutfallStage(int index, double stage)
Outfall[k].outfallStage = stage / UCF(LENGTH);
}
return(errcode);
}
}