ATTENTION

This FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices.


flexsim.com

Go Back   FlexSim Community Forum > FlexSim Software > Q&A
Downloads

Q&A Using Flexsim and building models

  #1  
Old 10-16-2007
AlanZhang's Avatar
AlanZhang AlanZhang is offline
Flexsim Super Moderator
 
Join Date: Aug 2007
Location: CA
Posts: 289
Downloads: 64
Uploads: 0
Thanks: 88
Thanked 91 Times in 47 Posts
Rep Power: 225
AlanZhang is a jewel in the roughAlanZhang is a jewel in the roughAlanZhang is a jewel in the rough
Post Object order in the summary report

Is that true the object order in the generated Flexsim Summary Report is the same as that in the Flexsim tree? I have a model in which I put objects in visual tools and each visual tool is a standard module having similar components. The similar component in different visual tools will have the same name. When I generate summary report, under the Object column, only object name is listed, but the path of the object is missing. Thus, I cannot tell which object is under which visual tool. I guess the order under the Object column would be the same as you see in the Flexsim tree. But I would like to confirm this.

And I also suggest the Summary Report should include the object path starting from the model root. Can this be put into version 4.1 release?

Thanks.

Alan
  #2  
Old 10-16-2007
AlanZhang's Avatar
AlanZhang AlanZhang is offline
Flexsim Super Moderator
 
Join Date: Aug 2007
Location: CA
Posts: 289
Downloads: 64
Uploads: 0
Thanks: 88
Thanked 91 Times in 47 Posts
Rep Power: 225
AlanZhang is a jewel in the roughAlanZhang is a jewel in the roughAlanZhang is a jewel in the rough
Default

Guess I can answer the question myself. By checking the code under MAIN:/project/exec/globals/nodefunctions/summaryreport, it seems the object order in the Flexsim tree is maintained in the output. It is also possible to output the full path of the object by changing code there. I will post my code once I finish it.

Alan
  #3  
Old 10-16-2007
AJ Bobo's Avatar
AJ Bobo AJ Bobo is offline
Flexsim Senior Developer
 
Join Date: Jul 2007
Posts: 108
Downloads: 8
Uploads: 0
Thanks: 23
Thanked 89 Times in 41 Posts
Rep Power: 221
AJ Bobo is a jewel in the roughAJ Bobo is a jewel in the roughAJ Bobo is a jewel in the roughAJ Bobo is a jewel in the rough
Default Summary Report object order

You are correct. The order in the Summary Report is the order of the objects in the tree. Showing the path would be a good idea. I'll talk to Anthony about adding that in a future release.

It's also worth pointing out that if you enable Full History and generate a Full Report you can include the Summary Report in the Full Report. When the Full Report is opened in Flexsim Chart the objects' paths will be displayed, not just their names.
  #4  
Old 10-16-2007
AlanZhang's Avatar
AlanZhang AlanZhang is offline
Flexsim Super Moderator
 
Join Date: Aug 2007
Location: CA
Posts: 289
Downloads: 64
Uploads: 0
Thanks: 88
Thanked 91 Times in 47 Posts
Rep Power: 225
AlanZhang is a jewel in the roughAlanZhang is a jewel in the roughAlanZhang is a jewel in the rough
Default

It turns out that including the full path for the object name is not so hard. Just replace the code in the MAIN:/project/exec/globals/nodefunctions/summaryreport with the following code. The changed code is marked as the red text. You need to compile the model after you replace the code. You may also need to create a global C++ code and include one line:
#include <vector>

Code to be placed in MAIN:/project/exec/globals/nodefunctions/summaryreport:
Code:
fsnode *nodes = node("/Tools/Charting/summaryreport",model()); // Point to the names of the nodes that will be in the report
fsnode *classinreportfunc = node("MAIN:/project/exec/globals/nodefunctions/classinlist");
fsnode *reportobjectfunc = node("MAIN:/project/exec/globals/nodefunctions/summaryreportobject");
fsnode *classlist = node("MAIN:/project/model/Tools/Charting/classlist");
fpt("Flexsim Summary Report"); fpr();
fpt("Time:,"); fpf(time()); fpr();
fpr();
// Print the column headers
fpt("Object,Class"); 
for (int index = 1; index <= content(nodes); index++)
{
  fpt(","); fpt(getname(rank(nodes,index)));
}
fpr();
// For all objects in the model, print the correct data
fsnode *curptr = rank(model(),2);
vector<treenode> parentptrs;
while (objectexists(curptr))
{
    if (nodefunction(classinreportfunc,tonum(curptr),tonum(classlist))){
        for(int j=0;j<parentptrs.size();j++){
            fpt(getname(parentptrs[j]));fpt("\\");
        }
        nodefunction(reportobjectfunc,tonum(curptr));
    }
    if (content(curptr) > 0){
        parentptrs.push_back(curptr);
        curptr = first(curptr);
    }
    else if (getrank(curptr) == content(up(curptr))) // If the object is last in the list, go back up
    {
        while (getrank(curptr) == content(up(curptr))){ // Move up until the object is not last
            parentptrs.pop_back();
            curptr = up(curptr);
        }
        if (curptr != model()) // Move to the next object in the list above the last-used object
            curptr = next(curptr);
        else // Stop when the object makes it up to model()
            curptr = NULL;
    }
    else // Move to the next object in the list
        curptr = next(curptr);
}
  #5  
Old 10-16-2007
AlanZhang's Avatar
AlanZhang AlanZhang is offline
Flexsim Super Moderator
 
Join Date: Aug 2007
Location: CA
Posts: 289
Downloads: 64
Uploads: 0
Thanks: 88
Thanked 91 Times in 47 Posts
Rep Power: 225
AlanZhang is a jewel in the roughAlanZhang is a jewel in the roughAlanZhang is a jewel in the rough
Default

Similar for State Report. Just replace the code in MAIN:/project/exec/globals/nodefunctions/statereport with the following code.

Code:
fsnode *nodes = node("/Tools/Charting/statereport/statelist",model()); // Point to the names of the nodes that will be in the report
int showpercents = get(prev(nodes));
fsnode *classinreportfunc = node("MAIN:/project/exec/globals/nodefunctions/classinlist");
fsnode *reportobjectfunc = node("MAIN:/project/exec/globals/nodefunctions/statereportobject");
fsnode *classlist = node("MAIN:/project/model/Tools/Charting/classlist");
fpt("Flexsim State Report"); fpr();
fpt("Time:,"); fpf(time()); fpr();
fpr();
// Print the column headers
fpt("Object,Class"); 
for (int index = 1; index <= content(nodes); index++)
{
  fpt(","); fpt(getname(rank(nodes,index)));
}
fpr();
// For all objects in the model, print the correct data
fsnode *curptr = rank(model(),2);
vector<treenode> parentptrs;    // vector to hold all parents vectors
while (objectexists(curptr))
{
    if (nodefunction(classinreportfunc,tonum(curptr),tonum(classlist))){
        for(int j=0;j<parentptrs.size();j++){
            fpt(getname(parentptrs[j]));fpt("\\");
        }
        nodefunction(reportobjectfunc,tonum(curptr),showpercents);
    }
    if (content(curptr) > 0){
        parentptrs.push_back(curptr);
        curptr = first(curptr);
    }
    else if (getrank(curptr) == content(up(curptr))) // If the object is last in the list, go back up
    {
        while (getrank(curptr) == content(up(curptr))){ // Move up until the object is not last
            parentptrs.pop_back();
            curptr = up(curptr);
        }
        if (curptr != model()) // Move to the next object in the list above the last-used object
            curptr = next(curptr);
        else // Stop when the object makes it up to model()
            curptr = NULL;
    }
    else // Move to the next object in the list
        curptr = next(curptr);
}



All times are GMT -6.
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.