Inconsistencies with the solver in virtual simulation with external data acquisition-Arduino
3 views (last 30 days)
Show older comments
I am working with a virtual two axis solar tracker panel model in simulink.
The dynamic is that the panel must follow a trajectory and it will be subjected to certain external disturbances. For this I have worked with the arduino-simulink libraries.
I can control the virtual solar panel through two physical potentiometers connected to the Arduino Due board.
In this configuration the performance is very good. I can manipulate the movement of the virtual solar panel at will.
My problem is when I subject the model to a PI control technique and sometimes the program runs normally, but other times the simulation is extremely slow.
Reviewing details, I realized the type of SOLVER, being the (auto)ODE15s the one that behaves best but without responding to the control laws.
On the other hand, it is observed that when running the program with (auto)ODE45, the simulator responds very well but is extremely slow.
Right now my problem is that the model no longer responds well in any configuration and I would like to know what the inconsistency is due to.
Could you all guide/help me on this?
I thank you for your attention and I remain at your service.
Federico.
federico.ampudia@gmail.com
0 Comments
Answers (1)
Shaunak
on 23 Apr 2025
It sounds like your issue is related to how Simulink’s solver interacts with your model, especially when you introduce the PI controller. Variable-step solvers like ‘ODE15s’ and ‘ODE45’ can behave unpredictably when the system has fast dynamics or discontinuities, which is often the case with feedback controllers. This can lead to very small-time steps and slow simulations or even cause the controller to not function as intended.
Since you are interfacing with Arduino hardware and need real-time or near real-time performance, I recommend switching to a ‘fixed-step solver’ (such as `ode4` or `discrete`) and discretizing your PI controller and plant model if possible. Fixed-step solvers are more predictable and better suited for real-time applications and hardware-in-the-loop scenarios.
Also, check your model for algebraic loops or direct feedthroughs, as these can slow down simulation and cause solver issues. You can use the Simulink Profiler to identify bottlenecks and see where the simulation is spending most of its time.
Kindly refer to the links below for more information on the same:
0 Comments
See Also
Categories
Find more on Arduino Hardware in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!