LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Simulink and Labview communication via TCP/IP

Hi guys,i am trying to send a sign wave from Simulink to labview but it doesnt seem to be sending.Is it possible to send data to labview via tcp/ip?I cant use the SIT cause i dont have installed.I have attached screen shots of the Simulink and Labview,please have a look and see if i have missed or neglected anything.Your input is appreciated.Thanks

 

Osowoaji

Download All
0 Kudos
Message 1 of 30
(7,540 Views)

Please look at the TCP examples to understand how the communication should work.  One end of the connection needs to open the port and listen for a connection (a server).  The other end opens a connection to that port (the client).  It appears that both your Simulink and LabVIEW programs are attempting to act as a client with no server listening for the connection, and in this case they will not establish a connection to each other.

0 Kudos
Message 2 of 30
(7,525 Views)

Hi Nathand and thanks for your reply.I am using simulink as the server and labview as the client.The simulink TCP/IP send block i dont think has the listen,wait for connection blocks(vis) like Labview.

0 Kudos
Message 3 of 30
(7,519 Views)

Nathand,by clicking on the 'verify address and port connectivity' under the sink block parameter:TCP/IP shown in the screen shot attached earlier it does the following;

 

Check if the specified remote address is correct.

Establish connection with the specified remote address and port

0 Kudos
Message 4 of 30
(7,517 Views)

@osowoaji wrote:

Hi Nathand and thanks for your reply.I am using simulink as the server and labview as the client.The simulink TCP/IP send block i dont think has the listen,wait for connection blocks(vis) like Labview.



@osowoaji wrote:

Nathand,by clicking on the 'verify address and port connectivity' under the sink block parameter:TCP/IP shown in the screen shot attached earlier it does the following;

 

Check if the specified remote address is correct.

Establish connection with the specified remote address and port


These two statements are unlikely to both be true.  If Simulink were acting as a server, you wouldn't need the "verify address and port connectivitiy" option because it would be sitting waiting for a connection, not trying to establish one, nor would it require a remote address since other systems would connect to it.  Based on that dialog box it looks to me like Simulink expects to be a client.  Also, it's the server that opens a listener, so without that, there's no way the Simulink system can be the server.

0 Kudos
Message 5 of 30
(7,513 Views)

Hi osowoaji,

 

To get a little bit of background, firstly I'd like to ask why you are using Simulink to generate a sine wave? Looking at your Simulink model in the screenshot, this could as easily be achieved by:

Sine to graph.png

 

Secondly regarding using TCP/IP with LabVIEW, examples from the example finder may greatly assist you. If you go to  help, find examples; then search for TCP/IP there's examples available including Data Client & Data Server.

This VI snippet shows the Data Client:

Data client.png

 

 

Looking into Simulink, it appears that you'd need the Instrument Control Toolbox.

 

According to the data sheet for this toolbox, it supports both sever & client functionality for TCP/IP.

 

Examples also exist for using Simulink to send and receive TCP/IP data.

 

Let me know if this answers your questions,

 

Kind regards,

 

 

Tori
Student
0 Kudos
Message 6 of 30
(7,485 Views)

Thanks Tori for your assistance.Firstly, i want to model a tank system in simulink and use labview as the user interface of the tank system.So i am trying simple task at moment sending data via tcp/ip between labview(labview-labview),simulink(simulink-simulink) that is why i am using simulink to send the sinewave.I am continueing this by now trying to send a sinwave from simulink and receive it in labview which is the problem i am having right now as they both dont seem to communicate.I have the instrument control toolbox installed but its still not working

0 Kudos
Message 7 of 30
(7,479 Views)

Hi Osowoaji,

 

Thanks for the update.

 

Did sending data from LabVIEW to LabVIEW work? And did sending data from Simulink to Simulink also work? Is it just when you try to send data from one to the other that you see issues?

 

Kind regards,

Tori
Student
0 Kudos
Message 8 of 30
(7,475 Views)

Correct Tori,Laview-Laview worked both on the same computer and on two computers.Simulink also worked on one computer as i dont have it installed on another computer to try on different computers.So the issue now is trying to send from simulink to labview.Nathand who replied earlier advice to have one software listening and opening a port for a connection as from my screenshot both simulink and labview were acting as clients.I have added create listener and wait on listener vis on my labview side but this is still not working.One problem i think is that my simulink model is not running continuously so labview cant establish a connection.Now i am trying to make the simulink run continuously and see if i both would connect but i am now getting this error message when i run labview  saying "LabVIEW:  The specified network address is currently in use.".

0 Kudos
Message 9 of 30
(7,470 Views)

This is currently being done on one computer not different computers

0 Kudos
Message 10 of 30
(7,467 Views)