How to Convert Entity Attribute Buses into Signal for RL Agent Observation Input?

조회 수: 3 (최근 30일)
Dear Matlab Simulink Experts,
I am having troubles with my model, right now I have designed a model to emulate a single part that goes through operations and maintenance procedures. I am utilizing bus elements in an entity generator, the next step of my model is to connect the intended output of the model from entity server 'damage' to an observation input port of the RL agent block. The RL agent block will then produce an output through the action port, connected again to an option of entity servers. How do I convert and entity attribute into a signal that the RL agent can receive, and vice versa, how do I revert back the signal into an entity attribute, after the RL agent has made its decision? Or what are other options other than converting entities to signal?
The attempts I have made were using a signal conversion block, and a Matlab function block, but my efforts hasn't been rewarding so far.
Your help would be very much appreciated. Attached are my files:
  • ModelV1.slx (the simulink model)
  • BusProfile.mat (the bus elements containing the entity attribute)
  • initialize.m (to initialize the bus editor)
  • RLScriptV4.mlx (the Reinforcement Learning script)
And this is the error generated:
Thank you in advance.

채택된 답변

Laurent Royer
Laurent Royer 2024년 7월 18일
Hi Aaron,
To convert an entity attribute into a signal, you can use a Simulink function. For example, to get the D attribute as a signal:
Add a Simulink Function "getD" as below:
This Simulink Function simply contains:
And you call it from your server complete action, see the last command below:
  댓글 수: 7
Laurent Royer
Laurent Royer 2024년 7월 24일
I think there's an algebraic loop that you should break. Try inserting a Memory block just before the Simulink function getAction.
Aaron Bramhasta
Aaron Bramhasta 2024년 7월 29일
Hi Laurent,
Thank you for your reply, your solution worked!
The RL Agent was able to implement the actions onto the SimEvents blocks, although the results are not what I expected as I would get from a dry model (with SimEvents only and without RL), but I will find out why the results differ.
Once again, thank you for your time, consideration, and expertise, it is very much appreciated.
Best,
Aaron.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Discrete-Event Simulation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by