LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Discover cDAQ Ethernet

So I am going to make a system, where an unknown number of cDAQ-9188 devices will be on the network.  First I will give each chassis a unique static IP address by powering it up on a development machine one at a time.  Then I will be putting an unknown number of them on a network with a single PC.  That PC needs to be able to detect the cDAQ chassis on the network, and get their IP addresses.

 

At the moment if you plug in a chassis and go to MAX you can see what the IP address is.  I can then run a VI that looks for all devices on the system that have an IP address and then attempt an Add Network Device, and the resulting output can tell if that hardware is really there.

 

This all works fine on the development machine.  But I need to be able to do this without opening MAX.  And it will potentially be on a machine that has never even ran MAX before.

 

So finally my question.  How can I programatically discover the IP addresses, of ethernet controlled cDAQ chassiss without running MAX?  As a test I plugged in the chassis opened MAX then set the IP to 192.168.0.101.  It then showed up in MAX and I could perform the Add Network Device, and see if it was attached.  At this point I could disconnect the chassis, and then reconnect and my code worked fine.  I plugged in the chassis into another PC and changed the IP to 192.168.0.102.  I then plugged it back into the first machine and didn't run MAX.  I just ran the attached VI and it still is trying to add the 101 device, not the 102.  I assume this is because MAX last saw a chassis at 101, and this is the device it is trying to find instead of looking on the network to find the 102 device.  If I open MAX and look at the device under Network Devices, then run the VI it will now look for the 102 address.  I also tried running the system configuration tools using the Force Property Refresh but it still looks for the old IP not the new one.

0 Kudos
Message 1 of 11
(5,348 Views)

I would suggest using NI System Configuration - Find Hardware.vi with a filter to only return the devices that match the model you are looking for.  You should be able to find examples under the Hardware Input and Output/System Configuration if you want help getting started.

 

 

http://www.ni.com/download/ni-system-configuration-5.6/4517/en/

0 Kudos
Message 2 of 11
(5,340 Views)

@JoshuaP wrote:

I would suggest using NI System Configuration - Find Hardware.vi with a filter to only return the devices that match the model you are looking for.  You should be able to find examples under the Hardware Input and Output/System Configuration if you want help getting started.

 

 

http://www.ni.com/download/ni-system-configuration-5.6/4517/en/


This doesn't work.  I perform a search with no filter so that all my hardware would be found.  I then saw which one was my device and had it return a bunch of data on that device.  For some reason the IP Address read returns an error "The property does not exist for this resource."  VI Attached

0 Kudos
Message 3 of 11
(5,325 Views)

Okay I have a working solution but it is clunky and relies on external software.  The attached VI will run a command line program that is made to ping many IPs at the same time.  I tried using the command line Ping function but it took about 50 seconds to return the result of 100 pings, all set to 10ms timeout.  I also tried using the .Net Ping function but it too took about 50 seconds.  This command line call takes between 100ms and 600ms with the same settings.

 

So the idea is that I can run this VI with the range of IPs that I have my cDAQ chassis assigned to.  In this case it is 101 through 200.  Then the ones that get returned I can add using using the NI call knowing that there is a device on the network with that IP.  Anyone else have a better solution?

Message 4 of 11
(5,318 Views)

 

 


This doesn't work.  I perform a search with no filter so that all my hardware would be found.  I then saw which one was my device and had it return a bunch of data on that device.  For some reason the IP Address read returns an error "The property does not exist for this resource."  VI Attached




Well that seems like a bug.  Try using Find Systems.vi and set the device class to "DAQmx Device".  You can also configure how the system strings are returned by changing the input "Output (Hostname and IP)" to just "IP".

0 Kudos
Message 5 of 11
(5,925 Views)

I also figued out what was wrong with your Find Hardware example.  There is evidently 2 IP address property nodes.  One for NICs and one for devices.  You want this one.

 

Screen Shot 2014-04-15 at 10.16.16 PM.png

Message 6 of 11
(5,914 Views)
Message 7 of 11
(5,896 Views)

@JoshuaP wrote:

Give this a try.


Thank you so much for pointing out I had the wrong IP Address.  Even so the original issue I mentioned still exists.  If I plug in in and go to MAX and see the IP is something like 192.168.0.101.  Then plug it into a different machine, change it to 192.168.0.102, then plug it back into the first machine and run your code, then the IP address it looks for is still at 101.  Because of this it fails to add the device because of a network timeout.

0 Kudos
Message 8 of 11
(5,259 Views)

Are you sure it doesn't find the 102?  Depending on the timing I would expect it to potentially return both.  One with a status of connected and one labeled as disconnected.

0 Kudos
Message 9 of 11
(5,250 Views)

@JoshuaP wrote:

Are you sure it doesn't find the 102?  Depending on the timing I would expect it to potentially return both.  One with a status of connected and one labeled as disconnected.


Yup I'm sure.  I performed the steps I described (make 101, use it, make it 102 on another computer, try to find it using VI).  I let it set there for several minutes.  I could then ping the 102 and see it.  But the query returned only the 101.  Below is also my attempt to show that the device is really at 102 (the add device was successful) but the query only returns 101.

 

http://screencast.com/t/EDIkSalrEel

0 Kudos
Message 10 of 11
(5,244 Views)