RL Agent can't inherint FiM sampling time
Show older comments
I am trying to experiment with this example. I replaced all logical operatios in reward and stop simulation blocks with MATLAB functions to get rid of Fixed in Minor Step (FiM) signals. This is the result:

I re-trained the agent and everything went well. Then, I made modification in agent's SampleTime. Since I want the agent to inherit environment's sampling time (decided by the solver), I set agent.AgentOptions.SampleTime = -1. During the simulation, this error message occured:
An error occurred while running the simulation for model 'rlwatertank' with the following RL agent blocks:
Caused by:
The block rlwatertank/RL Agent is not supported when inheriting a "Fixed In Minor Step" sample time. Either place a rate transition block at the block inports to inherit a discrete sample time or specify agent.SampleTime > 0.
MATLAB/Simulink said RL Agent cannot inherit FiM sample time, but there is no FiM signal in the model as we can see. How do I solve this problem? How can I make RL Agent inherit environment's sampling time? I'am using R2024b Update 5.
5 Comments
Ari
on 6 May 2025
Ari
on 6 May 2025
Emmanouil Tzorakoleftherakis
on 6 May 2025
Quick question before I reply: why do you want the agent to inherit the environment's sample time? This is not a requirement, and in fact it can often lead to unnecessary computational burden. For example, the solver may need a pretty small time step (if it's fixed step) to get decent simulation accuracy. The controller sample time however is completely independent of that and the environment. It may need to be smaller or larger depending on the application.
Ari
on 7 May 2025
Emmanouil Tzorakoleftherakis
on 7 May 2025
Thanks, will reply below. Fyi, what you are describing is easily implementable in MATLAB because in MATLAB environments there is no notion of time like in Simulink - you can define what time is somewhat arbitrarily.
Accepted Answer
More Answers (0)
Categories
Find more on Reinforcement Learning Toolbox 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!