MTConnect.NET-AgentProcessor-Python 7.2.0.105

dotnet add package MTConnect.NET-AgentProcessor-Python --version 7.2.0.105
                    
NuGet\Install-Package MTConnect.NET-AgentProcessor-Python -Version 7.2.0.105
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MTConnect.NET-AgentProcessor-Python" Version="7.2.0.105" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MTConnect.NET-AgentProcessor-Python" Version="7.2.0.105" />
                    
Directory.Packages.props
<PackageReference Include="MTConnect.NET-AgentProcessor-Python" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MTConnect.NET-AgentProcessor-Python --version 7.2.0.105
                    
#r "nuget: MTConnect.NET-AgentProcessor-Python, 7.2.0.105"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MTConnect.NET-AgentProcessor-Python@7.2.0.105
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MTConnect.NET-AgentProcessor-Python&version=7.2.0.105
                    
Install as a Cake Addin
#tool nuget:?package=MTConnect.NET-AgentProcessor-Python&version=7.2.0.105
                    
Install as a Cake Tool

MTConnect.NET Logo

MTConnect Python Agent Processor

This Agent Processor uses individual Python script files to transform input data

Configuration

processors:
  - python:
      directory: processors
  • directory - The directory to load and monitor for ".py" script files. The path can be absolute or relative to the executable's directory, and the directory is created if it does not exist. Default is processors.

Scripts

Scripts are implemented using IronPython and support Python v3. Both the MTConnect Entity to process and the MTConnect Agent are accessible from the script.

Example 1

Change the Result for a DataItem with a Type = "EMERGENCY_STOP"

def process(observation):

    if observation.DataItem.Type == 'EMERGENCY_STOP':

        result = observation.GetValue('Result')

        if result.lower() == 'TRUE'.lower():
            observation.AddValue('Result', 'ARMED')
        else:
            observation.AddValue('Result', 'TRIGGERED')

    return observation

Example 2

Change the Result for a DataItem with a Type = "PATH_FEEDRATE_OVERRIDE" from a Percentage to an Integer by multiplying by 100

def process(observation):

    if observation.DataItem.Type == 'PATH_FEEDRATE_OVERRIDE':

        result = float(observation.GetValue('Result'))
        observation.AddValue('Result', result * 100)

    return observation

Example 3

Add a new TimeSeries observation for any time a DataItem with an ID = "L2p1Fact" changes

import clr
clr.AddReference("MTConnect.NET-Common")
import MTConnect.Input

def process(observation):

    if observation.DataItem.Id == "L2p1Fact": 

        timeseries = MTConnect.Input.TimeSeriesObservationInput()
        timeseries.DataItemKey = 'L2p1Sensor'
        timeseries.SampleRate = 100

        n = 15
        samples = [0] * n

        for x in range(n):
            samples[x] = float(x)

        timeseries.Samples = samples

        observation.Agent.AddObservation(observation.DataItem.Device.Uuid, timeseries)

    return observation

Limiting which DataItems a script receives

process is called for every observation the Agent receives. A script that only handles some DataItems can declare them, and the processor then skips calling it for every other observation:

# Only call process() for these DataItem Types and/or IDs (either list is optional)
data_item_types = ['EMERGENCY_STOP', 'PATH_FEEDRATE_OVERRIDE']
data_item_ids = ['L2p1Fact']

def process(observation):
    ...
    return observation

A script whose process function raises an error 10 times in a row is disabled until the script file changes.

Contribution / Feedback

  • Please use the Issues tab to create issues for specific problems that you may encounter
  • Please feel free to use the Pull Requests tab for any suggested improvements to the source code
  • For any other questions or feedback, please contact TrakHound directly at info@trakhound.com.

License

This application and its source code is licensed under the MIT License and is free to use.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 is compatible.  net462 is compatible.  net463 was computed.  net47 is compatible.  net471 is compatible.  net472 is compatible.  net48 is compatible.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on MTConnect.NET-AgentProcessor-Python:

Package Downloads
MTConnect.NET-Applications-Agents

MTConnect.NET-Applications-Agents contains classes to fully implement an MTConnect Agent application. Supports MTConnect versions up to 2.7. Supports .NET Framework 4.6.1 up to .NET 10

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
7.2.0.105 137 11/21/2026
7.2.0.105-prerelease 124 11/21/2026
7.2.0.103-prerelease 137 11/20/2026
7.1.0.1-prerelease 62 9/13/2026
7.0.0.2-prerelease 246 6/26/2026
7.0.0.1-prerelease 60 9/13/2026
6.9.0.2 755 10/16/2025
6.8.0 296 9/13/2025
6.7.0 284 6/22/2025
6.6.0 429 1/18/2025
6.5.1 324 12/3/2024
6.5.0 392 10/21/2024
6.4.7 319 8/21/2024
6.4.6 288 8/7/2024
6.4.5 254 8/2/2024
6.4.4 312 7/16/2024
6.4.3 310 6/14/2024
6.4.2 334 6/12/2024
6.4.1 289 5/17/2024
6.4.0 334 5/14/2024
Loading failed