AdvancedHMI Software
General Category => Support Questions => Topic started by: bosko1978 on May 25, 2015, 02:01:16 PM
-
Hello I'm reading an array of UDTs that has 7 DINTs (each one holds Year, month, day, hour, minute, second) and then a float for a value. This UDT is 1440 elements long. I need to read in all the values and then put them in a CSV file. I've got it all working except the fact that I can only get it to read as DINTs which makes my float value be split up. This also wouldn't be a huge problem since I can put it back together in VB.net. So that's the first problem. The second one is that I'm doing a read starting at GWTUVDAI_CV.LOG[0]. The read thinks that the number of elements is 1440 (which is actually the array size) but that doesn't include everything that's inside the UDT as well. So the length should be:
1440 * the length of each UDT which if we're using DINTs is 9 (7 for the DINTs and 2 for the float). The problem is the .Read() function won't let me read more than 1440 elements which means it's really only reading up to array element 160 and not reading my entire array. please have a look at my attachment.
thanks
-
The CLX driver cannot read complex data types directly. To read all of your elements in the UDT, you would have to read through each UDT element with a separate read like this:
Dim values() as string
For i=0 to 143
Values=EthernetIPforCLXCom1.Read("GWTUVDAI.LOG[" & i & "].DataTime[0]",7)
'* Convert and write to data file
Next
-
thanks Archie. That was what I immediately tried to do as well, however it doesn't work well because I get PLC not responding errors in at some random point in the for loop. I don't know if it's hitting it too fast or what... I tried adding a pause in between the reads of 200ms but it will still fail at times. Any other suggestions?
Edit: perhaps there is a way to extend the timeout?
-
What version of the software are you using?
-
I'm using 398j. It's completely random how many of the for loop iterations it will get through before it eventually gets a "No response from PLC" exception.
-
I tried to replicate this using this code:
Dim v() As String
For i = 0 To 1439
v = EthernetIPforCLXCom1.Read("Values[" & i & "].DateTime[0]", 7)
Console.WriteLine(i & "-" & v(0))
Next
It completed for me 3 times in a row. It took 22 seconds to complete, but it never errored.
Can you do a WireShark capture during the read? Do you have any other software communicating with the PLC? That code will send the next packet less than 1ms after the response form the previous was received, so its sending a lot of data quickly.
-
I'm installing wireshark right now. Yes there is a wonderware InTouch application talking to this PLC, and there's PLC to PLC communication going on as well. Is there a way to slow down other than the one I mentioned before? Is there a way to extend the timeout?
-
I'm new to wireshark. Is there any way to look just at the PLC comms, or any perticular steps for troubleshooting?
-
In the filter at the top, enter this:
ip.addr==192.168.0.1
with it being set to the IP address of your PLC
-
Wireshark will reveal what is truly happening, but my guess is either the PLC is being overwhelmed with requests and skips a response or the response is getting lost on the network.
One of the timeout periods is set for 15 seconds, so I doubt extending that would help.
-
Thanks Archie. I decided to do catch the error, and then retry in the code. That seems to work fine.
-
Thanks Archie. I decided to do catch the error, and then retry in the code. That seems to work fine.
That was going to be my recommendation if the WireShark capture showed missing responses.
How long is it taking to read all of the elements?
-
It takes upwards of a minute. I'm doing this over a WAN so I'm not surprised. Thanks again for your help and all your hard work in creating AdvancedHMI.