I admit I started learning C++ only to get this to work so my apologies if the solution is trivial.

I have compiled the test file for the SWMM5 interfacing functions and  currently have it printing flow information from my model to individual csv files that represent each link in the system. 

Right now, the individual csv files are identified by the "itemindex" attribute that I use when calling the GetSwmmResult function. However I would prefer to have them named by the link ID names. From the interfacing guide I understand that the object ID names are stored in the binary output file following the "opening records" section. But that is about as far I have gotten. As far as I can tell, swmm5_iface.cpp  skips over that section of the binary entirely.

If someone can point me in the right direction that would be great. Let me know what kind of additional information I should post as well.

Thanks

You need to be a member of SWMM 5 or SWMM or EPASWMM and SWMM5 in ICM_SWMM to add comments!

Join SWMM 5 or SWMM or EPASWMM and SWMM5 in ICM_SWMM

Email me when people reply –

Replies

  • Thank you Bob. That pointed me in the right direction and I got it working.

  • This is how the headers are written at the top of the binary file,  I hope this is enough for you to read  the ID's

    fseek(Fout.file, 0, SEEK_SET);
    k = MAGICNUMBER;
    fwrite(&k, sizeof(INT4), 1, Fout.file); // Magic number
    k = VERSION;
    fwrite(&k, sizeof(INT4), 1, Fout.file); // Version number
    k = FlowUnits;
    fwrite(&k, sizeof(INT4), 1, Fout.file); // Flow units
    k = NumSubcatch; //(5.0.014 - LR)
    fwrite(&k, sizeof(INT4), 1, Fout.file); // # subcatchments
    k = NumNodes; //(5.0.014 - LR)
    fwrite(&k, sizeof(INT4), 1, Fout.file); // # nodes
    k = NumLinks; //(5.0.014 - LR)
    fwrite(&k, sizeof(INT4), 1, Fout.file); // # links
    k = Nobjects[POLLUT];
    fwrite(&k, sizeof(INT4), 1, Fout.file); // # pollutants

    // --- save ID names of subcatchments, nodes, links, & pollutants //(5.0.014 - LR)
    IDStartPos = ftell(Fout.file);
    for (j=0; j<Nobjects[SUBCATCH]; j++)
    {
    if ( Subcatch[j].rptFlag ) output_saveID(Subcatch[j].ID, Fout.file);
    }
    for (j=0; j<Nobjects[NODE]; j++)
    {
    if ( Node[j].rptFlag ) output_saveID(Node[j].ID, Fout.file);
    }
    for (j=0; j<Nobjects[LINK]; j++)
    {
    if ( Link[j].rptFlag ) output_saveID(Link[j].ID, Fout.file);
    }
    for (j=0; j<Nobjects[POLLUT]; j++) output_saveID(Pollut[j].ID, Fout.file);

This reply was deleted.