Ask our Experts
Didn't find what you are looking for? Ask our experts!
Launch of Consumer/Home Owner registration process! We are pleased to announce the commencement of the Consumer/Home Owner Registration Process on Community. Consumers/Home Owners may now proceed to register by clicking on Login/Register. The process is straightforward and designed to be completed in just a few steps.
This forum is addressing industrial automation design & engineering, operations, asset performance, cyber security and digital transformation for Plants & Machines.
Search in
Link copied. Please paste this link to share this article on your social media post.
Posted: 2023-04-27 12:45 PM
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:
public virtual void SaveDataToDisk(IProject project, string resultDtxPath)
{
int[] saveDataParameters = { 1, 0, 511, 1, 0, 1023, 1, 1 };
object used;
project.SaveDataFromPLC(resultDtxPath, saveDataParameters, out used);
}
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.
Thank you!
Link copied. Please paste this link to share this article on your social media post.
You’ve reached the end of your document
Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.