Average_Friction_Learning_MDD

Module –

High-Level Description

This module estimates the gear friction changes from the baseline friction and provides compensation. It is based on the column torque and handwheel angle. It is primarily active at higher speeds.

Figures

Component Diagram

avgfric.jpg


Variable Data Dictionary

For details on module input / output variable, refer to the Data Dictionary for the application. Input / output variable names are listed here for reference.

Module InputsModule Outputs
HwAng_HwDeg_f32EstFric_HwNm_f32
HwPosAuthority_Uls_f32FricOffset_HwNm_f32
HwTrq_HwNm_f32SatEstFric_HwNm_f32
HwVel_HwRadpS_f32
LatAcc_g_f32
CRFMtrTrq_MtrNm_f32
Temperature_DegC_f32
VehicleSpeedValid_Cnt_lgc
VehSpd_Kph_f32
DefeatFricLearning_Cnt_lgc

Module Internal Variables

This section identifies the name, range and resolutions for module specific data created by this module. If there are no range restrictions on the variable, the term “FULL” is placed into the table for legal range.

Variable NameResolution

Legal Range

(min)

Legal Range

(max)

Software Segment
FiltAvgFric_HwNm_M_f32[4]Single Precision Float-1010AVGFRICLRN_START_SEC_VAR_CLEARED_32
SatAvgFric_HwNm_M_f32[4]Single Precision Float-1010AVGFRICLRN_START_SEC_VAR_CLEARED_32
VehBaselineFric_HwNm_M_f32[4]Single Precision Float-1010AVGFRICLRN_START_SEC_VAR_CLEARED_32
HwAngBuf_HwDeg_M_f32[12]Single Precision Float-1440.111440.11AVGFRICLRN_START_SEC_VAR_CLEARED_32
HwVelBuf_HwDegpS_M_f32[12]Single Precision Float-1833.4651833.465AVGFRICLRN_START_SEC_VAR_CLEARED_32
ColTrqBuf_HwNm_M_f32[6]Single Precision Float-2020AVGFRICLRN_START_SEC_VAR_CLEARED_32
LearnConstTimer_mS_M_u321FULLFULLAVGFRICLRN_START_SEC_VAR_CLEARED_32
HwVelKSV_M_strLPF32KSV_StrAVGFRICLRN_START_SEC_VAR_CLEARED_UNSPECIFIED
LatAccKSV_M_strLPF32KSV_StrAVGFRICLRN_START_SEC_VAR_CLEARED_UNSPECIFIED
HwPosAuthorityKSV_M_strLPF32KSV_StrAVGFRICLRN_START_SEC_VAR_CLEARED_UNSPECIFIED
VehSpdKSV_M_strLPF32KSV_StrAVGFRICLRN_START_SEC_VAR_CLEARED_UNSPECIFIED
TemperatureKSV_M_strLPF32KSV_StrAVGFRICLRN_START_SEC_VAR_CLEARED_UNSPECIFIED
HwAngKSV_M_strLPF32KSV_StrAVGFRICLRN_START_SEC_VAR_CLEARED_UNSPECIFIED
ColTrqKSV_M_strLPF32KSV_StrAVGFRICLRN_START_SEC_VAR_CLEARED_UNSPECIFIED
FiltAvgKSV_M_str[4]LPF32KSV_StrAVGFRICLRN_START_SEC_VAR_CLEARED_UNSPECIFIED
RawAvgFric_HwNm_M_f32[4]Single Precision Float-1010AVGFRICLRN_START_SEC_VAR_CLEARED_32
AvgFricChgKSV_M_strLPF32KSV_StrAVGFRICLRN_START_SEC_VAR_SAVED_ZONEH_UNSPECIFIED
Rte_Pim_AvgFricLrnData.VehLearnedFric_HwNm_M_f32[4]Single Precision Float-1010
Rte_Pim_AvgFricLrnData.Theta_HwNm_M_f32[8][4]Single Precision Float-1010
Rte_Pim_AvgFricLrnData.RangeCounter_Cnt_M_u16[8][3]1065534
Rte_Pim_AvgFricLrnData.OpMode_Cnt_M_enumFricLrnModeType
Rte_Pim_AvgFricLrnData.FricOffset_HwNm_f32Single Precision Float-1010
Rte_Pim_AvgFricLrnData.EnableFricLearning_Cnt_lgcBooleanFALSETRUE
Rte_Pim_AvgFricLrnData.EnableFricOffsetOutput_Cnt_lgcBooleanFALSETRUE
DefeatFricOffsetOutput_Cnt_M_lgcBooleanFALSETRUE
Rte_Pim_AvgFricLrnData.EOLFric_HwNm_f32Float-1010
RunOnce_Cnt_M_lgcBooleanFALSETRUEAP_AVGFRICLRN_VAR
FrictionDiagThreshTimer_mS_M_u32Uint320FULLAVGFRICLRN_START_SEC_VAR_CLEARED_32

User defined typedef definition/declaration

This section documents any user types uniquely used for the module.

Typedef NameElement NameUser Defined Type

Legal Range

(min)

Legal Range

(max)

FricLrnModeType

FRICLRN_CALIBRATION = 0

FRICLRN_NORMAL = 1

FRICLRN_CLEAR = 2

FRICLRN_IDLE = 3

FRICLRN_BASELINE = 4

uint804

Constant Data Dictionary

Calibration Constants

This section lists the calibrations used by the module. For details on calibration constants, refer to the Data Dictionary for the application.

Constant Name
t_FrHystHwAPts_HwDeg_f32[]
t2_VehSpd_Kph_f32[][]
t_MskVehSpd_Cnt_lgc[]
t_FricChgWeight_Uls_f32[]
t_InvRatioX_HwDeg_u11p5[]
t_InvRatioY_HwNmpMtrNm_u6p10[]
k_LearningGain_Uls_f32
k_LearningThreshold_Cnt_u32
k_RangeCounterLimit_Cnt_u16
k_AvgFricLPFKn_Hz_f32
k_HwPosAuthMin_Uls_f32
k_HwVelConstLimit_HwDegpS_f32
k_HwVelMax_HwDegpS_f32
k_HwVelMin_HwDegpS_f32
k_LatAccMax_MpSecSqrd_f32
k_LatAccMin_MpSecSqrd_f32
k_SatFricChgLim_HwNm_f32
k_FricOffsetLPFKn_Hz_f32
k_TempMin_DegC_f32
k_TempMax_DegC_f32
k_DataPrepLPFKn_Hz_f32
k_IgnCycleFricChgLim_HwNm_f32
k_FricOffsetLimitLow_HwNm_f32
k_FricOffsetLimitHigh_HwNm_f32
t2_BaselineTheta_HwNm_f32[][]
t2_BaselineRangeCounter_Cnt_u16[][]
t_BaselineFric_HwNm_f32[]
k_BaselineEOLFric_HwNm_f32
k_EOLFricDiffScalingFactor_Uls_f32
k_EOLFricDiffLimitLow_HwNm_f32
k_EOLFricDiffLimitHigh_HwNm_f32
k_FrictionDiagTimer_mS_u32
k_FrictionDiagThreshold_HwNm_f32

Program(fixed) Constants

Embedded Constants

All embedded constants whose values are provided in Eng units will be evaluated to the equivalent counts by using the FPM_InitFixedPoint_m() macro within the #define statement.

Local

Constant NameResolutionUnitsValue
D_10MS_SEC_F32Single Precision FloatS0.01
D_LRNCNSTRTIME_MS_U321mS96
D_VEHSPDPTNUMX2_CNT_U161CountsD_VEHSPDPTNUM_CNT_U16*2
D_VEHSPDPTNUM_CNT_U161CountsTableSize_m(t2_VehSpd_Kph_f32)
D_HWPTNUM_CNT_U161CountsTableSize_m(t_FrHystHwAPts_HwDeg_f32)
D_HWPTNUMSUB1_CNT_U161CountsD_HWPTNUM_CNT_U16 - D_ONE_CNT_U16
D_BUFSIZE_CNT_U161Counts12
D_PHASESHIFTCNT_CNT_U161Counts6
D_TWO_CNT_U161Counts2
D_TEN_CNT_U161Counts10
D_QUARTER_CNT_f32Single Precision FloatCounts0.25
D_VEHSPDLOIDX_CNT_U161Counts0
D_VEHSPDHIIDX_CNT_U161Counts1
D_ONEG_MPSECSQRD_F32Single Precision FloatMpSecSqrd9.81

Global

This section lists the global constants used by the module. For details on global constants, refer to the Data Dictionary for the application.

Constant Name
D_ONE_CNT_U16
D_ZERO_CNT_U16
D_ONE_ULS_F32
D_ZERO_CNT_U32
D_180OVRPI_ULS_F32
D_FALSE_CNT_LGC
D_TRUE_CNT_LGC

Module specific Lookup Tables Constants

Constant NameResolutionValueSoftware Segment
None

Functions/Macros used by the Sub-Modules

Library Functions / Macros

The library and functions / Macros that are called by the various sub modules are identified below,

  1. TableSize_m

  2. LPF_Init_f32_m

  3. LPF_KUpdate_f32_m

  4. LPF_OpUpdate_f32_m

  5. FPM_FloatToFixed_m

  6. FPM_FixedToFloat_m

  7. IntplVarXY_u16_u16Xu16Y_Cnt

  8. Abs_f32_m

  9. Limit_m

  10. Min_m

  11. Max_m

Data Hiding Functions

  1. Rte_Pim_AvgFricLrnData()

  2. Rte_Call_AvgFricLrnData_WriteBlock()

Global Functions/Macros Defined by this Module

None

Local Functions/Macros Used by this MDD only

Load Buffer

Function NameLoadBufferTypeMinMaxUTP Tol.
Arguments PassedInput_Uls_T_f32float32FULLFULL
Buffer_Uls_T_f32float32 *FULLFULL
BufferSize_Cnt_T_u16uint16FULLFULL
Return ValueN/A

Description

Handwheel Angle Constraint

Function NameHwAngConstraintTypeMinMaxUTP Tol.
Arguments PassedHwAng_HwDeg_T_f32float32-1440.111440.11
HwAngOK_Cnt_T_lgcboolean *FULLFULL
SelHwAng_HwDeg_T_f32float32 *-1440.111440.11
Return ValueN/A

Description

Handwheel Velocity Constraint

Function NameHwVelConstraintTypeMinMaxUTP Tol.
Arguments PassedHwVel_HwDegpS_T_f32float32-18331833
HwVelOK_Cnt_T_lgcboolean *FULLFULL
Direction_Cnt_T_u16uint16 *01
Return ValueN/A

Description

Vehicle Speed Constraint

Function NameVehSpdConstraintTypeMinMaxUTP Tol.
Arguments PassedVehSpd_Kph_T_f32float320511
VehSpdOK_Cnt_T_lgcboolean *FULLFULL
VehSpdIndex_Cnt_T_u16uint16 *03
Return ValueN/A

Description

Friction Learning

Function NameFricLearningTypeMinMaxUTP Tol.
Arguments PassedHwAng_HwDeg_T_f32float32-1440.111440.11
ColTrq_HwNm_T_f32float32-2020
VehSpdIndex_Cnt_T_u16uint1603
Direction_Cnt_T_u16uint1601
Return ValueN/A

Friction Learning

Range Counter Manager

Calculate Average Friction

Baseline Mode (reset to baseline)

Function NameBaselineModeTypeMinMaxUTP Tol.
Arguments PassedN/A
Return ValueN/A

Description

Clear Mode (reset to zero)

Function NameClearModeTypeMinMaxUTP Tol.
Arguments PassedN/A
Return ValueN/A

Description

Software Module Implementation

Runtime Environment (RTE) Initial Values

This section lists the initial values of data written by this module but controlled by the RTE. After RTE initialization, the data in this table will contain these values.

DataValue
Rte_InitValue_EstFric_HwNm_f320
Rte_InitValue_FricOffset_HwNm_f320
Rte_InitValue_HwAng_HwDeg_f320
Rte_InitValue_HwPosAuthority_Uls_f320
Rte_InitValue_HwTrq_HwNm_f320
Rte_InitValue_HwVel_HwRadpS_f320
Rte_InitValue_LatAcc_g_f320
Rte_InitValue_CRFMtrTrq_MtrNm_f320
Rte_InitValue_SatEstFric_HwNm_f320
Rte_InitValue_Temperature_DegC_f320
Rte_InitValue_VehicleSpeedValid_Cnt_lgcFALSE
Rte_InitValue_VehSpd_Kph_f320
Rte_InitValue_DefeatFrictionLearning_cnt_lgcFALSE

Initialization Functions

Init: _Init1

Design Rationale

None

Module Outputs

None

Module Internal


Periodic Functions

Per: _Per1

Design Rationale

None

Program Flow Start

Rte_Call_AvgFricLrn_Per1_CP0_CheckpointReached()Store Module Inputs to Local copies

HwAngUnfilt_HwDeg_T_f32 = Rte_IRead_AvgFricLrn_Per1_HwAng_HwDeg_f32()

HwPosAuthorityUnfilt_Uls_T_f32 = Rte_IRead_AvgFricLrn_Per1_HwPosAuthority_Uls_f32()

HwTrq_HwNm_T_f32 = Rte_IRead_AvgFricLrn_Per1_HwTrq_HwNm_f32()

HwVelUnfilt_HwRadpS_T_f32 = Rte_IRead_AvgFricLrn_Per1_HwVel_HwRadpS_f32()

LatAccUnfilt_g_T_f32 = Rte_IRead_AvgFricLrn_Per1_LatAcc_g_f32()

MtrTrq_MtrNm_T_f32 = Rte_IRead_AvgFricLrn_Per1_CRFMtrTrq_MtrNm_f32()

TemperatureUnfilt_DegC_T_f32 = Rte_IRead_AvgFricLrn_Per1_Temperature_DegC_f32()

VehSpdUnfilt_Kph_T_f32 = Rte_IRead_AvgFricLrn_Per1_VehSpd_Kph_f32()

VehicleSpeedValid_Cnt_T_lgc = Rte_IRead_AvgFricLrn_Per1_VehicleSpeedValid_Cnt_lgc()

LatAccUnfilt_MpSecSqrd_T_f32 = LatAccUnfilt_g_T_f32 * D_ONEG_MPSECSQRD_F32

HwVelUnfilt_HwDegpS_T_f32 = HwVelUnfilt_HwRadpS_T_f32 * D_180OVRPI_ULS_F32

OpMode_Cnt_T_enum = Rte_Pim_AvgFricLrnData()->OpMode_Cnt_enum

DefeatFricLearning_Cnt_T_lgc = Rte_IRead_AvgFricLrn_Per1_DefeatFricLearning_Cnt_lgc()Determine Mode

Prep Data

Learning Constraint

Calibration/Running Modes

Fault Injection

Store Local copy of outputs into Module Outputs

Rte_IWrite_AvgFricLrn_Per1_FricOffset_HwNm_f32(FricOffsetOut_HwNm_T_f32)

Rte_IWrite_AvgFricLrn_Per1_EstFric_HwNm_f32(EstFric_HwNm_M_f32)

Rte_IWrite_AvgFricLrn_Per1_SatEstFric_HwNm_f32(SatEstFric_HwNm_M_f32)

Program Flow End

Rte_Call_AvgFricLrn_Per1_CP1_CheckpointReached()


Fault Recovery Functions

None

Shutdown Functions

None

Interrupt Functions

None

Serial Communication Functions

SCom: AvgFricLrn_SCom_GetEOLFric

Function NameAvgFricLrn_SCom_GetEOLFricTypeMinMaxUTP Tol.
Arguments Passed*EOLFric_HwNm_f32 uint8*0127N/A
Return ValueN/A

Design Rationale

None

Program Flow Start

N/A

Store Module Inputs to Local copies

None

Read EOLFric Service

Store Local copy of outputs into Module Outputs

None

Program Flow End

None

SCom: AvgFricLrn_SCom_ GetOffsetOutputDefeat

Function NameAvgFricLrn_SCom_ GetOffsetOutputDefeatTypeMinMaxUTP Tol.
Arguments Passed* DefeatOffsetOutput_Cnt_lgcboolean*FALSETRUE0
Return ValueN/A

Design Rationale

None

Program Flow Start

N/A

Store Module Inputs to Local copies

None

Read Offset Output Defeat Service

Store Local copy of outputs into Module Outputs

None

Program Flow End

None

SCom: AvgFricLrn_SCom_ GetSelect

Function NameAvgFricLrn_SCom_ GetSelectTypeMinMaxUTP Tol.
Arguments Passed* EnableFricLearning_Cnt_lgcboolean*FALSETRUE0
*EnableOffsetOutput_Cnt_lgcboolean*FALSETRUE0
*OpMode_Uls_u08uint8*040
Return ValueN/A

Design Rationale

None

Program Flow Start

N/A

Store Module Inputs to Local copies

None

Read Select Service

Store Local copy of outputs into Module Outputs

None

Program Flow End

None

SCom: AvgFricLrn_SCom_InitLearnedTables

Function NameAvgFricLrn_SCom_InitLearnedTablesTypeMinMaxUTP Tol.
Arguments PassedN/A
Return ValueN/A

Design Rationale

None

Program Flow Start

N/A

Store Module Inputs to Local copies

None

Restore Tables to Baseline Values Service

Store Local copy of outputs into Module Outputs

None

Program Flow End

None

SCOM: AvgFricLrn_SCom_ResetToZero

Function NameAvgFricLrn_SCom_ResetToZeroTypeMinMaxUTP Tol.
Arguments PassedN/A
Return ValueN/A

Design Rationale

None

Program Flow Start

N/A

Store Module Inputs to Local copies

None

Reset Tables to Zero Service

Store Local copy of outputs into Module Outputs

None

Program Flow End

None

SCom: AvgFricLrn_SCom_SetEOLFric

Function NameAvgFricLrn_SCom_SetEOLFricTypeMinMaxUTP Tol.
Arguments PassedEOLFric_HwNm_u08uint80127
Return ValueN/A

Design Rationale

None

Program Flow Start

N/A

Store Module Inputs to Local copies

None

Store EOL Friction Service

Store Local copy of outputs into Module Outputs

None

Program Flow End

None

SCom: AvgFricLrn_SCom_SetOffsetOutputDefeat

Function NameAvgFricLrn_SCom_SetOffsetOutputDefeatTypeMinMaxUTP Tol.
Arguments PassedDefeatOffsetOutput_Cnt_lgcBooleanFALSETRUE
Return ValueN/A

Design Rationale

None

Program Flow Start

N/A

Store Module Inputs to Local copies

None

Defeat Offset Output Service

Store Local copy of outputs into Module Outputs

None

Program Flow End

None

SCom: AvgFricLrn_SCom_SetSelect

Function NameAvgFricLrn_SCom_SetSelectTypeMinMaxUTP Tol.
Arguments PassedEnableFricLearning_Cnt_lgcBooleanFALSETRUE
EnableOffsetOutput_Cnt_lgcBooleanFALSETRUE
OpMode_Uls_u08Uint804
Return ValueN/A

Design Rationale

None

Program Flow Start

N/A

Store Module Inputs to Local copies

None

Select Mode and Enable Service

Store Local copy of outputs into Module Outputs

None

Program Flow End

None

Transition Functions

Trns: _Trns1

Design Rationale

This function implements the Power Off functions defined in the FDD model.

Program Flow Start

N/A

Store Module Inputs to Local copies

None

Save Learned Friction to NvM

Store Local copy of outputs into Module Outputs

None

Program Flow End

N/A


Execution Requirements

Execution Sequence of the Module

AvgFricLrn_Per1 executes at a rate of 10 ms. AvgFricLrn_Trns1 executes on power down.

Execution Rates for sub-modules called by the Scheduler

This table serves as reference for the Scheduler design

Function NameCalling FrequencySystem State(s) in which the function is called
AvgFricLrn_Init1On EventOn Init
AvgFricLrn_Per110 msOPERATE
AvgFricLrn_Trns1On EventOn Entering OFF

Execution Requirements for Serial Communication Functions

Function NameSub-Module called by (Serial Comm Function Name)
None


Memory Map Definition Requirements

Sub Modules (Functions)

This table identifies the software segments for functions identified in this module.

Name of Sub ModuleSoftware Segment
AvgFricLrn_Init1RTE_START_SEC_AP_AVGFRICLRN_APPL_CODE
AvgFricLrn_Per1RTE_START_SEC_AP_AVGFRICLRN_APPL_CODE
AvgFricLrn_Trns1RTE_START_SEC_AP_AVGFRICLRN_APPL_CODE

Local Functions

This table identifies the software segments for local functions identified in this module.

Name of Sub ModuleSoftware Segment
LoadBufferRTE_AP_AVGFRICLRN_APPL_CODE
HwAngConstraintRTE_AP_AVGFRICLRN_APPL_CODE
HwVelConstraintRTE_AP_AVGFRICLRN_APPL_CODE
VehSpdConstraintRTE_AP_AVGFRICLRN_APPL_CODE
FricLearningRTE_AP_AVGFRICLRN_APPL_CODE
BaselineModeRTE_AP_AVGFRICLRN_APPL_CODE
ClearModeRTE_AP_AVGFRICLRN_APPL_CODE


Known Issues / Limitations With Design

  1. INLINE functions defined in GlobalMacro.h are not unit tested.


Revision Control Log

Item #Rev #Change DescriptionDateAuthor Initials
11.0Initial Version24-May-12OT
22.0Fixed FPM type for calibration causing overflow08-Jun-12OT
33.0Fixed anomaly 3399 and initialization issue26-Jun-12OT
44.0Fixed integration issues24-Jul-12OT
55.0Fixed UTP Issue30-Jul-12OT
66.0Updated to SF-07 version 00213-Sep-12JWJ
77.0Added watchdog checkpoints24-Sept-12BWL
88.0Corrected code typographical mismatches and corrected anomaly 387227-Sep-12JWJ
99.0Added SCom get functions to return written values24-Oct-12JWJ
1010.0Updated MDD for UTP Catchups28-Jan-13NRAR
1111.0Set PrevOpMode in SetSelect per anom 467908-July-13BWL
1212.0Updated to SF-07 version 00325-Oct-13VK
Last modified October 12, 2025: Initial commit (0347a62)