Nono Posted December 6, 2008 Report Share Posted December 6, 2008 Hi everybody, I'm currently trying to control a Matlab/Simulink simulation using a nice LabVIEW interface, but I'm experiencing some trouble reading the values back. To make it simple, I send a numeric value using TCP write, Simulink processes it and then writes another numeric value back, which I read using TCP read. I only connect to my local machine (the IP address could be "localhost", the result would be the same). The returned value is then tested in order to display a particular picture according to it. (see attached subVI.vi) My problem is: if I don't test the value (e.g I delete the subVI), the returned value is displayed correctly on the graph. But since I added the subVI, after reading several values (a few dozens maybe), LabVIEW won't read anything else but zero... The data is updated by Simulink (I can monitor that in the model), but not read by LabVIEW. In the meantime, the control value sent by LabVIEW is read by Simulink, which means that the connection is still open... I attached a picture of the main VI, but I believe the problem to be located somewhere in the subVI... BTW I'm quite new to LabVIEW, and I'm sorry about the atrocities I might have coded in the VI If anybody has an idea about what could be wrong in my VI, please let me know, any help would be much apreciated ! Regards, Nono PS: I'm using LabVIEW 7.1 Edit : 2nd post : It's me again, I've done some more tests and It seems like the problem comes from the vi "read JPEG file" or maybe from "Draw Flattened Pixmap" or both. In fact, they are executed in the while loop, which slows down LabVIEW. Could someone tell me how to store a "picture" flow (output of Draw Flattened Pixmap.vi) in a local variable so that the reading files part could be done only once ? Thanks in advance, Regards, Nono Quote Link to comment
PJM_labview Posted December 6, 2008 Report Share Posted December 6, 2008 What you want to do is pre-load your images prior to really communicating with simulink (see screenshot). Attached is the code that do this. Download File:post-121-1228502405.zipLV 7.1 Enjoy PJM Quote Link to comment
Nono Posted December 9, 2008 Author Report Share Posted December 9, 2008 QUOTE (PJM_labview @ Dec 5 2008, 07:41 PM) What you want to do is pre-load your images prior to really communicating with simulink (see screenshot). Yes that's exactly what I wanted to do, thanks for your help PJM, your code works fine ! But I've still got a problem The value is read and displayed, but only about 7 seconds after MatLab sent it...There seems to be a refresh rate issue under LabVIEW. When I just read the value and display it on a graph without displaying a picture, LabVIEW gets it in "real time"...That's why I thought preloading the images would do the trick...But it looks like it was only a part of the problem... It looks like the execution of the "new picture" block requires enough processing time to delay the whole LabVIEW program (even though MatLab still works just as fast...). I tried to remove it and the graph display happened 2.5s after MatLab sent it. The problem is : I need it ! Do you know of any way to improve that kind of speed ? Regards, Nono Edit : I found a way to display the pictures within a very acceptable delay by using an 8-bit color table instead of a default 24-bit when reading the jpeg files... It's not exactly what I was dreaming of, but it's working...for the moment Still, if someone knows how to speed things up, please let me know ! Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.