Learn PLCs free
Advanced2-3 hoursSequential function chartParallel branchesWeight-based controlRecipe handling

Batch Mixer Sequence

Batch mixing is a stress test for sequential control — multiple ingredients fill in parallel, weight checks gate transitions, and the cycle must handle aborts and faults gracefully. This example uses a CASE-statement state machine equivalent to an SFC.

Sequence overview showing inputs flowing into PLC logic and outputs driving actuators, with this example named Batch Mixer Sequence.Process flow: inputs → logic → outputsInputsWeightCell, StartBtn2 signalsPLC LogicSequential function chart · Parallel branchesAdvanced · 2-3 hoursOutputsMV_A, MV_B, MV_C5 signals

I/O list

TagTypeDescription
MV_ADOIngredient A inlet valve
MV_BDOIngredient B inlet valve
MV_CDOIngredient C inlet valve
MV_DrainDODrain valve
MixerDOMixer motor
WeightCellAITank weight (kg)
Recipe_AREALIngredient A target weight
Recipe_BREALIngredient B target weight
Recipe_CREALIngredient C target weight
StartBtnDIStart button
StepINTCurrent state

Structured Text code

PROGRAM main
VAR
    MixTimer    : TON;
    InitialWt   : REAL;       (* Tank weight at start *)
    Tolerance   : REAL := 0.5; (* ±0.5 kg target *)
END_VAR

(* All outputs default off *)
MV_A := FALSE; MV_B := FALSE; MV_C := FALSE;
MV_Drain := FALSE; Mixer := FALSE;

CASE Step OF
    0:  (* IDLE *)
        IF StartBtn AND WeightCell < 1.0 THEN
            InitialWt := WeightCell;
            Step := 10;
        END_IF;

    10: (* PARALLEL FILL: A, B, C all open simultaneously *)
        MV_A := WeightCell < InitialWt + Recipe_A - Tolerance;
        MV_B := WeightCell < InitialWt + Recipe_A + Recipe_B - Tolerance;
        MV_C := WeightCell < InitialWt + Recipe_A + Recipe_B + Recipe_C - Tolerance;
        IF NOT MV_A AND NOT MV_B AND NOT MV_C THEN Step := 20; END_IF;

    20: (* MIX *)
        Mixer := TRUE;
        MixTimer(IN := TRUE, PT := T#5m);
        IF MixTimer.Q THEN
            MixTimer(IN := FALSE);
            Step := 30;
        END_IF;

    30: (* DISCHARGE *)
        MV_Drain := TRUE;
        IF WeightCell < InitialWt + 1.0 THEN Step := 0; END_IF;
END_CASE;

How it works

Step 0 (IDLE): waits for StartBtn AND empty tank. Records the initial tare weight.

Step 10 (PARALLEL FILL): all three ingredient valves open simultaneously, each closes when its cumulative target weight is reached. The math accumulates: A closes at InitialWt+RecipeA, B closes at InitialWt+RecipeA+RecipeB, etc.

Tolerance band: ±0.5 kg to allow valve close-time and avoid overshoot. Real systems use a fast-fill / slow-fill profile.

Step 20 (MIX): mixer runs for 5 minutes per recipe.

Step 30 (DISCHARGE): drain valve opens until tank returns to empty (within 1 kg of initial tare), then back to IDLE.

Production system: would add abort/hold buttons, fault recovery, recipe selection from HMI, batch number tracking, and ISA-88 batch state model.

More examples