Monitor and control a brewing process.

How-to ExamplesIndustry → BottlingLine ML


Download the solutionBottlingLine ML Demo.dbsln

This guide demonstrates how to create a complete IoT solution that collects data from the field, publishes it to an MQTT broker, historizes the data, applies machine learning models, and displays real-time values.

System Overview: 

  • Collects data from field devices (simulated)

  • Publishes data to MQTT broker

  • Historizes data to SQLite database

  • Applies machine learning models to monitor anomalies

  • Displays real-time values in customizable dashboards


Technical Information

New Solution

  1. In Solution Center, click to create a new solution

  2. Select Windows platform

  3. Choose Portable layout (allows visualization across different devices)

  4. Enter a solution name

  5. Click Create Solution

Demo Tags

  1. Use the GPT Frameworks AI assistant to generate tags for a demo

  2. Copy the generated table

  3. Navigate to Unified Namespace → Tags

  4. Paste the tags into the namespace

  5. Copy these tags for use in the next steps

Value Simulator for Data Collection

  1. Navigate to Devices → Protocols

  2. Select “Value Simulator” protocol and “New Channel…”

  3. In Devices → Points, Paste the tags copied from Step 2

  4. The Value Simulator will now generate random values for these tags

Note: The Value Simulator is used for testing purposes to generate field data.

MQTT Publishing

  1. Navigate to Devices → Protocols

  2. Select “MQTT” protocol and “New Channel…”

  3. Select the MQTT channel and create a new node

  4. Configure the Primary Station:

    • Define broker access (e.g., HiveMQ broker)

    • Test the connection to verify it's working

  5. Navigate to Points under MQTT

  6. Select the MQTT channel created

  7. Insert rows for all tags

  8. Change all tags to Write mode (for publishing to broker)

  9. Organize by node if desired

Note: For the MQTT, when no address is defined, the system uses the tag name as the MQTT topic.

 Data Historization

  1. Navigate to Historian module

  2. Right-click and select Insert Rows

  3. Paste the tags copied earlier

  4. Data will automatically be published to Table1 (default SQLite database)

Machine Learning Intelligence

Step A: Import the AnomalyML class from Library

  1. Navigate to Scripts → Classes

  2. Click the New button

  3. Select Import code from Library

  4. Choose AnomalyML from the library

  5. Click OK to open the code

  6. Make any minor edit to the code and save it

Step B: Create ML output tags

Navigate to Unified Namespace → Tags and create these tags under your monitored area (e.g., Brewery/ML/):

NameTypeDescription
{Area}/ML/ScoreDoubleML anomaly severity (0.0=normal, 1.0=severe)
{Area}/ML/IsAnomalyBooleanTrue when ML model detects anomaly
{Area}/ML/BaselineDoubleExpected normal value from ML model
{Area}/ML/ModelReadyBooleanTrue after ML model finishes training

Step C: Create Expressions to wire the class to tags

Navigate to Scripts → Expressions and create these four expressions. All must use the same Trigger (the sensor tag being monitored):

ObjectName

Expression

Execution

Tag.{Area}/ML/Score

Script.Class.AnomalyML.Check(Tag.{Area}/<SensorTag>)

OnChange

Tag.{Area}/ML/IsAnomaly

Script.Class.AnomalyML.GetIsAnomaly()

OnChange

Tag.{Area}/ML/Baseline

Script.Class.AnomalyML.GetBaseline()

OnChange

Tag.{Area}/ML/ModelReady

Script.Class.AnomalyML.IsModelReady()

OnChange

Where:

  • {Area}: The tag folder for your monitored area (e.g., Brewery/BrewHouse)

  • <SensorTag>: The specific sensor tag to monitor (e.g., FlowRate, Temperature)

Important: The Score expression must execute first each cycle — it calls Check() which runs the ML model. The other three read results from that same prediction. After starting the runtime, the model needs ~100 data points to train. During warmup, Score will be 0 and ModelReady will be false. At a 5-second scan rate, expect ~8 minutes before predictions begin.

For more details on the ML pipeline pattern, see the Edge ML Pipeline Skill documentation.

 Display Dashboard

  1. Navigate to Displays → Home Display

  2. Use the tree view in Drag Tags to Display to drag and drop tags onto the display

  3. Save the display

Complete System

  1. Click Runtime → Startup → Run Startup to start the runtime

  2. Observe real-time values changing in the displays

  3. Test different layouts:

    • Desktop Layout: Full desktop view

    • Mobile Layout: Optimized for mobile devices (includes scrollbar for multiple objects)

    • Pad Layout: Tablet-optimized view


In this section...