First, let's discuss the structure of the AFValues and AFValue object in PI AF SDK.
- AFValues: holds a list of AFValue
- AFValue: contains the following properties
I am trying to visualize what your requirement is. From the code provided above, it looks like each VesselData should hold all the values for 1 PI tag/AF attribute. Is this correct? If so, what would be the desired structure for VesselData? Right now, I see
- ParameterValues (which is a collection of ParameterTag)
One thing I noticed is that since there is only a single timestamp property, you are overwriting the timestamp in each loop through sIdObjVal. Is only the last timestamp important? If not, ideally, would you like a timestamp/value pair? If so, you might want to make changes to your VesselData class and associated code.
I see that you have a "wrapper" for the AFValue object. If this code will be reused, you can consider putting the logic behind building the new ParameterTag into a constructor for ParameterTag. Regarding looping through the AFValues and AFValue, I don't see a workaround to bypass this based on your current data structure.
Please let me know if I have sufficiently addressed your concerns. If not, can you let us know the specific questions you have?