FloWorks: How to record the current content of a group of tanks in floworks

FloWorks: How to record the current content of a group of tanks in floworks

Kelvin_Barbosa
Not applicable
13 Views
3 Replies
Message 1 of 4

FloWorks: How to record the current content of a group of tanks in floworks

Kelvin_Barbosa
Not applicable

[ FlexSim 24.0.1 ]

reference tank group.fsmHi,

I'm trying to collect the statistics of the current content of a group of tanks using 1 token.

I did the following test using processflow: I created a token at time 0 with two assign labels referencing the group of tanks and tried to record the current content, but it didn't work.

Thank you for your support in advance

0 Likes
Accepted solutions (1)
14 Views
3 Replies
Replies (3)
Message 2 of 4

patrick_zweekhorst
Advocate
Advocate
Accepted solution

If you want to get the content of a tank you need to cast the Object to a FlowTank (something like: token.Tank.as( FlowTank ).content.)

But since you are looking at a group I think you will need a short for loop or run subflow to get the content of all tanks. I would change the assign labels to something like:


1727876313871.png


Object current = param(1);
treenode activity = param(2);
Token token = param(3);
Variant assignTo = param(4);
string labelName = param(5);
treenode processFlow = ownerobject(activity);

Group tanks = token.lb_Tank;
double content = 0;
for( int i = 1; i <= tanks.length; i++ )
{
content += tanks[ i ].as( FlowTank ).content;
}

return content;


Hope this helps

0 Likes
Message 3 of 4

Kelvin_Barbosa
Not applicable

thanks patrick

0 Likes
Message 4 of 4

mischa_spelt
Advisor
Advisor

Just to add to @Patrick Zweekhorst 's answer: in the Dashboard library there is also an chart template "Group Content" that will group multiple tanks (default: by product) and display the content as a line chart vs time, or the current value in a bar chart or table.


1727882547128.png



1727882620111.png


If you want you can click "View Table" in the Advanced section of the chart properties to access the data, or "Install" the chart template to see how we did it.

1727882681337.png

0 Likes