to workspace block logging in real time?

1 回表示 (過去 30 日間)
SangHun Ahn
SangHun Ahn 2020 年 8 月 11 日
回答済み: Fangjun Jiang 2020 年 8 月 11 日
Hello
I made a block that logs actual sensor (GPS, IMU) data with Simulink using To workspace.
This sensor operates at 10Hz and logs data every 0.1 seconds when logging through an external program.
(Sensor data value logged by an external program, mSec refers to the fractional data in seconds, not milliseconds.)
To workspace block was used to record sensor data. Simulink settings were set to discrete time settings.
However, when looking at the recorded data through the To workspace block, it was confirmed that logging proceeded at least 60 times faster.
(The recorded data is UTC data of the GPS sensor, and the value corresponding to seconds has been logged more than 60 times.)
Since the sampling time of the To workspace block was set to 0.1s, I thought that I would log data every 10 Hz, which is the actual operation of the GPS sensor, but I faced the problem of logging more than 60 times faster.
I would like to know how to set the To workspace to record data every 10 Hz, which is the actual GPS operation Hz.
  2 件のコメント
Fangjun Jiang
Fangjun Jiang 2020 年 8 月 11 日
  1. "mSec refers to the fractional data in seconds, not milliseconds". Does the data you showed mean time at 37.4, 37.5, 37.6 and 37.3 second?
  2. "I faced the problem of logging more than 60 times faster". How does the data you showed indicate it is 60 times faster?
  3. "This sensor operates at 10Hz and logs data every 0.1 seconds when logging through an external program." How does Simulink connect to or receive this sensor data? Might it be that the sensor measurement is executed in almost real-time like every 0.1 second, while your Simulink simulation is running much faster, like it runs 60 iterations within 0.1 second? You know Simulink simulation is not in real time. It could be faster or slower than real time. In most cases, it is faster.
SangHun Ahn
SangHun Ahn 2020 年 8 月 11 日
1. That's right. Since the operation period of the GPS sensor is 10hz, it is logged when logging with an external program at 37.4, 37.5, 37.6s in 0.1 second increments.
2. When the logged data is analyzed through Simulink's'to workspace' block, for example, 37.4 seconds of data is logged about 60 times. Although it varies depending on the situation, data equivalent to approximately 37.4 seconds is repeated 60 times and logged.
3. Sensor data is collected using CAN communication. Of course, sensor data output is accurately output every 10hz and only once. I understand that the running time of Simulink is not real time. The part I want to solve is to run in real time as much as the log period of the to workspace block.
I am looking for a way to apply a limited real-time log system because the system crashes when I try to force the entire Simulink program I wrote to run in real time.

サインインしてコメントする。

回答 (1 件)

Fangjun Jiang
Fangjun Jiang 2020 年 8 月 11 日
In that case, you need this toolbox Simulink Desktop Real-Time. It can slows down your simulation to try to match real time.

カテゴリ

Help Center および File ExchangeConfigure and View Diagnostics についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by