Multiple wind turbines in single Simulink simulation: Must compile separate S-Functions for different wind/wave conditions?
I'm developing a Simulink simulation with multiple wind turbines running simultaneously in a single model, where each turbine needs to operate under different environmental conditions while using identical turbine structural models and controllers. My main question is: do I necessarily need to compile separate S-Function interfaces from source code for each turbine to handle these different external condition inputs, or can I achieve this with a single parameterized S-Function that accepts different environmental datasets?
Dear @kyy2233,
Can you clarify your use case? When you say "multiple wind turbines", do you mean you want to run distinct simulations at the same time within the same Simulink environment (presumably because that would be faster than running distinct simulations in series). Or do you need some interaction (e.g., wakes or control) between the multiple turbines?
Best regards,
Dear @jjonkman, Thank you for your response. Let me clarify my use case: I'm developing a wind farm frequency regulation study where multiple floating wind turbines operate simultaneously within a single Simulink model. Each turbine faces different wind speed conditions and needs to participate in grid frequency regulation. The turbines use identical structural models and controllers, but receive different environmental inputs. My question is: if my simulation involves multiple turbines simultaneously, do I need to compile multiple interfaces and S-functions from the source code for each turbine, or is there a simpler approach? Best regards, kyy2233
@kyy2233 I'm not entirely sure how to make this work, but I can offer some suggestions. First, are you running these simulations on Windows? And did you build the Mex file such that it references the OpenFAST shared library DLL using create_FAST_SFunc.m? I'm going to assume that this was the approach for the next steps. You'll need to create a copy of the OpenAFST_Simulink_x64.dll for each turbine such as OpenFAST_Simulink_x64-T1.dll, etc. Then you'll need to compile a new FAST_SFunc for each turbine such as FAST_SFunc-T1. This requires changing mexname and libname in create_FAST_SFunc.m for each turbine and running it. Then you'll need to put all the copies of the OpenFAST Simulink dll and the new Mex files into one directory that can be referenced by MATLAB and you should be able to load each and interact with them separately. The issue is that the OpenFAST shared library stores all of the turbine data so you need a separate instance for each turbine. If you simply load multiple copies of FAST_SFunc that all refer to the same dll, then they'll end up overwriting each other as only one copy of the dll is loaded. Please give this a try and let me know if it works.