Filter löschen
Filter löschen

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

1 Ansicht (letzte 30 Tage)
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

Akzeptierte Antwort

akshatsood
akshatsood am 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 Kommentar
Szilard Hegyi
Szilard Hegyi am 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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Simulink Environment Customization finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by