I want to run OpenFAST with Simulink for several thousand times to find an optimal value for controller. But it will take a very long time. So I want to use the parallel computing in MATLAB, but when I did this, MATLAB threw out an error:
Error reported by S-function ‘FAST_SFunc’ in ‘OPENFAST_OC4_PDEM_2/FAST Nonlinear Wind Turbine/S-Function’:
FAST_InitializeAll:FAST_Init:FAST_ReadPrimaryFile:OpenEcho:OpenFOutFile:Cannot open file
“E:\OPENFAST\r-test-master-2.4\cases\5MW_OC4Semi_WSt_WavesWN\5MW_OC4Semi_WSt_WavesWN.SFunc.ech”. Another program like MS Excel may have locked it for writing.
Could you tell me where the error is and how to solve it ? thanks a lot.
I’m not familiar with parallel computing in MATLAB, but it sounds like you have two (or more) processes trying to write to the same output file (5MW_OC4Semi_WSt_WavesWN.SFunc.ech, located in your E:\OPENFAST\r-test-master-2.4\cases\5MW_OC4Semi_WSt_WavesWN directory) at the same time. You could certainly disable the writing of echo files (by setting Echo = FALSE in the various OpenFAST input files), but I expect that you’d just receive the same error with other output files. I would think that if you are running multiple simulations at the same time, they should write to different filenames or different directories.
I wonder if I can make OpenFAST not generate the output files like .out and .sum files? And how can I change the filename or directory of the output files? Looking for your reply.
You can ensure that the OpenFAST output files (*.out etc.) have different file names and/or are written to different directories by ensuring that the input files have different names and/or are stored in different directories.
You can avoid generating the summary (*.sum) files altogether by setting the associated SumPrint flags to False in the OpenFAST driver code and various OpenFAST modules.
You can’t really disable the writing of the main time-series output file (*.out or *.outb) because generator those is the whole reason to run OpenFAST. That said, we are also working on a Python wrapper that will avoid writing output files altogether (the time-series output data is passed as an output array back to Python instead).