필터 지우기
필터 지우기

Compiling M files for dSpace

조회 수: 9 (최근 30일)
Kuan Tak
Kuan Tak 2011년 6월 10일
Hi,
I have implemented some controllers for my electrical ciruit using m files, when I tried to compile it or use with dSpace, I get the error message as follows:
*Error building Real-Time Workshop target for block diagram 'GridConnectedDSP'. MATLAB error message: Error using ==> tlc_new Error: File: C:\Program Files\MATLAB\R2008a\rtw\c\tlc\lib\utillib.tlc Line: 461 Column: 8 %exit directive: Real-Time Workshop Fatal in block: "GridConnectedDSP/Controller/Controller", block type "S-Function": MFile S-functions without a corresponding TLC file are not supported. You can inline your S-function (TKT_VIDG2U) by creating a TLC file for it. You can also remap your S-function to C by creating a corresponding C Mex source file and a TKT_VIDG2U.tlc file in the same directory as the MFile S-function which contains (on the first line): %% CallAsCMexLevel1 or %% CallAsCMexLevel2*
Is there a way to solve this problem? Really desperately looking for help. Thank in advance!

채택된 답변

Walter Roberson
Walter Roberson 2011년 6월 10일
I don't know if this 2002 discussion is still relevant, but possibly you just can't do that: see this
It is difficult to find useful information about dSpace on the Mathworks web site.
The message you are encountering means that somewhere in there you have a Level-2 S function that you are trying to generate code for, OR you are trying to generate code for a Simulink block that they did not provide compilation information for. In order to generate code for the missing piece, you have to provide a Target Language Compiler file.

추가 답변 (3개)

Arnaud Miege
Arnaud Miege 2011년 6월 10일
As Walter suggested, you can't generate C code from a MATLAB S-Function without writing a TLC file. See Generating Code from a Level-2 MATLAB S-Function in the Simulink documentation.
I would recommend using an Embedded MATLAB Function (now simply called a MATLAB Function in R2011a) instead, but you will need to restrict your code to using Functions Supported for Code Generation.
HTH,
Arnaud
  댓글 수: 2
Kuan Tak
Kuan Tak 2011년 6월 11일
Hi all, is there a way then to change my code or write the TLC files for my program? I am really at a loss. Thanks a lot for all the kind advices.
Arnaud Miege
Arnaud Miege 2011년 6월 13일
Either write your S-function in C or use an Embedded MATLAB Function as I suggested. My recommendation would be the latter.

댓글을 달려면 로그인하십시오.


Kuan Tak
Kuan Tak 2011년 6월 11일
Hi all, thanks a lot.

Kuan Tak
Kuan Tak 2011년 6월 11일
Hi all, is there a way then to change my code or write the TLC files for my program? I am really at a loss. Thanks a lot for all the kind advices.

카테고리

Help CenterFile Exchange에서 Simulink Coder에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by