What’s new in AnyLogic 7.3? Fluid library Orientation, Part 1

Striving to bring you increased capabilities and features, AnyLogic continues to broaden vertical solutions inside the product. AnyLogic 7.3 brings enhanced Fluid Library and new Road Traffic Library. In this post, I will highlight Fluid library, its functionality, and main features, with a brief walkthrough. The Fluid Library has been already used in real projects that prove its efficiency. It is Modeling and Optimization of Wells Scheduling for In Situ Oil Sands Production model, developed by Stream System. The simulation challenge was presented at AnyLogic Conference 2015.

This post should help answer the following question: why and when I should use the Fluid library instead of Process Modeling library (and sometimes instead of System Dynamics).

Overview

The Fluid library fills the gap between the continuous base of certain production areas (bulk and fluid materials, from a chocolate factory to oil production and sand transportation), and discrete basis of Process Modeling Library. Modeler has to split the difference and simulate the flows with discrete agents. Such approach has relatively sensitive shortcomings: no built-in animation for pipes, additional logic constructs, hardcoded discretization, etc.


Block and markup shapes of Fluid library

Surely, system dynamics diagrams have continuous basis as well, but the language of system dynamics is not convenient for simulation of manufacturing, as it has higher abstraction level. It would be difficult to imitate the mix of various materials, using stocks and flows from system dynamics.

Also, System Dynamics uses a numeric solver that can deal with non-linear behavior but loses to linear solver in speed and accuracy. Fluid and bulk flows have linear behavior, so the Fluid library provides better conceptualization and performance in comparison to System Dynamics.

So, Fluid Library merges process-centric approach with continuity of the processes in this area. As well as Process modeling and other libraries, it has functional blocks, and their sequence forms a flowchart: Fluid Source generates batches of materials, Pipeline or Conveyor transports the batches to different Tanks that stores and process the materials. The valve controls the throughput, while Fluid Select Out and Input blocks manage the flow route, and Fluid Split and Merge can divide and join the flows. Fluid Convert allows amplifying or shrinkage of the output, simulating the unpacking/packing process.


Animation of pipeline with different bathes — certain amount of one material flowing inside. Batches never mix, but one batch can become another batch (or completely new batch)


Flowchart has built in animation. Like in Process Modeling library, orange port indicates that it is closed: flow has 0 rate. Different colors show that flow consists on different materials.

As well as any other AnyLogic 7 library, Fluid library has its own markup shapes that are used to create 2D and 3D animation. Storage Tank and Pipe markup shapes animate Tanks and Pipes respectively. They are used for animation purposes only and does not affect at flowchart work at all. Bulk Conveyor Belt shape animates Bulk Conveyor block, and by default, it does not affect flowchart work as well. The modeler may link Bulk Conveyor length to the length of markup shape if required.

Features of fluid Flowchart

The flowchart of the Fluid library does not use agents, but numbers, which may be added to the respective part of the material flow. In simplest case flow is generated by Source block that acts like a water tap. The congeneric flow of materials is called batch. It should not be confused with batch from Process Modeling library (that is an agent-container that stores other agents). Fluid batch is not an agent, it is just a certain amount of material, continuously distributed in the chain of flowchart blocks.

Batches are distinguished according to their reference. It can be any object, usually they are named with a String name. Each batch has its own color, so it is easy to distinguish batches visually by looking at the flowchart and model animation at the same time.

So, blocks of fluid library can detect rate change, batch change, and other specific changes (e.g., Tank has On full, On empty and On certain amount actions). Modeler can execute code when the respective event occurs (or condition is met). These code fields are analogs of Process Modeling regular actions, like On Enter, On Exit, etc.


Properties of Fluid Source block from Chocolate Production example

To sum things up, the flowchart behaves like a network of tanks and pipelines with non-obvious features. For instance, in Process Modeling library you can connect output ports of two Delay blocks to one input port of the Queue block. In the fluid library, one output port can be connected to one input port only; otherwise, it is not clear how flows from different parts of the network can be split. Some blocks, like Fluid Merge, Fluid Select Input, and Mix Tank, have several input ports, allowing to manipulate the flows.


Flowchart of fluid library does not allow to have many-to-one connections.

So, it is not possible to connect, for instance, Delay with Pipeline directly. Four blocks integrate the Fluid library with the Process Modeling library: Fluid To Agent, Agent to Fluid, Fluid Pickup, and Fluid Dropoff. The first block creates an agent from the certain amount of materials (acting like Source block). Similarly, the second block generates the required amount of material from one agent (acting like Fluid Source block).


Combination of Fluid and Process Modeling libraries with Agent to Fluid and Fluid To Agent blocks


Combination of Fluid and Process Modeling libraries with Agent to Fluid and Fluid To Agent blocks

Fluid Pick Up acts like a regular Pick Up block, but takes material from the flowchart of the Fluid library (acting like Fluid Dispose block). Similarly, the Fluid Drop Off block generates a certain amount of material as the agent enters (acting like Fluid Source block). The transition rate of Fluid Drop Off blocks can be specified directly, while the rate of Fluid Pick Up block is calculated automatically, according to the rate of the flowchart.

Examples for learning

Four example models that use Fluid Library as the basis: Chocolate Production, Crude Oil Pipeline Network, Gas Station and Grain Terminal. It is simple to find the models using a new feature of AnyLogic 7.3 — search among example models. It searches for the model names, descriptions, and tags (press Ctrl + Space to show a list of tags). With Fluid library tag you can find the models above. Also, 16 simple how-to models that illustrate features of each block respectively.

In the next post, we will make a walkthrough of Chocolate Production and Gas station example models, covering use cases and features of most Fluid Library blocks. You will learn how to create complex flowcharts with 2D and 3D animation. Stay tuned!