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!