simulink unable to pace at specified rate
27 ビュー (過去 30 日間)
古いコメントを表示
I am attempting to operate a control circuit that inflates and deflates a balloon at a specific frequency of 7Hz. I am utilizing an I2C pressure sensor that is connected to an Arduino. The simulation is being conducted on Matlab 2022b in connected I/O mode, with a baud rate of 921600 set as the default.
However, my simulation is not running in real-time. It is running much slower, with one sample time taking up to 15 seconds. I have enabled pace mode and set it to 1 second, but the simulation is still running very slowly. At the bottom of the window, the message "pacing activ: unable to pace at specific rate" appears.
I am reading two registers of my I2C sensor. To obtain a high enough resolution, ideally, I require a sample time of 0.001. However, the lower the sample rate goes, the slower the simulation becomes. Even at a sample rate of 0.1, the simulation is off by approximately 0.2 seconds compared to real-time.
Is there a way to increase the sample time for my I2C sensor while still forcing the model to run in real-time?
0 件のコメント
回答 (1 件)
Mark McBroom
2023 年 3 月 25 日
Accelerator and rapid accelerator modes can be used to increase the simulation speed, but these options are not likely to get you a 15x speed up. You can use the profiler to locate the spots in the model consuming the most time. https://www.mathworks.com/help/simulink/slref/introduction-to-profiling-models.html Also, is your arduino running real-time at 0.001? Could your bottleneck be the arduino and not Simuilnk?
THanks.
Mark.
2 件のコメント
Nakul Khadilkar
2023 年 4 月 6 日
編集済み: Nakul Khadilkar
2023 年 4 月 6 日
Hi Fatih,
Is there a particular reason you are using connected IO for such fast sample times?
The different modes of operation in Simulink serve different intentions. For example, connected IO is for rapid prototyping purposes wherein the user checks if the model is working as expected and iterates over and over to get it right. It is not necessarily real-time. On the other hand, Monitor and Tune (external mode) is real time. It is the suggested mode to be used once the algorithm/model is finalized and the acquired data has to be processed/retrieved for further analysis or other applications. Please refer to the link below for explanation of the modes.
https://www.mathworks.com/help/supportpkg/arduino/ug/connected-io.html#mw_433e82f7-9aff-4659-8409-1b4cff38c0ff
参考
カテゴリ
Help Center および File Exchange で MATLAB Support Package for Arduino Hardware についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!