I am pretty new to Simulink and to programming general.
For the Simulation of a vertical axis wind turbine I am trying to integrate a control system into the open source program QBlade.
Therefor I am creating the control in Simulink. Afterwards I create the C++ Code and embed it into the source code of QBlade.
For the PI-Controller and Rate Limiter I use continuous time.
Generally I am wondering how the control gets the time /time-step when running the simulation. It seems to work fine for a while. But after about 400 Timesteps the simulation aborts. But I don't know if the error is related to the mentioned problem.
Should I choose a fixed time step to create the code? And adapt the time step in the wind turbine simulation tool QBlade? Or is the Simulink Code able to get the time out of the Simulation tool QBlade without transferring it manually?
A second question: Should I create and initialize (.initialize()) the Simulink Control Class Object in the simulation loop? Or is it necessary to create and initialize it outside the loop? And only put the input parameters, the function .step() and the output parameters inside the loop?
I am really looking forward to your answer!