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_f32 | AnaHwTorque_HwNm_f32 |
T2ADC_Volt_f32 | SysCAnaHwTorque_HwNm_f32 |
SysCHwTorqueSqd_HwNmSq_f32 | AnaDiffHwTrq_HwNm_f32 |
AbsPosStepSignal_Cnt_u08 | SrlComHwTrqValid_Cnt_lgc |
CntrlDisRampComplete_Cnt_lgc | ErrorActiveAnalog_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 Name | Resolution | Legal Range (min) | Legal Range (max) | Software Segment |
CorrDiagFiltOut_Volt_M_s4p11 | 2-11 | -5.0 | 5.0 | HWTRQ_START_SEC_VAR_CLEARED_16 |
CorrDiagFiltSV_Volt_M_s4p27 | 2-11 | -5.0 | 5.0 | HWTRQ_START_SEC_ VAR_SAVED_ZONEH_32 |
SSDiagFiltOut_Volt_M_s4p11 | 2-11 | -5.0 | 5.0 | HWTRQ_START_SEC_VAR_CLEARED_16 |
SSDiagFiltSV_Volt_M_s4p27 | 2-27 | -5.0 | 5.0 | HWTRQ_START_SEC_VAR_CLEARED_32 |
TDiagFiltOut_Volt_M_s4p11 | 2-11 | -5.0 | 5.0 | HWTRQ_START_SEC_VAR_CLEARED_16 |
TDiagFiltSV_Volt_M_s4p27 | 2-27 | -5.0 | 5.0 | HWTRQ_START_SEC_VAR_CLEARED_32 |
SumFltOut_Volt_M_u5p11 | 2-11 | 0 | 5.0 | HWTRQ_START_SEC_VAR_CLEARED_16 |
T1RngErrAcc_Cnt_M_u16 | 1 | 0 | FULL | HWTRQ_START_SEC_VAR_CLEARED_16 |
T2RngErrAcc_Cnt_M_u16 | 1 | 0 | FULL | HWTRQ_START_SEC_VAR_CLEARED_16 |
AnaDiffHwTrq_Volt_M_f32 | Single Precision Floating Point | -5 | 5 | HWTRQ_START_SEC_VAR_CLEARED_32 |
AnaHwTorque_HwNm_M_f32 | Single Precision Float | -10 | 10 | HWTRQ_START_SEC_VAR_CLEARED_32 |
TrqSum_Volts_M_s4p11 | 2-11 | -5.0 | 5.0 | HWTRQ_START_SEC_VAR_CLEARED_16 |
TrqSensorRecDiagAcc_Cnt_M_u16 | 1 | 0 | FULL | HWTRQ_START_SEC_VAR_CLEARED_16 |
NvMBlkStatus_Cnt_M_u8 | NvM_RequestResultType | N/A | N/A | HWTRQ_START_SEC_VAR_CLEARED_8 |
AnaHwTorqueSqd_HwNmSq_D_f32 | Single Precision Float | 0 | 100 | HWTRQ_START_SEC_VAR_CLEARED_32 |
HWTorqCorrLimDiff_HwNmSq_D_f32 | Single Precision Float | 0 | 100 | HWTRQ_START_SEC_VAR_CLEARED_32 |
HwTorqCh1vsCh2CorrLim_HwNmSq_D_f32 | Single Precision Float | 0 | 100 | HWTRQ_START_SEC_VAR_CLEARED_32 |
User defined typedef definition/declaration
This section documents any user types uniquely used for the module.
Typedef Name | Element Name | User Defined Type | Legal Range (min) | Legal Range (max) |
HwTrqStatusType | HWTRQSTATUS_NONE = 0 HWTRQSTATUS_ACTIVE = 1 HWTRQSTATUS_FAULT = 2 | uint8 | 0 | 2 |
ManufModeType | ProductionMode = 0 ManufacturingMode = 1 EngineeringMode = 2 | Uint8 | 0 | 2 |
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 Name | Resolution | Value |
D_HWTRQLOLMT_HWNM_F32 | Single Precision Floating Point | -10.0 |
D_HWTRQHILMT_HWNM_F32 | Single Precision Floating Point | 10.0 |
D_DFLTRTRQTRIM_VOLT_F32 | Single Precision Floating Point | 2.5 |
D_TRQSCALEWNDW_ULS_F32 | Single Precision Floating Point | 0.20 |
D_NTCFAILED_CNT_U08 | 1 | 0x01U |
D_SSDIAGNFILTSVLMT_VOLT_S4P27 | 2-27 | FPM_Fix_m((k_SSDiagLim_Volts_u5p11 + 1), u5p11_T, s4p27_T) |
D_FAILEDANDFAILEDTHISOPCYCLE_CNT_U08 | 1 | 0x03 |
D_TESTNOTCOMPLETEDTHISOPCYCLE_CNT_U08 | 1 | 0x40 |
D_NUMTRQSTEP_CNT_U08 | 1 | 10 |
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 Name | Resolution | Value | Software 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,
FPM_FixedToFloat_m()
FPM_FloatToFixed_m()
Limit_m()
Abs_f32_m ()
IntplVarXY_u16_u16Xu16Y_Cnt()
LPF_SvUpdate_s16InFixKTrunc_m()
LPF_OpUpdate_s16InFixKTrunc_m()
DiagPStep_m()
DiagNStep_m()
DiagFailed_m()
Data Hiding Functions
The data hiding functions / macros used in this module are identified below,
Rte_Pim_HwTrqTrimData()
Rte_Pim_HwTrqScaleData()
Rte_Pim_EOLTrqStepData()
Rte_Call_NxtrDiagMgr_SetNTCStatus()
Rte_Call_HwTrqTrim_WriteBlock()
Rte_Call_HwTrqScale_WriteBlock()
Rte_Call_NxtrDiagMgr_GetNTCFailed()
Rte_Call_NxtrDiagMgr_ResetEventStatus()
Rte_Call_HwTrqTrim_GetErrorStatus()
Local Functions/Macros Used by this MDD only
The local functions/macros in this module are identified below,
IsTrqScaleInRng_lgc()
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
Type | Min | Max | UTP Tol. | ||
Arguments Passed | TrqStep_HwNm_T_f32 | float * (array of 10 float values) | -10 | 10 | |
Return Value | None |
Description
Scomm: HwTrq_SCom_SetEOLTrqStep
Type | Min | Max | UTP Tol. | ||
Arguments Passed | TrqStep_HwNm_T_f32 | float * (array of 10 float values) | -10 | 10 | |
Return Value | None |
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 Name | IsTrqScaleInRng_lgc | Type | Min | Max | UTP Tol. |
Arguments Passed | TrqScale_VoltspDeg_T_f32 | Single Precision Floating Point | 0 | FULL | |
Return Value | TrqSclInRng_Cnt_T_lgc | BOOLEAN | N/A | N/A |
Description
Torque Trim Performance Diagnostic
Function Name | TrqTrimPerfDiag | Type | Min | Max | UTP Tol. |
Arguments Passed | MECCounter_Cnt_T_enum | ManufModeType | N/A | N/A | |
Return Value | None |
Description
Execution Requirements
Execution Rates for sub-modules called by the Scheduler
This table serves as reference for the Scheduler design
Function Name | Calling Frequency | System State(s) |
HwTrq_Init | Once at Initialization | STARTUP |
HwTrq_Per1 | 2ms | WARM INIT, OPERATE, DISABLE |
HwTrq_Per2 | 4ms | WARM INIT, OPERATE, DISABLE |
HwTrq_Per3 | 100ms | WARM INIT, OPERATE, DISABLE |
Execution Requirements for Serial Communication Functions
Function Name | Sub-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 Module | Software 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_ManualSetHwTrqTrim | RTE_SA_HWTRQ_APPL_CODE |
HwTrq_SCom_ReadEOLTrqStep | RTE_SA_HWTRQ_APPL_CODE |
HwTrq_SCom_SetEOLTrqStep | RTE_SA_HWTRQ_APPL_CODE |
Local Functions
This table identifies the software segments for local functions identified in this module.
Name of Sub Module | Software 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 Description | Date | Author Initials |
1.0 | Initial AutoSAR Release. | 04FEB11 | L.N. |
2.0 | Rte_Call_CorrDiagFiltSV_SetRamBlockStatus() added in Init() and Cross Check Diag Support Added | 03May11 | N.R.A.R |
3.0 | Updated for anomaly 3258 | 17JUN11 | LWW |
4.0 | Removed Cross Check Diag Support | 20JUL11 | LWW |
5.0 | Changes as per FDD #04 rev008 | 22Nov11 | VK |
5.1 | Changes 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 variables | 2Dec11 | VK |
6 | Per3 trigger rate moved to 100ms from 128ms Removed residual periodic specifiations | 5Dec11 | JJW |
7 | Corrected GetNTCFailed RTE call arguments in Per1 | 5Dec11 | VK |
8 | Changed HwTrqScaleStatus, HwTrqTrimStatus to boolean | 13Dec11 | VK |
9 | Matched the names of the elements in HwTrqScale_Datatype and HwTrqTrim_Datatype as in digital hw torque | 14Dec11 | VK |
10 | Corrected Rte read for MEC | 14Dec11 | VK |
11 | Updated Argument to Set Scale function to match DigHwTrq | 15Dec11 | OT |
12 | Fixed scale validity check logic | 16Dec11 | OT |
13 | Fixed NTC_STATUS_PASSED path anomaly, added error accumulator macros | 1Feb12 | OT |
14 | Fixed previous NTC_STATUS_PASSED anomaly fix, changed diff torque limit | 5Mar12 | OT |
15 | Added manual write scom function for torque trim block, removed MEC | 20 Apr 12 | VK |
16 | Updated NTC's NTC_Num_TrqSensorScaleInvalid and NTC_Num_EEPROMDiagTrqSnrStr with NTC_Num_PriSnsrTrqStorFlt and logic to clear the fault | 21-Apr-12 | VK |
17 | Changes to HwTrq_SCom_ManualSetHwTrqTrim to match the name of the argument being passed. Changes to Per1 updating DiagTrqTrimInvalid_Cnt_T_lgc | 23-Apr-12 | VK |
18 | Removal of polarity input (not called out in FDD) | 27-Apr-12 | LWW |
19 | Updated to FDD 04A v005 | 06-Jun-12 | OT |
20 | Updated to FDD 04A v006 | 14-Jun-12 | JWJ |
21 | Removed double de-reference from EOLTrqStepData pointers in Per1 and Scom functions. | 17-Jun-12 | KJS |
22 | Brought in Nexteer MEC Counter | 23-Aug-12 | VK |
23 | Added double de-reference to EOLTrqStepData pointers in Per1 and Scom functions. | 04-Sep-12 | VK |
24 | MDD, Src mismatch corrections | 10-Sep-12 | VK |
25 | Added checkpoints and memmap software segment is updated for static variables | 27-Sep-12 | Selva |
26 | Implemented FDD 04A v007 | 12-Oct-12 | OT |
27 | Anomaly 2824 – T1 vs T2 comparison cal usage | 24-Oct-12 | OT |
27.1.1 | Anomaly 4683 Correction | 25-Mar-13 | LWW |