02-18-2011 01:17 AM
Hi;
I have a question about the Simulation Interface Toolkit and would appreacite any answer.
I have an application where my labview code is interfaced with my simulink model. In my labview code, I can enter inputs into my simulink code using labview control blocks just fine. Now I need to do something else: instead of using labview control blocks to send inputs to my simulink model, I would like to use a different labview vi. More specifically, I have a labview code which generates data and stores them in a real time FIFO, and now I would like read the stored data and send it to my SIT generated code. Could you please explin how to do this?
Thank you very much!
Best Regards
02-21-2011 11:14 AM
Could you clarify how you are running your LabVIEW code, and your Simulink® model? Are you running all of this code on a Desktop PC, or are you running a portion of your code on a Real-Time controller?
If you can transfer your input values via Shared Variables, you'll be able to pull values from other code via Shared Variables and assign those values to the mapped controls.
I hope this helps,
02-23-2011 11:50 PM
Hello Fred;
Thank you very much for your response.Below is the details of my application:
In my application, I have a Simulink model that I developed in my host machine. I deploy the DLL version of this model (I used RealTime Workshop for the conversion) into a NI PXI machine to run the code in real time. I monitor the data coming from the DLL model using SIT. Again, SIT provides the connection between the PXI and the host machine. My simulink model accepts RS232 signals coming from my sensors that are connected to my PXI machine.
My original problem was not being able to send the RS232 signals into my model but I evenutally found out how to do this. To get the RS232 signals, I custimized the driver.vi created by SIT by adding my custom code into the write sequence structure of the IO BASE RATE LOOP.vi as shown in http://zone.ni.com/reference/en-XX/help/371504F-01/lvsithowto/sit_h_customdrivervi/.
However, this approach failed when I tried to read the content of a real time FIFO in the read sequence structure. The content of the real time FIFO is created by a seperate vi running in the same PXI machine. This seperate vi reads the RS232 signals, works on them, and then writes it to a real time FIFO. Once again, I am trying to read the content of this FIFO in the read sequence structure in the IO BASE RATE LOOP.vi of the SIT generated
driver vi.(Please see the attached pictures from my code)
Do you have any idea why this approach fails? For some reason, the FIFO seems to be not visible to IO BASE RATE LOOP.vi.
I would really appreaciate any answer.
Best Regards,
02-25-2011 11:29 AM
You should be able to use RT FIFO to transfer data between VIs on the RT controller. Do you get a particular error when you try to run your code?
Could you try to use a Single-Process shared variable with RT FIFO enabled, and see if that allows you to transfer data, or if that experiences the same problem?
If you aren't able to get this running, I would be curious to try and reproduce the issue. What version of LabVIEW, and MATLAB® are you using?
Kind regards,
03-02-2011 11:30 PM
Yes you were right. The RT FIFO approach worked just fine.
Thank you