08-10-2010 04:10 AM
Hi,
I'm trying to send the output from LabVIEW to Simulink so that it can be use as an input there.
Currently, I'm using SIT to connect Simulink and LabVIEW but atm I could only controlled the Simulink input and received its output to LabVIEW. I wanted to make a closed loop network where I use the output of Simulink that has been send to LabVIEW as an input to some function I created in LabVIEW.. then, I wanted to send the result of that function back to Simulink and display it there or use is as an input for another function in Simulink.
Do anyone know how you could do that? Preferably using SIT.
Thanks
08-10-2010 04:47 AM
Hi there Tebu.
I'm afraid this is not an available mapping in SIT, because SIT is pulling inputs and outputs from Simulink into LabVIEW, and what you're discribing is the other way around. With SIT, you can only map LabVIEW controls to Simulink controls, and indicators to indicators.
Essentially, what's needed in your case is MATLAB to call into LabVIEW and grab the value you need. SIT works by calling into a DLL that contains the Simulink controls and indicators, so I imagine that MATLAB would need to call into a DLL in LabVIEW to do the same thing. You would need to create a DLL with the LabVIEW variables you want MATLAB to be able to use and create a wrapper DLL for it so MATLAB can recognize the data types.
I'm afraid I dont have any good examples to give at the present time, but I'll get back to you if I turn up anything useful!
08-11-2010 04:20 PM
Hi tebu,
Data gets passed back and forth between your model and your LabVIEW program via the controls and indicators. Your LabVIEW 'output' will need to be written to an indicator. You may need to modify the LabVIEW code that SIT scripts if you need more control over how the data is passed between your model and your LabVIEW VI.
I hope this helps!
08-11-2010 11:54 PM
If I mapped the LabVIEW output to indicator, I would not be able to map it to the control in Simulink. Do you have any examples that I could look at for changing the SIT scripts?
08-12-2010 04:24 PM
Hi tebu,
You could instead write the data to a control by using a property node.
1. Create a property node for your control by right-clicking it from the block diagram.
2. Select Create»Property Node»Value.
3. Right-click the property node and select Change All to Write.
You can then write your data to it that way.
08-12-2010 04:35 PM
YES! Thank you! This is what I've been looking for actually.
08-29-2010 04:49 PM
hi, i thought this was the solution but after further testing, apparently.. it wont work as the control now behave like an indicator. it wont change it value even though the data is changing in labview.
08-30-2010 02:48 PM
Hi tebu,
What do you mean by the control doesn't update? Does it not update when you write to the value property?
08-30-2010 03:17 PM
I had the mention control connected to a constant in Simulink via Simulation Interface Toolkit (SIT). and my reason why I need it to update itself is I want the output from a function LabVIEW to be send back to Simulink and use as an input there. The problem I had with above solution is eventhou the LabVIEW output changing, the value of the control that just stays at the same value as in the constant in Simulink. It acts and function more like an indicator rather than a controller.
08-31-2010 12:40 PM
Hi tebu,
I'll still need a bit more clarification. How are you writing data to the control? Could you post a snippet of code to illustrate what you have currently tried? Any visual or more indepth explanation of what you see and what you want to see would be a big help!
Take care!