I have been told that PI Interface or sth can map the array variable into scalars, but I don't know how-to. Could somebody tell me that?
Please see documentation:
PI Interface for OPC DA
Thank you very much, Brent. I am new to PI products and didn't know which document explains what I want to know. I'll take a look at them.
Now I am expecting an OPC array that has 13 elements and whose data type is VT_ARRAY | VT_R8. I attempted to define the two first elements in AF via PI System Management Tools.
I set UserInt1 to 1 and 2 for the points corresponding to the two elements, location 2 to 5 as the data type is VT_R8, location 3 to 0 as they are polled data, location 4 to 199 so as to impose the same scan class to the points; however the PI system still couldn't read the values from OPC, displaying "Pt Created." What else could I do to fetch the OPC values?
I've made it, thank you.
location 2 => 8 is desirable
location 3 => left 3 when polled data
location 4 => "scan class" is a tricky concept but this column should be filled an integer such as 3 or 4, up to 200.
userint1 => this's directly related to the index of elements in an array.
exdesc => this field can be left blank.
instrmenttag => should be kept identical for an OPC array.
I'm glad to hear you got it working!
Can you check your location3 setting? In your previous post, you said it was 0 for polled tags, which is correct, but in the last post you said it was 3.The scan class should correspond to one of the scan classes that is configured for the OPC DA interface (similarly, location1 should correspond to the ID of the interface and the pointsource should match the pointsource of the interface). As you correctly mentioned, all tags getting data from the same OPC array object should be in the same scan class. A couple of other notes on scan classes:
1. Scan class 1 of the OPC DA interface is always reserved for advise tags.
2. Never mix polled and advise tags in the same scan class.
These articles are good reading if you want to learn more about setting up OPC DA scan classes:
Thank you for all your kind support. The value of location3 was fortunately 0 and the former '3' was a typo. As far as I understand, it works but some sets of arrays do not return values but 'Pt Created.' Is there any effective way to debug this? I am manually checking OPC server and all the instrument tag or so again and again...
So far, there's almost no difference in options for variables that return values and ones that do not return values. The sets of arrays have different scan classes but a group of variables in an array have the same scan class.
I have attempted to correct location4 scan classes for variables that do not return values to scan classes for ones that return values. For instance, I had array 1 to 4, each of which has 13 elements, and only array 1 and 2 returned values. Scan classes for array 1 and 2 were 3 and 4 respectively; ones for array 3 and 4 were 5 and 6. Then, after the scan classes were changed to 3 and 4 for array 3 and 4, the array 3 and 4 now started to return values. This phenomenon confuses me because I don't understand what exactly affects PI Point access to OPC array.
I'd say we are at the point where a call to Tech Support would be the best way to resolve this quickly.
Keep in mind that in order to capture any item within an array, the first index needs to be queried in the same OPC Group (by default, that means the same scan class).
To define a PI point to contain an element from an OPC array, specify the ItemID of the array item in the instrumenttag attribute and set userint1 to the index number of the element in the array. You must define a PI point for the first array element (userint1 = 1), even if you do not require its data. However, you do not need to define points for all array elements, only for the first array element and any individual elements of interest. If an array tag from the OPC server is read into multiple PI points, each PI point receives the value of the array element indexed by the userint1 setting and the same time stamp and quality, because an array contains multiple values but only one time stamp and quality. To read an OPC array tag into a single PI point, you must use the TimeArray plug-in, which stores an array of values into a single PI point as successive data values, incrementing the time stamp that came with the array by a configured interval for each value. For details, refer to the TimeArray plug-in manual. All PI points configured for an OPC array must have identical settings for pointsource, location1, and location4 (and userint2, if they are event points). For advise points, set location3 to 1. For polled points, set location3 to 0. When configuring PI points to read OPC arrays, note the following: • You must define a point that reads the first array element. • Assign the points to the same scan class. • To optimize CPU usage, do not use the same scan class to read more than one OPC array. • If you need to read the same OPC array element into more than one point, you must assign the points to different scan classes.
In general, it is much easier to keep each array in their own scan class. OPC classic does not work so well with multiple arrays in the same group. Some OPC Servers do not behave as expected when requesting multiple arrays in the same group, so in that case, it may be a good idea to put each array in its own scan class.
The interface itself really does not care. As long as you ask for the first index, it will get the entire array, then distribute it to each item with userint>1
Retrieving data ...