question

Ville Teivastenaho avatar image
0 Likes"
Ville Teivastenaho asked Ville Teivastenaho commented

FloWorks: FlowTank initial content from a global table

Hi,

Attached there is a image from a very simple model where I try to set the initial content for a FlowTank based on a global table. When setting value using Set flow content, content is updated as expected but the flow state of the tank stays as "Empty" because Initial Cont. for the tank's 3D object is set to 0. Setting this "Initial Cont." parameter directly from the table doesn't seem to be possible either.

So is there a way to set initial content in a way that would also update the state automatically, or is the best solution to just manually set the initial state at the same time when setting the content?1667209332396.png

FlexSim 22.0.1
FloWorksstatesflowtanks
1667209332396.png (215.2 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.

Joerg Vogel avatar image Joerg Vogel commented ·
Please let your model run. Then stop your model run. Then check the statistic again. Any change of parameter needs a run of model to reflect any change!
0 Likes 0 ·

1 Answer

Patrick Zweekhorst avatar image
0 Likes"
Patrick Zweekhorst answered Ville Teivastenaho commented

Hi @Ville Teivastenaho ,

You can set the initial content of a tank in your global OnModelReset trigger in the toolbox. The code you would use is something like this:

FlowTank tank = Model.find("Cylindric1");
double startContent = 100; //Read from global table
tank.setProperty( "InitialContent", startContent );

The reason just setting the content in processFlow does not work is because there is no change in flow happening because of your change. Currently only when flow rates change the status is updated. This could be something to change in a new version. I have put this on the dev list.

If you don't want the OnModelReset code you could also set the state of the tank yourself in the processFlow.

Good luck!

Patrick

· 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.

Ville Teivastenaho avatar image Ville Teivastenaho commented ·

Thank you! I thought it must somehow be related to when the states are updated. I don't see this as a problem, it just something to keep in mind if you need to manually change content somewhere else than in OnModelReset.

For some reason I couldn’t get tank.setProperty to work in this case, but managed to do same thing with:

setvarnum(tank, "initialcontent", startContent)
0 Likes 0 ·