cppagent icon indicating copy to clipboard operation
cppagent copied to clipboard

Building An Adapter

Open sdstncl opened this issue 3 years ago • 5 comments

Anyone got any advice on building their own adapter? Right now I'm trying to build one for a local machine and it's not going great.

sdstncl avatar Aug 16 '22 15:08 sdstncl

An adapter us host a socket server that streams pip delimited data starting with a timestamp and followed by key value pairs (for simple cases).

An adapter can be written in as little as 5 lines of ruby or python and we have some examples on GitHub.

What are the specific issues?

  • W

On Aug 16, 2022, at 08:54, sdstncl @.***> wrote:

Anyone got any advice on building their own adapter? Right now I'm trying to build one for a local machine and it's not going great.

— Reply to this email directly, view it on GitHub https://github.com/mtconnect/cppagent/issues/257, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJ6BCKHJ2FPV6LR5PKNA5DVZO2SRANCNFSM56WLSLBA. You are receiving this because you are subscribed to this thread.

wsobel avatar Aug 16 '22 16:08 wsobel

Currently, I'm trying to create an adapter that will utilize Modbus to read registers and upload the values that they read. I've attempted to utilize NModbus, which I've read is useful for doing Modbus stuff in C#. However, it seems that NModbus utilizes a different .NetFramework (Version 4.0) compared to the .NetFramework that the dot_net_sdk solution file uses, so that's dead in the water. Checking the MTConnect github again, there is an adapter repository that seems to have created a Modbus adapter, however I'm not exactly sure how I should go about modifying the file to suit my needs. I don't mean for this to come off as whining, I'm just not exactly sure what needs modification in these files and what doesn't. I've already managed to create a MTC agent and a modified XML file to suit my needs. I'm also fully aware that I may just be looking at the wrong files

sdstncl avatar Aug 16 '22 16:08 sdstncl

@sdstncl For simplicity, can you spin up NodeRed and install the modbus node?

The flow would look something like this:

image

Once you can read data using a TCP client, we'll move into structuring the data as SHDR and managing heartbeat.

MRIIOT avatar Oct 03 '22 13:10 MRIIOT

@sdstncl

Here are some alternatives:

JS https://github.com/Ladder99/ladder99/tree/main/services/adapter

.NET https://github.com/TrakHound/MTConnect.NET (used in Fanuc-Driver https://github.com/Ladder99/fanuc-driver/blob/main/fanuc/transports/SHDR.cs)

MRIIOT avatar Oct 03 '22 18:10 MRIIOT

Ladder99 uses NodeJS - the latest branch is here - https://github.com/Ladder99/ladder99/tree/historian/services/adapter.

An example that reads an autoclave status - https://github.com/Ladder99/ladder99/blob/historian/services/adapter/src/drivers/autoclave/cpc.js. It writes to a cache that checks if a value changed before outputting SHDR to the agent.

We're on version 0.8. Docs are here - https://docs.ladder99.com.

bburns avatar Oct 03 '22 19:10 bburns

If there is no more discussion I will close this issue.

wsobel avatar Aug 18 '23 07:08 wsobel

Closing the issue

wsobel avatar Oct 19 '23 22:10 wsobel