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

2 次查看(过去 30 天)
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

采纳的回答

akshatsood
akshatsood 2023-8-30
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Deployment, Integration, and Supported Hardware 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by