LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read data from instrument that sends XML files via ethernet?

Hello, I need some help for a project. I have various equipment for an experiment that was put togehter to work without a computer, just using some separate displays installed on a plastic box. Now I need to make them work using a computer with Labview (2017 Home and Student edition), which I know is not going to be easy. Any help is greatly appreciated, as I am relatively new to LabView.

 

I have a radiation detector, a Dual Area Monitor 375 by Ludlum Measurements Inc., which can be connected to a computer via ethernet connection. It is supposed to work with a specidic software sold separately, but I would like to read and record data from it with LabView. I have been told by customer support that it is technically possible to do it, so I just have to figure out how 🙂

 

The device itself communicates (read only) by sending a data message every 2 seconds in XML format, as explained in the manual.  Here is the structure of the data example they provide:

 

<?xml version="1.0" encoding="us-ascii" ?>

<area_monitor rev ="1.0" serial="12345">

  <status>

    <rate>9999.9</rate>

    <raw>9999999</raw>

    <units_code>99</units_code>

    <audio>1</audio>

    <alarm1>1</alarm1>

    <alarm2>1</alarm2>

    <over_range>1</over_range>

    <monitor>1</monitor>

    <error_code>9</error_code>

  </status>

</area_monitor>

 

Which functions should I use to acquire these files in real time and take the numbers that I need, so I can print them on a graph or store them in a file for later use?

 

Thank you very much for any help!

0 Kudos
Message 1 of 20
(5,764 Views)

First use TCP functions to read in the xml strings over Ethernet

tcp.png

Then use XML Parsing function to parse the data.xml parser.png

 

Omar
0 Kudos
Message 2 of 20
(5,733 Views)

 

The XML stuff can be tricky advise reading up on it.

www.w3schools.com/xml/

Especially XPaths

www.w3schools.com/xml/xpath_intro.asp

 

For LabVIEW this should get you started

xml.png

Omar
0 Kudos
Message 3 of 20
(5,725 Views)

Thank you for your fast and clear reply!

I found the functions you mentioned, will have a look at it and let you know

0 Kudos
Message 4 of 20
(5,717 Views)

Hi, I was looking at the functions and wanted to do things step by step, to be sure I'm getting it right.

So first i was trying to run a simple program with the purpose of getting this XML file "as is", and check if it matches the layout shown in the manual.  (See picture)

 

TCP_Test1.JPG

 

Unfortunately it looks like there is no signal coming, the whole thing just stops at the first block (TCP Listen), waiting for connection and then returning Error 56 after the 10 sec waiting time that I set, which seems strange to me.   The device is on and connected via ethernet cable, the connection on PC has been set properly and verified with the "ping" command in the Command Prompt. You are not supposed to do anything else, the detector just has the on/off switch, once it's turned on it should start to send data.

 

I was wondering if I'm using the wrong functions in LabView. I don't see any input for the IP address for example, I was just able to type the port, which I got from the network settings of the device (see figure).IP_screen.JPG

 

 

Any idea of what I'm doing wrong?

 

Thank you for your help

0 Kudos
Message 5 of 20
(5,692 Views)

The TCP Listen is for servers to wait for something to connect to it.  In this case, you are the client.  So use the TCP Open Connection instead.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 20
(5,688 Views)

Is your remote device trying to establish a connection on port 50000? Your remote device needs to make a connection to your server. In addition, once you do get a connection you are reading 0 bytes, so you will not get any data. The device must have some protocol for sending the data stream. You need to understand that protocol so you know how much data to receive. I realize that you said it will be sending XML, but generally there is something in the protocol to let the server know how many bytes of data are being sent. A common practice is to send 4 bytes which indicate the number of data bytes to follow. There your server would read 4 bytes first and convert this to a number. It would use that number in the next TCP Read to indicate how many bytes should be read. This process is repeated so that you can read all of the data.

 

However, we would need the specific details of the protocol the device is using.

 

I just noticed that your device is the server so your code will need to use TCP Open to establish a connection with the device.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 7 of 20
(5,686 Views)

Thank you, I tried the Open Connection as first, but I was getting (and am still getting) Error 63 ("The network connection was refused by the server"), so I thought I was using the wrong function. I just put the same port and added the IP address (which doesn't change anything, I tried also without)

0 Kudos
Message 8 of 20
(5,678 Views)

Are there any firewalls enabled between you and your device? This can cause problems connecting.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 9 of 20
(5,676 Views)

There is Windows Defender firewall on, plus another antivirus.   But if I am able to get an answer with the ping command, shouldn't the connection be working?

IMG_7689.JPG

 

 

 

0 Kudos
Message 10 of 20
(5,665 Views)