"Steven Lord" <Steven_Lord@mathworks.com> wrote in message <email@example.com>... > > "Saravanan Mani" <firstname.lastname@example.org> wrote in message > news:email@example.com... > > Dear All, > > > > During simulation matlab has encountered on internal problem, I don't know > > how to resolve this issue, Please let me know how to resolve this issue. > > *snip most of the crash log file* > > > ------------------------------------------------------------- > > This segmentation violation occurred while executing the S-function > > 'SF_Comp_I_330_SWF_HVSMBWP' in block 'Composition_Signal_Test/S-Function > > Builder'. > > A common cause of this segmentation violation is an incorrect > > input port direct feedthrough setting. Each input port of the > > S-function that is read (accessed) in mdlOutputs and/or > > mdlGetTimeOfNextVarHit must specify that it needs its input > > signal in these routines by setting direct feedthrough for > > these input ports. > > 1) To debug your C-MEX S-function, you can enable diagnostics > > by compiling the S-function source with the -g flag, e.g., > > mex -g sfunction_name.c > > 2) You can ask Simulink to try assuming your S-function has > > direct feedthrough using: > > set_param('modelname','TryForcingSFcnDF','on') > > If Simulink can find a valid sorting mode that does not > > result in algebraic loops involving your S-function, your > > model will execute (assuming that the cause of this > > segmentation violation is an incorrect direct feedthrough > > setting on an input port). > > See matlabroot/simulink/src/sfuntmpl_directfeed.txt > > ------------------------------------------------------------- > > Did you try these two steps? If you don't know how to do so, or if you've > tried them and it hasn't resolved the problem, send your model and the crash > log file to Technical Support (see the instructions in my signature for how > to contact them.) > > -- > Steve Lord > firstname.lastname@example.org > To contact Technical Support use the Contact Us link on > http://www.mathworks.com
Dear Steve Lord,
Thanks for your reply, sorry for delaying.
I have tried those two methods for your reference Please see below.
>> mex -g SF_G11_I330_SW_F_wrapper.c LINK : error LNK2001: unresolved external symbol mexFunction C:\Users\qxf8933\AppData\Local\Temp\mex_W1PQbQ\templib.x : fatal error LNK1120: 1 unresolved externals
C:\PROGRA~1\MATLAB~1\BIN\MEX.PL: Error: Link of 'SF_G11_I330_SW_F_wrapper.mexw32' failed.
??? Error using ==> mex at 208 Unable to complete successfully.
set_param('UnitTest_BMW_MOD_FuSiLDFwp_G11_G12','TryForcingSFcnDF','on') Model 'UnitTest_BMW_MOD_FuSiLDFwp_G11_G12' has specified set_param('UnitTest_BMW_MOD_FuSiLDFwp_G11_G12','TryForcingSFcnDF','on'); This setting enables a special execution mode found in Simulink 4.0 and earlier that attempts to compensate for S-functions that: (1) Specify in mdlInitializeSizes that they don't have direct feedthrough on their input ports; and (2) In their mdlOutputs or mdlGetTimeOfNextVarHit methods they then access the corresponding input signals. This compensation mode can result in incorrect block execution orders for models involving S-functions within nonvirtual subsystems. Please update any S-functions in your model to specify direct feedthrough for any input port signals that are accessed in mdlOutputs() or mdlGetTimeOfNextVarHit() and then run set_param('UnitTest_BMW_MOD_FuSiLDFwp_G11_G12','TryForcingSFcnDF','off'); Note, the term 'direct feedthrough' can be misleading. To reduce the confusion, you can think of the direct feedthrough setting as a 'needs input' setting. Specifically, if the S-function access an input signal in either mdlOutputs() or mdlGetTimeOfNextVarHit(), then the direct feedthrough flag must be set to 1 (true). For more information see matlabroot/simulink/src/sfuntmpl_directfeed.txt >>
I can't share you my model, I asked my manager, No way to share our model.
I am doing unit test, Model has generated the code. I want to test the generated code. So i am testing with help of S-Function builder via. I am setting all the input/output ports and data types in the Data properties pane tab, like library pane, output pane I have given all the info. S-sunction builder is builded successfully. Once done build, If i do simulation matlab went crashing.
I am in very difficult situation now, other people are saying for Generated C code testing they are suggesting other tools to management , but I am only one person saying we can able to do test in Matworks tool/ S-function builder block. Matworks very easy to understand compare than other tools I am saying. but I can't produce some output to them because I am facing this issue. I belive Matworks/ Matlab can do anying, Please I have over confidence with our tool. My confident want to success to the management Please do the needful, I need your support. I Want to success with Matlab Tool No need to use other tools.