Data Correlation
Data correlation are used
- To create a generic information model (GIM)
- To reduce data traffic to platforms
Data Processors
Different types exist
- Processors with simple predicate logic
- Processors with C# Scripts
- Processors dedicated for event processing
- Processors dedicated for streaming data processing
Each processor defines input and output ports which are connected to data nodes or other processor ports.
Port Matching
The port matching rule is responsible to match the data nodes to processor ports.
Make sure your device information model includes a port matching rule.
Following rules are applied to match of the data nodes with ports of the processors
- The property
PortMatchId
must be equal - The DataType must be equal
- The data node class
Event
must match with port typeEventPassing
orStream
must match withStreaming
Complex Data Processing
Complex data processing is realized with C# Scripts.
The script file is referenced by the processing node:
The script file itself is placed in the folder of the Heidenhain plugin:
Following example shows the program header processing of the Heidenhain controllers:
using HumanOS.Kernel.Processing;
using System.Linq;
using System;
namespace HumanOS.UHAL.HeidenhainControl.Scripts
{
/// <summary>
/// Processes the program header of the main program
/// </summary>
public class TMainProgramHeaderProcessorScript : TAbstractProcessingScriptObject
{
/// <see cref="TAbstractProcessingScriptObject"/>
public override void process(IProcessingNode Processor)
{
// get input values
string strMainHeader = Processor.getProperty<string>("In_MainProgramHeader");
string strProductName = "";
string strProcessStep = "";
// calculate program name
if (strMainHeader != null)
{
string[] astrLines = strMainHeader.Split('\n');
strProductName = astrLines.FirstOrDefault(n => n.Contains(";PRODUCT:"));
strProcessStep = astrLines.FirstOrDefault(n => n.Contains(";STEP:"));
if (strProductName.isEmpty()) { strProductName = ""; }
else { strProductName = strProductName.Split(";PRODUCT:").Last(); }
if (strProcessStep.isEmpty()) { strProcessStep = ""; }
else { strProcessStep = strProcessStep.Split(";STEP:").Last(); }
}
Processor.setProperty<string>("Out_ProductName", strProductName.trimWhiteSpaces());
Processor.setProperty<string>("Out_ProductionStep", strProcessStep.trimWhiteSpaces());
}
}
}
Use the trim function like
strProductName.trimWhiteSpaces()
to eliminate spaces and\r
.
If you use different scripts make sure the class name is unique. Use the internal script editor of HumanOS IoT Designer and check for syntax errors before you deploy your IoT project.