LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Simulink source block for sending values from a LabView VI to a Simulink Model?

Hello!
In the moment I am working with LabView and Matlab/Simulink. With the RT Workshop from Simulink it is possible to convert a Simulink Model into a Model DLL. And that Model DLL I can call in LabView through the Sit Connection Manager.  
My Problem is the following:
In Simulink there is a NISink block existing to connect it with a LabView indicator. But there is no "NISource" block in Simulink which I can use to establish a connection between a LabView control and an input in Simulink. So that means I cannot send a value from my LabView VI to the Simulink model. In the moment I can only recieve values from the Simulink model.
Is there anyone who can help me?
 
Perez
0 Kudos
Message 1 of 22
(5,310 Views)

You don't need a "Source" block.  Controls on your LabVIEW front panel link to parameters in Simulink blocks.  For instance, if you had a Constant block in your Simulink diagram, you could map the "Value" parameter of that Constant block to a Numeric control on your LabVIEW front panel.  If it's an array constant block, you can map its Value to an array control on your LabVIEW front panel.  If you have a Signal Generator block in your model, you can map its Amplitude, Frequency, Phase, etc. to controls on your LabVIEW front panel...all of these parameters should be visible in the parameter tree in the SIT Connection Manager (Tools > SIT Connection Manager).

Also, since you're using NI_Sink blocks, it sounds like you have version 2.0.x of the toolkit.  You should consider upgrading to the Simulation Interface Toolkit 3.0...with this new version of the toolkit, you no longer need NI_Sink blocks...you can map indicators on your LabVIEW front panel to the output of any block in your Simulink model.

Good luck,
-D

0 Kudos
Message 2 of 22
(5,308 Views)
Hello Darren!
Thanks for the information. But I had already tried this and then I always got an error message:
Warnung 14151 ist bei Occurred at SIT_RegisterWithServer.vi
Failure to register RegelstreckeDLL/Constant/Value aufgetreten
Mögliche Gründe:
Simulation Interface Toolkit:  Anmeldung fehlgeschlagen
 
So I don't know what I am doing wrong! If I don't create a Model DLL and just connect the Simullink Model to the LabView VI through the SIT Connection Manager I don't have any problems.
 
Yes, you are right I have got Simulation Interface Toolkit 2.0.3. So is it possible to upgrade this version to SIT 3.0 for free or do I have to pay for it? I have got the feeling that my SIT version is not compatible to my Matlab 7.1! That could be the reason of my problem.
 
Perez
 
0 Kudos
Message 3 of 22
(5,299 Views)

I just checked the SIT 2.0.3 readme, and it only supports MATLAB versions up to 7.0...that could explain why you're seeing this error.

I'm not sure if upgrading from SIT 2.0.3 to 3.0 is a paid upgrade...you can check with your local salesperson on that.

Good luck,
-D

0 Kudos
Message 4 of 22
(5,292 Views)

Thanks again for the information. I have already talked to a local salesperson and he will send a upgrade CD to me. And it will be for free

Bye.

0 Kudos
Message 5 of 22
(5,285 Views)

Hello!

Now I got the CD with SIT Version 3.0 and I also downloaded an upgrade for Labview 7.1 to update it to Version 7.1.1. After installing Version 7.1.1 it is said in the readme file that you should do a mass compilation in the Labview file. but something went wrong with this mass compilation, because I got some error messages.....

Has anyone experiences with updating the Labview Version 7.1?

 

Perez

0 Kudos
Message 6 of 22
(5,258 Views)
Perez,

Errors in some VIs are expected when doing Mass Compile on SIT 3.0, and this does not indicate a problem. These VIs are templates that SIT uses to make host and driver VIs for your model, so it is not bad that they don't work correctly on their own.

If you'd like to be absolutely certain, then please post the error messages you received and I'll take a look at them. Otherwise, SIT 3 ought to work fine.
Message 7 of 22
(5,251 Views)

Thanks for the information!

But after installing the upgrade I have got problems to build a Model DLL of a Simulink Model in the Real Time Workshop from Matlab/Simulink with the System Target File "nidll.tlc".

I always get the following error message in the Matlab command window:

### Creating C:\SimulationInterfaceToolkit\ModelInterface\\tmw\lib\rtwlib_sit.lib
 del C:\SimulationInterfaceToolkit\ModelInterface\\tmw\lib\rtwlib_sit.txt
C:\SimulationInterfaceToolkit\ModelInterface\tmw\lib\rtwlib_sit.txt konnte nicht gefunden werden
NMAKE : fatal error U1077: 'del' : Rueckgabe-Code '0x1'
Stop.
 
C:\Programme\MATLAB71\work\RegelstreckeDLL_nidll_rtw>echo The make command returned an error of 2 
The make command returned an error of 2

0 Kudos
Message 8 of 22
(5,234 Views)
Hello again,

I'm sorry you are having that issue.

Fortunately, it is easy to make it go away by making a simple change to one of the files that SIT 3 installs. Go to the C:\SimulationInterfaceToolkit\ModelInterface\tmw directory (if you installed SIT to a drive other than C, then use that drive letter instead). There is a file in that directory called nidll_vc.tmf. Open it in a text editor - for instance, you can right-click on the file, pick Open With... and select Notepad from the list.

Find the line in nidll_vc.tmf that looks like this:
del $(SIT_ROOT)\tmw\lib\|>EXPAND_LIBRARY_NAME<|_sit.txt
and change it to this:
-del $(SIT_ROOT)\tmw\lib\|>EXPAND_LIBRARY_NAME<|_sit.txt
(the only difference is the addition of the - character at the beginning).
Please notice that the very first character of that line in nidll_vc.tmf is a tab character; due to limitations of the 'make' program, it must be a tab character and not one or more spaces, so please don't change or remove the tab character.

By the way, this issue will be fixed in a future version of SIT. Again, I apologize for this difficulty and wish you good luck.

-Andrew
Message 9 of 22
(5,221 Views)
Thanks for the information again! Now I can convert successfully a Simulink Model into a Model DLL!
But I still have some problems! At first I always get a warning:
### Generating TLC interface API.
..Warning: Could not find an exact (case-sensitive) match for 'SIT_ModelNameInBlockPathToLower'.
C:\SimulationInterfaceToolkit\ModelInterface\tmw\SIT_modelNameInBlockPathToLower.m is a case-insensitive match and will be used instead.
You can improve the performance of your code by using exact
name matches and we therefore recommend that you update your
usage accordingly.  Alternatively, you can disable this warning using
warning('off','MATLAB:dispatcher:InexactMatch').
Is this warning important?
My aim is to establish a connection between my Host VI and the Model DLL through the SIT Connection Manager in Windows. But with Simulation Interface Toolkit 3.0 the model_main.vi is not created in the Realtime Workshop of Simulink. With the SIT 2.0 I had to start manually this model_main.vi, so that the Model DLL could run in Windows.
And if I open the SIT Connection Manager Dialogbox to create a communikation between a Simulink Model and my Host VI, I can't connect the Out1 block of the Simulink Model with an indicator of my Host VI.
 
 
 
0 Kudos
Message 10 of 22
(5,209 Views)