The Flow Control Tab

Introduction

The Flow Control tab manages the settings of the Flow Control object in your model.

The following properties are on the Flow Control tab:

Network Scan

FloWorks includes several versions of the solver that will try to simplify the flow network before before determining the flow rates. By default the mathematical optimization model includes all ports and connections of the objects connected to the flow control. It is recommended to use the last (newest) option in the dropdown, but previous versions of the solver logic are still provided for reproducability of legacy models.

Legacy mode

In legacy mode, the solver will include the entire flow network in the mathematical model. Closed ports or connections which otherwise have a maximum flow rate of zero will be included as constraints in the mathematical model. For small networks this leads to less pre-processing and therefore faster solutions, but for larger models the optimization step outweighs the reduced solver run time. It is recommended not to use this option unless you have a model built in FloWorks 2018 or earlier and you need to maintain reproducability.

Optimize network before solving

This option was introduced in FloWorks 19.0. The flow control will try to simplify the flow network before determining the flow rates. By default the mathematical optimization model includes all ports and connections of the objects connected to the flow control.

Consider the situation above, where four tanks (A) can each flow into four other tanks (B). This model has 24 connections, which means that the optimization model will be at least a 24 × 24 matrix (in reality, this can be even more because tanks can sometimes internally be considered as a sink and / or a source). You will quickly notice that most ports in the situation above are closed, which will impose many constraints on the optimization. When solving this model straight away, there are therefore many variables but also many constraints which ultimately means that the model will have few degrees of freedom. For us, as humans, it is quite easy to just observe that this network is not really that complex in reality. Taking away all the closed connections, it is equivalent to the following network:

In fact, the network can potentially be reduced to nothing more than a source connected to a sink (specifically, this happens when the maximum inflow and outflow rates of the tanks are non-constraining).

By choosing the "Optimize network before solving" option, the flow control will spend some time on trying to find such simplifications before creating the mathematical optimization model. For small networks and networks in which all port connections are used, this may lead to a slower calculation overall. However, for many networks the time taken to perform this simplification will be won back by reducing the time needed to solve the optimization problem to determine the flow rates. Examples of such networks are those with many closed connections, or situations with many 'through' paths, e.g. sequences of flow processors with one input and one output connection.

An example of a model in which attempting to optimize the flow network first will lead to a shorter overall calculation time. Essentially, the network is a flow source connected to an tank with no outputs (i.e. a flow sink) with a maximum flow rate determined by the minimum rate of the source, pump, valve, loading arm and vessel tank inflow. In this case, allowing FloWorks to spend a little bit of time reducing this network, the "optimization" problem to determine all flow rates actually becomes trivial.

Advanced scan

This option was added in FloWorks 2023. It is an improvement on the "Optimize network before solving" solver. It is recommended to enable this option unless you need to use the previous version for reproducability.

The main differences with the previous version of the solver are that the "advanced scan" optimizes the network more agressively, and that penalties on network connections are assigned after the optimization step.

Force cycle detection before solving

This option is available when the network scan mode is set to "advanced scan". In larger models, building and solving the optimization model may take a long time if the network contains large cycles. With this option disabled (the default), cycle detection will happen during the network scan. As soon as a cycle is found, the scan is aborted and restarted after the cycle has been identified. Enabling this option will spend some additional processing time before the actual network scan to detect and simplify these cycles. The option is disabled by default, because the additional calculation overhead that this causes does not outweigh the benefit for most models. However, if you have a complex network with many cycles, enabling it may improve the performance of the model.

Rounding errors

In any modern computer, floating point operations do not have infinite accuracy and at some point rounding errors will occur. These rounding errors may cause events that should fire at the same time, to occur at slightly different times. For example, consider a source filling a tank of capacity 1000. Due to a rounding error, the content of the tank may only be, for instance, 999.9999990342, even if the output of the source is exactly 1000. If you close the output of the source but keep waiting for the tank's On Full trigger your model may end up in a deadlock, or fire the tank full trigger at an unexpected time once the source re-opens.

Many of these rounding errors are handled by FloWorks behind the scenes, but in some models the default error correction may not be sufficient. That's why the Flow Control offers you different strategies for handling rounding errors detected during recalculation.

The options for this setting are described in more detail below, the following table summarizes the differences.

Setting Look for rounding errors during flow rate calculation Fire events that are within epsilon distance of their target Update underlying statistics (such as content or total flow) to the rounded amount
Ignore rounding errors No No No
Trigger events, keep original values Yes Yes No
Correct possible rounding errors, and trigger events Yes Yes Yes

Ignore rounding errors

FloWorks does not look for rounding errors. You may be waiting for an event, such as a flow amount trigger or tank full or empty event, that does not fire. Or you may expect two of these events to fire simultaneously, as in the example of the source output trigger with the tank full trigger above, where only one of them happens.

When recalculating the flow network, FloWorks tries to actively detect rounding errors. If it detects that an event is almost reached, for example the flow amount trigger or tank content is a certain fraction of a unit below its target value, it will execute the event nonetheless. The value of the underlying statistic will not be corrected. For example, when a recalculation happens on a tank with a capacity 1000 and a content of 999.9999990342, the On Full event will be fired but requesting the tank's content will still return a value of 999.9999990342.

Note that when you re-initialize a listener for the same event, it may trigger again; in the above example if you continue filling the tank then the On Full trigger may fire for a second time after a very small amount of time, when the content actually reaches 1000.

Correct possible rounding errors, and trigger events

When recalculating the flow network, FloWorks tries to actively detect and correct rounding errors. If it detects that an event is almost reached, for example the flow amount trigger or tank content is a certain fraction of a unit below its target value, it will set the underlying statistic to the 'correct' value and execute the event. For example, when a recalculation happens on a tank with a capacity 1000 and a content of 999.9999990342, the tank's content will be updated to the exact value of 1000 and subsequently the On Full event will be fired.