Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
This Document is not yet Rated  Rate this Document

Calling Multiple Model DLLs Simultaneously with Simulation Interface Toolkit

Primary Software: LabVIEW Toolkits>>Simulation Interface Toolkit
Primary Software Version: 2.0
Primary Software Fixed Version: N/A
Secondary Software: N/A

Problem: I currently have Simulation Interface Toolkit v2.0. I have two DLLs, test40.dll and test36.dll, where the former has 40 output ports and the latter has 36. The MathWorks, Inc Simulink® software generated test40_base.vi and test36_base.vi for these dlls, as expected. I have a main initialization VI that calls both of these _base VIs. However, I have noticed that depending on which of the 2 VIs gets called first, the behavior changes. It appears that if test40_base VI is called first, the test36_base VI also initializes with 40 ports. And if I initialize test36_base VI first, it will sometimes crash LabVIEW.

Solution: This is expected behavior you are seeing because the SIT VIs, which are used in the _base VIs, are not reentrant. Thus, depending on which VI gets called first, the memory is allocated based on that. This the reason why the second VI initializes with the same number of ports as the first VI. This is also why LabVIEW crashes when you initialize test36_base VI first, since then test40_base VI tries to use 36 allocated ports in memory for 40 ports that it actually needs.

In other words, if you are calling the SIT VIs simultaneously for different DLLs, you need to make the SIT VIs reentrant. So you need to go through the _base VIs (or whichever generated VIs you are using), and double-click on each of the SIT VIs, such as SIT Initialize Model (no server).vi, etc, and make them reentrant. You can make them reentrant by going to File»Properties»Execution and check the Reentrant execution parameter.

This will allow you to use the same SIT VIs to call and initialize different DLLs.

Simulink® is a registered trademark of The MathWorks, Inc. Other product and company names listed are trademarks and trade names of their respective companies.

Related Links:

Attachments:





Report Date: 05/13/2004
Last Updated: 11/03/2005
Document ID: 39CCD4DS

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit