TrakHound / MTConnect.NET

Fully featured .NET library in C# to build MTConnect Agent, Adapter, and Client Applications. Pre-built Agents with Windows Installers. Support for Windows and Linux. Supports MTConnect Versions up to 2.3. Supports .NET Framework 4.6.1 up to .NET 8
http://www.TrakHound.com
MIT License
96 stars 36 forks source link

Add Multiple Devices in Embedded MTConnect Agent #61

Closed smtpl-iiotian closed 3 months ago

smtpl-iiotian commented 5 months ago

@PatrickRitchie this is another great development of embedded mtconnect agent. I tested it for 1 machine and it worked as expected. I was able to route Mitsubishi CNC data to MTConnect agent. But I was only able to add 1 device in the protected override IDevice OnAddDevice() function.

Please guide how can I add x number of devices.

PatrickRitchie commented 5 months ago

Glad to hear you have found the embedded agent helpful. I intended for additional devices to be added by adding multiple configurations to the configuration file similar to below:

- haas-ethernet:
    deviceKey: VF2-01
    server: 192.168.1.101
    port: 5051

- haas-ethernet:
    deviceKey: VF2-02
    server: 192.168.1.102
    port: 5051

- haas-ethernet:
    deviceKey: VF2-03
    server: 192.168.1.103
    port: 5051

This will create an instance of the same module for each configuration.

Let me know if this works for you or if you have any other questions or recommendations.

smtpl-iiotian commented 5 months ago

@PatrickRitchie very much thanks. I was able to add x number of devices after configuration update.

smtpl-iiotian commented 4 months ago

@PatrickRitchie is there any provision in the embedded mtconnect agent to make the executable .exe as a windows service OR I have to do it manually?

PatrickRitchie commented 4 months ago

Yes, the embedded agent supports all of the standard command line arguments including "install" which will install as a windows service.

Command Prompt

YourAssembly.exe install

Note that you may need to run the command in a command prompt with Administrator privileges

https://github.com/TrakHound/MTConnect.NET/tree/version-6.0/agent/MTConnect.NET-Agent#usage

smtpl-iiotian commented 4 months ago

@PatrickRitchie, I tried to install published .exe as a windows service as per the above link and guide. I added serviceName in configuration file to add multiple windows services one for Mitsubishi and another for Modbus devices but it only gets applied as a Display name as seen in the Windows Process(image attached).

MTCService

The windows Service name remains the same as MTConnect.Net-Agent. So when I try to install Modbus.exe with admin privileges of cmd the earlier windows service Mitsubishi-MTConnect.Net-Agent gets replaced with Modbus-MTConnect.Net-Agent

MTCServicename Attached snippet of configuration file

Kindly guide, If I am going wrong

PatrickRitchie commented 4 months ago

See if this is fixed in the v6.4.1 Release.

I added serviceDisplayName and serviceDescription in the configuration file:

serviceName: Mitsubishi-MTConnect.NET-Agnet
serviceDisplayName: Mitsubishi MTConnect.NET Agent
serviceDescription: MTConnect Agent to read information from a Mitsibishi Machine

I also fixed an issue with passing a configuration file path when installing the agent as a service

Please let me know if this is still an issue or if you find anything else.

koturcu commented 3 months ago

@smtpl-iiotian Hello, I am trying to data collect from a Mitsubishi CNC machine and I am writing a thesis on this subject, can you help me? It was written on some sites that free data cannot be collected from Mitsubishi, is this true?

smtpl-iiotian commented 3 months ago

@PatrickRitchie apologies for late reply. It is working now.

smtpl-iiotian commented 3 months ago

@koturcu explore NC Communication SDK on https://www.mitsubishielectric.com/fa/download/software/search.page?mode=software&kisyu=/cnc It is not free as said.

koturcu commented 3 months ago

Thank you sir