Clear Filters
Clear Filters

Change Simulink AUTOSAR compu method calculation?

6 views (last 30 days)
In my existing (legacy) AUTOSAR SW I have an interface with the following compu method:
<COMPU-NUMERATOR>
<V>0</V>
<V>8192</V>
</COMPU-NUMERATOR>
<COMPU-DENOMINATOR>
<V>45</V>
</COMPU-DENOMINATOR>
I now want to access this interface with an AUTOSAR SWC created with Simulink. I therefore have to redefine the interface in Simulink so that the SW build can connect both worlds (legacy and Simulink SWCs). However the generated ARXML definition from Simulink looks as follows:
<COMPU-NUMERATOR>
<V>0</V>
<V>182.04444444444445</V>
</COMPU-NUMERATOR>
<COMPU-DENOMINATOR>
<V>1</V>
</COMPU-DENOMINATOR>
Simulink seems to always set the denominator to 1 and calculates the numerator based on that. This causes my SW build to fail as it is expecting exactly the first compu method. Is there any way how I can do this? I guess the issue is that in Simulink all I can define is a slope but not numerator/denominator specifically?
Thanks.

Answers (1)

SANKALP DEV
SANKALP DEV on 5 Oct 2023
Hi Nico,
I understand that you are facing issues while trying to access an interface in your existing AUTOSAR software with a Simulink-generated AUTOSAR Software Component (SWC).
In Simulink, you can define the slope of the CompuMethod, but it does not provide direct control over the numerator and denominator values. However, there are a couple of workarounds you can try to achieve the desired CompuMethod definition.
  1. Use a scaling factor:
  • Multiply the numerator and denominator values in the AUTOSAR SWC by a scaling factor to obtain integer values.
  • For example, if you multiply the numerator and denominator by 45, the CompuMethod in Simulink would be:
<COMPU-NUMERATOR>
<V>0</V>
<V>368640</V>
</COMPU-NUMERATOR>
<COMPU-DENOMINATOR>
<V>45</V>
</COMPU-DENOMINATOR>
2. process the generated ARXML:
  • After Simulink generates the ARXML, you can manually modify the Compumethod values to match your legacy AUTOSAR SW.
  • Open the generated ARXML file and locate the CompuMethod section.
  • Update the numerator and denominator values manually to match your desired values.
  • Save the modified ARXML file and use it in your SW build.
To know more about configuring CompuMethods, refer to following MATLAB documentation.
Hope this helps.

Categories

Find more on AUTOSAR Blockset in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!