フィルターのクリア

Test Manager: Wrap on overflow detected

11 ビュー (過去 30 日間)
Christophe
Christophe 2024 年 1 月 17 日
回答済み: Christophe 2024 年 2 月 8 日
Hi,
In Test Manager, i created a harness and when i run a test the following error occures:
An error occurred ('Stateflow:Runtime:DataOverflowErrorMSLD') when calling 'sim':
Wrap on overflow detected.
Transition in Chart 'Applicative_Test_Sequence_Harness/CAN_Decoding/CAN_BusA_Decoding/Decode Stream 10ms BusA/Decode_B_frames_10ms_sent_bus_A':
B_stream_10ms_busA.FRAME_EXTSYS_STATE.BAT_STARTUP = ((A_data64_bigend[0] << 5)>>63);
This last line is in a State Flow among other identical lines
{
B_stream_10ms_busA.FRAME_EXTSYS_STATE.SPARE_STT_1 = ((A_data64_bigend[0] << 0)>>61);
B_stream_10ms_busA.FRAME_EXTSYS_STATE.SOURCE_AVAIL = ((A_data64_bigend[0] << 3)>>63);
B_stream_10ms_busA.FRAME_EXTSYS_STATE.LOAD_AVAIL = ((A_data64_bigend[0] << 4)>>63);
B_stream_10ms_busA.FRAME_EXTSYS_STATE.BAT_STARTUP = ((A_data64_bigend[0] << 5)>>63);
B_stream_10ms_busA.FRAME_EXTSYS_STATE.RESET = ((A_data64_bigend[0] << 6)>>63);
B_stream_10ms_busA.FRAME_EXTSYS_STATE.SPARE_STT_2 = ((A_data64_bigend[0] << 7)>>63);
...
}
When i update (compile) the model, the error doesn't appear.
The problem should be in the harness, but i didn't find it.
Thanks in advance for any help.

採用された回答

Christophe
Christophe 2024 年 2 月 8 日
Hi,
For your information, I didn't find the solution to this error.
I had to modify the model even though I didn't want to.
Thanks for your help,
Christophe
PS: The problem can be considered solved

その他の回答 (2 件)

Shubh
Shubh 2024 年 1 月 19 日
Hi Christophe,
The error you're encountering, 'Stateflow:Runtime:DataOverflowErrorMSLD', indicates a data overflow problem in your Stateflow model within MATLAB's Simulink Test Manager. This error often arises when a variable exceeds its maximum value that can be represented by its data type, leading to a wrap-around effect.
In the context of your code, the issue seems related to the bitwise operations you're performing. Specifically, this line:
B_stream_10ms_busA.FRAME_EXTSYS_STATE.BAT_STARTUP = ((A_data64_bigend[0] << 5)>>63);
and similar lines are shifting bits and potentially causing an overflow.
Here are a few steps to troubleshoot and resolve the issue:
  1. Check Data Types: Ensure that the data types of the variables involved in the bitwise operations are large enough to handle the values after shifting. If 'A_data64_bigend' is not of a sufficiently large data type, the shift operation could cause an overflow.
  2. Review Shift Operations: Bitwise shift operations can easily result in values that exceed the data type's limits. Ensure that your shift logic is correct and does not cause values to exceed these limits.
  3. Explicit Type Casting: If necessary, you can explicitly cast your variables to larger data types before performing the shift operations. This can prevent unintended overflows.
  4. Debugging Stateflow: Use Stateflow debugging tools to step through the state machine execution. This can help you pinpoint the exact location and cause of the data overflow.
  5. Model Configuration: Since the error does not appear when updating (compiling) the model, there might be a difference in the way variables are initialized or handled between the compilation and the test run. Ensure that your model's configuration parameters are consistent between these stages.
Here's an example of how you might modify the code to include explicit type casting to a larger data type (if applicable):
% Assuming A_data64_bigend is an array of uint64
% Casting to a larger data type before shifting
tempVar = uint64(A_data64_bigend[0]);
B_stream_10ms_busA.FRAME_EXTSYS_STATE.BAT_STARTUP = bitshift(bitshift(tempVar, 5), -63);
Remember, the key is to ensure that the intermediate values produced during the shift operations do not exceed the range of the data type. If 'uint64' is not sufficient, you may need to consider an even larger data type or revise your approach to avoid such large intermediate values.
Hope this helps!

Christophe
Christophe 2024 年 1 月 22 日
Thanks Shubh for your response.
I'm going to focus on your 5th response:
5. Model Configuration: Since the error does not appear when updating (compiling) the model, there might be a difference in the way variables are initialized or handled between the compilation and the test run. Ensure that your model's configuration parameters are consistent between these stages.
As I'm testing the product, and I can't modify it at the moment. Another reason is the error doesn't appear in another harness including the block I try to test.
Regards,
Christophe

カテゴリ

Help Center および File ExchangeOutputs についてさらに検索

タグ

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by