Why is there a difference between imported and exported ARXML file with Internal-Constrs?

3 ビュー (過去 30 日間)
Why is there a difference between imported and exported ARXML file with Internal-Constrs?

採用された回答

MathWorks Support Team
MathWorks Support Team 2019 年 4 月 24 日
The issue seems to be that the physical range is not taken into account for that type along with the compu method. The type uses a compu method with an internal-to-physical conversion rule of 1/100, which maps on to an internal constraint of 0 to 32000. ceil(log2(32000-0)) is 15, implying we need 15 bits to represent the physical range of 0 to 320, not ceil(log2(320-0)) = 9, which is what we are importing as a numeric type and exporting to the ARXML (the physical constraint of 0 to 5.11 is thus re-calculated from the new internal constraint of 0 to 2^9-1, using the internal-to-physical conversion rule of 1/100).
If you add an internal constraint to "AB10477DC552B6F51113954083CCBE70" that sort of mirrors the physical constraint once the compu method is applied, e.g.
Imported ARXML file: (the addition of the constraint is in bold. It was previously unspecified, but still appeared in the exported ARXML file)
<DATA-CONSTR UUID="54237557-8678-44b5-b265-189b2e402545">
<SHORT-NAME>AB10477DC552B6F51113954083CCBE70</SHORT-NAME>
<DATA-CONSTR-RULES>
<DATA-CONSTR-RULE>
<PHYS-CONSTRS>
<LOWER-LIMIT INTERVAL-TYPE="CLOSED">0</LOWER-LIMIT>
<UPPER-LIMIT INTERVAL-TYPE="CLOSED">320</UPPER-LIMIT>
<UNIT-REF DEST="UNIT">/DataType/DataTypeUnits/KiloMtrPerHr</UNIT-REF>
</PHYS-CONSTRS>
*<INTERNAL-CONSTRS>
<LOWER-LIMIT INTERVAL-TYPE="CLOSED">0</LOWER-LIMIT>
<UPPER-LIMIT INTERVAL-TYPE="CLOSED">32000</UPPER-LIMIT>
</INTERNAL-CONSTRS>*
</DATA-CONSTR-RULE>
</DATA-CONSTR-RULES>
</DATA-CONSTR>
and we export this to:
Exported ARXML file:
<DATA-CONSTR UUID="54237557-8678-44b5-b265-189b2e402545">
<SHORT-NAME>AB10477DC552B6F51113954083CCBE70</SHORT-NAME>
<DATA-CONSTR-RULES>
<DATA-CONSTR-RULE>
<PHYS-CONSTRS>
<LOWER-LIMIT INTERVAL-TYPE="CLOSED">0</LOWER-LIMIT>
<UPPER-LIMIT INTERVAL-TYPE="CLOSED">320</UPPER-LIMIT>
<UNIT-REF DEST="UNIT">/DataType/DataTypeUnits/KiloMtrPerHr</UNIT-REF>
</PHYS-CONSTRS>
<INTERNAL-CONSTRS>
<LOWER-LIMIT INTERVAL-TYPE="CLOSED">0</LOWER-LIMIT>
<UPPER-LIMIT INTERVAL-TYPE="CLOSED">32767</UPPER-LIMIT>
</INTERNAL-CONSTRS>
</DATA-CONSTR-RULE>
</DATA-CONSTR-RULES>
The internal constraint is 32767, which is 2^15-1, since we need 15 bits to represent the type. If you don't perform this change at all on round trip, you should just use 32767 as the upper limit.

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by