Creating a DLL from Simulink model


I have created a Simulink model (adapted from the ROSCO controller model found at ROSCO_toolbox/Matlab_Toolbox/Simulink at main · NREL/ROSCO_toolbox · GitHub), for control functionality of the IEA 15 MW Semi-Submersible.

I want to package my model into a .dll for use in another program. However, when I attempt to build the code I get the following error, associated with pulling data for a specific parameter from the OutList:

“Input (“u”) index must be a positive integer in the expression: u(strmatch(‘Azimuth’, OutList)) when used for code generation”

What changes do I need to make fo the the model for the code generation to be successful?

I am also unsure on the code generation process, what pre-requisite files are required (aside from discon.tlc), and what files are created, so any information you can share on that would be much appreciated

Thank you,


Hi Andrew,

I have seen that error in Simulink when the OpenFAST model does not have Azimuth as an output channel. It should be declared in the ElastoDyn input.

I don’t know much about the code generation process. Sorry, I can’t be more help there.

Best, Dan

Hi Dan,

The Azimuth is specified as an output channel in the ElastoDyn input. I think this issue is to do with the code generation itself. I found a similar thread at:

What I’m having trouble understanding is how to compile a Simulink model into a .dll that is compatible for use in the “Bladed Interface” section of the ServoDyn file (PCMode = 5). This means that I require to create a new libdiscon.dll and DISCON.IN file, but I’m not sure whether this is possible using the build function in Simulink.

Kind regards,


Hi Andrew,

I know this group has developed some methods for compiling Simulink controllers into DLLs: GitHub - TUDelft-DataDrivenControl/DISCON_Simulink: Tool to compile a Bladed style DLL controller from Simulink for use in OpenFAST or Bladed. I know we have done some similar things for field demonstrations, but they were probably developed even earlier. I can ask around.

Best, Dan