Clear Filters
Clear Filters

There are problems when matlab and amesim jointly defend

5 views (last 30 days)
Reinforcement learning is a problem that occurs when the s-function of amesim is invoked in the co-simulation of matlab and amesim
警告: Fast Restart mode cannot be enabled for model 'untitled1' for the following reasons:
警告: Fast Restart mode relies on the ability to save the model's operating point. However, the following error occurred when an attempt was made to save the operating point:
警告: Simulink is unable to save the operating point of the C Level-2 S-Function (testnew_) block 'untitled1/testnew2/S-Function' because the S-function has pointer work (PWork) vectors.
  1 Comment
cm s
cm s on 20 Feb 2024

Sign in to comment.

Answers (1)

Aiswarya on 19 Dec 2023
Edited: Aiswarya on 21 Feb 2024
I see that you are trying to save the operating point of a model which involves S-functions. The error you are getting is because of Operating Point Compliance which handles S-function operating point information when saving the model operating point. In the error it shows that your S-function has pointer work (Pwork) vectors. When you use PWorks without explicitly specifying the operating point compliance, the compliance becomes DISALLOW_OPERATING_POINT after compilation. For this setting, the S-function does not allow saving or restoring its operating point and the software issues an error.
This error can be resolved by changing the OperatingPointCompliance in the S-function using ssSetOperatingPointCompliance ( The appropriate setting for S-functions that use Pwork vectors is 'USE_CUSTOM_OPERATING_POINT'. You can change this setting inside the 'mdlInitializeSizes' function of your S-function as follows:
ssOperatingPointCompliance setting = USE_CUSTOM_OPERATING_POINT;
ssSetOperatingPointCompliance(S, setting);
If you want to access the operating point information for your S-function in the 'Simulink.op.ModelOperatingPoint' object for the model you have to also enable the 'OperatingPointVisibility'.
boolean_T visibility = true;
ssSetOperatingPointVisibility(S, visibility);

Community Treasure Hunt

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

Start Hunting!