cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
markus
Level IV

Labview Connection

We are on the search for a direct labview connection. As it appears on MathLab that it is a TCP/IP exchange: https://de.mathworks.com/matlabcentral/fileexchange/42567-matlab-and-labview-data-exchange-over-tcp-...
Is it possible to create something similar for JMP or is it existing already? 

Thanks for help in advance!

Markus

1 ACCEPTED SOLUTION

Accepted Solutions
Craige_Hales
Super User

Re: Labview Connection

Looks like it should be possible. https://www.ni.com/en-us/support/documentation/supplemental/06/basic-tcp-ip-communication-in-labview... is a starting point for LabView ; it says "LabVIEW users can develop custom applications for TCP/IP communication. The programmer is responsible for developing both the client and the server."

I know very little about LabVIEW, so I can't help you on that end. It appears that you would use the LabView GUI to create a server that JMP could connect to for exchanging data. On the LabVIEW side that server would be responsible for gathering and sending data from your LabVIEW setup, and for receiving and dispersing data to your LabVIEW setup.

The server is not obvious (to me) in the link you provided, but it must exist. See https://www.vut.cz/www_base/zav_prace_soubor_verejne.php?file_id=125490 page 21 - that might be showing a server. It appears to have a listener (with an ear) and a transmitter (outbound arrow) and receiver (inbound arrow).

On the JMP end you'll be writing a JSL script using sockets. Recent versions of JMP >=15 have pretty good socket examples in the scripting index. You'll be writing code similar to the Java(?) code in the matlab example.

Save your JSL before running it; it is easy to get a socket to hang waiting on data the server is never going to send! You can set the JSL sockets to use non-blocking I/O (NBIO) to prevent the hang...you'll need to poll the socket.

It is possible to use UDP connections as well, and the unreliable part of UDP may be reliable enough on localhost. That could greatly simplify both ends.

The example you found makes it look like there must always be a bi-directional exchange, but I'm pretty sure that is just the way the example was written.

 

What time is it?  example of UDP socket

News Feed  example of creating a server in JSL (I'm suggesting the other way around, create the server in LabVIEW)

 

This is not "just going to work" the first time. Plan on learning a bit about TCP and sockets; when it doesn't work there is not a lot of indication what's wrong.

You might want to build a file-based prototype first. By saving a file to disk in LabVIEW and reading it in JMP (or the other way around, or both) you have a way to see what's happening. If it is fast enough, you could be done.

Craige

View solution in original post

1 REPLY 1
Craige_Hales
Super User

Re: Labview Connection

Looks like it should be possible. https://www.ni.com/en-us/support/documentation/supplemental/06/basic-tcp-ip-communication-in-labview... is a starting point for LabView ; it says "LabVIEW users can develop custom applications for TCP/IP communication. The programmer is responsible for developing both the client and the server."

I know very little about LabVIEW, so I can't help you on that end. It appears that you would use the LabView GUI to create a server that JMP could connect to for exchanging data. On the LabVIEW side that server would be responsible for gathering and sending data from your LabVIEW setup, and for receiving and dispersing data to your LabVIEW setup.

The server is not obvious (to me) in the link you provided, but it must exist. See https://www.vut.cz/www_base/zav_prace_soubor_verejne.php?file_id=125490 page 21 - that might be showing a server. It appears to have a listener (with an ear) and a transmitter (outbound arrow) and receiver (inbound arrow).

On the JMP end you'll be writing a JSL script using sockets. Recent versions of JMP >=15 have pretty good socket examples in the scripting index. You'll be writing code similar to the Java(?) code in the matlab example.

Save your JSL before running it; it is easy to get a socket to hang waiting on data the server is never going to send! You can set the JSL sockets to use non-blocking I/O (NBIO) to prevent the hang...you'll need to poll the socket.

It is possible to use UDP connections as well, and the unreliable part of UDP may be reliable enough on localhost. That could greatly simplify both ends.

The example you found makes it look like there must always be a bi-directional exchange, but I'm pretty sure that is just the way the example was written.

 

What time is it?  example of UDP socket

News Feed  example of creating a server in JSL (I'm suggesting the other way around, create the server in LabVIEW)

 

This is not "just going to work" the first time. Plan on learning a bit about TCP and sockets; when it doesn't work there is not a lot of indication what's wrong.

You might want to build a file-based prototype first. By saving a file to disk in LabVIEW and reading it in JMP (or the other way around, or both) you have a way to see what's happening. If it is fast enough, you could be done.

Craige