Reinforcement Learning : MaxSumWordLength is 65535 bits and a minimum word length of 65536 bits is necessary so that this sum or difference can be computed with no loss of precision - ( 'rl.simuli​nk.blocks.​AgentWrapp​er' )

4 ビュー (過去 30 日間)
Hello,
I am trying to control the battery connection of the following example of a microgrid ( https://es.mathworks.com/help/physmod/sps/ug/simplified-model-of-a-small-scale-micro-grid.html ) using Reinforcement Learning. The idea is using the RL Agent block as a controller that generates the "Control" signal (in the example this signal is "1" for connecting the battery system and "0" for disconnecting it) for the battery system.
I created an Integrated Environment called "Integratedmicrogrid2_RL" and trained a DQN Agent following the instructions of the RL user guide without too many problems.
However, when I run the simulation of the system working with the RL Agent as controller, an error always happen at the same simulation time. This error is shown in the Diagnostic Viewer:
An error occurred while running the simulation and the simulation was terminated
Caused by:
MATLAB System block 'Integratedmicrogrid2_RL/RL Agent/AgentWrapper' error occurred when invoking 'outputImpl' method of 'rl.simulink.blocks.AgentWrapper'. The error was thrown from '
'C:\Program Files\MATLAB\R2020b\toolbox\rl\rl\+rl\+policy\AbstractPolicy.m' at line 237
'C:\Program Files\MATLAB\R2020b\toolbox\rl\rl\simulink\+rl\+simulink\+blocks\AgentWrapper.m' at line 98'.
Invalid input argument type or size such as observation, reward, isdone or loggedSignals.
MaxSumWordLength is 65535 bits and a minimum word length of 65536 bits is necessary so that this sum or difference can be computed with no loss of precision. Increase MaxSumWordLength if you want the sum to grow to a larger word length. To constrain the result to a type with a smaller word length, use colon-equals assignment, A(:) = B, or the CAST function.
I think that there must be any kind of problem regarding the configuration of the use of the memory of my computer during the simulation (things related to buffer size, maybe?).
Can anybody suggest some parameters to be configured in order to avoid this error?
Thanks in advance.

回答 (1 件)

Emmanouil Tzorakoleftherakis
Emmanouil Tzorakoleftherakis 2021 年 2 月 9 日
It's a bit hard to find the cause of the error without a reproduction model, but based on the error you are seeing, I would check the data type of the reward, observation and reward signals that go into the agent block. If anything is not single/double, use the data conversion block to cast it.

カテゴリ

Help Center および File ExchangeEnvironments についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by