Mathematical Formulation of Automatic Product Blend Optimization
,
The total mass, total product and residual flows are calculated as the sum of all product contributions:,
,
.
To evaluate volumetric product specifications, the algorithm also converts mass flows into volumetric contributions using component densities:where is the density of product i.
The total product volume is then computed as
.
These equations form the structural foundation of the blending model. Every feasible solution produced by the LP solver automatically satisfies the conservation of mass before product blending constraints are evaluated..
This objective is typically used when sufficient blending components are available and the primary goal is to maximize product yield while satisfying all quality specifications.
where:
where
,
,
Maximum Balancing Additive Utilization Constraint
,
The following equation introduces a penalty for product underproduction, allowing the optimization to remain feasible when the required production rate cannot be achieved:
,
As a result, the blending model is regenerated every time the process conditions change. No manual reformulation of the mathematical model is required. The overall workflow can be represented as
The generated LP model contains only linear equations and inequalities, allowing standard linear programming solvers to obtain an optimal solution efficiently even for large blending problems. Because the mathematical formulation is generated directly from the current simulation state, the optimization automatically adapts to:
- changing feedstock availability;- changing process topology.
This automatic model generation enables ProductMixer to operate as an optimization engine within a refinery digital twin, continuously recalculating optimal blending decisions as process conditions evolve.
//LpSolve equations
min: -1.0*FLOW_MASS_PRODUCT;
1*FLOW_MASS37 = 360000.0;
1*FLOW_MASS37 + -1*FLOW_MASS_PRODUCT37 + -1*FLOW_MASS_RESIDUAL37 = 0.0;
1*FLOW_VOLUME_PRODUCT37 + -1.287995878413189*FLOW_MASS_PRODUCT37 = 0.0;
1*FLOW_MASS_RESIDUAL_FIRST + -1*FLOW_MASS_RESIDUAL37 = 0;
1*FLOW_MASS_RESIDUAL_SECOND = 0;
1*FLOW_MASS + -1*FLOW_MASS37 = 0;
1*FLOW_MASS_PRODUCT + -1*FLOW_MASS_PRODUCT37 = 0;
1*FLOW_MASS_RESIDUAL + -1*FLOW_MASS_RESIDUAL37 = 0;
1*FLOW_VOLUME_PRODUCT + -1*FLOW_VOLUME_PRODUCT37 = 0;
1*FLOW_MASS_PRODUCT + 1*FLOW_PENALTY_MIN <= 100.0;
1*FLOW_PENALTY_MIN + -0.0*FLOW_MASS_PRODUCT >= 0;
1*FLOW_LIMIT1 + -85.0*FLOW_MASS_PRODUCT37 = 0;
90.0*FLOW_MASS_PRODUCT + -11.0*FLOW_PENALTY1 + -1.0*FLOW_LIMIT1 <= 0;
1.0*FLOW_PENALTY1 + -0.2*FLOW_MASS_PRODUCT <= 0;
1.0*FLOW_PENALTY1 + -1*FLOW_PENALTY_MIN <= 0;
1*FLOW_PENALTY + -1*FLOW_PENALTY1 = 0;