Update objects in financial analysis

Update objects in financial analysis

carmen_fernandez7YE4Y
Participant Participant
378 Views
4 Replies
Message 1 of 5

Update objects in financial analysis

carmen_fernandez7YE4Y
Participant
Participant

[ FlexSim 25.0.3 ]

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

0 Likes
Accepted solutions (1)
379 Views
4 Replies
Replies (4)
Message 2 of 5

moehlmann_fe
Advocate
Advocate
Accepted solution

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.value) == te) {         objects.subnodes.destroy();         break;     } }
0 Likes
Message 3 of 5

carmen_fernandez7YE4Y
Participant
Participant

This is a new world for me, but I think it's time to jump in and keep moving forward 😉  I've modified the trigger with the fuctions you mentioned and it works! Thank you so much for your help.

0 Likes
Message 4 of 5

afonsorios_viana
Participant
Participant

Do you know how to do the same but for a distance traveled chart, for example? I tried to use the same logic by exploring the structure and using the commands there, but it isn't working. 

0 Likes
Message 5 of 5

moehlmann_fe
Advocate
Advocate

The travel distance chart stores the attached objects in a group. Adding task executers to that group will make them appear in the chart after the next model reset.

moehlmann_fe_1-1755498479288.png

 

Group objects = Model.find("Tools/ChartTemplates/Travel Distance>stats/primaryGroup/primaryGroup");
objects.addMember(Model.find("Operator1"));

 

To track transient objects (TE's that are created and destroyed during the model run) you can use a custom Statistics Collector instead.