OpenFAST / openfast

Main repository for the NREL-supported OpenFAST whole-turbine and FAST.Farm wind farm simulation codes.
http://openfast.readthedocs.io
Apache License 2.0
695 stars 459 forks source link

RL toolbox and openfast #1656

Open Dwivedi07 opened 1 year ago

Dwivedi07 commented 1 year ago

Hello there, I wanted to use a Reinforcement learning toolbox to replace the baseline controller for the NREL 5MW wind turbine. I had created my environment and RL agent. But when I start training the agent an error is thrown by Openfast Simulink Interface. The syntax error which the 'FAST_SFunc' is reporting are actually the in the output signal which i feed into the agent as observations. Kindly look into this if anyone tried to do the same. Also, Do openfast-Simulink allows me to link it with RL toolbox? Error using rl.train.SeriesTrainer/run An error occurred while running the simulation for model 'RL_Model' with the following RL agent blocks:

[RL_Model/RL Agent](matlab: open_and_hilite_hyperlink('RL_Model/RL Agent','error'))

Error in [rl.train.TrainingManager/train](matlab:matlab.internal.language.introspective.errorDocCallback('rl.train.TrainingManager/train', 'C:\Program Files\MATLAB\R2023a\toolbox\rl\rl+rl+train\TrainingManager.m', 479)) ([line 479](matlab: opentoline('C:\Program Files\MATLAB\R2023a\toolbox\rl\rl+rl+train\TrainingManager.m',479,0))) run(trainer);

Error in [rl.train.TrainingManager/run](matlab:matlab.internal.language.introspective.errorDocCallback('rl.train.TrainingManager/run', 'C:\Program Files\MATLAB\R2023a\toolbox\rl\rl+rl+train\TrainingManager.m', 233)) ([line 233](matlab: opentoline('C:\Program Files\MATLAB\R2023a\toolbox\rl\rl+rl+train\TrainingManager.m',233,0))) train(this);

Error in [rl.agent.AbstractAgent/train](matlab:matlab.internal.language.introspective.errorDocCallback('rl.agent.AbstractAgent/train', 'C:\Program Files\MATLAB\R2023a\toolbox\rl\rl+rl+agent\@AbstractAgent\train.m', 136)) ([line 136](matlab: opentoline('C:\Program Files\MATLAB\R2023a\toolbox\rl\rl+rl+agent\@AbstractAgent\train.m',136,0))) trainingResult = run(trainMgr,checkpoint);

Caused by: Error using rl.env.internal.reportSimulinkSimError Error due to multiple causes. Error using rl.env.internal.reportSimulinkSimError The expression: u(strmatch('BldPitch1',OutList)) in '[RL_Model/Blade Pitch angle 1](matlab:open_and_hilite_hyperlink ('RL_Model/Blade Pitch angle 1','error'))' has a syntax error Error using rl.env.internal.reportSimulinkSimError Error reported by S-function 'FAST_SFunc' in '[RL_Model/FAST Nonlinear Wind Turbine1/S-Function](matlab:open_and_hilite_hyperlink ('RL_Model/FAST Nonlinear Wind Turbine1/S-Function','error'))': FAST_InitializeAll:ED_Init:ED_ReadInput:ReadBladeInputs:ReadBladeFile:OpenFInpFile:The input file, ".../5MW_Baseline/NRELOffshrBsline5MW_Blade.dat", was not found. Error using rl.env.internal.reportSimulinkSimError The expression: u(strmatch('GenSpeed',OutList)) in '[RL_Model/Generator Speed](matlab:open_and_hilite_hyperlink ('RL_Model/Generator Speed','error'))' has a syntax error Error using rl.env.internal.reportSimulinkSimError The expression: u(strmatch('GenTq',OutList)) in '[RL_Model/Generator Torque](matlab:open_and_hilite_hyperlink ('RL_Model/Generator Torque','error'))' has a syntax error Error using rl.env.internal.reportSimulinkSimError The expression: u(strmatch('GenPwr',OutList)) in '[RL_Model/Power](matlab:open_and_hilite_hyperlink ('RL_Model/Power','error'))' has a syntax error Error using rl.env.internal.reportSimulinkSimError The expression: u(strmatch('RtAeroFxh ',OutList)) in '[RL_Model/Rotor Aero Load](matlab:open_and_hilite_hyperlink ('RL_Model/Rotor Aero Load','error'))' has a syntax error Error using rl.env.internal.reportSimulinkSimError The expression: u(strmatch('Time',OutList)) in '[RL_Model/Time Signal](matlab:open_and_hilite_hyperlink ('RL_Model/Time Signal','error'))' has a syntax error Error using rl.env.internal.reportSimulinkSimError The expression: u(strmatch('WindVelX',OutList)) in '[RL_Model/Wind Speed](matlab:open_and_hilite_hyperlink ('RL_Model/Wind Speed','error'))' has a syntax error .

What can be there a reason behind this? I have rechecked my syntax already and they are correct.

jjonkman commented 1 year ago

Dear @Dwivedi07,

I'm not aware of anyone at NREL using the Reinforcement Learning (RL) toolbox, but this has been discussed on this site before, e.g., see: https://github.com/OpenFAST/openfast/discussions/884.

The errors you are receiving, though, appear tied to more basic issues. Does your model run in Simulink without the added complexities of the RL toolbox? Are the outputs you are selecting via strmatch actually available in the OutList of your OpenFAST model? The other error you are receiving is about the ElastoDyn blade input file, which would guess be related to an incorrect filename or path.

Best regards,