Fluid Library Orientation Part 4 - Advanced Features and Hints

Previous posts on Fluid Library proved that it is a useful tool for modeling objects, containing liquids and friable materials. Today I will tell you about advanced features of the library and I hope they will help you explore AnyLogic and improve your skills. Enjoy reading!

At the gas station walkthrough, you may have noticed that the flowchart contained two custom blocks, Split4 and Dispenser. This allowed for the creation of more intuitive and clearer charts by implementing the missing functionality and encapsulating a single logical part inside one block. You can create Split6 or Split8, SelectOutput4, and other similar blocks for further reuse in any models.


SelectOutput block example

Another interesting application of the Fluid Library is that it collects the time that an agent spends in a certain state. If the flow rate is equal to 1, and goes into a tank with infinite capacity, then the actual tank volume shows the model time (make sure that units are consistent). Enter and Exit actions of the state open and close valves, so the tank precisely reflects time that an agent spends in the state.

Previously, you had to create discrete counters or use a simple flow or a stock system diagram. Discrete counters are effective in terms of performance, but you have to create a logical structure that will calculate enter/exit time differences for each state, and increase the respective counter. System dynamics solution is simpler, but dramatically drains performance, making it inapplicable in models with hundreds of agents.

Fluid Library does not use solver, so its calculations are very fast, and performance is rather close to the performance of discrete calculations.

It was the last post on how to use Fluid Library and when it might be helpful. I hope you enjoyed Fluid Library and its capabilities! If you have any questions, feel free to ask.;)