MotorVelocity2_MDD

Module -- Motor Velocity

High-Level Description

This function calculates motor velocity using a diverse method and a converts this to HwVel.

Based on HighLevelDesignDocument (State Dependant Runnables_BMW_Future.xlsx), Runnables shown in different application segments are placed in different source files. For MtrVel, FDD Ver 007, HLDD has 4 runnables, two of which are in ASILD listed as MtrVel_Per1() and MtrVel_Per2(). And two of them are in ASILB’(D) listed as MtrVel2_Per1() and MtrVel2_Per2(). This document is responsible for ASILB’(D) runnables.

Figures

Diagram – Function Data Sharing

This diagram shows all data that is shared between functions within the module.

No Shared Data

Diagram – MtrVel

This diagram describes the functional characteristics and data flow of a given function.

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.

(Note: Full variable names required in table.)

(Note: All global variables including End Of Line data used should be shown here)

Module Inputs (Global Variable Name)Module Outputs (Global Variable Name)
CumMtrPosMRF_Deg_f32SysCDiagHandWheelVel_HwRadpS_f32
AsstAssemPol_Cnt_s8SysCDiagMtrVelMRF_MtrRadpS_f32
HandwheelVel_HwRadpS_f32
MRFMotorVel_MtrRadpS_f32

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
PrevSysCDiagCumMtrPos_Rad_M_f32Single Precision Floating Point-1745.331745.33MTRVEL2_START_SEC_VAR_CLEARED_32
SysCMtrVelMRF_MtrRadpS_M_f32Single Precision Floating Point-13501350MTRVEL2_START_SEC_VAR_CLEARED_32
SysCHwVelCRF_HwRadpS_M_f32Single Precision Floating Point-4242MTRVEL2_START_SEC_VAR_CLEARED_32
SysCMtrVelDiffAcc_Cnt_M_u1610255MTRVEL2_START_SEC_VAR_CLEARED_16
SysCHwVelDiffAcc_Cnt_M_u1610255MTRVEL2_START_SEC_VAR_CLEARED_16
SysCMtrVelCorrLimDiff_MtrRadpS_D_f32Single Precision Floating Point02700MTRVEL2_START_SEC_VAR_CLEARED_32
SysCHwVelCorrLimDiff_HwRadpS_D_f32Single Precision Floating Point02700MTRVEL2_START_SEC_VAR_CLEARED_32
SysCDiagCumMtrPosDelta_Rad_D_f32Single Precision Floating Point-6.2831856.283185MTRVEL2_START_SEC_VAR_CLEARED_32
SysCDiagMtrVelRawMRF_MtrRadpS_D_f32Single Precision Floating Point-6283.089436283.08943MTRVEL2_START_SEC_VAR_CLEARED_32
SysCDiagMtrVelRawMRFSv_M_strN/AN/AN/AMTRVEL2_START_SEC_VAR_CLEARED_UNSPECIFIED
SysCDiagMtrVelRawMRFSv_M_str.K_Uls_f32Single Precision Floating Point0.2222323210.529510782MTRVEL2_START_SEC_VAR_CLEARED_UNSPECIFIED
SysCDiagMtrVelRawMRFSv_M_str.SV_Uls_f32Single Precision Floating Point-6283.089436283.08943MTRVEL2_START_SEC_VAR_CLEARED_UNSPECIFIED

* Note: These ranges are based on the range of the normalized sine and cosine global inputs, which in turn are based on the maximum amount of signal variation that can be caused by temperature changes on the MSB signals.

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)

(Name given for the user defined typdef of type struct/union)

(Variable name qualified similar to all other variables)

(Variable name qualified similar to all other variables)as other variables

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_HwVelSampleTime_ms_f32
k_DiagMtrVelFiltKn_Hz_f32
k_GearRatio_Uls_f32
k_MtrVelCorrLim_Cnt_Str
k_HwVelCorrLim_Cnt_Str
k_MtrVelCorrLim_MtrRadpS_f32
k_HwVelCorrLim_HwRadpS_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 NameResolutionValue
D_MTRVELLOLMT_MTRRADPS_F32Single Precision Floating Point-1350
D_MTRVELLOLMT_MTRRADPS_F32Single Precision Floating Point1350
D_HWVELLOLMT_HWRADPS_F32Single Precision Floating Point-42
D_HWVELHILMT_HWRADPS_F32Single Precision Floating Point42

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_MSECPERSEC_ULS_F32
D_PIOVR180_ULS_F32

Module specific Lookup Tables Constants

(This is for lookup tables (arrays) with fixed values, same name as other tables)

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. Abs_f32_m()

  2. LPF_OpUpdate_f32_m ()

  3. LPF_KUpdate_f32_m

Data Hiding Functions

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

Local Functions/Macros Used by this MDD only

(Note if they are defined in another source file, then reference the appropriate header file)

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

Software Module Implementation

Initialization Functions

Init: MtrVel2_Init1

Design Rationale

None

Module Outputs

SysCDiagCumMtrPos_Rad_T_f32 as float

SysCDiagCumMtrPos_Rad_T_f32= Rte_IRead_MtrVel2_Init_ CumMtrPosMRF_Rev_f32 ()

PrevSysCDiagCumMtrPos_Rad_M_f32 = SysCDiagCumMtrPos_Rad_T_f32

LPF_KUpdate_f32_m(k_DiagMtrVelFiltKn_Hz_f32, D_2MS_SEC_F32, &SysCDiagMtrVelRawMRFSv_M_str)

Module Internal

None

Periodic Functions

Per: MtrVel2_Per1

Design Rationale

Program Flow Start

N/A

Store Module Inputs to Local copies

Rte_Call_MtrVel2_Per1_CP0_CheckpointReached()

AsstAssemPol_Cnt_T_s8 = Rte Rte_IRead_MtrVel2_Per1_AsstAssemPol_Cnt_s8 ()

SysCMechMtrPos_Rev_T_f32 = Rte_IRead_MtrVel2_Per1_SysCMechMtrPos_Rev_f32 ()

Calculate SysC Motor Velocity

Store Local copy of outputs into Module Outputs

Rte_IWrite_MtrVel2_Per1_SysCDiagHandWheelVel_HwRadpS_f32 (SysCHwVelCRF_HwRadpS_M_f32)

Rte_IWrite_MtrVel2_Per1_SysCDiagMtrVelMRF_MtrRadpS_f32 (SysCMtrVelMRF_MtrRadpS_M_f32)

Rte_Call_MtrVel2_Per1_CP1_CheckpointReached()

Program Flow End

N/A

Periodic Functions

Per: MtrVel2_Per2

Design Rationale

Program Flow Start

N/A

Store Module Inputs to Local copies

Rte_Call_MtrVel2_Per2_CP0_CheckpointReached()

HandwheelVel_HwRadpS_T_f32 = Rte_IRead_MtrVel2_Per2_HandWheelVel_HwRadpS_f32 ()

MRFMotorVel_MtrRadpS_T_f32 = Rte_IRead_MtrVel2_Per2_MRFMotorVel_MtrRadpS_f32 ()

Calculate Raw Motor Velocity

Rte_Call_MtrVel2_Per2_CP1_CheckpointReached()

Fault Recovery Functions

None

Shutdown Functions

None

Interrupt Functions

None

Serial Communication Functions

None

Local Function/Macro Definitions

None

Execution Requirements

Execution Sequence of the Module

(Describe in words relevant details about the execution sequence of the different sub modules.)

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
MtrVel2_Init1OnceALL STATES
MtrVel2_Per12msALL STATES
MtrVel2_Per24msALL STATES

Execution Requirements for Serial Communication Functions

Function NameSub-Module called by (Serial Comm Function Name)
N/A


Memory Map Definition Requirements

Sub Modules (Functions)

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

Name of Sub ModuleSoftware Segment
MtrVel2_Per1
MtrVel2_Per2

Local Functions

none


Known Issues / Limitations With Design

Revision Control Log

Item #Rev #Change DescriptionDateAuthor Initials
11.0Initial AutoSAR release.5OCT12NRAR
22.0Input range changes on MtrVel and HwVel signals to match FDD08APR13JJW
33.0Changes corresponding to FDD 02B r11. Updates to diverse computation of motor velocity.25APR13JJW
44.0Added limits per anomaly 513912JUN13KJS
Last modified October 12, 2025: Initial commit (0347a62)