Field fix / guidePLC / HMI Code & LogicVendor-agnostic (IEC 61131-3)Sorting Classificationindustrial-automation

Bottle Weight Verify — PLC Control Template

Shared by TSIMEREZIVO Team · 4 Oct 2026 · 46 views

# Bottle Weight Verify — Usage Guide ## Overview Bottle fill verification template using a pass/fail weight window and reject gate. Includes a basic SPC-style failure-rate alarm to highlight filler drift. ## Commissioning 1. Establish min/max weight limits from fill specification 2. Verify reject timing matches conveyor speed and reject station offset 3. Confirm failure-rate alarm is based on a representative sample size --- ## Control Logic — Vendor-Agnostic Pseudocode # Bottle Weight Verify — Logic ## Standards: IEC 61131-3 | ISA-5.1 | ISA-18.2 ## Scan Rate: 10ms | Pattern: pass/fail checkweigher with SPC alarm ``` ROUTINE: BottleWeightVerify SCAN_RATE: 10ms // SECTION 1 — PASS FAIL IF SAMPLE_READY THEN PASS := (WEIGHT_PV >= MIN_WEIGHT_SP) AND (WEIGHT_PV <= MAX_WEIGHT_SP) IF PASS THEN PASS_COUNT := PASS_COUNT + 1 ELSE FAIL_COUNT := FAIL_COUNT + 1 END_IF END_IF // SECTION 2 — REJECT GATE IF SAMPLE_READY AND NOT PASS THEN REJECT_CMD := TRUE END_IF IF REJECT_CMD THEN REJECT_TMR := REJECT_TMR + 1 IF REJECT_TMR >= REJECT_TIME_TICKS THEN REJECT_CMD := FALSE; REJECT_TMR := 0 END_IF END_IF // SECTION 3 — SPC TOTAL_COUNT := PASS_COUNT + FAIL_COUNT IF TOTAL_COUNT >= SPC_MIN_COUNT THEN FAIL_RATE := (FAIL_COUNT * 100.0) / TOTAL_COUNT IF FAIL_RATE >= FAIL_RATE_SP THEN SET_ALARM(ALM_HIGH_FAIL_RATE, HIGH) END_IF END_IF // SECTION 4 — HMI HMI_PASS := PASS HMI_WEIGHT := WEIGHT_PV HMI_FAIL_RATE := FAIL_RATE END_ROUTINE ``` --- ## Tag List ```csv Tag Name,Description,Data Type,Direction,Engineering Unit,Range Min,Range Max,Default Value,Address SAMPLE_READY,Weigh Sample Ready Pulse,BOOL,input,,,,FALSE,DI:0:0.0 WEIGHT_PV,Measured Bottle Weight,REAL,input,g,0,5000,0,AI:0:0.0 MIN_WEIGHT_SP,Minimum Accept Weight,REAL,internal,g,0,5000,490, MAX_WEIGHT_SP,Maximum Accept Weight,REAL,internal,g,0,5000,510, PASS,Pass/Fail Result,BOOL,calculated,,,,FALSE, REJECT_CMD,Reject Gate Command,BOOL,output,,,,FALSE,DO:1:0.0 REJECT_TMR,Reject Pulse Timer,INT,internal,,0,1000,0, REJECT_TIME_TICKS,Reject Pulse Duration,INT,internal,,0,1000,30, PASS_COUNT,Accepted Bottle Count,DINT,internal,,0,999999,0, FAIL_COUNT,Rejected Bottle Count,DINT,internal,,0,999999,0, TOTAL_COUNT,Total Checked Count,DINT,calculated,,0,999999,0, FAIL_RATE,Failure Rate,REAL,calculated,%,0,100,0, SPC_MIN_COUNT,Minimum Sample Size for SPC,INT,internal,,0,999999,50, FAIL_RATE_SP,Failure Rate Alarm Threshold,REAL,internal,%,0,100,3, ALM_HIGH_FAIL_RATE,High Failure Rate Alarm,BOOL,calculated,,,,FALSE, HMI_PASS,HMI: Pass Result,BOOL,output,,,,FALSE, HMI_WEIGHT,HMI: Bottle Weight,REAL,output,g,0,5000,0, HMI_FAIL_RATE,HMI: Failure Rate,REAL,output,%,0,100,0, ``` --- ## Alarm Matrix ```csv Alarm Tag,Condition,Setpoint,Priority,Type,Response,Delay,Auto Acknowledge ALM_HIGH_FAIL_RATE,FAIL_RATE >= FAIL_RATE_SP after SPC_MIN_COUNT samples,3%,high,process,Reject rate too high. Investigate filler calibration and bottle tare variation.,0s,No ```

More like this

Rate, comment, and get full access

Members can download files, rate contributions, and discuss fixes with the engineers who posted them — free.

Join the library