Handwheel_Torque_MDD

Module -- Hand Wheel Torque2626

High-Level Description

This function calculates the Hand Wheel Torque and performs the diagnostics on the Torque input signals T1 and T2.

Figures

Component Diagram

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 Inputs (Global Variable Name)Module Outputs (Global Variable Name)
T1ADC_Volt_f32AnaHwTorque_HwNm_f32
T2ADC_Volt_f32SysCAnaHwTorque_HwNm_f32
SysCHwTorqueSqd_HwNmSq_f32AnaDiffHwTrq_HwNm_f32
AbsPosStepSignal_Cnt_u08SrlComHwTrqValid_Cnt_lgc
CntrlDisRampComplete_Cnt_lgcErrorActiveAnalog_Cnt_enum
MECCounter_Cnt_enum

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
CorrDiagFiltOut_Volt_M_s4p112-11-5.05.0HWTRQ_START_SEC_VAR_CLEARED_16
CorrDiagFiltSV_Volt_M_s4p272-11-5.05.0HWTRQ_START_SEC_ VAR_SAVED_ZONEH_32
SSDiagFiltOut_Volt_M_s4p112-11-5.05.0HWTRQ_START_SEC_VAR_CLEARED_16
SSDiagFiltSV_Volt_M_s4p272-27-5.05.0HWTRQ_START_SEC_VAR_CLEARED_32
TDiagFiltOut_Volt_M_s4p112-11-5.05.0HWTRQ_START_SEC_VAR_CLEARED_16
TDiagFiltSV_Volt_M_s4p272-27-5.05.0HWTRQ_START_SEC_VAR_CLEARED_32
SumFltOut_Volt_M_u5p112-1105.0HWTRQ_START_SEC_VAR_CLEARED_16
T1RngErrAcc_Cnt_M_u1610FULLHWTRQ_START_SEC_VAR_CLEARED_16
T2RngErrAcc_Cnt_M_u1610FULLHWTRQ_START_SEC_VAR_CLEARED_16
AnaDiffHwTrq_Volt_M_f32Single Precision Floating Point-55HWTRQ_START_SEC_VAR_CLEARED_32
AnaHwTorque_HwNm_M_f32Single Precision Float-1010HWTRQ_START_SEC_VAR_CLEARED_32
TrqSum_Volts_M_s4p112-11-5.05.0HWTRQ_START_SEC_VAR_CLEARED_16
TrqSensorRecDiagAcc_Cnt_M_u1610FULLHWTRQ_START_SEC_VAR_CLEARED_16
NvMBlkStatus_Cnt_M_u8NvM_RequestResultTypeN/AN/AHWTRQ_START_SEC_VAR_CLEARED_8
AnaHwTorqueSqd_HwNmSq_D_f32Single Precision Float0100HWTRQ_START_SEC_VAR_CLEARED_32
HWTorqCorrLimDiff_HwNmSq_D_f32Single Precision Float0100HWTRQ_START_SEC_VAR_CLEARED_32
HwTorqCh1vsCh2CorrLim_HwNmSq_D_f32Single Precision Float0100HWTRQ_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)

HwTrqStatusType

HWTRQSTATUS_NONE = 0

HWTRQSTATUS_ACTIVE = 1

HWTRQSTATUS_FAULT = 2

uint802
ManufModeType

ProductionMode = 0

ManufacturingMode = 1

EngineeringMode = 2

Uint802

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
k_TbarStiff_NmpDeg_f32
k_HwTrqSclNom_VoltspDeg_f32
k_AnaRngDiag_Cnt_str
k_T1LowRange_Volts_f32
k_T1HghRange_Volts_f32
k_T2LowRange_Volts_f32
k_T2HghRange_Volts_f32
k_MaxTrqSumLmt_Volts_f32
t_TdiagFiltKnTbl_Cnt_u16[17]
t_TdiagIndptTbl_Volts_u5p11[17]
k_TdiagLim_Volts_u5p11
k_SSDiagKn_Cnts_u16
k_CorrDiagKn_Cnts_u16
k_TdiagCorrLim_Volts_u5p11
k_SSDiagLim_Volts_u5p11
k_CorrDiagFiltActiv_Volts_u5p11
k_MaxHwTrqTrim_Volts_f32
k_SumFiltRecLim_Volt_u5p11
k_SSFiltRecLim_Volt_u5p11
k_TrqFltRecLim_Cnt_u16
k_T1AccRecLim_Cnt_u16
k_T2AccRecLim_Cnt_u16
k_AnaT1T2ErrThreshold_Volts_u5p11
t_HwTorqCorrLimXAxis_HwNm_u4p12[]
t_HwTorqCorrLimYAxis_HwNmSq_u7p9[]
k_HwTorqCorrLimDiag_Cnt_str

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 NameResolutionValue
D_HWTRQLOLMT_HWNM_F32Single Precision Floating Point-10.0
D_HWTRQHILMT_HWNM_F32Single Precision Floating Point10.0
D_DFLTRTRQTRIM_VOLT_F32Single Precision Floating Point2.5
D_TRQSCALEWNDW_ULS_F32Single Precision Floating Point0.20
D_NTCFAILED_CNT_U0810x01U
D_SSDIAGNFILTSVLMT_VOLT_S4P272-27FPM_Fix_m((k_SSDiagLim_Volts_u5p11 + 1), u5p11_T, s4p27_T)
D_FAILEDANDFAILEDTHISOPCYCLE_CNT_U0810x03
D_TESTNOTCOMPLETEDTHISOPCYCLE_CNT_U0810x40
D_NUMTRQSTEP_CNT_U08110

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_FALSE_CNT_LGC
D_ZERO_ULS_F32
D_ZERO_CNT_U16
D_ZERO_CNT_U8

Module specific Lookup Tables Constants

Constant NameResolutionValueSoftware Segment
None

Functions/Macros used by the Sub-Modules

Library Functions / Macros

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

  1. FPM_FixedToFloat_m()

  2. FPM_FloatToFixed_m()

  3. Limit_m()

  4. Abs_f32_m ()

  5. IntplVarXY_u16_u16Xu16Y_Cnt()

  6. LPF_SvUpdate_s16InFixKTrunc_m()

  7. LPF_OpUpdate_s16InFixKTrunc_m()

  8. DiagPStep_m()

  9. DiagNStep_m()

  10. DiagFailed_m()

Data Hiding Functions

The data hiding functions / macros used in this module are identified below,

  1. Rte_Pim_HwTrqTrimData()

  2. Rte_Pim_HwTrqScaleData()

  3. Rte_Pim_EOLTrqStepData()

  4. Rte_Call_NxtrDiagMgr_SetNTCStatus()

  5. Rte_Call_HwTrqTrim_WriteBlock()

  6. Rte_Call_HwTrqScale_WriteBlock()

  7. Rte_Call_NxtrDiagMgr_GetNTCFailed()

  8. Rte_Call_NxtrDiagMgr_ResetEventStatus()

  9. Rte_Call_HwTrqTrim_GetErrorStatus()

Local Functions/Macros Used by this MDD only

The local functions/macros in this module are identified below,

  1. IsTrqScaleInRng_lgc()

  2. TrqTrimPerfDiag()

Software Module Implementation

Initialization Functions

Init: HwTrq_Init

Design Rationale

None

Check Faults and Initialize Filters

Periodic Functions

Per: HwTrq_Per1

Design Rationale

None

Program Flow Start

Rte_Call_HwTrq_Per1_CP0_CheckpointReached()

Store Module Inputs to Local copies

AbsPosStepSignal_Cnt_T_u08 = Rte_IRead_HwTrq_Per1_AbsPosStepSignal_Cnt_u08()

Torque1_Volt_T_f32 = Rte_Iread_HwTrq_Per1_T1ADC_Volt_f32()

Torque2_Volt_T_f32 = Rte_Iread_HwTrq_Per1_T2ADC_Volt_f32()

Rte_Call_NxtrDiagMgr_GetNTCStatus(NTC_Num_TrqSensorRecoveryFlt, &DiagTrqRecvStatus_Cnt_T_u08)

Rte_Call_NxtrDiagMgr_GetNTCStatus(NTC_Num_T1OutofRange, &DiagT1OutofRangeStatus_Cnt_T_u08)

Rte_Call_NxtrDiagMgr_GetNTCStatus(NTC_Num_T2OutofRange, &DiagT2OutofRangeStatus_Cnt_T_u08)

Rte_Call_NxtrDiagMgr_GetNTCStatus(NTC_Num_T1vsT2, &DiagT1vsT2Status_Cnt_T_u08)

Rte_Call_NxtrDiagMgr_GetNTCStatus(NTC_Num_TrqSensorNotTrimmed, &DiagTrqTrimNotPerfStatus_Cnt_T_u08)

Rte_Call_NxtrDiagMgr_GetNTCStatus(NTC_Num_PriSnsrTrqStorFlt, &DiagTrqTrimInvalidStatus_Cnt_T_u08)

AbsPosStepSignal_Cnt_T_u08 = Limit_m(AbsPosStepSignal_Cnt_T_u08, D_ZERO_CNT_U8, D_NUMTRQSTEP_CNT_U08 - 1U)

Calculate Handwheel Torque and SCom Validity

Analog Error Active

Store Local copy of outputs into Module Outputs

AnaDiffHwTrq_Volt_M_f32 = DiffHwTorque_Volts_T_f32

AnaHwTorque_HwNm_M_f32 = AnaHwTorque_HwNm_T_f32

Rte_IWrite_HwTrq_Per1_AnaDiffHwTrq_Volt_f32(DiffHwTorque_Volts_T_f32)

Rte_Iwrite_HwTrq_Per1_AnaHwTorque_HwNm_f32(AnaHwTorque_HwNm_T_f32)

Rte_IWrite_HwTrq_Per1_SysCAnaHwTorque_HwNm_f32(AnaHwTorque_HwNm_T_f32)

Rte_IWrite_HwTrq_Per1_ErrorActiveAnalog_Cnt_enum(ErrorActiveAnalog_Cnt_T_enum)

Rte_Iwrite_HwTrq_Per1_SrlComHwTrqValid_Cnt_lgc(SrlComHwTrqValid_Cnt_T_lgc)

Program Flow End

Rte_Call_HwTrq_Per1_CP1_CheckpointReached()

Per: HwTrq_Per2

Design Rationale

None

Program Flow Start

Rte_Call_HwTrq_Per2_CP0_CheckpointReached()

Store Module Inputs to Local copies

CntrlDisRampComplete_Cnt_T_lgc = Rte_IRead_HwTrq_Per2_CntrlDisRampComplete_Cnt_lgc()

SysCHwTorqueSqd_HwNmSq_T_f32 = Rte_IRead_HwTrq_Per2_SysCHwTorqueSqd_HwNmSq_f32()

Torque1_Volt_T_f32 = Rte_Iread_HwTrq_Per2_T1ADC_Volt_f32()

Torque2_Volt_T_f32 = Rte_Iread_HwTrq_Per2_T2ADC_Volt_f32()

T1Trim_Volt_T_f32 = Rte_Pim_HwTrqTrimData()->T1Trim_Volts_f32

T2Trim_Volt_T_f32 = Rte_Pim_HwTrqTrimData()->T2Trim_Volts_f32

T1 & T2 Out of Range

T1 vs T2 Diagnostic

Torque Recovery Diagnostic

Handwheel Diff Torque Cross Check

Store Local copy of outputs into Module Outputs

TrqSum_Volt_M_s4p11 = TrqSum_Volt_T_s4p11

TDiagFiltOut_Volt_M_s4p11 = TDiagFiltOut_Volt_T_s4p11

AnaHwTorqueSqd_HwNmSq_D_f32 = AnaHwTorqueSqd_HwNmSq_T_f32

HWTorqCorrLimDiff_HwNmSq_D_f32 = HwTorqCorrLimDiff_HwNmSq_T_f32

HwTorqCh1vsCh2CorrLim_HwNmSq_D_f32 = HwTorqCh1vsCh2CorrLim_HwNmSq_T_f32

Program Flow End

Rte_Call_HwTrq_Per2_CP1_CheckpointReached()

Per: HwTrq_Per3

Design Rationale

None

Program Flow Start

Rte_Call_HwTrq_Per3_CP0_CheckpointReached()

Store Module Inputs to Local copies

None

T1 Vs T2 Diagnostic

Store Local copy of outputs into Module Outputs

Program Flow End

Rte_Call_HwTrq_Per3_CP1_CheckpointReached()

Serial Communication Functions

Scomm: HwTrq_Scom_ClrHwTrqScale

Design Rationale

None

Program Flow Start

N/A

Store Module Inputs to Local copies

Clear Handwheel Torque Scale Service

Store Local copy of outputs into Module Outputs

None

Program Flow End

N/A

Scomm: HwTrq_Scom_ClrHwTrqTrim

Design Rationale

None

Program Flow Start

N/A

Store Module Inputs to Local copies

Clear Handwheel Torque Trim Service

Store Local copy of outputs into Module Outputs

None

Program Flow End

N/A

Scomm: HwTrq_Scom_ReadHwTrqScale

Design Rationale

None

Program Flow Start

N/A

Store Module Inputs to Local copies

None

Read Handwheel Torque Scale Service

Store Local copy of outputs into Module Outputs

None

Program Flow End

N/A

Scomm: HwTrq_Scom_ReadHwTrqTrim

Design Rationale

None

Program Flow Start

N/A

Store Module Inputs to Local copies

None

Read Handwheel Torque Trim Service

Store Local copy of outputs into Module Outputs

None

Program Flow End

N/A

Scomm: HwTrq_Scom_SetHwTrqScale

Design Rationale

None

Program Flow Start

N/A

Store Module Inputs to Local copies

None

Set Handwheel Torque Scale Service

Store Local copy of outputs into Module Outputs

None

Program Flow End

N/A

Scomm: HwTrq_Scom_SetHwTrqTrim

Design Rationale

None

Program Flow Start

N/A

Store Module Inputs to Local copies

 Rte_Read_T1ADC_Volt_f32(&Torque1_Volt_T_f32)

Rte_Read_T2ADC_Volt_f32(&Torque2_Volt_T_f32)

Rte_Read_MECCounter_Cnt_enum(&MECCounter_Cnt_T_enum)

Set Handwheel Torque Trim Service

Store Local copy of outputs into Module Outputs

None

Program Flow End

N/A

Manual Set Hand wheel Torque Trim

Description


Scomm: HwTrq_SCom_ReadEOLTrqStep

TypeMinMaxUTP Tol.
Arguments PassedTrqStep_HwNm_T_f32float * (array of 10 float values)-1010
Return ValueNone

Description

Scomm: HwTrq_SCom_SetEOLTrqStep

TypeMinMaxUTP Tol.
Arguments PassedTrqStep_HwNm_T_f32float * (array of 10 float values)-1010
Return ValueNone

Description

Local Function/Macro Definitions

If these are numerous and defined in a separate source file then reference the source file only.

Is Torque Scale In Range Check

Function NameIsTrqScaleInRng_lgcTypeMinMaxUTP Tol.
Arguments PassedTrqScale_VoltspDeg_T_f32Single Precision Floating Point0FULL
Return ValueTrqSclInRng_Cnt_T_lgcBOOLEANN/AN/A

Description

Torque Trim Performance Diagnostic

Function NameTrqTrimPerfDiagTypeMinMaxUTP Tol.
Arguments PassedMECCounter_Cnt_T_enumManufModeTypeN/AN/A
Return ValueNone

Description

Execution Requirements

Execution Rates for sub-modules called by the Scheduler

This table serves as reference for the Scheduler design

Function NameCalling FrequencySystem State(s)
HwTrq_InitOnce at InitializationSTARTUP
HwTrq_Per12msWARM INIT, OPERATE, DISABLE
HwTrq_Per24msWARM INIT, OPERATE, DISABLE
HwTrq_Per3100msWARM INIT, OPERATE, DISABLE

Execution Requirements for Serial Communication Functions

Function NameSub-Module called by (Serial Comm Function Name)
HwTrq_Scom_ClrHwTrqScale()EPSInternalPIDWrite(),EPSInternalRoutineControl()
HwTrq_Scom_ClrHwTrqTrim()EPSInternalRoutineControl()
HwTrq_Scom_ReadHwTrqScale()EPSInternalPIDRead()
HwTrq_Scom_ReadHwTrqTrim()EPSInternalPIDRead()
HwTrq_Scom_SetHwTrqScale()EPSInternalPIDWrite()
HwTrq_Scom_SetHwTrqTrim()EPSInternalRoutineControl()
HwTrq_SCom_ManualSetHwTrqTrim
HwTrq_SCom_ReadEOLTrqStep
HwTrq_SCom_SetEOLTrqStep


Memory Map Definition Requirements

Sub Modules (Functions)

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

Name of Sub ModuleSoftware Segment
HwTrq_Init()RTE_SA_HWTRQ_APPL_CODE
HwTrq_Per1()RTE_SA_HWTRQ_APPL_CODE
HwTrq_Per2()RTE_SA_HWTRQ_APPL_CODE
HwTrq_Per3()RTE_SA_HWTRQ_APPL_CODE
HwTrq_Scom_ClrHwTrqScale()RTE_SA_HWTRQ_APPL_CODE
HwTrq_Scom_ClrHwTrqTrim()RTE_SA_HWTRQ_APPL_CODE
HwTrq_Scom_ReadHwTrqScale()RTE_SA_HWTRQ_APPL_CODE
HwTrq_Scom_ReadHwTrqTrim()RTE_SA_HWTRQ_APPL_CODE
HwTrq_Scom_SetHwTrqScale()RTE_SA_HWTRQ_APPL_CODE
HwTrq_Scom_SetHwTrqTrim()RTE_SA_HWTRQ_APPL_CODE
HwTrq_Scom_ManualSetHwTrqTrimRTE_SA_HWTRQ_APPL_CODE
HwTrq_SCom_ReadEOLTrqStepRTE_SA_HWTRQ_APPL_CODE
HwTrq_SCom_SetEOLTrqStepRTE_SA_HWTRQ_APPL_CODE

Local Functions

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

Name of Sub ModuleSoftware Segment
IsTrqScaleInRng_lgc()RTE_SA_HWTRQ_APPL_CODE
TrqTrimPerfDiag()RTE_SA_HWTRQ_APPL_CODE


Known Issues / Limitations With Design

INLINE functions defined in globalmacro.h are not unit tested

Revision Control Log

Rev #Change DescriptionDateAuthor Initials
1.0Initial AutoSAR Release.04FEB11L.N.
2.0Rte_Call_CorrDiagFiltSV_SetRamBlockStatus() added in Init() and Cross Check Diag Support Added03May11N.R.A.R
3.0Updated for anomaly 325817JUN11LWW
4.0Removed Cross Check Diag Support20JUL11LWW
5.0Changes as per FDD #04 rev00822Nov11VK
5.1Changes to Scom functions passing a null pointer instead of Boolean flag for the writeblock Rte call. Changed SumFltOut_Volt_M_u5p11 and SSDiagFiltOut_Volt_M_s4p11 to display variables2Dec11VK
6

Per3 trigger rate moved to 100ms from 128ms

Removed residual periodic specifiations

5Dec11JJW
7Corrected GetNTCFailed RTE call arguments in Per15Dec11VK
8Changed HwTrqScaleStatus, HwTrqTrimStatus to boolean13Dec11VK
9Matched the names of the elements in HwTrqScale_Datatype and HwTrqTrim_Datatype as in digital hw torque14Dec11VK
10Corrected Rte read for MEC14Dec11VK
11Updated Argument to Set Scale function to match DigHwTrq15Dec11OT
12Fixed scale validity check logic16Dec11OT
13Fixed NTC_STATUS_PASSED path anomaly, added error accumulator macros1Feb12OT
14Fixed previous NTC_STATUS_PASSED anomaly fix, changed diff torque limit5Mar12OT
15Added manual write scom function for torque trim block, removed MEC20 Apr 12VK
16Updated NTC's NTC_Num_TrqSensorScaleInvalid and NTC_Num_EEPROMDiagTrqSnrStr with NTC_Num_PriSnsrTrqStorFlt and logic to clear the fault21-Apr-12VK
17Changes to HwTrq_SCom_ManualSetHwTrqTrim to match the name of the argument being passed. Changes to Per1 updating DiagTrqTrimInvalid_Cnt_T_lgc23-Apr-12VK
18Removal of polarity input (not called out in FDD)27-Apr-12LWW
19Updated to FDD 04A v00506-Jun-12OT
20Updated to FDD 04A v00614-Jun-12JWJ
21Removed double de-reference from EOLTrqStepData pointers in Per1 and Scom functions.17-Jun-12KJS
22Brought in Nexteer MEC Counter23-Aug-12VK
23Added double de-reference to EOLTrqStepData pointers in Per1 and Scom functions.04-Sep-12VK
24MDD, Src mismatch corrections10-Sep-12VK
25Added checkpoints and memmap software segment is updated for static variables27-Sep-12Selva
26Implemented FDD 04A v00712-Oct-12OT
27Anomaly 2824 – T1 vs T2 comparison cal usage24-Oct-12OT
27.1.1Anomaly 4683 Correction25-Mar-13LWW
Last modified October 12, 2025: Initial commit (0347a62)