All Forums

GetSwmmResults

Hi,
Anyone who knows how to use the "item number" in GetSwmmResults function, please be kind enough to elaborate it using the following example.

There are 5 weirs and 2 orifices in the network and one wanted to get the flow only through the orifices.

GetSwmmResults(2, ?, 0, t, &x)

I just wanted to know how to use the 2nd number of the above function.
Thanks a lot.
Upaka

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

  • can elaborate more detail?
    • thanks a lot for your reply.

      I mean when we link the SWMM 5.0 with another software module, we have to call the results from the programming language, what we are using.

      I am using c++ to link SWMM 5.0 with NSGA II (an optimization module) to do my research work.
      In this case I have to get some results from the SWMM 5.0 to run the optimization module and the SWMM 5.0 interfacing guide has given some details, but bit confusing.

      The results calling function should be able to identify the particular item in order to get the exact result of it.

      The guide gives the following but I can't understand how to use the "item index" in a situation as described follows.

      Think there are 5 weirs and 2 orifices in a network and one wanted to get the flow rates at orifices using the above mentioned "GetSwmmResult" function.



      The guide gives;

      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 argument identifies 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.

      The choices for varIndex depend on the class of object being sought and are listed in the Output File - Reporting Variables topic of Appendix B.


      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).
        • Hello Thanks for the answer. I have a question about the inputs. When i do GetSwmmResults(2, ?, 0, t, &x), what does the &x do. 

          Also when i call the GetSwmmResult where can i find the value of a result? 

          Thanks

          • 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 argument identifies 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. 

            //-------------------------------------
            // 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

            For example, Node Flooding would be variable 5 as described here http://swmm2000.com/profiles/blogs/calling-nth-pollutant-from

This reply was deleted.