Multiple Flow Providers are designed to handle process units with several connected input or output streams. Both provider types inherit their common functionality from
AbstractFlowsProvider, avoiding duplication of flow measurement and aggregation logic. The main difference between them is the additional information associated with each flow direction.
Input Flow Provider AbstractInputFlowsProvider extends the common functionality with input-specific features. Its main responsibilities include:
- Retrieving and aggregating connected input flows.
- Accessing an optional Mixer associated with the input connections.
- Providing mixing factors for individual input streams.
- Calculating normalized mixing ratios.
- Formatting input flow statistics.
The
getMixFactors() method can be overridden by subclasses to provide mixing factors in the order of connected input flows. By default, it returns an empty array.
Two methods are available for presenting mixing information:
- getFormattedFactors() — displays the original mixing factors.
- getFormattedRatios() — normalizes the factors by their sum to obtain relative proportions.
This functionality is particularly useful for refinery process units where several feedstock streams are combined before further processing.
Output Flow Provider AbstractOutputFlowsProvider provides corresponding functionality for process units with multiple output streams.
Its additional responsibility is to provide separation factors through the
getSepFactors() method. Subclasses can override this method to define the distribution of output flows across connected streams.
As with input providers, two formatting methods are available:
- getFormattedFactors() — displays the original separation factors.
- getFormattedRatios() — converts the factors into normalized ratios.
These methods help describe how a process unit distributes its output among different products or destinations.
Shared Flow StatisticsBoth input and output providers inherit the core functionality from
AbstractFlowsProvider, including:
- Flow aggregation: calculating total flow across connected FluidBlock objects.
- Product identification: finding connected flows assigned to a specific product.
- Indexed access: retrieving individual flow values by connection index.
- Flow distribution: calculating the contribution of an individual stream to the total flow.
- Statistical formatting: generating formatted reports with product names, flow values, percentages, and available valve limits.
The shared implementation also supports dynamically resolved connections through Java Supplier interfaces. This allows flow data to be retrieved on demand rather than relying exclusively on arrays captured during provider initialization. As a result, input and output providers offer a consistent approach to flow monitoring and statistics in AnyLogic refinery simulation, while retaining their specific responsibilities for mixing and separation data.