Download the solution: BottlingLine 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
In Solution Center, click to create a new solution
Select Windows platform
Choose Portable layout (allows visualization across different devices)
Enter a solution name
Click Create Solution
Use the GPT Frameworks AI assistant to generate tags for a demo
Copy the generated table
Navigate to Unified Namespace → Tags
Paste the tags into the namespace
Copy these tags for use in the next steps
Navigate to Devices → Protocols
Select “Value Simulator” protocol and “New Channel…”
In Devices → Points, Paste the tags copied from Step 2
The Value Simulator will now generate random values for these tags
Note: The Value Simulator is used for testing purposes to generate field data.
Navigate to Devices → Protocols
Select “MQTT” protocol and “New Channel…”
Select the MQTT channel and create a new node
Configure the Primary Station:
Define broker access (e.g., HiveMQ broker)
Test the connection to verify it's working
Navigate to Points under MQTT
Select the MQTT channel created
Insert rows for all tags
Change all tags to Write mode (for publishing to broker)
Organize by node if desired
Note: For the MQTT, when no address is defined, the system uses the tag name as the MQTT topic.
Navigate to Historian module
Right-click and select Insert Rows
Paste the tags copied earlier
Data will automatically be published to Table1 (default SQLite database)
Step A: Import the AnomalyML class from Library
Navigate to Scripts → Classes
Click the New button
Select Import code from Library
Choose AnomalyML from the library
Click OK to open the code
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/):
| Name | Type | Description |
|---|---|---|
{Area}/ML/Score | Double | ML anomaly severity (0.0=normal, 1.0=severe) |
{Area}/ML/IsAnomaly | Boolean | True when ML model detects anomaly |
{Area}/ML/Baseline | Double | Expected normal value from ML model |
{Area}/ML/ModelReady | Boolean | True 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 |
|---|---|---|
|
| OnChange |
|
| OnChange |
|
| OnChange |
|
| 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.
Navigate to Displays → Home Display
Use the tree view in Drag Tags to Display to drag and drop tags onto the display
Save the display
Click Runtime → Startup → Run Startup to start the runtime
Observe real-time values changing in the displays
Test different layouts:
Desktop Layout: Full desktop view
Mobile Layout: Optimized for mobile devices (includes scrollbar for multiple objects)
Pad Layout: Tablet-optimized view