필터 지우기
필터 지우기

How to make simulink function block interact with RL Agents by updating states and other environment parameters?

조회 수: 1 (최근 30일)
In Simulink RL toolbox, I am trying to make an environment block. Instead of creating the block with simulink objects due to too complex nature of the control system model, I used a matlab function block that interacts with agents. It takes actions from agents as function input and progresses with time giving certain states as observable outputs for agents. Since I was not able to access the base workspace parameters from the function block, I defined a class object with those properties and passed it as input to the function block. After updating the states every sampling period, again output the object for the agents to observe. Is it a right way to implement? Can anyone suggest any better way?

채택된 답변

Emmanouil Tzorakoleftherakis
Emmanouil Tzorakoleftherakis 2020년 10월 15일
I think you can just read the workspace params if you set an additional variable as a parameter in the MATLAB Fcn block. In the screenshot below, if you click 'Edit Data' and add an additional parameter as shown, give it the same name as you base workspace variable and you are all set. This could be a struct if you have multiple parameters
  댓글 수: 3
Emmanouil Tzorakoleftherakis
Emmanouil Tzorakoleftherakis 2021년 2월 7일
The following link may be helpful: https://www.mathworks.com/matlabcentral/answers/110060-simulink-matlab-function-block
Sunandan Adhikary
Sunandan Adhikary 2021년 2월 7일
편집: Sunandan Adhikary 2021년 2월 7일
Yes, tried that as well. Seems since I am using a structure, evalin can not update a struture element wise. If I try to update the whole structure in one go, it shows ""Simulink does not have enough information to determine output sizes for this block. If you think the errors below are inaccurate, try specifying types for the block inputs and/or sizes for the block outputs."
And using evalin also throws eror.
I have asked this in another question thread with more explanations. Can you please help?

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

추가 답변 (0개)

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by