Hello, can someone please assist with my application... An automation system collects 512 measurement points per sensor. Each measurement point has dedicated OPC tag which I can read using OpenOPC for Python. However, with multiple sensors, the OPC server can lag. So, the automation system programmer created an "array of floats" as quoted...
..."I pack the profile data into an array of floats (32 bit) which I store in the tag. You would see this as an array of 4*512 = 2048 Bytes, since the OPC server has no information on what type of data stores in an array-tag. Only the size is known, therefore you will get it as bytes. If you can easily address it as an array of floats (in C this is just a typecast of a pointer), you can give it a try. The data has byte alignment and it is stored in little endian format (Intel)."
My problem is that I do not have a clue how to properly import the array of floats into Python and use an array pointer to read/unpack the array. I tried the following code (results pasted in) which I think is just misapplication of a tupple...
ProfileArray = opc.read('QMS.Readings.TABRawProfileValues.0.DataArray') print ProfileArray (<read-write buffer ptr 0x03436140, size 2048 at 0x03436120>, 'Good', '08/24/10 10:12:35') print ProfileArray \ï print ProfileArray Good print ProfileArray 08/24/10 10:12:35
I have researched Python online and consulted one other forum which landed me here. I do not know where to focus next...struct? ctype? numpy?
Can someone please outline Python code that will handle the array of floats?