PDA

View Full Version : Object order in the summary report


AlanZhang
10-16-2007, 09:44 AM
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

AlanZhang
10-16-2007, 11:11 AM
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

AJ Bobo
10-16-2007, 11:17 AM
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.

AlanZhang
10-16-2007, 05:42 PM
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:

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),tonu m(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);
}

AlanZhang
10-16-2007, 05:50 PM
Similar for State Report. Just replace the code in MAIN:/project/exec/globals/nodefunctions/statereport with the following 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),tonu m(classlist))){
for(int j=0;j<parentptrs.size();j++){
fpt(getname(parentptrs[j]));fpt("\\");
}
nodefunction(reportobjectfunc,tonum(curptr),showpe rcents);
}
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);
}