Based on the error shared, it looks like you are encountering an issue with code generation for a Simulink model containing OPC DA Read/Write blocks in R2024b, which previously worked in R2017a or R2017b. The likely reason it worked in the earlier versions is that the OPC Read/Write blocks were part of the “OPC Toolbox.” Since then, they have been moved to the “Industrial Communication Toolbox,” which no longer supports code generation for these blocks. Consequently, the necessary TLC files for code generation are not included, resulting in the error you are experiencing.
As a workaround, you can try to implement the OPC DA Read/Write logic outside of MATLAB in C, and then use the “C Caller Block” in Simulink to execute their functionality. You can refer to https://www.mathworks.com/help/simulink/c_caller.html for more information on how to include custom C code into Simulink models using the "C Called block".
Additionally, be aware that future releases of the Industrial Communication Toolbox will phase out support for OPC DA technology, with a shift towards enhancing OPC UA (Unified Architecture) capabilities. This is highlighted in the R2024a Release notes: https://www.mathworks.com/help/releases/R2024a/icomm/release-notes.html#mw_9fc36dd2-9e06-4421-b6e4-1f2264b09a40.
Starting with the R2024a release, OPC UA Simulink blocks have been introduced. It would be advisable to transition your model to use OPC UA blocks instead of OPC DA blocks, as the former will receive more support and may be compatible with code generation.
I hope this answers your question.
