Appendix A. Mathematical Model of Flowing Tank Farm Simulation

This appendix summarizes the mathematical formulation of the flow control algorithm implemented in the Digital Twin model.

This appendix presents the mathematical model of the Flowing Tank Farm simulation algorithm described in Flowing Tank Farm Simulation for Refinery Digital Twin Models .

Notation

Symbol Description
\(P_i(t)\)Flow from process unit i
\(D_j(t)\)Auxiliary flow from upstream tank farms
\(V_{in}(t)\)Total inlet flow (t/h)
\(V_{out}(t)\)Outlet flow (t/h)
\(S(t)\)Tank inventory (t)
\(S_{min},S_{max}\)Inventory limits
\(S_{target}\)Target inventory
\(V_{min},V_{max}\)Pump capacity limits
\(dV\)Maximum outlet flow change per step
\(\Delta t\)Simulation time step

1. Total Inlet Flow

$$ V_{in}(t)= \sum_{i=1}^{N}P_i(t)+ \sum_{j=1}^{M}D_j(t) $$

2. Material Balance

$$ S(t+\Delta t)= S(t)+ \left( V_{in}(t)-V_{out}(t) \right)\Delta t $$

3. Pump Capacity

$$ V_{min} \le V_{out}(t) \le V_{max} $$

4. Inventory Limits

$$ S_{min} \le S(t) \le S_{max} $$

5. Flow Ramp Constraint

$$ V_{out}(t)-dV \le V_{out}(t+\Delta t) \le V_{out}(t)+dV $$ or equivalently $$ \left| V_{out}(t+\Delta t)-V_{out}(t) \right| \le dV $$

6. Maximum Feasible Outlet Flow

$$ V_{out}^{max} = \min \left( V_{max}, V_{ramp}^{max}, V_{inventory}^{max} \right) $$ where $$ V_{ramp}^{max} = V_{out}(t)+dV $$ $$ V_{inventory}^{max} = V_{in}(t)+ \frac{S(t)-S_{min}} {\Delta t} $$

7. Minimum Feasible Outlet Flow

$$ V_{out}^{min} = \max \left( V_{min}, V_{ramp}^{min}, V_{inventory}^{min} \right) $$ where $$ V_{ramp}^{min} = V_{out}(t)-dV $$ $$ V_{inventory}^{min} = V_{in}(t)+ \frac{S(t)-S_{max}} {\Delta t} $$

8. Preferred Outlet Flow

Ignoring operational constraints, the preferred outlet flow is $$ V_{out}^{*}(t)= V_{in}(t)+ \frac{ S(t)-S_{target} } {\Delta t} $$

9. Selected Outlet Flow

The controller projects the preferred outlet flow onto the feasible operating region. $$ V_{out}(t)= \min \left( V_{out}^{max}, \max \left( V_{out}^{min}, V_{out}^{*}(t) \right) \right) $$

10. Optimization Objective

The controller seeks an outlet flow satisfying $$ S(t)\rightarrow S_{target} $$ subject to $$ V_{min}\le V_{out}(t)\le V_{max} $$ $$ S_{min}\le S(t)\le S_{max} $$ $$ \left| V_{out}(t+\Delta t)-V_{out}(t) \right| \le dV $$

11. Control Algorithm

  1. Calculate total inlet flow.
  2. Determine the operating mode.
  3. Compute feasible outlet-flow limits.
  4. Calculate the preferred outlet flow.
  5. Apply pump, inventory and ramp-rate constraints.
  6. Update the material balance.
  7. Advance the simulation time.
  8. Repeat until the end of the simulation.