All Forums

"GetSwmmResults" function

Hi,
I am bit confused on calling the results of the SWWM using the above function. 
Interfacing guide explains it as follows; but I guess I am confusing specially shown at bold-italic letters.
If anyone knows how to call the results using the above function please be kind enough to explain me using an example.

Thanks alot.
Upaka



The function GetSingleResult, which is included in the example code files that accompany this guide, demonstrates the
code needed to retrieve the computed result for a particular variable for a
given object at a specific point in time. The arguments to the function are:


itemType
the class of item being sought (input)
itemIndex
the index of the item being sought (input)
varIndex
the index of the variable being sought (input)
period
the index of the time period being sought, starting from 1(input)
value
the value of the result being sought (output).


The function returns a value of 1 if it was successful or a value of 0 if was not.

The choices for
itemType can be:

·0 for Subcatchments,  
·1 for Nodes  
·2 for Links  
·3 for System  

The
itemIndex argumentidentifies items of a given class that are reported on by consecutive numbers
starting from 0, which are assigned in the same order as the item appeared in
the SWMM 5 input file. As an example, suppose that a system contains 5 junction
nodes with ID names J1, J2, J3, J4, and J5 that are listed in this same order in
the project's input file, but output results are only requested for junctions J2
and J4.
Then an
itemIndex of 0
would retrieve results for J2 while an
itemIndex of 1 would
do the same for J4.
Any other values for
itemIndex would be
invalid. For System items the
itemIndex argument
is ignored. 

You need to be a member of SWMM 5 or SWMM or EPASWMM - (not formally associated with EPA) to add comments!

Join SWMM 5 or SWMM or EPASWMM - (not formally associated with EPA)

Email me when people reply –

Replies

  • Hi,
    Thanks for the replies.

    I am using Microsoft Visual C++ 6.0 to get the results (I mean linking SWMM to another software and to call the results) using C++. (I have downloaded the SWMM5.0 interfacing guide from the EPA web site)

    Think I should explain more the problem what I have.

    Let us assume there are 5 weirs and 2 orifices at one problem and I wanna get the flow rate through the weirs.

    Is the following coding in c++ correct?

    OpenSwmmOutFile("f3.out");

    GetSwmmResults(2, 1, 0, t, A);

    GetSwmmResults(2, 2, 0, t, B);

    GetSwmmResults(2, 3, 0, t, C);

    GetSwmmResults(2, 4, 0, t, D);

    GetSwmmResults(2, 5, 0, t, E);

    CloseSwmmOutFile();

    In this case I am not sure how I can use the "itemIndex" which is the second number. Since both weirs and orifices are under the category of links it is bit confusing.

    Thanks alot.
    • I found the answer for my own question and would like paste it here if anyone needs it in future.


      When results for all links are saved, then the ItemIndex is the order
      (starting from 0) in which the Link is first defined in the input file.
      For example, suppose your input file looked as follows:

      [CONDUITS]
      A
      B
      C

      [WEIRS]
      W1
      W2

      ]PUMPS]
      P1
      P2

      [ORIFICES]
      O-A
      O-B

      Then the ItemIndex for weir W1 would be 3 while that for orifice O-B is
      8.

      If in the [REPORT] section you specify that results are only saved for
      weir W1 and orifices O-A and O-B, then the item index of W1 is 0 and
      that of O-B is 2 (even if you listed them as O-B, W1, and O-A in the
      [REPORT] section, since the numbering is still relative to their
      position where they are first defined in the input file).
  • This the help file and Pascal code for the SWMM 5 Interfacing Guide
  • There is a feature in SWMM 5 that allows you to either save ALL of the junction information or only a portion of the junction information. If you just save two junctions then you can only retrieve the values from two junctions.
    • Can you please explain this particular feature on saving portion of the junction information?
      Thanks
  • Hi, Are you getting this code from the Delphi code of SWMM 5?
This reply was deleted.