Mixer Simulation: Dynamic Material Flow Mixing

       The Petroleum Refining Library (PRL) Mixer is a component for combining multiple material flows in process simulation. Unlike MixerLight, which supports mixing two input flows, Mixer can combine any number of incoming material flows. It supports mixer simulation by merging incoming streams into a single output flow while preserving mass balance. The calculation of the resulting product composition and properties is performed by the ProductMixer component.
       The Mixer can be used as an independent component or internally by other Petroleum Refining Library components, for example, to combine material flows from multiple Process Units, Tank Farms, pipelines, and other process streams in refinery simulation, oil and gas process simulation, refinery production planning, and process simulation models. Mixer provides extensive statistics for monitoring and analyzing multiple input streams, flow ratios, mix factors, output flow, and valve state during process simulation.
       Learn more about flow splitting and mixing components in the Petroleum Refining Library.
The Petroleum Refining Library Mixer differs from the standard AnyLogic Fluid Merge by supporting dynamic mixing of multiple material flows while preserving mass balance.
       The priority mechanism in the standard AnyLogic FluidSplit and FluidMerge components does not guarantee that a higher-priority flow will be accepted or transferred in full. Although these components support neutral, proportional, and priority-based allocation algorithms, the priority mode represents a preference rather than a strict allocation rule.
       The configured priority coefficients are incorporated into the objective function of the underlying linear programming (LP) flow-network model as penalty or benefit factors. As a result, in complex networks, the LP solver may allocate flow from a lower-priority connection if this produces a more advantageous overall solution.
       Mixer can select a single inlet by closing the others through its merge factors. The actual flow accepted from that inlet remains subject to supply, downstream capacity, and valve limits.

How the Mixer Combines Material Flows

       Unlike MixerLight, which combines two incoming flows, the Mixer can combine an arbitrary number of incoming streams into a single material flow. The total output mass flow is calculated from the incoming flows allowed by the current merge configuration.

Multiple Input Flows and Dynamic Mixing

       The Mixer supports an arbitrary number of input flows. Input flows are defined through the FluidExit[] inputFlows array, where each array element represents one input connection. However, the mass flow rates and material composition of the existing input flows can change dynamically during simulation. The output mass flow is the sum of the admitted inlet flows. ProductMixer handles composition and property calculations when the model needs them. This makes the Mixer suitable for dynamic material flow modeling in AnyLogic refinery and oil and gas simulation models.

Mixer API

       The Petroleum Refining Library Mixer API provides methods for flow connection, material flow mixing, throughput control, and dynamic Mixer configuration during simulation.
       Connecting Flows
When connectAfterStart is enabled, call connect(FluidExit[] inputFlows, FluidEnter outputFlow) after startup to establish the connections. The standalone agent rejects a second initialization. onAfterInitialize() runs after a successful connection.
       Managing Merge Factors
       Merge factors control how individual input flows contribute to the resulting mixed flow. They can be configured for all input flows using an array of factors, specified by product ID, or used to select a single product flow. setMerge(int productId) selects the matching inlet and closes the other inlet paths. The selected inlet can supply the flow permitted by the network.
The public setMerge overloads return true when a nonzero factor is supplied. Missing product IDs in the map receive a factor of zero. getMixRatios() normalizes the configured factors. Use statistics.input to inspect measured inlet contributions.
getMixFactorsMap() returns an empty map when all factors are zero and rejects duplicate product IDs when building a nonempty map.
       Managing Mixer Throughput
       The Mixer throughput can be controlled using an overall flow limit or individual limits applied to specific input flows. These flow constraints can be used in refinery production planning and process optimization scenarios.
The onSpeedChange(double totalSpeed, Map<Integer, Double> speedByInputIndex) callback reports the outlet rate and rates by one-based inlet index, in tons per hour. By default, a significant outlet-rate change or a transition between zero and positive flow schedules it. TRIGGER_ON_COMPONENT_FLOW_CHANGE switches the trigger to component flow changes.
       Managing Mixer State
       The Mixer state can be controlled dynamically during simulation. It can be closed to completely stop the flow or reset to restore its default operating state.

Conclusion

       The Petroleum Refining Library Mixer provides a flexible approach to mixer simulation and dynamic material flow mixing in process simulation. It combines multiple incoming flows into a single output while preserving mass balance. Merge factors can be changed dynamically, flow limits can be applied to the entire Mixer or individual input flows, and the Mixer can be closed or reset during simulation. These capabilities make the Mixer suitable for refinery simulation, petroleum refining, oil and gas process simulation, production planning, process optimization, logistics, and digital twin models, including models that combine flows between Process Units, Tank Farms, storage systems, and pipelines.

FAQ

1. What is the Petroleum Refining Library Mixer?
The Petroleum Refining Library Mixer combines multiple incoming material flows into a single output flow while preserving mass balance. ProductMixer calculates the resulting material composition.

2. How does the Mixer combine material flows?
The Mixer sums the mass-flow rates admitted by the active merge factors, valve limits, and the connected network.

3. Does the Mixer preserve mass balance?
Yes. The Mixer preserves mass balance by combining the incoming mass flows into a single output flow.

4. Can the Mixer combine flows with different material compositions?
Yes. Mixer can combine their mass flows. ProductMixer calculates composition and properties when those values are required.

5. Can the Mixer have multiple input flows?
Yes. The Mixer supports an arbitrary number of input flows defined through the inputFlows array.

6. What are merge factors?
Merge factors control how the configured input flows contribute to the resulting output flow. They can be configured for all input flows or using product IDs as input identifiers.

7. Can merge factors be changed during simulation?
Yes. Merge factors can be changed dynamically during simulation using the setMerge() methods.

8. Can a single product flow be selected for mixing?
Yes. setMerge(int productId) selects the matching inlet. Its actual flow depends on supply, valve limits, and downstream capacity.

9. Can flow limits be applied to the Mixer?
Yes. A maximum flow rate can be applied to the entire Mixer or to individual input connections.

10. What happens when the Mixer is closed?
When the Mixer is closed, it blocks material flow. The Mixer can be reopened dynamically during simulation.

11. Can the Mixer be used in refinery production planning?
Yes. The Mixer can be used to combine material flows from multiple Process Units, Tank Farms, storage systems, pipelines, and other process streams in refinery production planning, refinery simulation, and oil and gas process simulation models.

12. Can the Mixer be used in digital twin models?
Yes. The Mixer is suitable for digital twin models of refinery and oil and gas operations, including dynamic process simulation, material flow modeling, production planning, logistics, and refinery optimization.