how to change 'StartTime' while training RL algorithm in Simulink environment

3 ビュー (過去 30 日間)
Pavel Semenov
Pavel Semenov 2020 年 10 月 11 日
編集済み: Pavel Semenov 2020 年 10 月 15 日
hello, maybe somebody can help me,
I feed weather datafile (8761 x 19 table of annual weather data, recorded with 3600s timestep) to the Simulink model of a solar collector. To make the algorithm learn from the different data, I would like to reset 'StartTime' for each training episode (24 hours) in such a way, the episode starts at random time in the range of a year: (0, 364*24*3600).
I tried to use set_param to set 'StartTime'. Below is the code in LocalResetFcn.m:
function in = localResetFcn(in)
in = set_param(in,'simulink_model','StartTime','3600*24*randi(364)');
end
it's not working and the errors are:
What can you advise to solve this?
  1 件のコメント
Pavel Semenov
Pavel Semenov 2020 年 10 月 15 日
編集済み: Pavel Semenov 2020 年 10 月 15 日
I can manage it in the model without RL agent, by writing in Callbacks >InitFcn:
set_param('modelname','StartTime','3600*24*randi(365)')
but when I apply this for RL model, it gives the error message " localHandleSimoutErrors":
Error
Caused by:
Error using rl.env.SimulinkEnvWithAgent>localHandleSimoutErrors (line 689)
Invalid StopTime specified in the Configuration Parameters dialog for block diagram 'modelname '
I specified Start and stop time as follows:

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeInteractive Model Editing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by