How to use a C# DLL in an S-Function for a Real Time application
3 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
采纳的回答
Jan Houska
2013-8-14
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!