LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Simulink generated c code to DLL Labview

hello,

 

Is there a way to convert a c code generated from Simulink model into a DLL to be used in Labview without using the module interface tool?

 

thanks

0 Kudos
Message 1 of 8
(5,949 Views)

Model Interface Toolkit (MIT) was released with LabVIEW 2013. If you're looking to work with models in LabVIEW 2012 or earlier you will need to use Simulation Interface Toolkit (SIT) instead. 

 

If you just mean to ask if you can develop your own code to take the place of MIT the answer is yes, but it will take a lot of development on your part. We script the way the model DLL is built in order to allow us to use the same function calls of any model DLL to run it.  You would need to develop your own method for hooking into a DLL/.OUT file to successfully use it in LabVIEW. I'd recommend weighing the additional development time (at your level of expertise) against the cost of Licensing for MIT.   

 

MATLAB®, Simulink®, and Real-Time Workshop® are registered trademarks of The MathWorks, Inc.  All other trademarks are the property of their respective owners.

Applications Engineer
National Instruments
CLD Certified
0 Kudos
Message 2 of 8
(5,911 Views)

Thanks. What about just deploying a c code in labview? Is that possible?

0 Kudos
Message 3 of 8
(5,900 Views)

With the according Matlab tools that can generate a DLL you should be able to incorporate such a DLL through the Call Library Node. However without some good C knowledge this tends to be a very painful exercise.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 4 of 8
(5,895 Views)

Don't forget that you don't have to rely on the c-code version of the simulink model, and that you can import the .mdl file directly (with the MIT). The success of the conversion depends upon the exact nature of the original model - e.g. discrete or continuous time, graphical or s-function, and how you want to realise the final model, e.g. within LabVIEW's CD&SIM or in some more primative construct (e.g. timed loop for discrete model).

 

We did a model conversion where the original model was s-function based, and the easiest way was just to copy the various parts of the s-function into several appropriately connected Mathscript nodes within LabVIEW.

Consultant Control Engineer
www-isc-ltd.com
0 Kudos
Message 5 of 8
(5,839 Views)

Andy, I believe you may have SIT and MIT confused. SIT (2012 and prior) did allow you to use the SIT server to run your .MDL files remotely, but that functionality has not been brought into MIT. 

 

MIT is only able to load models that conform to NI VeriStand Model Framework header file (NIVERISTAND_API.h). Which can be completed by a variety of IDE's, LabVIEW included. 

Applications Engineer
National Instruments
CLD Certified
0 Kudos
Message 6 of 8
(5,808 Views)

Zach - you are right that we have only used SIT, but I was not talking about running the mdl files remotely (i.e. requiring Matlab to be available), rather we used an import feature to convert the model in the mdl file into a native CD&SIM model. I thought that this import feature was still available using the MIT. Please correct me if I've got that wrong. Thanks,

 

Andy

Consultant Control Engineer
www-isc-ltd.com
0 Kudos
Message 7 of 8
(5,800 Views)

Ah, you're talking about the Model coverter tool in CD&SIM. More info here: http://zone.ni.com/reference/en-XX/help/371894G-01/TOC8.htm

 

Yes, the Control Design and Simulation toolkit opens up a lot of other avenues. As I mentioned before, LabVIEW can be used to build Models for MIT, most simulation models in LabVIEW are made using CD&Sim. So, by extension you could pull your .mdl file into CD&Sim and then use CD&Sim to build a model to be used by MIT. By itself though, MIT is not able to use .mdl files. The functionality you've mentioned is a part of CD&Sim. 

 

MATLAB®, Simulink®, and Real-Time Workshop® are registered trademarks of The MathWorks, Inc.  All other trademarks are the property of their respective owners.

Applications Engineer
National Instruments
CLD Certified
Message 8 of 8
(5,784 Views)