Clear Filters
Clear Filters

Issues regarding XCP CAN config when using it in a Referenced Model in Normal mode

1 view (last 30 days)
Hi
I'm trying to use the XCP CAN config block in a referenced model, let's say a Hil model referenced in a Test harness, and I get the following error.
'The S-Function 'sxcpcanconfig' in 'HilMdl/XCP_A/XCP CAN Configuration' has a mdlStart and a mdlProcessParameters function. This is not supported when used in a model referenced in normal mode, unless the S-Function has called ssSetModelReferenceNormalModeSupport with the value MDL_START_AND_MDL_PROCESS_PARAMS_OK'
I'm not yet familiar with the S functions capability, but how can I modify the apropriate S function in order for it to work.
I found this support page, which tells what to modify, but I'm not sure where to insert it in my generated cpp code.
Thanks

Accepted Answer

akshatsood
akshatsood on 30 Aug 2023
Hi Szilard,
I understand that you are facing issues working with XCP CAN config in a Referenced Model in Normal Mode. In response to the error mentioned, it advocates the use of ssSetModelReferenceNormalModeSupport with the value MDL_START_AND_MDL_PROCESS_PARAMS_OK. It is worth noting that when a C S-function appears in a referenced model that executes in Normal mode, successful execution is impossible if all of the following are true:
  • The S-function has both an mdlProcessParameters function and an mdlStart function.
  • The mdlProcessParameters function depends on the mdlStart function.
  • The referenced model calls mdlProcessParameters before calling mdlStart.
As per my understanding, error originates because mdlProcessParameters has dependency requirements that mdlStart has not satisfied. Examples of such dependencies include:
  • Allocating memory in mdlStart and using that memory in mdlProcessParameters. This is often done using ssSetUserData and ssGetUserData.
  • Initializing any DWork or any global memory in mdlStart and reading the values in mdlProcessParameters.
Going by the suggestion raised in the error, you can include the following statement in mdlInitializeSizes
ssSetModelReferenceNormalModeSupport(S, MDL_START_AND_MDL_PROCESS_PARAMS_OK);
Have a look at below references for better understanding
I hope this helps.
  1 Comment
Szilard Hegyi
Szilard Hegyi on 13 Nov 2023
Thanks for the answer, this seems to work, but also another way we solved it, was using the called model as a Referenced Subsystem

Sign in to comment.

More Answers (0)

Categories

Find more on Deployment, Integration, and Supported Hardware in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!