Trouble Getting Data From a Modicon PLC With Unity Developer's Edition
Industry Automation and Control Forum
This forum is addressing industrial automation design & engineering, operations, asset performance, cyber security and digital transformation for Plants & Machines.
Send a co-worker an invite to the portal.Just enter their email address and we'll connect them to register. After joining, they will belong to the same company.
You have entered an invalid email address. Please re-enter the email address.
This co-worker has already been invited to the Exchange portal. Please invite another co-worker.
Please enter email address
Send InviteCancel
Invitation Sent
Your invitation was sent.Thanks for sharing Exchange with your co-worker.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2023-04-2712:45 PM
Trouble Getting Data From a Modicon PLC With Unity Developer's Edition
Hello,
I am writing a .NET 6 console application that uses the Unity Developer's Edition (UDE) COM API to automate some Control Expert features. So far I have successfully used UDE to connect to a Modicon M340 PLC over TCP/IP, transfer the PLC's project to my PC, and save the project to my hard drive as an STU file. Next I am trying to save the PLC's data to my PC with UDE's IProject::SaveDataFromPLC method, but this method consistently returns an error.
The error is a System.Runtime.InteropServices.COMException that contains no information other than a hexadecimal error code: 0xE8A72CED. I could not find any information about this error code online. Microsoft's Error Lookup Tool returns the following:
# No results found for hex 0xe8a72ced / decimal -391697171 # anonymous HRESULT: Severity: FAILURE (1), Facility 0x8a7, Code 0x2ced # for hex 0x2ced / decimal 11501 WSA_PNRP_CLOUD_NOT_FOUND p2p.h # 1 matches found for "0xE8A72CED"
From my googling, WSA_PNRP_CLOUD_NOT_FOUND is related to peer-to-peer networking, but because the Error Lookup Tool says there were no results found for the full hex, I am unsure whether WSA_PNRP_CLOUD_NOT_FOUND is relevant.
My console application is written in C#, and I worry that I am passing invalid arguments to IProject::SaveDataFromPLC. Here is the method I wrote that takes the Control Expert project and a file path as arguments and invokes IProject::SaveDataFromPLC to save the project's data to the file path:
This method is invoked after acquiring the write token to the project and saving the project STU to my hard drive. The error occurs in this method on the line that invokes project.SaveDataFromPLC.
Any advice on things I may be doing wrong or on other available methods to automate saving the data from a Modicon M340 PLC would be greatly appreciated.