CPU usage 100% when I use simulink desktop real time, both in connected mode and kernel mode

11 次查看(过去 30 天)
My sotfware and hardware infomation:
Simulink Desktop Real-Time version 23.2.0 (C) The MathWorks, Inc. 1994-2023
Matlab version is R2023b, and my CPU is Intel 13900H
I use simulink desktop real time to run my project, the fixed step is 0.1s, Once I start the model simulation, regardless of kernel mode or connected mode, my computer's cpu usage is always dead at 100% unless I stop the model simulation; at first I suspected that it's a problem with my model or time step, so I switched to the official matlab example (openExample('sldrt/ RealTimeVanDerPolSimulationExample')), the result is still the same as my model simulation, the cpu usage stays at 100% unless I stop the model simulation for the cpu usage to return to normal.
Please help, thanks

采纳的回答

Jan Houska
Jan Houska 2024-8-10
Hello,
this behavior is normal, expected, and not a problem.
Windows computes the CPU utilization by measuring the percentage of time the CPUs are idle, then subtracting this from 100%, and report the resulting number as CPU utilization. Simulink Desktop Real-Time intentionally keeps the CPUs in non-idle state, so the response to the hardware timer event does not require waking up the CPU from idle state (which does take some small amount of time). This significantly improves real-time performance. So, the CPU utilization reported by Windows does not correspond to the real CPU utilization. Typically, there is plenty of CPU power left to run other processes. You can try to run other processes on the computer and see if there are any performance issues - there should be none.
So, you can ignore the CPU utilization reported by Windows when the real-time kernel is active, because the method used to measure it does not provide correct values in this situation.
Jan

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by