MTConnect.NET-SHDR
3.4.2
See the version list below for details.
dotnet add package MTConnect.NET-SHDR --version 3.4.2
NuGet\Install-Package MTConnect.NET-SHDR -Version 3.4.2
<PackageReference Include="MTConnect.NET-SHDR" Version="3.4.2" />
paket add MTConnect.NET-SHDR --version 3.4.2
#r "nuget: MTConnect.NET-SHDR, 3.4.2"
// Install MTConnect.NET-SHDR as a Cake Addin #addin nuget:?package=MTConnect.NET-SHDR&version=3.4.2 // Install MTConnect.NET-SHDR as a Cake Tool #tool nuget:?package=MTConnect.NET-SHDR&version=3.4.2
SHDR Adapters
Adapter classes to handle the SHDR Agent Adapter Protocol associated with the MTConnect Standard.
Overview
The ShdrAdapter class handles the TCP connection to the Agent. SHDR conversion is handled in each individual class:
- ShdrDataItem : Handles converting Events and/or Samples with a Representation of VALUE to the appropriate SHDR format.
- ShdrCondition : Handles converting Conditions to the appropriate SHDR format
- ShdrTimeSeries : Handles converting Samples with a Representation of TIME_SERIES to the appropriate SHDR format
- ShdrDataSet : Handles converting Events and/or Samples with a Representation of DATA_SET to the appropriate SHDR format
- ShdrTable : Handles converting Events and/or Samples with a Representation of TABLE to the appropriate SHDR format
The ShdrAdapterClient class handles the TCP connection to read from the Adapter and add data to an IMTConnectAgent class.
Usage
There are several different ways to setup and add data to the ShdrAdapter
Initialization
using MTConnect.Adapters.Shdr;
string deviceName = "OKUMA.Lathe";
ShdrAdpater adapter = new ShdrAdapter(deviceName);
adapter.Start();
Add DataItems Individually
// DataItemId and CDATA
adapter.AddDataItem(new ShdrDataItem("L2estop", "ARMED"));
// DataItemId, CDATA, and Timestamp
adapter.AddDataItem(new ShdrDataItem("L2estop", "ARMED", DateTime.UtcNow));
If no timestamp is given then the timestamp will be set when the DataItem is sent to the Agent. To insure that all dataitems have the same timestamp, it can be set explicitly.
Add List of DataItems
var dataItems = new List<ShdrDataItem>();
dataItems.Add(new ShdrDataItem("L2p1execution", "READY"));
dataItems.Add(new ShdrDataItem("L2p1Fovr", 100));
dataItems.Add(new ShdrDataItem("L2p1partcount", 15));
dataItems.Add(new ShdrDataItem("L2p1Fact", 250));
adapter.AddDataItems(dataItems);
Store DataItems in Variables
ShdrDataItem executionDataItem = new ShdrDataItem("L2p1execution");
ShdrDataItem feedrateOverrideDataItem = new ShdrDataItem("L2p1Fovr");
ShdrDataItem partCountDataItem = new ShdrDataItem("L2p1partcount");
ShdrDataItem feedrateActualDataItem = new ShdrDataItem("L2p1Fact");
executionDataItem.Value = "READY";
feedrateOverrideDataItem.Value = 100;
partCountDataItem.Value = 15;
feedrateActualDataItem.Value = 250;
adapter.AddDataItem(executionDataItem);
adapter.AddDataItem(feedrateOverrideDataItem);
adapter.AddDataItem(partCountDataItem);
adapter.AddDataItem(feedrateActualDataItem);
Use Models
The DeviceModel class can be used to add data to an ShdrAdapter by setting the properties of the DeviceModel and adding those Observations to the Adapter as shown below:
using MTConnect.Models;
using MTConnect.Observations.Events.Values;
DeviceModel deviceModel = new DeviceModel("OKUMA.Lathe");
deviceModel.Controller.EmergencyStop = EmergencyStop.ARMED;
adapter.AddDataItems(deviceModel.GetObservations());
Conditions
ShdrCondition condition = new ShdrCondition("L2p1system", ConditionLevel.FAULT);
condition.NativeCode = "404";
condition.NativeSeverity = "100";
condition.Qualifier = "LOW";
condition.Message = "Testing from new adapter";
adapter.AddCondition(condition);
TimeSeries
List<double> samples = new List<double>();
samples.Add(12);
samples.Add(15);
samples.Add(14);
samples.Add(18);
samples.Add(25);
samples.Add(30);
ShdrTimeSeries timeSeries = new ShdrTimeSeries("L2p1Sensor", samples, 100);
adapter.AddTimeSeries(timeSeries);
DataSets
List<DataSetEntry> dataSetEntries = new List<DataSetEntry>();
dataSetEntries.Add(new DataSetEntry("V1", 5));
dataSetEntries.Add(new DataSetEntry("V2", 205));
ShdrDataSet dataSet = new ShdrDataSet("L2p1Variables", dataSetEntries);
adapter.AddDataSet(dataSet);
Tables
List<TableEntry> tableEntries = new List<TableEntry>();
// Tool 1
List<TableCell> t1Cells = new List<TableCell>();
t1Cells.Add(new TableCell("LENGTH", 7.123));
t1Cells.Add(new TableCell("DIAMETER", 0.494));
t1Cells.Add(new TableCell("TOOL_LIFE", 0.35));
tableEntries.Add(new TableEntry("T1", t1Cells));
// Tool 2
List<TableCell> t2Cells = new List<TableCell>();
t2Cells.Add(new TableCell("LENGTH", 10.456));
t2Cells.Add(new TableCell("DIAMETER", 0.125));
t2Cells.Add(new TableCell("TOOL_LIFE", 1));
tableEntries.Add(new TableEntry("T2", t2Cells));
// Tool 3
List<TableCell> t3Cells = new List<TableCell>();
t3Cells.Add(new TableCell("LENGTH", 6.251));
t3Cells.Add(new TableCell("DIAMETER", 1.249));
t3Cells.Add(new TableCell("TOOL_LIFE", 0.93));
tableEntries.Add(new TableEntry("T3", t3Cells));
ShdrTable table = new ShdrTable("L2p1ToolTable", tableEntries);
adapter.AddTable(table);
SHDR Conversion
Conversion to and from an SHDR message is done through methods in the ShdrDataItem, ShdrCondition, ShdrTimeSeries, ShdrDataSet, and ShdrTable classes. Each class overrides the base "ToString()" method and also contains a "FromString()" method. The "ToString()" method creates an SHDR compatible string from the object and the "FromString()" creates an object from an SHDR string.
ShdrDataItem.ToString()
ShdrDataItem availableDataItem = new ShdrDataItem("L2avail", Availability.AVAILABLE, DateTime.UtcNow);
Console.WriteLine(availableDataItem);
2022-02-01T13:53:03.6940000Z|L2avail|AVAILABLE
ShdrCondition.ToString()
ShdrCondition condition = new ShdrCondition("L2p1system", ConditionLevel.FAULT, DateTime.UtcNow);
condition.NativeCode = "404";
condition.NativeSeverity = "100";
condition.Qualifier = "LOW";
condition.Message = "Testing from new adapter";
Console.WriteLine(condition);
2022-02-01T13:55:11.8460000Z|L2p1system|FAULT|404|100|LOW|Testing from new adapter
ShdrTimeSeries.ToString()
List<double> samples = new List<double>();
samples.Add(12);
samples.Add(15);
samples.Add(14);
samples.Add(18);
samples.Add(25);
samples.Add(30);
ShdrTimeSeries timeSeries = new ShdrTimeSeries("L2p1Sensor", samples, 100, DateTime.UtcNow);
Console.WriteLine(timeSeries);
2022-02-01T13:56:58.7700000Z|L2p1Sensor|6|100|12 15 14 18 25 30
ShdrDataSet.ToString()
List<DataSetEntry> dataSetEntries = new List<DataSetEntry>();
dataSetEntries.Add(new DataSetEntry("V1", 5));
dataSetEntries.Add(new DataSetEntry("V2", 205));
ShdrDataSet dataSet = new ShdrDataSet("L2p1Variables", dataSetEntries, DateTime.UtcNow);
Console.WriteLine(dataSet);
2022-02-01T13:58:31.8150000Z|L2p1Variables|V1=5 V2=205
ShdrTable.ToString()
List<TableEntry> tableEntries = new List<TableEntry>();
// Tool 1
List<TableCell> t1Cells = new List<TableCell>();
t1Cells.Add(new TableCell("LENGTH", 7.123));
t1Cells.Add(new TableCell("DIAMETER", 0.494));
t1Cells.Add(new TableCell("TOOL_LIFE", 0.35));
tableEntries.Add(new TableEntry("T1", t1Cells));
// Tool 2
List<TableCell> t2Cells = new List<TableCell>();
t2Cells.Add(new TableCell("LENGTH", 10.456));
t2Cells.Add(new TableCell("DIAMETER", 0.125));
t2Cells.Add(new TableCell("TOOL_LIFE", 1));
tableEntries.Add(new TableEntry("T2", t2Cells));
// Tool 3
List<TableCell> t3Cells = new List<TableCell>();
t3Cells.Add(new TableCell("LENGTH", 6.251));
t3Cells.Add(new TableCell("DIAMETER", 1.249));
t3Cells.Add(new TableCell("TOOL_LIFE", 0.93));
tableEntries.Add(new TableEntry("T3", t3Cells));
ShdrTable table = new ShdrTable("L2p1ToolTable", tableEntries, DateTime.UtcNow);
Console.WriteLine(table);
2022-02-01T13:59:47.5980000Z|L2p1ToolTable|T1={LENGTH=7.123 DIAMETER=0.494 TOOL_LIFE=0.35} T2={LENGTH=10.456 DIAMETER=0.125 TOOL_LIFE=1} T3={LENGTH=6.251 DIAMETER=1.249 TOOL_LIFE=0.93}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. 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 was computed. 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 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 is compatible. |
.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. |
-
.NETCoreApp 3.1
- MTConnect.NET-HTTP (>= 3.4.2)
- MTConnect.NET-XML (>= 3.4.2)
-
.NETFramework 4.6.1
- MTConnect.NET-HTTP (>= 3.4.2)
- MTConnect.NET-XML (>= 3.4.2)
-
.NETFramework 4.6.2
- MTConnect.NET-HTTP (>= 3.4.2)
- MTConnect.NET-XML (>= 3.4.2)
-
.NETFramework 4.7
- MTConnect.NET-HTTP (>= 3.4.2)
- MTConnect.NET-XML (>= 3.4.2)
-
.NETFramework 4.7.1
- MTConnect.NET-HTTP (>= 3.4.2)
- MTConnect.NET-XML (>= 3.4.2)
-
.NETFramework 4.7.2
- MTConnect.NET-HTTP (>= 3.4.2)
- MTConnect.NET-XML (>= 3.4.2)
-
.NETFramework 4.8
- MTConnect.NET-HTTP (>= 3.4.2)
- MTConnect.NET-XML (>= 3.4.2)
-
.NETStandard 2.0
- MTConnect.NET-HTTP (>= 3.4.2)
- MTConnect.NET-XML (>= 3.4.2)
-
net5.0
- MTConnect.NET-HTTP (>= 3.4.2)
- MTConnect.NET-XML (>= 3.4.2)
-
net6.0
- MTConnect.NET-HTTP (>= 3.4.2)
- MTConnect.NET-XML (>= 3.4.2)
NuGet packages (6)
Showing the top 5 NuGet packages that depend on MTConnect.NET-SHDR:
Package | Downloads |
---|---|
MTConnect.NET
MTConnect.NET is a fully featured .NET library for MTConnect Agents, Adapters, and Clients. Supports MTConnect Versions up to 2.3. Supports .NET Framework 4.6.1 up to .NET 8 |
|
MTConnect.NET-Applications-Adapters-SHDR
MTConnect.NET-Applications-Adapters-SHDR contains classes to fully implement an MTConnect SHDR Adapter application. Supports MTConnect Versions up to 2.1. Supports .NET Framework 4.6.1 up to .NET 7 |
|
MTConnect.NET-AgentModule-ShdrAdapter
MTConnect.NET-AgentModule-ShdrAdapter implements the SHDR protocol for use with the MTConnectAgentApplication class in the MTConnect.NET-Applications-Agents library. Supports MTConnect Versions up to 2.2. Supports .NET Framework 4.6.1 up to .NET 8 |
|
MTConnect.NET-AgentModule-HttpServer
MTConnect.NET-AgentModule-HttpServer implements a server for the MTConnect HTTP REST Protocol for use with the MTConnectAgentApplication class in the MTConnect.NET-Applications-Agents library. Supports MTConnect Versions up to 2.3. Supports .NET Framework 4.6.1 up to .NET 8 |
|
MTConnect.NET-AdapterModule-SHDR
MTConnect.NET-AdapterModule-SHDR implements the MTConnect SHDR Protocol for Adapter Applications. Supports MTConnect Versions up to 2.3. Supports .NET Framework 4.6.1 up to .NET 8 |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
6.5.0 | 565 | 10/21/2024 |
6.4.7 | 874 | 8/21/2024 |
6.4.6 | 525 | 8/7/2024 |
6.4.5 | 241 | 8/2/2024 |
6.4.4 | 465 | 7/16/2024 |
6.4.3 | 467 | 6/14/2024 |
6.4.2 | 314 | 6/12/2024 |
6.4.1 | 512 | 5/17/2024 |
6.4.0 | 288 | 5/14/2024 |
6.3.2-beta | 245 | 5/2/2024 |
6.3.1-beta | 377 | 4/24/2024 |
6.3.0-beta | 228 | 4/17/2024 |
6.2.2-beta | 267 | 4/5/2024 |
6.2.1-beta | 288 | 4/3/2024 |
6.2.0-beta | 260 | 3/27/2024 |
6.1.3-beta | 289 | 3/15/2024 |
6.1.2-beta | 265 | 3/15/2024 |
6.0.11-beta | 508 | 2/2/2024 |
6.0.10-beta | 447 | 1/26/2024 |
6.0.9-beta | 538 | 12/28/2023 |
6.0.8-beta | 496 | 12/27/2023 |
6.0.7-beta | 535 | 12/19/2023 |
6.0.5-beta | 606 | 12/14/2023 |
6.0.3-beta | 607 | 12/12/2023 |
6.0.1-beta | 690 | 12/7/2023 |
5.4.4 | 4,495 | 6/6/2023 |
5.4.3 | 2,806 | 5/20/2023 |
5.4.1 | 1,701 | 3/28/2023 |
5.4.0 | 1,737 | 3/20/2023 |
5.3.0 | 1,472 | 3/14/2023 |
5.2.0 | 1,580 | 3/5/2023 |
5.1.0 | 1,629 | 3/3/2023 |
5.0.0 | 3,744 | 2/3/2023 |
4.6.0 | 1,528 | 11/28/2022 |
4.5.0 | 1,662 | 10/18/2022 |
4.4.0 | 1,575 | 10/5/2022 |
4.3.0 | 1,596 | 9/20/2022 |
4.2.0 | 1,512 | 9/13/2022 |
4.1.0 | 1,498 | 8/30/2022 |
4.0.0 | 1,491 | 8/26/2022 |
3.4.2 | 2,062 | 6/20/2022 |
3.4.1 | 1,423 | 6/17/2022 |
3.4.0 | 1,256 | 6/16/2022 |
3.3.1 | 1,732 | 4/27/2022 |
3.3.0 | 1,293 | 4/13/2022 |
3.2.0 | 1,423 | 3/29/2022 |