|
Hi,
I wrote a simple Level-1 M-File S-Functions, which I included in a
Simulink Diagram, and I tried to compile it with the Simulink Diagram
with RTWinTgt (Real-Time Windows Target) Toolbox Version 2.6
(R14SP3). I have used the rtwin.tlc System Target File, for the RTW
configuration.
The RTW gives a error in File: utillib.tlc Line: 403 Column: 8, and
in the Matlab Command Line prints the information about the TLC
Function Traceback.
I found that the error are generated by the File: simple_example.m
Line: 18 Column: 24. The change of the value of the sizes.NumOutputs
variable to 0, will produce no error in the compiling time. But with
this change the diagram lose the posibility to output the variable
and also gains some warnings.
sizes.NumOutputs = 0;
Please, Do you have some advice to solve this error correctly? Maybe,
I have to modify the RTWinTgt TLC Files, to make that the TLC files
work properly.
Regards,
Pedro Villena
**** - TLC Function Traceback ****
C:\MATLAB71\rtw\c\tlc\lib\utillib.tlc:SLibReportError(403)
C:\MATLAB71\rtw\c\tlc\lib\utillib.tlc:LibBlockReportFatalError(331)
C:\MATLAB71\rtw\c\tlc\blocks\gensfun.tlc:FcnGetAndCheckSFunctionType(1
23)
C:\MATLAB71\rtw\c\tlc\blocks\gensfun.tlc:BlockTypeSetup(370)
C:\MATLAB71\rtw\c\tlc\mw\commonpass.tlc(149)
**** - END TLC Function Traceback ****
*** RTW error ******************************************
Error: File: C:\MATLAB71\rtw\c\tlc\lib\utillib.tlc Line: 403 Column:
8
%exit directive: Real-Time Workshop Fatal in block:
"testxldde00/S-Function", block type "S-Function": MFile S-functions
without a corresponding TLC file are not supported. You can inline
your S-function (simple_example) 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 simple_example.tlc file in the same directory as
the MFile S-function which contains (on the first line):
%% CallAsCMexLevel1
or
%% CallAsCMexLevel2
*** simple_example.m ***********************************
01 function [sys,x0,str,ts] = simple_example(t,x,u,flag)
02 switch flag,
03 case 0,
04 [sys,x0,str,ts] = mdlInitializeSizes;
05 case 2,
06 sys = mdlUpdate(t,x,u);
07 case 3,
08 sys = mdlOutputs(t,x,u);
09 case 9,
10 sys = [];
11 otherwise
12 sys=[];
13 end
14 function [sys,x0,str,ts]=mdlInitializeSizes
15 sizes = simsizes;
16 sizes.NumContStates = 0;
17 sizes.NumDiscStates = 1;
18 sizes.NumOutputs = 1;
19 sizes.NumInputs = 1;
20 sizes.DirFeedthrough = 0;
21 sizes.NumSampleTimes = 1;
22 sys = simsizes(sizes);
23 x0 = 0;
24 str = [];
25 ts = [0 0];
26 function sys = mdlUpdate(t,x,u)
27 sys = u;
28 function sys = mdlOutputs(t,x,u)
29 sys = x;
|