question

Carmen F avatar image
0 Likes"
Carmen F asked Felix Möhlmann answered

Update objects in financial analysis

Hello, I need help modifying the objects considered in the financial analysis graph, which are trucks (Camiones) in my real model. I've attached an example with the problem to be solved.

Basically, in my model, I use a parameter (Camiones_XL) to define the number of active trucks to be considered during the simulation, and I have a trigger On Model Reset that updates the members of the active truck group ("Group_Camiones_XL") by taking resources from the "Group_Camiones_XL_MAX" group, which contains the maximum number of trucks. (I do this because I need a model which could be used without a license)

My problem is that the objects in the financial analysis graph aren't updated based on the active trucks group. Unfortunately, the "sampler" doesn't run for groups, and I'm not sure if it's recommended to destroy and create new nodes through the model tree.

Could someone explain me how to solve this?

Thanks in advance.objectfinancialanalysischart-dummy.jpg

FlexSim 25.0.3
selected objectstree nodefinancial analysis
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered

You can often times find useful information by 'exploring' GUI elements.

1745583088915.png

It takes a bit of experience, but you can find out what code is executed when certain GUI elements are pressed and then just use that code yourself.

In this case, we can find that there is a "function_s"-call to add objects to the chart. The "focus" here is the chart object.

1745583198034.png

At to remove objects, the code also just deletes the link-nodes from the chart's tree.

1745583293173.png

In both cases the code also calls "onchangeobjectset" on the class object. I don't know if that is important to do but probably can't hurt to do as well.

So in summary:

Object chart = Model.find("Tools/Statistics/Financial Analysis");
Object te = ...; // Adding function_s(chart, "addMember", te); function_s(classobject(chart), "onchangeobjectset", chart); // Removing treenode objects = getvarnode(chart, "objects"); for(int i = 1; i <= objects.subnodes.length; i++) {     if(ownerobject(objects.subnodes[i].value) == te) {         objects.subnodes[i].destroy();         break;     } }

1745583088915.png (25.1 KiB)
1745583198034.png (44.8 KiB)
1745583293173.png (36.4 KiB)
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.