question

Kelvin Barbosa avatar image
0 Likes"
Kelvin Barbosa asked Mischa Spelt edited

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

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

FlexSim 24.0.1
processs flowFloWorks
5 |100000

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

Patrick Zweekhorst avatar image
0 Likes"
Patrick Zweekhorst answered Kelvin Barbosa commented

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


1727876313871.png (18.9 KiB)
· 1
5 |100000

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

Kelvin Barbosa avatar image Kelvin Barbosa commented ·

thanks patrick

0 Likes 0 ·
Mischa Spelt avatar image
0 Likes"
Mischa Spelt answered Mischa Spelt edited

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


1727882547128.png (28.8 KiB)
1727882620111.png (132.9 KiB)
1727882681337.png (4.6 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.