There are problems when matlab and amesim jointly defend

3 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
朋友你好,请问你解决这个问题了吗?我的也是matlab与amesim联仿进行强化学习方面的研究。我的程序和你有一样的“警告”,是可以跑,但跑起来在amesim中没任何数据产生,很苦恼,我检查了很多地方,怀疑就这三个“警告”的问题。可以的话,希望与你交流一下,可以有偿

Sign in to comment.

Answers (1)

Aiswarya
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 (https://www.mathworks.com/help/simulink/sfg/sssetoperatingpointcompliance.html?searchHighlight=OperatingPointCompliance&s_tid=srchtitle_support_results_1_OperatingPointCompliance). 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);

Categories

Find more on Manual Performance Optimization 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!