I'm using Ignition to copy log file dumps from a Siemens controller. Ignition connects to the device via OPC UA, opens, reads, and copies the raw byte data to a server. This is all done through OPC Method calls and works properly. Below is a partial example of how I'm opening the file and reading data:
log.trace('Beginning Open Method for file %s'%(fileName))
payload['methodId'] = fileName + '.Open'#call open method
payload['inputList'] = [1]#pass the input parameter 1. This will give us a file handle id to use
resultsOpen = system.util.sendRequest(project, messageHandler, payload)#if the call was successful, the message handler will return an arraylist
log.debug('Open Output for %s is; %s' %(isolatedFileName, str(resultsOpen))) #otherwise, it will return a -1
if resultsOpen == -1:
raise OPCMethodOpenFailure#raise custom exception
else:
log.debug('Successful Open Method for file %s'%(isolatedFileName))
fileHandle = int(resultsOpen[2][0])#get the file handle integer
fileSize = system.opc.readValue('M044 MC30L', fileName+'.Size').value #this gets the file size. Needed for the read method call
log.debug('File Size for %s is %s'%(isolatedFileName,str(fileSize)))
log.trace('Beginning Read Method for file %s'%(isolatedFileName))
payload['methodId'] = fileName + '.Read'
payload['inputList'] = [fileHandle,fileSize]#pass the file handle and file size gathered above
resultsRead = system.util.sendRequest(project, messageHandler, payload)
log.debug('Read Output for %s is; %s' %(isolatedFileName, str(resultsRead)))
if resultsRead == -1:#file failed to read
raise OPCMethodReadFailure
elif len(resultsRead[2]) == 0:#file successfully read, but no byte data returned
log.warn('Read succeeded on file %s, but no byte data returned.'%(isolatedFileName))
continue
else:
log.debug('Successful Read Method for file %s'%(isolatedFileName))
Once the file is read, I need to invoke the 'delete' method to remove the file sitting on the OPC Server to clear space off the disk. For the above two method calls, I simply have to pass integers as input parameters when calling the method. However, for the delete call, the server requires a 'NodeId' data type as a parameter. Below is an example of the method call in UAExpert:
The NodeId type consists of 3 values; the NamespaceIndex, the IdentifierType, and the Identifier. How do I go about passing this non-intuitive datatype from an Ignition script as an input parameter? Thanks.