03-18-2015 10:28 AM
Thanks for the suggestions.
Actually, what I am doing is trying to read the XML data from the TCP/IP server.
Each XML string has values from tip, sleeve, pressure and temperature.
I need to read the string approximately 3 times in a second.
I am not sure if the way I am using the match pattern is working or not? Is it reading all the data correctly or not?
Thanks
03-18-2015 10:37 AM
I also tried the parsing method. But it keeps on giving me the Error shown in the screenshot.
I am not sure if its due to schema or something else?
Thanks
03-18-2015 11:14 AM
Your code may miss samples. It will do this if the packet you read has more then one sample of a particular kind. If there are two pressure values then your code will miss the second one.
Match pattern only returns the first match. To find later matches, you have to take the string past match output and search it again.
From this end it is hard to decide what to suggest since I don't know much about the XML string from the server. Hopefully there is some information in the XML or the way it sent to you that would help this process. For instance do you always get four values everytime you read from the socket? Are the packets always the same size or smaller? and so on.
Knowing nothing, I would take a brute force approach. I would assume that this is a continuous stream of XML data. That subsequent packets are to be appended to the end of packets I have already read. That the breaks between packets may happen in the middle of a string instead of helpfully at the end of a section or a line.
I would read a packet and place it in a string shift register. I would search it for each of the four kinds of data. For the kind closest to the beginning of the string, I would parse out the data and then discard that section of the packet. (The part up to and including the match.) Repeat with the other three searches. Get another packet and append it to whatever string you have left. Repeat the search on this string. Loop indefinitely.
Does that make sense?
03-18-2015 01:39 PM
Each packet will have one value each for tip, sleeve, pressure and temperature.
Would it still miss any points?
03-18-2015 01:59 PM
I think so, presumming that it can keep up with the data rate. Since the data rate is 3 times a second it should have no problem.
An obvious way to tell is to run it for an hour or so and count how many points are in the stream. If you get a count consistant with 3 samples per second then you code is working. If not, you will know there is a problem.
03-19-2015 01:25 PM
Manny09,
Can you give us an update?
I hope everything worked out fine.
In the mean time I'm working on getting solid documentation on XML and examples but I haven't had much luck, just basic stuff. Although it seem that the match patter function will only return a value, it will make sense to me that if you use a shift register or another method that, let's call it , "repeats the last action" which was get a match patter, and do that 3 times on intervals of x number of seconds it might work. I will keep on searching in the mean time.
If you have further questions regarding this issue please let me know.
Sincerely,
Siggi D.
AE
03-19-2015 01:34 PM
I just tested the match pattern with my system. So far it looks good.
I am just reading 3 samples per channel each second, so I think its safe to use the match pattern.
But I will try some more tests and let you know how it goes.
Thanks