LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Transferring data to simulink

I have two simulink Models that I am working with using LabView.  Basically, both of the simulink models are dependent to each other in a sense.  It is obvious how I can transfer the data to LabView using NiSink.  I do not know if this is the approach I need to take though because this outputs to a waveform chart.  The data being a waveform, would be considered a 2d array.  Well, my row would be given with respect to time, and the two colums are, one Resistance and two Inductance.  I have developed a block in simulink that calculates the equivalent Impedance from an entering voltage and current.  This Impedance Equivalent is what I am transferring to LabView in the form of a chart using NiSink.  Now that is my FIRST model sending data to LabView.  Also, for the array of data, I do not the whole array.  I really just need the last data points at the end of the calculation time interval.  Now those two numbers i.e. R=0.34 and I=0.000314 I need to be transferred some how to model TWO.  These two numbers are now going to be the resistance and inductance for model TWO.  Model TWO's RLC branch is variable and depends on the calculated values in Model ONE.  These values are going to vary after each time step.  I tried using the three hour tutorial to gather some thoughts on how to approach this and they did not help enough.  Would use please recommend a tactful approach?
0 Kudos
Message 1 of 4
(2,912 Views)

The best way to implement this kind of application would be to place both simulink models into one larger model.  For example, you could create a subsystem from the second model and then place the subsystem into the first model.  You can still display the values you want to see in LabVIEW by wiring the NI Sink to the appropriate place on your model, but you'll also send those values to the subsystem.  Will that work  for you?  If not, are you running the models through the SIT Server or are you deploying them as dlls that you plan to call in LabVIEW Real-Time?

Regards,

Kristi H

National Instruments

0 Kudos
Message 2 of 4
(2,888 Views)
I am sorry but that will not work for me.  The whole purpose of this is to communicate to two separate models(systems) over TCP/IP.  I figure though if I can communicate and send data back and forth with one computer then it would just be a matter a changing the IP address.  I want the two systems, while separated, to act as one.  For instance, there will be a controller at TAMU and One system will be at CalTech and the other half(system) will be at U of H.  So what I am thinking is I need to send the data from Simulink to LabView for the First Systems. and from LabView to Simulink second system.  Does that make sense?
0 Kudos
Message 3 of 4
(2,885 Views)
You should certainly be able to do that as well.  You will need to take the VIs created by the Simulation Interface Toolkit (SIT) and modify them a bit to add the TCP communication you need.  As a first step, try creating some simple TCP programming between the two machines you have running the SIT VIs.  This will help you eliminate any issues with security that may prevent you later from communicating between the two systems. 
 
In LabVIEW, go to Help->Find Examples.  In the Search tab, type "tcp/ip" and a list of examples will appear.  The Simple Data Client.vi and Simple Data Server.vi will be good for this purpose.  Run the Simple Data Server on one of the systems first and then run the Simple Data Client on the remote machine to make sure they can communicate.  You may want to reference the following tutorial as well to set this up.
 
If you are deploying the SIT created VIs onto a Real-Time System, you'll probably want to reference the below document.
 
I hope this helps.  Please let us know if you have more questions.
 
Regards,
 
Kristi H
0 Kudos
Message 4 of 4
(2,874 Views)