Simulink variable in Code Composer Studio stops incrementing

2 ビュー (過去 30 日間)
Kemal Tas
Kemal Tas 2024 年 2 月 7 日
回答済み: Mark McBroom 2024 年 2 月 10 日
I am trying to calculate the total battery consumption (in watt/hours) using simulink model. For this ,using 2 ADC modules, i first scale the adc values to get the correct voltage and current values. Then, i divide the power with 3600(watt/hours) * 20000(adc sample time) to find the power value for cycle. The data type is single. The problem is, when i generate ccs project and run it, the consumption value is type float, and when i constantly have 64V and 1A, about 5 minutes later, the total consumption stops at value 32.0 . A counter(type double) that i put in the code to watch the cycles per second also stops at about 16.770.000. How can i fix this? (F280025C)

回答 (1 件)

Mark McBroom
Mark McBroom 2024 年 2 月 10 日
It sounds like that section of your code is no longer running. You can use CCS to set a breakpoint to confirm this or you can add blocks to your simulink model that toggle an output/LED to make sure your code is still running.

Community Treasure Hunt

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

Start Hunting!

Translated by