How to use a C# DLL in an S-Function for a Real Time application

4 visualizaciones (últimos 30 días)
I have a problem using a C# DLL (which I don´t have the root code) in a S-function in Simulink. I tried with a simple call using "addNetAssembly", but since it is not a valid "C++" command, it didn´t work.
I then looked for a way of implement code from C# in C++, so I created a C# Wrapper code that I compiled for a COM use. I made my tests in Visual Studio and then came back to my S-Function and it worked well.
The problem appears when I switched to external use for Real Time Work Shop with Real Time Windows Targe(RTWT), because I load my COM with the command line #import, and the compiler for RTWT (OPEN WATCOM)did not accept it. I have been thinking in some ways to solve the problem, but I don´t want to lose myself in so many languages. Are there others ways to do what I´m trying here? Are there other ways to run a real time application with no physical devices connected than Real Time Windows Target? Thanks in advance and forgive my short experience :D.

Respuesta aceptada

Jan Houska
Jan Houska el 14 de Ag. de 2013
You cannot use C# or any other language that requires .NET in real-time code. This is not because of Open Watcom, but because of the .NET code not being able to run in real time (with guaranteed execution time).
You should be able to use your S-function in Real-Time Windows Target Normal Mode, available from Release 2012a. This is probably the best you can do if you want to run your model in real time. There is no chance you can compile any .NET code for any real-time target running in External Mode.
  1 comentario
Martin
Martin el 14 de Ag. de 2013
Thanks for your time and advice, I´ll try what you said and hope to find an acceptable result.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Introduction to Installation and Licensing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by