LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Simulink and Labview communication via TCP/IP

Hi Osowaji,

 

Is there a specific delay each time on between the x-axes on your graphs?

 

Also would it be possible to please attach your LabVIEW coding for the SIT? Dependant on how your data is being read and then outputted to your graph, we may be able to use the "Build waveform" function and then adjust the t0 value on it.

 

Thanks,

 

 

Tori
Student
0 Kudos
Message 21 of 30
(1,666 Views)

There is no specific delay per say Tori.I have attached a screenshot of the scope from simulink together with the labview from panel.The simulation for the screenshot was set at 400s.Also find attached the Labview VI.Thanks

Download All
0 Kudos
Message 22 of 30
(1,663 Views)

Hi osowaji,

 

To avoid delay between your LabVIEW user interface and Simulink model, you would be best to build you Simulink model into a dll, using Simulink's real-time workshop as this would allow you to configure timing parameters.

 

There may be some delay caused by your VI waiting 50ms every time the loop runs. To check this, right click on the Wait (looks like a stopwatch) and then go to replace >> timing palette >> wait until next ms multiple. Let me know if this makes any diffference to the delay that you are seeing.

 

Kind regards,

 

 

 

Tori
Student
0 Kudos
Message 23 of 30
(1,651 Views)
Hi to Tori and thanks again for your reply.I will try what you have suggested but the problem really is the time on the time axis in labview.example if I simulate the model at 400 seconds,the scope in simulink shows the correct 400s but its not 400s in labview but rather 40s which does not show the correct result.the response is the same.even when I autoscale it still doesn't give the correct time.you can see what I mean from the sceenshot I attached of the simulink and labview graph placed side by side.thanks
0 Kudos
Message 24 of 30
(1,649 Views)

Hi Osowaji,

 

Looking at the coding, there's a chance the difference in time scales could be caused by a variety of factors such as different units or even the Timestamps data from your "Get current data" VI not being outputted to anything.

 

What I would recommend as the next step for you would be create a new Simulink model which just has your step input going straight to a scope, then reading this back in LabVIEW. Do you still have this same issue of different scales? And is it as noticeable?

 

Kind regards,

Tori
Student
0 Kudos
Message 25 of 30
(1,638 Views)

Hi Tori,thanks again for your assistance.I just tried what you suggested but its still the same.The y-axis(amplitude) is okay but the x-axis(time) is not.Find attached a screen shot of both the scope in simulink and the graph from labview simulated at 10 and 20sec so you see.Thanks

Download All
0 Kudos
Message 26 of 30
(1,634 Views)

Hi osowoaji,

 

I believe I can now see where the route of your issue may be occurring.

 

Please take a look at the example of using a LabVIEW user interface for your Simulink model. Near the bottom of this page, under the downloads header, there is a file entitled sine_wave.vi. I believe this may be what you based your own VI on.

 

 

If you take a look at the SIT_Indicator_Cases for loop, and the "0" case within that, you can see that the data being outputted into the sine wave output is showing a waveform data type, whereas your output only shows an array of doubles. The additional information that is being converted into a waveform by the VI before the for loop (has 2 orange and a blue wire going in) contains information both about the values but also regarding the timestamp.

 

I hope this is made clearer by the screenshot below:

VI Sinewave.png

 

 

As your coding is lacking the Timestamp sent by the Simulink code, this is likely to explain why your time axis do not match between LabVIEW & Simulink.

 

 

I have edted the sinewave example to match the user interface that you created. I have attached this for LabVIEW 2010.

 

Please let me know whether this works as expected.

 

Kind regards and best wishes,

 

Tori
Student
Message 27 of 30
(1,627 Views)

Hi osowoaji,

 

Attached for 8.5 as requested.

 

Thanks,

Tori
Student
0 Kudos
Message 28 of 30
(1,621 Views)

Hi Tori,i still could not open the 8.5 as it was asking for a particular add on but what i did was look at the block diagram(the edited one you sent) and added the missing vis to mine and its working fine now giving me the same time when i put both axis on auto scale.I cant thank you enough for your help.Thanks once again

 

Osowoaji

0 Kudos
Message 29 of 30
(1,619 Views)

Hi osowoaji,

 

Great to here that fixed the issue!! As mentioned before, as the timestamp information was lacking, LabVIEW was missing the information regarding the timing for the signal.

 

Best of luck with the rest of your application!

Tori
Student
0 Kudos
Message 30 of 30
(1,617 Views)