Using WonderWare to Ping an IP address

SandwichMagic

Member
Join Date
Jun 2015
Location
Central California
Posts
96
Hey Everybody. I am an intern at a production facility in our integration department. One of my major projects this summer has been the development of a Wonderware Intouch application for our office that displays status information of every PLC in the plant connected to our network (about 70). This has so far been a great success, even preventing a bit of downtime from a tripped breaker or two. Recently we had an ethernet switch failure, which was quite a big deal as you can imagine. While it should be pretty obvious there is a switch problem (that being that all the PLCs connected to a switch drop out at the same time) the kind of end goal for this application isn't really to help us up here, but to eventually put another thin client running the same app in the maintainence shop. For this reason, I am trying to make it as user friendly as possible so we don't have to jump through hoops to know what is down and where.

My boss has discussed with me about creating a button in our application for each ethernet switch, where when you push the button it will ping the ethernet switch and display something (a light, piece of text, or some form of indication) if you get a reply. I suppose my question is can this be done? My boss said something about changing something to HTML but I wanted some advice from experts before I dive off the deep end and mess up my application (I've already had to rebuild it once, not too interested in having a third go). I have searched the site and google, and the only result I have come up with has been a link that looked all sorts of sketchy, to the point of where I dont even want to investigate.

I seem to have misplaced the paper that I wrote down the version information, but I am pretty sure this was Intouch version 10.6 with Archestra IDE version 3(ish?). I will provide exact version numbers if they prove necessary.

Thanks to anyone for any input!

Regards,
SandwichMagic
 
You can use WW to initiate a windows ping, but WW, itself, cannot ping. Why not use a heartbeat status so that you don't have to manually click a button? A heartbeat will give constant status for each of your controllers.
 
Won't be able to setup a heartbeat with an ethernet switch, only the plc's connected to it.

We use archestrA scripting in .NET to use windows ping to each of our switches - just setup a periodic script that runs once a min. or whatever time interval you want. We have ours pinging our switches once every min with no problems, then alarm it if it does not respond after 3 ping attempts.
 
Thanks for your reply.

I am already using a heartbeat for each of the processors themselves, that infromation is displayed graphically in the app. I just need a system to determine the status of a switch on our network.

You can use WW to initiate a windows ping

That would be pretty satisfactory. Is there any more information that you can give me on this?

Thanks again.
 
Won't be able to setup a heartbeat with an ethernet switch, only the plc's connected to it.

We use archestrA scripting in .NET to use windows ping to each of our switches - just setup a periodic script that runs once a min. or whatever time interval you want. We have ours pinging our switches once every min with no problems, then alarm it if it does not respond after 3 ping attempts.

Excellent, that sounds exactly like what I am looking for! I am looking into .NET right now on the web. Is there more information about this in the WW help files? I might be back for some help in the scripting but I'm all about learning.

Thanks again.
 
If you can initiate ping through a system call, you might be able to use a redirection symbol like this: Ping 192.168.1.1 >> c:\ping.txt then use a file function to examine the size of the file - it will be different for failed vs. successful response.

edit: it may be a single redirection symbol instead of double:
ping yada=yada > c:\ping.txt

one of them appends to the file, the other overwrites an existing file.
 
Last edited:
I suppose I misunderstand, I am not incredibly familiar with some of the terminology. I thought that ArchestrA works alongside InTouch? That's why I listed them seperately in my OP.

haha, and so you did! My apologies as I missed that part of your post. You could create a ping to your switch using VB.NET code, as he suggested and this is probably your best bet. I would have it run continuously, or at least semi-scheduled so you always have a status without needing to click a button to test it.
 
If you can initiate ping through a system call, you might be able to use a redirection symbol like this: Ping 192.168.1.1 >> c:\ping.txt then use a file function to examine the size of the file - it will be different for failed vs. successful response.

edit: it may be a single redirection symbol instead of double:
ping yada=yada > c:\ping.txt

one of them appends to the file, the other overwrites an existing file.

So essentially I would be using ArchestrAs VB capabilities to ping an ip, then copy the results to a text file, and then reading the size of the file. I then would use that size of the file and write that value to a tag, and then use that tag to display whether I got a reply or not? Please let me know if there was something I missed.

This sounds like a daunting task, but a really really cool one. Im quite new with visual basic scripting (only did a touch of basic in highschool) so I might be back with another question, but I definitely am going to look into it. One question I can think of right now is that for each switch (there are 20) I would have to have a different txt file, right? Otherwise if I overwrote the old text with the new, then the old tag would have incorrect values. Not that that is a problem, just trying to think things through a little bit.



haha, and so you did! My apologies as I missed that part of your post. You could create a ping to your switch using VB.NET code, as he suggested and this is probably your best bet. I would have it run continuously, or at least semi-scheduled so you always have a status without needing to click a button to test it.

I think that pinging it every once in a while sounds fine, I just have to clear it with my boss. This app really was a thing that he never had time to finish, and he had a vision of how it should be. Each PLC is grouped by switch, and the headers telling you which switch it is are buttons that dont do anything right now. He wanted it to ping them when you clicked the switch, but I can probably make a case for auto pinging.
 
You can even create a batch file to do the pinging and redirection, then use the VB capabilities to examine the file size.

I opened a CMD prompt on my laptop and entered :
Ping 192.168.99.99 > ping.txt
there is no device with that address on my network and it created a file sized 222 bytes (took nearly 20 seconds to complete).

Then I pinged my router the same way and it created a file sized 447 bytes.

If the VB capabilities provide for discovery of file size or attributes possibly, you can use that to determine success or failure..
 
You can even create a batch file to do the pinging and redirection, then use the VB capabilities to examine the file size.

I opened a CMD prompt on my laptop and entered :
Ping 192.168.99.99 > ping.txt
there is no device with that address on my network and it created a file sized 222 bytes (took nearly 20 seconds to complete).

Then I pinged my router the same way and it created a file sized 447 bytes.

If the VB capabilities provide for discovery of file size or attributes possibly, you can use that to determine success or failure..

So far through research I have found how to start command prompt through WW and how to read the size of a file, and with you help (thanks, by the way) I know how to write it from command prompt to a text file. The only piece missing from the puzzle is getting it to run the ping with the correct IP and file name without me having to type it in. I will look into batch files and see what I can come up with. I really appreciate the help!
 
I don't like to use the root of the hard drive but if there aren't too many things you plan on doing there I make an exception. The root is nice because it cuts down on having to ensure you have the correct folder delimiter - some languages require a backslash, some require two and some require a forward slash.

So, for multiple IP addresses, just make multiple batch files which each pipe the ping results to individual files.

You can use windows explorer to create a text file with nearly exactly what I described earlier and when you're finished, just change the extension from .txt to .bat.
 
I don't like to use the root of the hard drive but if there aren't too many things you plan on doing there I make an exception. The root is nice because it cuts down on having to ensure you have the correct folder delimiter - some languages require a backslash, some require two and some require a forward slash.

So, for multiple IP addresses, just make multiple batch files which each pipe the ping results to individual files.

You can use windows explorer to create a text file with nearly exactly what I described earlier and when you're finished, just change the extension from .txt to .bat.

You are the man! I was a little confused at first because cmd prompt didnt give me its usual spiel when I ran the batch file. It opened and then it just closed, but then looking through my documents, sure enough, I found "ping.txt" with the information from command prompt! Man, I just love that feeling of getting stuff to work. I imagine that I can route where it writes the file to? For instance, say that I wanted to write it to a folder called "switch pings" or something else, I would just follow that directory and have the filname it writes be the same? Also if I try and execute it twice with different results will it overwrite the old file with the new one? I'm sure that these are questions that I will run into when I start doing it, but I'm just thinking out loud I guess. Once again, can't thank you enough!

EDIT:

I don't like to use the root of the hard drive but if there aren't too many things you plan on doing there I make an exception. The root is nice because it cuts down on having to ensure you have the correct folder delimiter - some languages require a backslash, some require two and some require a forward slash.

Oops, if I had read this statement a little more carefully, I would have inferred that you can in fact route it. I don't think that it's necessary to, but I think that it would be handy to have that in once neat place.
 
Last edited:
Easy enough within the batch file to point to a specific directory (folder):
ping 192.168.1.1 > "c:\switch pings\ping 1.txt"
note the double quotes surrounding the destination because there are spaces in the folder and/or filename.

If you were to use a double pipe like '>>' instead of the single '>' then it would append to the file. Single pipe '>' overwrites the file.

I was actually referring to the VB (or other) code and the function calls needing the single or double backslash being finicky and you having to play with that to get it to work but probably not an issue.

Now, I have not played around with it much more than I have described in this thread although I did do virtually the same thing many years ago to test a router which seemed to like to disconnect at odd times, then using a USB connected I/O board, I cycled power to the router. The point being this - there may be other incarnations of the ping results that could occur that would generate different results. You may want to create a log file to record the resulting file sizes so you can review and determine that you always get similar results.
 

Similar Topics

Hi; In my O/G facility we are using Wonderware Intouch ver 9.5 for SCADA. We need to automate the process of exporting realtime process values for...
Replies
2
Views
2,542
Hey guys, I'm working on an existing system where the old programmer (from like 25 years ago) used a bunch of conditional scripts in Wonderware...
Replies
2
Views
1,801
https://www.theregister.co.uk/2018/01/15/meltdown_ics/ Here's another thread with an RSWho issue...
Replies
1
Views
2,078
I am building a new galaxy for a customer and I am trying to test things as I go. All my Ethernet PLCs are OK, but I have a test PLC5 in my...
Replies
1
Views
2,171
I operate a distillation column for Argon gas. It has a pressure controlling valve that cools a condenser at the top of the column with nitrogen...
Replies
4
Views
2,282
Back
Top Bottom