Appendix A. Mathematical Model of Flowing Tank Farm Simulation
This appendix presents the mathematical formulation of the predictive flow control algorithm implemented in the RpFlowing simulation component of the Petroleum Refining Library (PRL). The controller predicts the availability of both source and receiving tank farms and continuously determines the maximum sustainable outlet flow while respecting operational constraints.
This appendix presents the mathematical model of the Flowing Tank Farm simulation algorithm described in the article Flowing Tank Farm Simulation for Refinery Digital Twin Models .
The controller first determines the allowable outlet flow interval.
Maximum flow allowed by the flow ramp constraint.
Maximum pump capacity.
Upper allowable outlet flow.
Minimum flow allowed by the flow ramp constraint.
Minimum pump operating flow.
Lower allowable outlet flow.
The controller predicts the waiting time for every source tank.
Waiting time for a tank currently being filled.
Waiting time for a tank undergoing certification.
Unavailable tanks are assigned a sufficiently large waiting time.
The smallest waiting time determines the next available source tank.
Maximum sustainable outlet flow determined by the source tank farm.
The same procedure is applied to the receiving tank farm.
Remaining unloading time for a tank in the shipment state.
Waiting time for a tank undergoing certification.
The receiving tank with the minimum waiting time is selected.
Maximum sustainable receiving flow.
The controller combines the predictions obtained for both tank farms.
The governing outlet flow is determined by the most restrictive tank farm.
The outlet flow is finally limited to the allowable operating range.
| Symbol | Description |
|---|---|
| \(V_{1,in}\) | Inlet flow rate of the source tank farm. |
| \(V_{1,out}\) | Outlet flow rate of the source tank farm. |
| \(V_{2,in}\) | Inlet flow rate of the receiving tank farm. |
| \(V_{2,out}\) | Outlet flow rate of the receiving tank farm. |
| \(V_{max}\) | Maximum allowable outlet flow. |
| \(V_{min}\) | Minimum allowable outlet flow. |
| \(dV\) | Maximum flow variation during one control interval. |
| \(S\) | Tank inventory. |
| \(S_{min}\) | Minimum allowable inventory. |
| \(S_{max}\) | Maximum allowable inventory. |
| \(C\) | Certification duration. |
| \(Delay\) | Remaining certification time. |
| \(R\) | Safety time reserve. |
| \(D\) | Predicted waiting time until tank availability. |
| \(Q\) | Number of source tanks. |
| \(U\) | Number of receiving tanks. |
The predictive flow control algorithm forms the mathematical basis of the RpFlowing simulation component implemented in the Petroleum Refining Library (PRL) for AnyLogic. The controller continuously predicts tank availability, evaluates inventory constraints, and automatically selects the maximum sustainable outlet flow, thereby minimizing transfer interruptions while respecting hydraulic and storage limitations.