Case Study: Ignition Batch Tracking System

A real-time batch logging and reporting system built using Ignition Perspective, Jython tag event scripting, SQLite database integration, and Named Query bindings

Project Overview

This project implements a full-stack batch tracking solution within the Ignition SCADA platform, targeting the Maker Edition environment. The system covers the complete production record lifecycle: operator data entry via a Perspective HMI screen, event-driven database writes triggered by a boolean completion tag, persistent storage in a SQLite relational database, and real-time record retrieval via Named Query bindings surfaced in a live Perspective Table component. The architecture mirrors the data flow patterns found in production MES (Manufacturing Execution System) integrations, where traceability, auditability, and low-latency record retrieval are primary requirements.

Problem

Industrial batch production environments require complete traceability of each production run for quality control, regulatory compliance, and operational reporting. Manual paper-based logging introduces transcription errors, delayed visibility, and gaps in audit trails. The engineering requirement was to replace this manual process with an event-driven digital system capable of capturing batch metadata atomically at the moment of completion, persisting it to a structured relational store, and surfacing historical records to operators in real time — without requiring a page refresh or manual query execution.

Solution

System Components and Responsibilities:
  • Operator Input Fields — Perspective text and numeric input components bound to memory tags; capture Recipe Name, Batch Duration, and Operator ID for the active production run
  • Memory Tags — Gateway-scoped tags acting as the live data store for operator-entered values; decouples the UI layer from the scripting layer
  • Batch_Complete Trigger Tag — A boolean memory tag that acts as the write signal; a rising-edge transition on this tag fires the tag value change event script
  • Tag Event Script (valueChanged) — A Jython script subscribed to the Batch_Complete tag; executes a parameterised SQL INSERT using system.db.runPrepUpdate and reads live tag values via system.tag.readBlocking at the moment of trigger
  • SQLite Database — Configured as a named database connection in the Ignition Gateway via JDBC; provides persistent, structured storage for all batch records
  • Named Query — A reusable, Gateway-managed SQL SELECT query bound to the Perspective Table component; parameterised queries enforce separation between data access logic and the UI layer
  • Perspective Table Component — Displays the full batch history in real time via Named Query binding; automatically reflects new records without operator intervention

When the operator activates the Complete Batch button, it writes TRUE to the Batch_Complete memory tag. The Gateway detects the rising-edge value change and immediately dispatches the registered valueChanged tag event script. The script reads the current values of Recipe_Name, Batch_Duration, and Operator_Name from the tag provider using blocking reads to guarantee value consistency, then executes a prepared INSERT statement against the production_db connection. The Perspective Table, bound to a Named Query polling the same database, updates its dataset to reflect the newly written record, completing the end-to-end data pipeline.

Project Screenshots

Database Structure

Table: production_batches
    id         : INTEGER (Primary Key, Auto-increment)
    timestamp  : DATETIME  -- populated via system.date.now() at script execution time
    recipe     : TEXT      -- recipe name read from [default]Recipe_Name tag
    duration   : REAL      -- batch duration in operator-defined units
    operator   : TEXT      -- operator identifier read from [default]Operator_Name tag

Core Script Logic

def valueChanged(tag, tagPath, previousValue, currentValue, initialChange, missedEvents):

    # Guard clause: only execute on a confirmed rising-edge transition
    # Prevents duplicate inserts on Gateway restart or initialChange events
    if currentValue.value == True and previousValue.value == False:

        system.db.runPrepUpdate(
            "INSERT INTO production_batches (timestamp, recipe, duration, operator) VALUES (?, ?, ?, ?)",
            [
                system.date.now(),
                system.tag.readBlocking(["[default]Recipe_Name"])[0].value,
                system.tag.readBlocking(["[default]Batch_Duration"])[0].value,
                system.tag.readBlocking(["[default]Operator_Name"])[0].value
            ],
            "production_db"
        )

Testing & Debugging

System validation was performed by manually driving tag values through the Ignition Tag Browser and using the Query Browser to inspect database state after each trigger event. The following test cases were executed and confirmed:

Challenges Faced

Key Learning Outcomes

Tools Used