My conclusion so far: After some trials, in simulink it seems RL Agent can only inherit sample time from discrete signals.
RL Agent can't inherint FiM sampling time
11 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Ari
il 5 Mag 2025
Risposto: Emmanouil Tzorakoleftherakis
il 7 Mag 2025
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 Commenti
Emmanouil Tzorakoleftherakis
il 7 Mag 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.
Risposta accettata
Emmanouil Tzorakoleftherakis
il 7 Mag 2025
Based on the comments section above, it seems you are looking to have an "adaptive" sample time for the RL Agent block. The screenshot you have above shows that the input signals to the RL Agent block are continuous - this cannot happen. RL needs to happen at discrete sample time per definition of MDP. A couple of options I see:
1) Add a rate transition block to the output of the water tank subsystem (height signal). Set the sample time in the block to be whatever makes sense to you. The RL Agent block will inherit the same sample time. Note this will still be "fixed" time step.
2) For adaptive sample time, you need to place the RL Agent block inside a triggered subsystem. Doing that you can "call" the RL Agent block at varying sample time based on some event (could be the variable-step sample time of the environment or some other metric you define to recognize transients vs steady state).
Hope this helps
0 Commenti
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
