LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sending an output in LabVIEW to Simulink as an input

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

0 Kudos
Message 1 of 37
(5,476 Views)

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!

Rhys
Applications Engineer
National Instruments
0 Kudos
Message 2 of 37
(5,465 Views)

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!

Tanya Visser
National Instruments
LabVIEW Group Manager
0 Kudos
Message 3 of 37
(5,439 Views)

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?

0 Kudos
Message 4 of 37
(5,429 Views)

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.

21311i70340C90E14287E9

You can then write your data to it that way.

Tanya Visser
National Instruments
LabVIEW Group Manager
Message 5 of 37
(5,410 Views)

YES! Thank you! This is what I've been looking for actually.

0 Kudos
Message 6 of 37
(5,406 Views)

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.

0 Kudos
Message 7 of 37
(5,306 Views)

Hi tebu,

 

What do you mean by the control doesn't update? Does it not update when you write to the value property?

Tanya Visser
National Instruments
LabVIEW Group Manager
0 Kudos
Message 8 of 37
(5,285 Views)

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.

0 Kudos
Message 9 of 37
(5,280 Views)

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!

Tanya Visser
National Instruments
LabVIEW Group Manager
0 Kudos
Message 10 of 37
(5,243 Views)