Hi,
I use a m-File to write a function in the function-block in PLECS. The input variable of the function has to be a value that is recalculated in each simulation-step in PLECS. The problem is that I need to have this variable in the m-File.
How can I get a PLECS-Variable that changes in every simulation step to the Matlab workspace?
The “To File” Block is not suitable because it gives course of the variable back after the whole simulation but I need this variable after every time step to feed in the function.
In MATLAB and Simulink there is not a means to have the time-step by time-step results available in the MATLAB workspace in a manner where it interacts with the Simulink simulation model in a closed-loop fashion.
I recommend reading about S-Functions in MATLAB if you would like to integrate an algorithm written in MATLAB into a Simulink model.
Then one could have the relevant signals from the PLECS portion of the model made available via Inports and Outports and fed to the S-Function block.
Depending on the nature of the function, one could also implement it in PLECS or Simulink blocks as well.