This is the multi-page printable view of this section. Click here to print.
Motor Control
1 - CurrCmd_MDD
Module -- CurrCmd
High-Level Description
This Module generates the current command and the voltage reference for the current control.
Diagram – Function Data Sharing
Diagram – Function (Name)
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 | Module Outputs | |
MRFTrqCmdScl_MtrNm_f32 | DaxIntegralGain_Uls_f32 | |
MRFMtrVel_MtrRadpS_f32 | DaxPropotionalGain_Uls_f32 | |
EstKe_VpRadpS_f32 | QaxIntegralGain_Uls_f32 | |
EstR_Ohm_f32 | QaxPropotionalGain_Uls_f32 | |
EstLd_Henry_f32 | MtrCurrDaxRef_Amp_f32 | |
EstLq_Henry_f32 | MtrCurrQaxRef_Amp_f32 | |
VehSpd_Kph_f32 | MtrVoltDaxFF_Volt_f32 | |
MtrQuad_Cnt_u08 | MtrVoltQaxFF_Volt_f32 | |
FastDataAccessBufIndex_Cnt_M_u16 | MtrCurrAngle_Rev_f32 | |
CurrentGainSvc_Cnt_lgc | MtrTrqCmdSign_Cnt_s16 | |
MtrPosComputationDelay_Rad_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 Name | Resolution | Legal Range (min) | Legal Range (max) | Software Segment |
MtrVelFiltFFSV_MtrRadpS_M_s11p20 | 0.00000095367431640625 | -1118 | 1118 | CURRCMD_START_SEC_VAR_CLEARED_32 |
MtrVelFiltPISV_MtrRadpS_M_s11p20 | 0.00000095367431640625 | -1118 | 1118 | CURRCMD_START_SEC_VAR_CLEARED_32 |
MtrVelFilt_RadpSec_D_f32 | Single Precision Float | -1118 | 1118 | CURRCMD_START_SEC_VAR_CLEARED_32 |
MtrMaxCurrDaxRef_Amps_D_f32 | Single Precision Float | 0 | 200 | CURRCMD_START_SEC_VAR_CLEARED_32 |
MtrCurrQaxRef_Amp_D_f32 | Single Precision Float | -220 | 220 | CURRCMD_START_SEC_VAR_CLEARED_32 |
MtrCurrDaxRef_Amp_D_f32 | Single Precision Float | -220 | 220 | CURRCMD_START_SEC_VAR_CLEARED_32 |
PeakTorque_MtrNm_D_f32 | Single Precision Float | -8.8 | 8.8 | CURRCMD_START_SEC_VAR_CLEARED_32 |
MRFMtrVelFiltPI_MtrRadpS_D_f32 | Single Precision Float | -1118 | 1118 | CURRCMD_START_SEC_VAR_CLEARED_32 |
ElecPosDelayComp_Rad_D_f32 | Single Precision Float | -2*pi | 2*pi | CURRCMD_START_SEC_VAR_CLEARED_32 |
KpqGain_Uls_D_f32 | Single Precision Float | 0 | 100 | CURRCMD_START_SEC_VAR_CLEARED_32 |
KiqGain_Uls_D_f32 | Single Precision Float | 0 | 100 | CURRCMD_START_SEC_VAR_CLEARED_32 |
KpdGain_Uls_D_f32 | Single Precision Float | 0 | 100 | CURRCMD_START_SEC_VAR_CLEARED_32 |
KidGain_Uls_D_f32 | Single Precision Float | 0 | 100 | CURRCMD_START_SEC_VAR_CLEARED_32 |
IdMin_Amp_D_f32 | Single Precision Float | -220 | 220 | CURRCMD_START_SEC_VAR_CLEARED_32 |
IqMin_Amp_D_f32 | Single Precision Float | -220 | 220 | CURRCMD_START_SEC_VAR_CLEARED_32 |
IqMax_Amp_D_f32 | Single Precision Float | -220 | 220 | CURRCMD_START_SEC_VAR_CLEARED_32 |
IdMax_Amp_D_f32 | Single Precision Float | -220 | 220 | CURRCMD_START_SEC_VAR_CLEARED_32 |
ImSqMin_AmpSq_D_f32 | Single Precision Float | 0 | \96800 | CURRCMD_START_SEC_VAR_CLEARED_32 |
LimitedMRFMtrTrqCmd_MtrNm_D_f32 | Single Precision Float | -8.8 | 8.8 | CURRCMD_START_SEC_VAR_CLEARED_32 |
PhsAdvPeak_Rad_D_f32 | Single Precision Float | -2*pi | 2*pi | CURRCMD_START_SEC_VAR_CLEARED_32 |
CosDelta_Cnt_M_f32 | Single Precision Float | -1 | 1 | CURRCMD_START_SEC_VAR_CLEARED_32 |
SinDelta_Cnt_M_f32 | Single Precision Float | -1 | 1 | CURRCMD_START_SEC_VAR_CLEARED_32 |
EstKe_VpRadpS_M_f32 | Single Precision Float | 0.025 | 0.075 | CURRCMD_START_SEC_VAR_CLEARED_32 |
TermXq_Uls_M_f32 | Single Precision Float | -90 | 90 | CURRCMD_START_SEC_VAR_CLEARED_32 |
TermXd_Uls_M_f32 | Single Precision Float | -60 | 60 | CURRCMD_START_SEC_VAR_CLEARED_32 |
TermEgR_Amp_M_f32 | Single Precision Float | -4050 | 4050 | CURRCMD_START_SEC_VAR_CLEARED_32 |
TermVR2_AmpSq_M_f32 | Single Precision Float | 14400 | 810000 | CURRCMD_START_SEC_VAR_CLEARED_32 |
TermEgRZ_Amp_M_f32 | Single Precision Float | -5 | 5 | CURRCMD_START_SEC_VAR_CLEARED_32 |
TermVRZ_Amp_M_f32 | Single Precision Float | 0.02 | 900 | CURRCMD_START_SEC_VAR_CLEARED_32 |
TermVR_Amp_M_f32 | Single Precision Float | 120 | 900 | CURRCMD_START_SEC_VAR_CLEARED_32 |
Reluctance_Henry_M_f32 | Single Precision Float | 0.0002 | 0.0005 | CURRCMD_START_SEC_VAR_CLEARED_32 |
LocateMinImNIter_Cnt_D_u16 | 1 | 0 | 5 | CURRCMD_START_SEC_VAR_CLEARED_16 |
LocateTrqExNIter_Cnt_D_u16 | 1 | 0 | 5 | CURRCMD_START_SEC_VAR_CLEARED_16 |
CurrCmd_IdBoostAmount_Amp_D_f32 | Single Precision Float | See Data Dictionary | See Data Dictionary | CURRCMD_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) |
None |
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_a0IdSlope_Uls_f32 |
k_a1IdSlope_Uls_f32 |
k_a2IdSlope_Uls_f32 |
k_MtrVelFiltFFKn_Cnt_u16 |
k_MtrVelFiltPIKn_Cnt_u16 |
k_MtrMaxCurr_AmpsSq_f32 |
k_IdrefMtrVelOffset_RadpSec_f32 |
k_K2Slope_RadpSecpNm_f32 |
k_K3VelIntercep_RadpSec_f32 |
k_NoofPoles_Uls_f32 |
k_PIGainVspdCutoff_kph_f32 |
t_KpqGainX_MtrRadpSec_u12p4[8] |
t_KpqGainY_Uls_u6p10[8] |
t_KiqGainX_MtrRadpSec_u12p4[8] |
t_KpdGainX_MtrRadpSec_u12p4[8] |
t_KpdGainY_Uls_u6p10[8] |
t_KidGainX_MtrRadpSec_u12p4[8] |
t_KidGainY_Uls_u10p6[8] |
t_RefDeltaPoints_Rad_f32[8] |
t_Q13VltgSchedXTbl_MtrRadpS_u12p4[10] |
t_Q13VltgSchedYTbl_Volt_u5p11[10] |
t_Q24VltgSchedXTbl_MtrRadpS_u12p4[10] |
t_Q24VltgSchedYTbl_Volt_u5p11[10] |
k_IdqRefTrqTol_Rad_f32 |
k_IdqRefTrqNIter_Cnt_u16 |
k_IdqRefIminTol_Amp_f32 |
k_IdqRefLocateRefNIter_Cnt_u16 |
k_deadtimeVScale_Uls_f32 |
k_IdBoostGain_Uls_f32 |
k_IdBoostVRThreshScl_Uls_f32 |
t_IdBoostTrqCmdX_MtrNm_u4p12 |
t_IdBoostTrqCharSclY_Uls_u1p15 |
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 | Units | Value |
D_SQRT3OVR2_ULS_F32 | Single Precision Float | Uls | 0.866025403784 |
D_MTRPOLESDIV2_CNT_F32 | Single Precision Float | Cnt | 3.0 |
D_2OVRSQRT3_ULS_F32 | Single Precision Float | Uls | 1.15470053837925 |
D_NEG2OVRSQRT3_ULS_F32 | Single Precision Float | Uls | -1.15470053837925F |
D_ROUND_ULS_F32 | Single Precision Float | Uls | 0.5 |
D_NEGROUND_ULS_F32 | Single Precision Float | Uls | -0.5 |
D_NEG_ULS_F32 | Single Precision Float | Uls | - 1 |
D_MAXCURRENT_AMP_F32 | Single Precision Float | Amp | 220 |
D_SIZERDLTAPOINTS_CNT_U16 | 1 | Cnt | TableSize_m(t_RefDeltaPoints_Rad_f32) |
D_MAXDELTAPOINTSSIZE_CNT_U16 | 1 | Cnt | D_SIZERDLTAPOINTS_CNT_U16 – 1U) |
D_PIPLUSPIOVER4_ULS_F32 | Single Precision Float | ULS | D_PI_ULS_F32+( D_2PI_ULS_F32/4) |
D_VECUMAX_VOLTS_F32 | Single Precision Float | Volts | 31.0F |
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_ZERO_ULS_F32 |
D_180OVRPI_ULS_F32 |
D_ONE_ULS_F32 |
D_QUADRANT3_CNT_U8 |
D_QUADRANT1_CNT_U8 |
D_2PI_ULS_F32 |
D_ZERO_CNT_U16 |
D_VECUMIN_VOLTS_F32 |
Module specific Lookup Tables Constants
(This is for lookup tables (arrays) with fixed values, same name as other tables)
Constant Name | Resolution | Value | Software 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,
FPM_FloatToFixed_m
LPF_SvUpdate_s16InFixKTrunc_m
LPF_OpUpdate_s16InFixKTrunc_m
FPM_FixedToFloat_m
Sqrtf
Abs_f32_m
atan2f
IntplVarXY_u16_u16Xu16Y_Cnt
Sinf
Cosf
Data Hiding Functions
Global Functions/Macros Defined by this Module
None
Local Functions/Macros Used by this MDD only
Local Function #1
Function Name | ParabolicInterpolation | Type | Min | Max | UTP Tol. |
Arguments Passed | IntpolPoints_Uls_T_f32[6] | Float32 | - | - | |
Return Value | ParaIntpol_Uls_T_f32 | Float32 | N/A | N/A |
Description
Local Function #2
Function Name | CalculateImVSIdq | Type | Min | Max | UTP Tol. |
Arguments Passed | IdRef_Amp_T_f32 | Float32 | -220 | +220- | |
IqRef_Amp_T_f32 | Float32 | -220 | +220- | ||
Return Value | ImVSIdq_AmpSq_T_f32 | Float32 | 0 | 96800 |
Description
Local Function #3
Function Name | CalculateIq | Type | Min | Max | UTP Tol. |
Arguments Passed | Torquecmd_MtrNm_T_f32 | Float32 | -8.8 | 8.8 | |
IdRef_Amp_T_f32 | Float32 | -220 | 220 | ||
Return Value | IqRefTmp_Amp_T_f32 | Float32 | -220 | 220 |
Description
Local Function #4
Function Name | CurrtoVoltTest | Type | Min | Max | UTP Tol. |
Arguments Passed | IqRef_Amp_T_f32 | Float32 | -220 | 220 | |
IdRef_Amp_T_f32 | Float32 | -220 | 220 | ||
*VqR_Amp_T_f32 | Float32 | -220 | 220 | ||
*VdR_Amp_T_f32 | Float32 | -220 | 220 | ||
Return Value | VoltTest_Uls_T_lgc | Boolean | False | True |
Description
Local Function #5
Function Name | CalcTorque | Type | Min | Max | UTP Tol. |
Arguments Passed | CosDelta_Cnt_T_f32 | Float32 | 0 | 1 | |
SinDelta_Cnt_T_f32 | Float32 | 0 | 1 | ||
*IdMax_Amp_T_f32 | Float32 | -220 | 220 | ||
Return Value | TorqueCalc_MtrNm_T_f32 | Float32 | -8.8 | 8.8 |
Description
Local Function #6
Function Name | LocateTrqExtremese | Type | Min | Max | UTP Tol. |
Arguments Passed | MtrTrqCmd_MtrNm_T_f32 | Float32 | -8.8 | 8.8 | |
*IdMax_Amp_T_f32 | Float32 | -220 | 220 | ||
*PhsAdvPeak_Rad_T_f32 | Float32 | -2*pi | +2*pi | ||
Return Value | TorqueState_MtrNm_T_f32 | Float32 | -8.8 | 8.8 |
Description
Local Function #7
Function Name | LocateMinimumIm | Type | Min | Max | UTP Tol. |
Arguments Passed | MtrTrqCmd_MtrNm_T_f32 | Float32 | -8.8 | 8.8 | |
* IdMin_Amp_T_f32 | Float32 | -220 | 220 | ||
* IqMin_Amp_T_f32 | Float32 | -220 | 220 | ||
Return Value | ImSqrMin_AmpSq_T_f32 | Float32 | 0 | 96800 |
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.
Data | Value |
Rte_InitValue_DaxIntegralGain_Uls_f32 | 0 |
Rte_InitValue_DaxPropotionalGain_Uls_f32 | 0 |
Rte_InitValue_EstKe_VpRadpS_f32 | 0 |
Rte_InitValue_EstLd_Henry_f32 | 0 |
Rte_InitValue_EstLq_Henry_f32 | 0 |
Rte_InitValue_EstR_Ohm_f32 | 0 |
Rte_InitValue_MRFMtrVel_MtrRadpS_f32 | 0 |
Rte_InitValue_MRFTrqCmdScl_MtrNm_f32 | 0 |
Rte_InitValue_MtrCurrAngle_Rev_f32 | 0 |
Rte_InitValue_MtrCurrDaxRef_Amp_f32 | 0 |
Rte_InitValue_MtrCurrQaxRef_Amp_f32 | 0 |
Rte_InitValue_MtrPosComputationDelay_Deg_f32 | 0 |
Rte_InitValue_MtrTrqCmdSign_Cnt_s16 | 0 |
Rte_InitValue_MtrVoltDaxFF_Volt_f32 | 0 |
Rte_InitValue_MtrVoltQaxFF_Volt_f32 | 0 |
Rte_InitValue_QaxIntegralGain_Uls_f32 | 0 |
Rte_InitValue_QaxPropotionalGain_Uls_f32 | 0 |
Rte_InitValue_VehSpd_Kph_f32 | 0 |
FastDataAccessBufIndex | 0 |
Initialization Functions
CurrCmd_Init
Program Flow Start
Rte_Call_CurrCmd_Per1_CP0_CheckpointReached()
Processing
Periodic Functions
Per: CurrCmd_Per1
Design Rationale
None
Program Flow Start
Rte_Call_CurrCmd_Per1_CP0_CheckpointReached()
Store Module Inputs to Local copies
WriteAccessBufIndex_Cnt_T_u16= (FastDataAccessBufIndex_Cnt_M_u16&1)^1;
MRFMtrTrqCmd_MtrNm_T_f32=Rte_Iread_CurrCmd_Per1_MRFTrqCmdScl_MtrNm_f32
MRFMtrVel_MtrRadpS_T_f32=Rte_Iread_CurrCmd_Per1_MRFMtrVel_MtrRadpS_f32
EstKe_VpRadpS_T_f32=Rte_Iread_CurrCmd_Per1_EstKe_VpRadpS_f32
EstR_Ohm_T_f32=Rte_Iread_CurrCmd_Per1_EstR_Ohm_f32
EstLd_Henry_T_f32=Rte_Iread_CurrCmd_Per1_EstLd_Henry_f32
EstLq_Henry_T_f32=Rte_Iread_CurrCmd_Per1_EstLq_Henry_f32
VehSpd_Kph_T_f32=Rte_Iread_CurrCmd_Per1_VehSpd_Kph_f32
MtrQuad_Cnt_T_u8 = Rte_Iread_CurrCmd_Per1_MtrQuad_Cnt_u08
CurrentGainSvc_Cnt_T_lgc = Rte_IRead_CurrCmd_Per1_CurrentGainSvc_Cnt_lgc()
Vecu_Volt_T_f32 = Limit_m(Vecu_Volt_T_f32, D_VECUMIN_VOLTS_F32, D_VECUMAX_VOLTS_F32)
Store Local copy of outputs into Module Outputs
MtrDaxIntegralGain_Uls_M_f32[WriteAccessBufIndex_Cnt_T_u16] = KidGain_Uls_T_f32
MtrDaxPropotionalGain_Uls_M_f32[WriteAccessBufIndex_Cnt_T_u16] = KpdGain_Uls_T_f32
MtrQaxIntegralGain_Uls_M_f32[WriteAccessBufIndex_Cnt_T_u16] = KiqGain_Uls_T_f32
MtrQaxPropotionalGain_Uls_M_f32[WriteAccessBufIndex_Cnt_T_u16] = KpqGain_Uls_T_f32
MtrCurrQaxRef_Amp_M_f32[WriteAccessBufIndex_Cnt_T_u16] = MtrCurrQaxRef_Amp_T_f32
MtrCurrDaxRef_Amp_M_f32[WriteAccessBufIndex_Cnt_T_u16] = MtrCurrDaxRef_Amp_T_f32
Rte_Iwrite_CurrCmd_Per1_MtrCurrDaxRef_Amp_f32(MtrCurrDaxRef_Amp_T_f32)
Rte_Iwrite_CurrCmd_Per1_MtrCurrQaxRef_Amp_f32(MtrCurrQaxRef_Amp_T_f32)
MtrVoltDaxFF_Volt_M_f32[WriteAccessBufIndex_Cnt_T_u16]=MtrVoltDaxFF_Volt_T_f32
MtrVoltQaxFF_Volt_M_f32[WriteAccessBufIndex_Cnt_T_u16]=MtrVoltQaxFF_Volt_T_f32
Rte_Iwrite_CurrCmd_Per1_MtrVoltDaxFF_Volt_f32(MtrVoltDaxFF_Volt_T_f32)
Rte_Iwrite_CurrCmd_Per1_MtrVoltQaxFF_Volt_f32(MtrVoltQaxFF_Volt_T_f32)
Rte_Iwrite_CurrCmd_Per1_MtrCurrAngle_Rev_f32(MtrCurrElecAngle_Rev_T_f32)
Rte_Iwrite_CurrCmd_Per1_MtrTrqCmdSign_Cnt_s16(Sign_f32_m(MRFMtrTrqCmd_MtrNm_T_f32))
MtrPosComputationDelay_Rad_M_f32[WriteAccessBufIndex_Cnt_T_u16] = ElecPosDelayComp_Rad_T_f32
Program Flow End
Rte_Call_CurrCmd_Per1_CP1_CheckpointReached()
Fault Recovery Functions
None
Shutdown Functions
None
Interrupt Functions
None
Serial Communication Functions
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 Name | Calling Frequency | System State(s) in which the function is called |
CurrCmd_Per1 | 2ms | ALL |
CurrCmd_Init | At init | ALL |
Execution Requirements for Serial Communication Functions
Function Name | Sub-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 Module | Software Segment |
CurrCmd_Per1 | RTE_START_SEC_AP_CURRCMD_APPL_CODE |
CurrCmd_Init | RTE_START_SEC_AP_CURRCMD_APPL_CODE |
Local Functions
This table identifies the software segments for local functions identified in this module.
Name of Sub Module | Software Segment |
ParabolicInterpolation | RTE_START_SEC_AP_CURRCMD_APPL_CODE |
CalculateIq | RTE_START_SEC_AP_CURRCMD_APPL_CODE |
CalculateImVSIdq | RTE_START_SEC_AP_CURRCMD_APPL_CODE |
CurrtoVoltTest | RTE_START_SEC_AP_CURRCMD_APPL_CODE |
CalcTorque | RTE_START_SEC_AP_CURRCMD_APPL_CODE |
LocateTrqExtremes | RTE_START_SEC_AP_CURRCMD_APPL_CODE |
LocateMinimumIm | RTE_START_SEC_AP_CURRCMD_APPL_CODE |
Known Issues / Limitations With Design
Global Macro’s are not unit tested.
Revision Control Log
Item # | Rev # | Change Description | Date | Author Initials |
1 | 1.0 | Initial version | 15th-May-12 | KPIT-RT |
2 | 2.0 | Partial implementation of SF-99B v004 | 20-Sep-12 | OT |
3 | 3.0 | Checkpoints and memmap statements added | 20-Nov-12 | Selva |
4 | 4.0,5.0 | Implementation of SF99 v8 | 23-Mar-13 19-Apr-13 | Selva |
6 | 6.0 | Corrected for A5883. Corrected LocateMinimumIm | 21-Oct-13 | Selva |
7 | 7.0 | Updated for v11 FDD99B | 6-Nov-13 | Selva |
8 | 8,0 | Corrected for NewDelta calculation / Updated for v11 FDD99B UTP fixes | 8-Nov-13 | Selva |
9 | 9.0 | Updated for V12 of FDD SF99 | 26-Nov-13 | Selva |
2 - CurrParamComp_MDD
Module -- Parameter Compensation
High-Level Description
Figures
Diagram – Function Data Sharing
None
Diagram – Function (Name)
None
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 | Module Outputs | |
---|---|---|
MtrCurrDaxRef _Amp_f32 | EstKe_VpRadpS_f32 | |
MtrCurrQaxRef_ Amp_f32 | EstR_Ohm_f32 | |
CuTempEst_DegC_f32 | EstLq_Henry_f32 | |
MagTempEst_DegC_f32 | EstLd_Henry_f32 | |
SiTempEst_DegC_f32 | ||
FastDataAccessBufIndex_Cnt_M_u16 | ||
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 |
---|---|---|---|---|
EstKeFF_VpRadpS_M_f32 | single precision float | 0.025 | 0.075 | CURRPARAMCOMP_START_SEC_VAR_CLEARED_32 |
EstRFF_Ohm_M_f32 | single precision float | 0.005 | 0.12565 | CURRPARAMCOMP_START_SEC_VAR_CLEARED_32 |
KeSatSclFac_Uls_D_f32 | single precision float | 0 | 1 | CURRPARAMCOMP_START_SEC_VAR_CLEARED_32 |
LqSatSclFac_Uls_D_f32 | single precision float | 0 | 2 | CURRPARAMCOMP_START_SEC_VAR_CLEARED_32 |
LdSatSclFac_Uls_D_f32 | single precision float | 0 | 2 | CURRPARAMCOMP_START_SEC_VAR_CLEARED_32 |
EstRfetFF_Ohm_D_f32 | single precision float | 0.005 | 0.12565 | CURRPARAMCOMP_START_SEC_VAR_CLEARED_32 |
EstRmtrFF_Ohm_D_f32 | single precision float | 0.005 | 0.12565 | CURRPARAMCOMP_START_SEC_VAR_CLEARED_32 |
PreLmtEstKe_VpRadpS_D_f32 | single precision float | 0.25 | 0.075 | CURRPARAMCOMP_START_SEC_VAR_CLEARED_32 |
PreLmtEstLq_Henry_D_f32 | single precision float | 0.00003 | 0.00041 | CURRPARAMCOMP_START_SEC_VAR_CLEARED_32 |
PreLmtEstLd_Henry_D_f32 | single precision float | 0.00003 | 0.00041 | CURRPARAMCOMP_START_SEC_VAR_CLEARED_32 |
User defined typedef definition/declaration
This section documents any user types uniquely used for the module.
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_KeSatTblX_Amp_u9p7 |
t_KeSatTblY_Uls_u2p14 |
t_KeSatTblX_Amp_u12p4 |
t_CurrParamCompDaxRef_Amp_u9p7 |
t_CurrParamCompQaxRef_Amp_u9p7 |
t_CurrParamLqSatSclFac_Uls_u2p14 |
k_MinKeRngLmt_VpRadpS_f32 |
k_MaxKeRngLmt_VpRadpS_f32 |
k_MinRRngLmt_Ohm_f32 |
k_MaxRRngLmt_Ohm_f32 |
k_MinLqRngLmt_Henry_f32 |
k_MaxLqRngLmt_Henry_f32 |
k_MinLdRngLmt_Henry_f32 |
k_MaxLdRngLmt_Henry_f32 |
k_NomTemp_DegC_f32 |
k_MagThrC_VpRadpSpDegC_f32 |
k_SiThermCoeff_OhmpDegC_f32 |
k_NomRfet_Ohm_f32 |
k_CuThermCoeff_OhmpDegC_f32 |
k_NomLq_Henry_f32 |
k_NomLd_Henry_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 Name | Resolution | Units | Value |
---|---|---|---|
D_SQRT3OVR2_ULS_F32 | single precision float | Unitless | 0.866025403784 |
D_MINRRANGE_OHM_F32 | single precision float | Ohm | 0.005f |
D_MAXRRANGE_OHM_F32 | single precision float | Ohm | 0.12565f |
D_MINKERANGE_VPRADPS_F32 | single precision float | VpRadpS | 0.025f |
D_MAXKERANGE_VPRADPS_F32 | single precision float | VpRadpS | 0.075f |
D_CUTEMPESTLOLMT_DEGC_F32 | single precision float | DegC | (-50.0f) |
D_CUTEMPESTHILMT_DEGC_F32 | single precision float | DegC | 300.0f |
D_MAGTEMPESTLOLMT_DEGC_F32 | single precision float | DegC | (-50.0f) |
D_MAGTEMPESTHILMT_DEGC_F32 | single precision float | DegC | 200.0f |
D_SITEMPESTLOLMT_DEGC_F32 | single precision float | DegC | (-50.0f) |
D_SITEMPESTHILMT_DEGC_F32 | single precision float | DegC | 150.0f |
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 |
---|
Module specific Lookup Tables Constants
(This is for lookup tables (arrays) with fixed values, same name as other tables)
Constant Name | Resolution | Value | Software 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,
FPM_InitFixedPoint_m
Abs_f32_m
Limit_m
FPM_FloatToFixed_m
TableSize_m
FPM_FixedToFloat_m
IntplVarXY_u16_u16Xu16Y_Cnt
BilinearXYM_u16_u16Xu16YM_Cnt
Data Hiding Functions
<None>
Global Functions/Macros Defined by this Module
None
Local Functions/Macros Used by this MDD only
Local Function #1
Function Name | None | Type | Min | Max | UTP Tol. |
Arguments Passed | |||||
Return Value |
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.
Data | Value |
---|---|
Rte_IWrite_CurrParamComp_Init_EstR_Ohm_f32 | Rte_Pim_EOLNomMtrParam()->NomRmtr_Ohm_f32 |
Rte_IWrite_CurrParamComp_Init_EstLd_Henry_f32 | k_NomLd_Henry_f32 |
Rte_IWrite_CurrParamComp_Init_EstLq_Henry_f32 | k_NomLq_Henry_f32 |
Rte_IWrite_CurrParamComp_Init_EstKe_VpRadpS_f32 | Rte_Pim_EOLNomMtrParam()->NomKe_VpRadpS_f32 |
Initialization Functions
Init: ParamComp_Init1
Design Rationale
Module Outputs
Rte_IWrite_CurrParamComp_Init_EstR_Ohm_f32(NomRmtr_Ohm_T_f32)
Rte_IWrite_CurrParamComp_Init_EstLd_Henry_f32(k_NomLd_Henry_f32)
Rte_IWrite_CurrParamComp_Init_EstLq_Henry_f32(k_NomLq_Henry_f32)
Rte_IWrite_CurrParamComp_Init_EstKe_VpRadpS_f32(NomKe_VpRadpS_T_f32) MtrEstKe_VpRadpS_M_f32[0] = NomKe_VpRadpS_T_f32
MtrEstKe_VpRadpS_M_f32[1] = NomKe_VpRadpS_T_f32
Module Internal
Periodic Functions
Per: ParamComp_Per1
Design Rationale
FastDataAccessBufIndex allows the buffer synchronization between data calculated on slower periodic loop time(2 milli seconds) and are read by faster periodic run time (ie 0.125ms)
Program Flow Start
Rte_Call_CurrParamComp_Per1_CP0_CheckpointReached()
Store Module Inputs to Local copies
IqRef_Amp_T_f32=Rte_IRead_CurrParamComp_Per1_MtrCurrQaxRef_Amp_f32()
IdRef_Amp_T_f32=Rte_IRead_CurrParamComp_Per1_MtrCurrDaxRef_Amp_f32()
Processing
Store Local copy of outputs into Module Outputs
MtrEstKe_VpRadpS_M_f32[(ActFaseDataAccBufIndex_Cnt_M_u16&1)^1]=EstKe_VpRadpS_T_f32
ActFaseDataAccBufIndex_Cnt_M_u16= (ActFaseDataAccBufIndex_Cnt_M_u16& 1)^1
Rte_IWrite_CurrParamComp_Per1_EstKe_VpRadpS_f32(EstKe_VpRadpS_T_f32)
Rte_IWrite_CurrParamComp_Per1_EstR_Ohm_f32(EstR_Ohm_T_f32)
Rte_IWrite_CurrParamComp_Per1_EstLq_Henry_f32(EstLq_Henry_T_f32)
Rte_IWrite_CurrParamComp_Per1_EstLd_Henry_f32(EstLd_Henry_T_f32)
Program Flow End
Rte_Call_CurrParamComp_Per1_CP1_CheckpointReached()
Per: ParamComp_Per2
Design Rationale
None
Program Flow Start
Rte_Call_CurrParamComp_Per2_CP0_CheckpointReached()
Store Module Inputs to Local copies
NomKe_VpRadpS_T_f32 = Rte_Pim_EOLNomMtrParam()->NomKe_VpRadpS_f32
NomRmtr_Ohm_T_f32 = Rte_Pim_EOLNomMtrParam()->NomRmtr_Ohm_f32
CuTempEst_DegC_T_f32 = Rte_IRead_CurrParamComp_Per2_CuTempEst_DegC_f32()
MagTempEst_DegC_T_f32 = Rte_IRead_CurrParamComp_Per2_MagTempEst_DegC_f32()
SiTempEst_DegC_T_f32 = Rte_IRead_CurrParamComp_Per2_SiTempEst_DegC_f32()
NomRmtr_Ohm_T_f32 = Limit_m( NomRmtr_Ohm_T_f32, D_MINRRANGE_OHM_F32, D_MAXRRANGE_OHM_F32)
NomKe_VpRadpS_T_f32 = Limit_m(NomKe_VpRadpS_T_f32,D_MINKERANGE_VPRADPS_F32,D_MAXKERANGE_VPRADPS_F32)
CuTempEst_DegC_T_f32 = Limit_m(CuTempEst_DegC_T_f32,D_CUTEMPESTLOLMT_DEGC_F32, D_CUTEMPESTHILMT_DEGC_F32)
MagTempEst_DegC_T_f32 = Limit_m(MagTempEst_DegC_T_f32, D_MAGTEMPESTLOLMT_DEGC_F32, D_MAGTEMPESTHILMT_DEGC_F32 )
SiTempEst_DegC_T_f32 = Limit_m(SiTempEst_DegC_T_f32, D_SITEMPESTLOLMT_DEGC_F32, D_SITEMPESTHILMT_DEGC_F32)
Processing
Store Local copy of outputs into Module Outputs
None
Program Flow End
Rte_Call_CurrParamComp_Per2_CP1_CheckpointReached()
Fault Recovery Functions
None
Shutdown Functions
None
Interrupt Functions
None
Serial Communication Functions
SComm: SCom_EOLNomMtrParam_Get
Design Rationale
None
Program Flow Start
None
Store Module Inputs to Local copies
None
Processing
Store Local copy of outputs into Module Outputs
None
Program Flow End
None
SComm: SCom_EOLNomMtrParam_Set
Design Rationale
None
Program Flow Start
None
Store Module Inputs to Local copies
None
Processing
Store Local copy of outputs into Module Outputs
None
Program Flow End
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 Name | Calling Frequency | System State(s) in which the function is called |
---|---|---|
ParamComp_Per1 | 2 ms | ALL |
ParamComp_Per2 | 100 ms | ALL |
Execution Requirements for Serial Communication Functions
Function Name | Sub-Module called by (Serial Comm Function Name) |
---|---|
SCom_EOLNomMtrParam_Get | EPS_DiagSrvc |
SCom_EOLNomMtrParam_Set | EPS_DiagSrvc |
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 |
---|---|
ParamComp_Per1 | RTE_AP_CURRPARAMCOMP_APPL_CODE |
ParamComp_Per2 | RTE_AP_CURRPARAMCOMP_APPL_CODE |
SCom_EOLNomMtrParam_Get | RTE_AP_CURRPARAMCOMP_APPL_CODE |
SCom_EOLNomMtrParam_Set | RTE_AP_CURRPARAMCOMP_APPL_CODE |
Local Functions
This table identifies the software segments for local functions identified in this module.
Name of Sub Module | Software Segment |
---|---|
Known Issues / Limitations With Design
(Item #1)
Revision Control Log
Item # | Rev # | Change Description | Date | Author Initials | ||
1 | 1.0 | Initial Version | 25-May-12 | SK | ||
2 | 2.0 | Added checkpoints and memmap statements | 20-Nov-12 | Selva | ||
3 | 3.0 |
| 11-Jan-13 | Selva | ||
4 | 4.0 | Updated to version 8 of the Sf99 Mtrlcntrl | 21-Mar-13 | Selva | ||
5 | 5.0 | Updated to version 10 FDD SF99 B. Divide by zero fixed | 21-Oct-13 | Selva | ||
6 | 6.0 | Updated to version 11 FDD SF99 B. Limiting EEPROM Read | 7-Nov-13 | Selva |
3 - Data Dictionary
Overview
Change LogVariable Dictionary
Calibration Dictionary
Global Constants
Template
Help
Sheet 1: Change Log
MotorControl_CM - Rev 8 | <- Global Program / Module Name | ||||||
Revision | Author | Date | Change Description | Data Dictionary Type: | Component | ||
1.0 | Selva | 15-Nov-12 | Initial template for Motor control Current mode | ||||
2.0 | Selva | 24-Feb-13 | Updated for SF99 B torque reasonable portion | ||||
3.0 | Selva | 20-Mar-13 | Updated for SF99 B v 008 | ||||
4.0 | Selva | 20-Apr-13 | Corrected for SF99 B v 008 | ||||
5.0 | Selva | 3-Jun-13 | Updated for SF99 B v 009 | ||||
6.0 | Selva | 21-Oct-13 | Updated for SF99 B v 010 | ||||
7 | Selva | 7-Nov-13 | Updated for SF99 B v 011 | ||||
8 | Selva | 26-Nov-13 | Updated for SF99 B v 012 | ||||
Sheet 2: Variable Dictionary
Sheet 3: Calibration Dictionary
Sheet 4: Global Constants
MotorControl_CM - Rev 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Variable Information (Global Variables Only) | Achieved in Software Design | Used in Module List | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Layer 2 | Layer 3 | Layer 4 | Layer 5 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Constant Name | Description | Uints | Type | Engineering Value | ADC | ADC Diagnostics | Data Memory Verification | DC Link Power Control | DSP Computational Integrity | DSP SPI driver | Event Manager Driver | External Memory Driver | Flash Programming Exec | GPIO | Illegal OpCode Handler | Interrupt Handler | Motor Current Driver | Motor Driver Diagnostics | Motor Position Driver | Phase Feedback Capture | Powerdown Control | Primary Shutdown Control | Program Flow | Program Memory Diagnostic | PWM Duty Cycle | Redundant Memory Check | Redundant Rapid Shutdown | Scheduler | Stack Monitor | State Dependent Task List | System Boot & Startup | System Control | Temperature Sensor Diagnostic | Unused Interrupt Handler | Utilization Monitor | Watchdog Dirver | Smith | Battery Voltage | Battery Voltage Diagnostics | Diagnostic CTC Manager | Diagnostic Manager | Diagnostics Application Services | EOL TorqueTest | Flash Boot Loader | Flight Recorder | Handwheel Position | Handwheel Torque | Motor Control Output Conversion | Motor Position Diagnostics | Motor Position Initialization | Motor Velocity | Motor Velocity Tachometer | Serial Communications I/O | Serial Communications Services | States and Modes | Tuning Select | Vehicle Power Mode | Vehicle Speed | Controller Polarity | Current Estimation | Handwheel Velocity | Inverse Motor Model | Motor Temperature Estimation | Motor Torque Limit | Output Reasonableness Dianostic | Parameter Estimation | Quadrant and rate Detection | Active Pull Compensation | Assist | Damping | Duty Cycle | Kinematic Integrity Diagnostic | Long Term Vehicle Speed Diagnostic | Max Assist Limit | Return | State Output Control | Torque Output |
Sheet 5: Template
2.2a | Data File: | |||||
Header: | extern <TYPE><TAB><NAME>; | |||||
Source: | #pragma DATA_SECTION(<ROOTNAME>, "<SEGMENT>"); <TYPE> <NAME>; | |||||
EOL Constants: | ||||||
Header: | extern <TYPE><TAB><NAME>; | |||||
Source: | #pragma DATA_SECTION(<ROOTNAME>, "<SEGMENT>"); <TYPE> <NAME>; | |||||
Global (Embedded) Constants: | ||||||
Header: | #define <NAME><COL40><VALUE> | |||||
A2L Name | ||||||
Measurement: | rte_<SWC>_<NAME> | |||||
Calibration Constants: | ||||||
Tuning ID: | ||||||
Tuning: | N | Index Range: | ||||
Header: | extern CONST(<AUTOSAR_TYPE>, CAL_CONST) <NAME>; | |||||
Source: | #pragma DATA_SECTION(<ROOTNAME>, ".<SEGMENT>"); CONST(<AUTOSAR_TYPE>, CAL_CONST) <NAME> = <VALUE>; | |||||
eCal: | <NAME> | |||||
Tuning: | Y | Index Range: | ||||
Header: | <NONCRITICAL> #define <ROOTNAME><TAB>k_N_CalNC_Cnt_Str.<ROOTNAME> <NONCRITICAL> <SAFETYCRITICAL> #define <ROOTNAME><TAB>k_S_CalSC_Cnt_Str.<ROOTNAME> <SAFETYCRITICAL> | |||||
Source: | ||||||
eCal: | <NONCRITICAL> k_N_CalNC_Cnt_Str.<ROOTNAME> <NONCRITICAL> <SAFETYCRITICAL> k_S_CalSC_Cnt_Str.<ROOTNAME> <SAFETYCRITICAL> | |||||
Tuning: | P | Index Range: | ||||
Header: | <NONCRITICAL> #define <ROOTNAME><TAB>k_N_CalNC_Cnt_Str.Personality[L3_S_CalPersSelect_Cnt_G_u16].<ROOTNAME> <NONCRITICAL> <SAFETYCRITICAL> #define <ROOTNAME><TAB>k_S_CalSC_Cnt_Str.SC_Personality[L3_S_CalPersSelect_Cnt_G_u16].<ROOTNAME> <SAFETYCRITICAL> | |||||
Source: | ||||||
eCal: | <NONCRITICAL> k_N_CalNC_Cnt_Str.Personality[L3_S_CalPersSelect_Cnt_G_u16].<ROOTNAME> <NONCRITICAL> <SAFETYCRITICAL> k_S_CalSC_Cnt_Str.SC_Personality[L3_S_CalPersSelect_Cnt_G_u16].<ROOTNAME> <SAFETYCRITICAL> | |||||
Sheet 6: Help
Short cut | Macro | Sescription |
Ctrl-q | ClearDataDictFilter | Will clear all autofilters on the Global Data Dictionary |
DFD_Create | Creates a Series of Data Flow Worksheet Pages from the information in the data dictionary. If Data Flow Worksheet pages already exist, they will be deleted first. | |
DFD_Delete | Will clear all Data Flow Diagram pages from the Data Dictionary. This will make the file smaller for archiving. | |
DFD_Print | Formate and prepares to print the Data Flow Worksheet pages. |
4 - Design Review_MtrCtrl_CM
Overview
Summary SheetDavinci Files
Source Code _PICurrCntrl
Source Code_CurrCmd
MDD_PICurrCntrl
MDD_CurrCmd
Data Dictionary
QAC_PICurrCntrl
QAC_CurrCmd
Sheet 1: Summary Sheet
Sheet 2: Davinci Files
Sheet 3: Source Code _PICurrCntrl
Rev 2.0 | 26-Aug-13 | |||||||||||||||||||||||
Peer Review Meeting Log (Source Code Review) | ||||||||||||||||||||||||
Source File Name: | Source File Revision: | |||||||||||||||||||||||
Module Design Document Name: | MDD Revision: | |||||||||||||||||||||||
Data Dictionary Revision: | ||||||||||||||||||||||||
Quality Check Items: | ||||||||||||||||||||||||
Yes | No | Rationale is required for all answers of No | ||||||||||||||||||||||
Pre-review checklist (change owners only) | Analysis performed for divide by zero | X | Comments: | CR10557 will check this | ||||||||||||||||||||
Software Design and Coding Standard followed | X | Comments: | CR10557 will check this | |||||||||||||||||||||
Software Naming Convention followed | X | Comments: | CR10557 will check this | |||||||||||||||||||||
All buffered outputs are written in every path | X | Comments: | ||||||||||||||||||||||
Group-review Checklist (review board) | Telelogic Synergy version matches header | X | Comments: | |||||||||||||||||||||
Change log contains detailed description of changes | X | Comments: | ||||||||||||||||||||||
Code compared vs requirements (Document or Model) | X | Comments: | Only for the changes | |||||||||||||||||||||
Global Outputs (RTE/Non-RTE) Initialized | X | Comments: | ||||||||||||||||||||||
Global Outputs are limited to the legal range defined | X | Comments: | Not limited | |||||||||||||||||||||
in the FDD Data dictionary | CR10557 will check this | |||||||||||||||||||||||
No Compiler Errors verified | X | Comments: | ||||||||||||||||||||||
Type Casting and Fix Point Macros use reviewed | X | Comments: | N/A | |||||||||||||||||||||
Function prototype and passed parameters are | X | Comments: | N/A | |||||||||||||||||||||
consistent | ||||||||||||||||||||||||
General Notes / Comments: | ||||||||||||||||||||||||
Change Owner: | Selva Sengottaiyan | Review Date : | 11/27/13 | Group Review Level: | DR4 | |||||||||||||||||||
Lead Peer Reviewer: | Jared Julian | Approved by Reviewer(s): | Yes | |||||||||||||||||||||
Other Reviewer(s): | Prerit Pramod | |||||||||||||||||||||||
Sheet 4: Source Code_CurrCmd
Rev 2.0 | 26-Aug-13 | |||||||||||||||||||||||
Peer Review Meeting Log (Source Code Review) | ||||||||||||||||||||||||
Source File Name: | Source File Revision: | |||||||||||||||||||||||
Module Design Document Name: | MDD Revision: | |||||||||||||||||||||||
Data Dictionary Revision: | ||||||||||||||||||||||||
Quality Check Items: | ||||||||||||||||||||||||
Yes | No | Rationale is required for all answers of No | ||||||||||||||||||||||
Pre-review checklist (change owners only) | Analysis performed for divide by zero | X | Comments: | CR10557 will check this | ||||||||||||||||||||
Software Design and Coding Standard followed | Comments: | CR10557 will check this | ||||||||||||||||||||||
Software Naming Convention followed | Comments: | CR10557 will check this | ||||||||||||||||||||||
All buffered outputs are written in every path | X | Comments: | ||||||||||||||||||||||
Group-review Checklist (review board) | Telelogic Synergy version matches header | X | Comments: | |||||||||||||||||||||
Change log contains detailed description of changes | X | Comments: | ||||||||||||||||||||||
Code compared vs requirements (Document or Model) | X | Comments: | Only for the changes | |||||||||||||||||||||
Global Outputs (RTE/Non-RTE) Initialized | X | Comments: | ||||||||||||||||||||||
Global Outputs are limited to the legal range defined | X | Comments: | Not limited | |||||||||||||||||||||
in the FDD Data dictionary | CR10557 will check this | |||||||||||||||||||||||
No Compiler Errors verified | X | Comments: | ||||||||||||||||||||||
Type Casting and Fix Point Macros use reviewed | X | Comments: | Only for the changes | |||||||||||||||||||||
Function prototype and passed parameters are | X | Comments: | Only for the changes | |||||||||||||||||||||
consistent | ||||||||||||||||||||||||
General Notes / Comments: | ||||||||||||||||||||||||
Change Owner: | Selva Sengottaiyan | Review Date : | 11/27/13 | Group Review Level: | DR4 | |||||||||||||||||||
Lead Peer Reviewer: | Jared Julian | Approved by Reviewer(s): | Yes | |||||||||||||||||||||
Other Reviewer(s): | Prerit Pramod | |||||||||||||||||||||||
Sheet 5: MDD_PICurrCntrl
Sheet 6: MDD_CurrCmd
Sheet 7: Data Dictionary
Sheet 8: QAC_PICurrCntrl
Rev 2.0 | 26-Aug-13 | |||||||||||||||||||||||
Peer Review Meeting Log (QAC Review) | ||||||||||||||||||||||||
Module Name: | Source File Revision: | 12 | Module | 4 | of | 4 | ||||||||||||||||||
Compliance Document Version: | unreleased | |||||||||||||||||||||||
Quality Check Items: | ||||||||||||||||||||||||
Yes | No | Rationale is required for all answers of No | ||||||||||||||||||||||
Pre-review checklist for change owners | QAC version is correct and did not change (List version) | X | Comments: | |||||||||||||||||||||
Contract Folder's header files are appropriate | X | Comments: | ||||||||||||||||||||||
G Group-review Checklist (review board) | 100% Compliance to the MISRA Compliance Document | X | Comments: | |||||||||||||||||||||
General Notes / Comments: | ||||||||||||||||||||||||
Change Owner: | Selva Sengottaiyan | Review Date : | 11/27/13 | Group Review Level: | DR4 | |||||||||||||||||||
Lead Peer Reviewer: | Jared Julian | Approved by Reviewer(s): | Yes | |||||||||||||||||||||
Other Reviewer(s): | Prerit Pramod | |||||||||||||||||||||||
Sheet 9: QAC_CurrCmd
Rev 2.0 | 26-Aug-13 | |||||||||||||||||||||||
Peer Review Meeting Log (QAC Review) | ||||||||||||||||||||||||
Module Name: | Source File Revision: | 12 | Module | 2 | of | 4 | ||||||||||||||||||
Compliance Document Version: | unreleased | |||||||||||||||||||||||
Quality Check Items: | ||||||||||||||||||||||||
Yes | No | Rationale is required for all answers of No | ||||||||||||||||||||||
Pre-review checklist for change owners | QAC version is correct and did not change (List version) | X | Comments: | |||||||||||||||||||||
Contract Folder's header files are appropriate | X | Comments: | ||||||||||||||||||||||
G Group-review Checklist (review board) | 100% Compliance to the MISRA Compliance Document | X | Comments: | |||||||||||||||||||||
General Notes / Comments: | ||||||||||||||||||||||||
Change Owner: | Selva Sengottaiyan | Review Date : | 11/27/13 | Group Review Level: | DR4 | |||||||||||||||||||
Lead Peer Reviewer: | Jared Julian | Approved by Reviewer(s): | Yes | |||||||||||||||||||||
Other Reviewer(s): | Prerit Pramod | |||||||||||||||||||||||
5 - MtrCntrl_Integration_Manual
1.2 Configuration Files to be provided by Integration Project 2
1.3 Functions to be provided by Integration Project 2
Dependencies
SWCs
Module | Required Feature |
---|---|
Configuration Files to be provided by Integration Project
MtrCtrl_Cfg.h
Functions to be provided to Integration Project
PICurrCntrl_Per1()
TrqCogCancRefPer1()
Configuration
Build Time Config
Modules | Notes | |
---|---|---|
PICurrentCntrl TrqCanc | Optimization level greater than 3 |
Generator Config
Constant | Notes | SWC |
---|---|---|
None |
Integration
Global Data
The global symbols mapping done in MtrCtrl_Cfg.h.
Component Conflicts
None
Include Path
The “include” directory of this SWC needs to be included in the integration project include search path.
.
Configurator Changes
None
Runnable Scheduling
This section specifies the required runnable scheduling.
Runnable | Scheduling Requirements | Trigger |
---|---|---|
TrqCogCancRefPer1() | Must be placed in the motor control ISR, after MtrPos | Cyclic (ISR) |
PICurrCntrl_Per1() | Must be placed in the motor control ISR after TrqCogCancRefPer1() | Cyclic (ISR) |
Runnable | Scheduling Requirements | Trigger |
---|---|---|
CurrParamComp_Init() | RTE (init) | |
TrqCanc_Init | Must be placed after CurrParamComp_Init | RTE (init) |
QuadDet_Per1 | Must run after TrqReasonable Diagnostics | RTE (2ms) |
CurrCmd_Per1 | Must run after QuadDet | RTE (2ms) |
TrqCanc_Per1 | Must run after CurrCmd_Per1 | RTE (2ms) |
PICurrCntrl_Per2() | Must be placed after TrqCanc_Per1 | RTE (2ms) |
CurrParamComp_Per1() | Must be placed after PICurrCntrl_Per2 | RTE (2ms) |
PeakCurrEst_Per1() | Must be placed after PICurrCntrl_Per2 | RTE (2ms) |
*Note: In motor control ISR include Ap_MtrCtrl.h instead of CDD_Func.h
Proper Initialization of input signals should occur before running each function for the first time. (CurrParamComp_Init).
Memory Mapping
Mapping
Memory Section | Contents | Notes |
---|---|---|
RTE Memory mapping | ||
* Each …START_SEC… constant is terminated by a …STOP_SEC… constant as specified in the AUTOSAR Memory Mapping requirements.
Usage
Feature | RAM | ROM |
---|---|---|
Full driver |
Table 1: ARM Cortex R4 Memory Usage
RTE NvM Blocks
Block Name Size |
---|
Rte_Pim_CogTrqCal 512 |
Rte_Pim_CogTrqRplComp 9 |
Note : Size of the NVM block is changed.
Revision Control Log
Rev # | Change Description | Date | Author |
1 | Initial version | 25-Mar-13 | Selva |
2 | Updated TrqCanc_Init in RTE Runnables and size of the NVM block CogTrqCal is changed from 512 to 521 | 21-Oct-13 | Selva |
3 | Added new NVM block “Rte_Pim_CogTrqRplComp” | 23-Oct-13 | Selva |
6 - PeakCurrEst_MDD
Module – PeakCurrEst
High-Level Description
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 | Module Outputs | |
---|---|---|
MtrCurrQax_Amp_f32 | EstPkCurr_AmpSq_f32 | |
MtrCurrDax_Amp_f32 | FiltEstPkCurr_AmpSq_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 Name | Resolution | Legal Range (min) | Legal Range (max) | Software Segment |
---|---|---|---|---|
QaxCurrFiltSV_Amp_M_u12p20 | Single Precision Float | -220 | 220 | PEAKCURREST_START_SEC_VAR_CLEARED_32 |
DaxCurrFiltSV_Amp_M_s11p20 | Single Precision Float | -220 | 220 | PEAKCURREST_START_SEC_VAR_CLEARED_32 |
EstPkCurr_AmpSq_M_f32 | Single Precision Float | 0 | 48400 | PEAKCURREST_START_SEC_VAR_CLEARED_32 |
EstPkCurrFiltSV_AmpSq_M_u16p16 | Single Precision Float | 0 | 48400 | PEAKCURREST_START_SEC_VAR_CLEARED_32 |
FiltMtrCurEst_Id_Amp_D_f32 | Single Precision Float | -220 | 220 | PEAKCURREST_START_SEC_VAR_CLEARED_32 |
MtrCurEst_Iq_AmpSq_D_f32 | Single Precision Float | -220 | 220 | PEAKCURREST_START_SEC_VAR_CLEARED_32 |
MtrCurEst_Id_AmpSq_D_f32 | Single Precision Float | 0 | 48400 | PEAKCURREST_START_SEC_VAR_CLEARED_32 |
FiltMtrCurEst_Iq_Amp_D_f32 | Single Precision Float | 0 | 48400 | PEAKCURREST_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) |
---|---|---|---|---|
None |
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_EstPkCurr2msLPFKn_Uls_u16 |
k_EstPkCurrSlowLoopLPFKn_Uls_u16 |
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 | Units | Value |
---|---|---|---|
None | |||
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_ESTPKCURRLOLMT_AMPSQ_F32 |
D_ESTPKCURRHILMT_AMPSQ_F32 |
Module specific Lookup Tables Constants
Constant Name | Resolution | Value | Software 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,
LPF_SvUpdate_u16InFixKTrunc_m
LPF_OpUpdate_u16InFixKTrunc_m
LPF_SvUpdate_s16InFixKTrunc_m
LPF_OpUpdate_s16InFixKTrunc_m
FPM_FloatToFixed_m
FPM_FixedToFloat_m
Limit_m
Data Hiding Functions
None
Global Functions/Macros Defined by this Module
None
Local Functions/Macros Used by this MDD only
None
Software Module Implementation
Runtime Environment (RTE) Initial Values
None
Initialization Functions
None
Periodic Functions
Per: PeakCurrEst_Per1
Design Rationale
None
Program Flow Start
Rte_Call_PeakCurrEst_Per1_CP0_CheckpointReached
Store Module Inputs to Local copies
EstMtrCurrQax_Amp_T_f32=Rte_IRead_PeakCurrEst_Per1_MtrCurrQax_Amp_f32()
EstMtrCurrDax_Amp_T_f32=Rte_IRead_PeakCurrEst_Per1_MtrCurrDax_Amp_f32()
Module Design
Store Local copy of outputs into Module Outputs
Rte_IWrite_PeakCurrEst_Per1_EstPkCurr_AmpSq_f32(EstPkCurr_AmpSq_T_f32)
Program Flow End
Rte_Call_PeakCurrEst_Per1_CP1_CheckpointReached
Per: PeakCurrEst_Per2
Design Rationale
Program Flow Start
Rte_Call_PeakCurrEst_Per2_CP0_CheckpointReached()
Module Design
Store Local copy of outputs into Module Outputs
Rte_IWrite_PeakCurrEst_Per2_FiltEstPkCurr_AmpSq_f32(FiltEstPkCurr_AmpSq_T_f32)
Program Flow End
Rte_Call_PeakCurrEst_Per2_CP1_CheckpointReached()
Fault Recovery Functions
None
Shutdown Functions
None
Interrupt Functions
None
Serial Communication Functions
None
Execution Requirements
Execution Sequence of the Module
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) in which the function is called |
---|---|---|
PeakCurrEst_Per1 | 2ms | OFF,DISABLE,OPERATE |
PeakCurrEst_Per2 | 100ms | OFF,DISABLE,OPERATE |
Execution Requirements for Serial Communication Functions
Function Name | Sub-Module called by (Serial Comm Function Name) |
---|---|
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 |
---|---|
PeakCurrEst_Per1 | RTE_AP_PEAKCURREST_APPL_CODE |
PeakCurrEst_Per2 | RTE_AP_PEAKCURREST_APPL_CODE |
Local Functions
This table identifies the software segments for local functions identified in this module.
Name of Sub Module | Software Segment |
---|---|
Known Issues / Limitations With Design
INLINE functions defined in GlobalMacro.h are not unit tested.
Revision Control Log
Item # | Rev # | Change Description | Date | Author Initials |
---|---|---|---|---|
1 | 1.0 | Initial Version | 5/15/2012 | KPIT-RD |
2 | 2.0 | Addition of checkpoints and memmap statements | 20-Nov-12 | Selva |
3 | 3.0 | Updated to version 8 FDD SF99 B | 20-Mar-12 | Selva |
7 - PICurrentContrl
Module -- PICurrCntrl
High-Level Description
Non-AUTOSAR PI driver required to perform EPS motor control PWM profiles.
Figures
Diagram – Function Data Sharing
This diagram shows all data that is shared between functions within the module.
Module Inputs and Outputs
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) |
MtrCurrQax_Amp_f32 | EstKe_VpRadpS_f32 |
MtrCurrDax_Amp_f32 | MtrCurrQaxFinalRef_Amp_f32 |
MtrCurrQaxRef_Amp_f32 | MtrDaxVoltage_Volt_f32 |
MtrCurrDaxRef_Amp_f32 | MtrQaxVoltage_Volt_f32 |
PIDaxIntegralGain_Uls_f32 | ModIdx_Uls_u16p16 |
PIDaxPropotionalGain_Uls_f32 | PhaseAdvanceFinal_Rev_u0p16 |
PIQaxIntegralGain_Uls_f32 | CommOffset_Cnt_u16 |
PIQaxPropotionalGain_Uls_f32 | MtrVolt_Volt_f32 |
ElecPosDelayComp_Rad_f32 | MtrCurrDaxIntg_Volt_f32 |
MtrVoltDaxFF_Volt_f32 | MtrCurrQaxIntg_Volt_f32 |
MtrVoltQaxFF_Volt_f32 | DervLambdaAlphaDiag_Volt_T_f32 |
Vecu_Volt_f32 | DervLambdaBetaDiag_Volt_T_f32 |
ModIdxSrlComSvcDft_Cnt_lgc | SlowDataAccessBufIndex_Cnt_M_u16 |
SysState_Cnt_Enum | |
MtrCurrOffComOffset_Cnt_u16 | |
MtrCurrQaxRpl_Amp_M_f32 | |
MtrCurrQaxCog_Amp_M_f32 | |
MRFMtrVel_MtrRadpS_f32 | |
MtrVoltDaxFF_Volt_f32 | |
MtrVoltQaxFF_Volt_f32 | |
MtrCurrQaxRpl_Amp_f32 | |
FastDataAccessBufIndex_Cnt_M_u16 | |
EstKe_VpRadpS_f32 | |
CorrMtrPosElec_Rev_f32 | |
EstR_Ohm_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.
(Note: If no module specific variables are used by the design, place the text “None” in the first Variable Name cell in the table)
Variable Name | Resolution | Legal Range (min) | Legal Range (max) | Software Segment |
MtrCurrQaxPrevIntg_Volt_M_f32 | single precision float | -31 | 31 | PICURRCNTRL_START_SEC_VAR_CLEARED_32 |
MtrCurrDaxPrevIntg_Volt_M_f32 | single precision float | -31 | 31 | PICURRCNTRL_START_SEC_VAR_CLEARED_32 |
MtrVoltQaxPrevFinalLimit_Volt_M_f32 | single precision float | -31 | 31 | PICURRCNTRL_START_SEC_VAR_CLEARED_32 |
MtrVoltPrevDaxFinal_Volt_M_f32 | single precision float | -31 | 31 | PICURRCNTRL_START_SEC_VAR_CLEARED_32 |
MtrCurrQaxError_Amp_D_f32 | single precision float | -220 | 220 | PICURRCNTRL_START_SEC_VAR_CLEARED_32 |
MtrCurrDaxError_Amp_D_f32 | single precision float | -220 | 220 | PICURRCNTRL_START_SEC_VAR_CLEARED_32 |
MtrVoltQaxFinal_Volt_D_f32 | single precision float | -31 | 31 | PICURRCNTRL_START_SEC_VAR_CLEARED_32 |
MtrVoltQaxFinalLimit_Volt_D_f32 | single precision float | -31 | 31 | PICURRCNTRL_START_SEC_VAR_CLEARED_32 |
MtrVoltDaxFinal_Volt_D_f32 | single precision float | -31 | 31 | PICURRCNTRL_START_SEC_VAR_CLEARED_32 |
MtrVoltQaxProp_Volt_D_f32 | single precision float | -31 | 31 | PICURRCNTRL_START_SEC_VAR_CLEARED_32 |
MtrVoltDaxProp_Volt_D_f32 | single precision float | -31 | 31 | PICURRCNTRL_START_SEC_VAR_CLEARED_32 |
MtrVoltQaxInt_Volt_D_f32 | single precision float | -31 | 31 | PICURRCNTRL_START_SEC_VAR_CLEARED_32 |
MtrVoltDaxInt_Volt_D_f32 | single precision float | -31 | 31 | PICURRCNTRL_START_SEC_VAR_CLEARED_32 |
PICurrCntrl_MtrCurrQax_Amp_D_f32 | single precision float | FULL | FULL | PICURRCNTRL_START_SEC_VAR_CLEARED_32 |
PICurrCntrl_MtrCurrDax_Amp_D_f32 | single precision float | FULL | FULL | PICURRCNTRL_START_SEC_VAR_CLEARED_32 |
MtrVoltDax_Volt_M_f32[2] | single precision float | See data Dictionary | See data Dictionary | PICURRCNTRL_START_SEC_VAR_CLEARED_32 |
MtrVoltQax_Volt_M_f32[2] | single precision float | See data Dictionary | See data Dictionary | PICURRCNTRL_START_SEC_VAR_CLEARED_32 |
MtrCurrQaxFinalRef_Amp_M_f32[2] | single precision float | See data Dictionary | See data Dictionary | PICURRCNTRL_START_SEC_VAR_CLEARED_32 |
PICurrCntrl_DervLambdaQax_Volt_D_f32 | single precision float | See data Dictionary | See data Dictionary | PICURRCNTRL_START_SEC_VAR_CLEARED_32 |
PICurrCntrl_DervLambdaDax_Volt_D_f32 | single precision float | See data Dictionary | See data Dictionary | PICURRCNTRL_START_SEC_VAR_CLEARED_32 |
User defined typedef definition/declaration
This section documents any user types uniquely used for the module.
Variable Name | Typedef Name | Storage Type | Safety Critical Classification |
None |
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.
(Note: If no calibrations are used by the design, place the text “None” in the first location in the table)
Constant Name |
k_PiSamplingTs_Sec_f32 |
t_CommOffsetTblX_Uls_u3p13[2] |
t_CommOffsetTblY_Cnt_u16[2] |
k_NoofPoles_Uls_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 Name | Resolution | Units | Value |
D_SCALERADTOCNTS_ULS_F32 | Single Precision Float | Unitless | 10430.3783505F |
D_REVWITHROUND_ULS_F32 | Single Precision Float | Unitless | 65536.5F |
D_ROUND_ULS_F32 | Single Precision Float | Unitless | 0.5F |
D_DEG2RAD_ULS_F32 | Single Precision Float | Unitless | 0.0174532925199F |
D_GAIN_ULS_F32 | Single Precision Float | Unitless | 0.5 |
D_VECUMAX_VOLTS_F32 | Single Precision Float | Volts | 31 |
D_SQRT3OVR2_ULS_F32 | Single Precision Float | Unitless | 0.866025403784 |
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_ZERO_ULS_F32 |
D_VECUMIN_VOLTS_F32 |
Module specific Lookup Tables Constants
(This is for lookup tables (arrays) with fixed values, same name as other tables)
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,
IntplVarXY_u16_u16Xu16Y_Cnt_m()
FPM_FloatToFixed_m
Sign_f32_m
Sqrtf
Sinf
Cosf
Data Hiding Functions
The data hiding functions / macros used in this module are identified below,
Rte_ModeType_StaMd_Mode
MtrCntrl_Read_MtrCurrQax_Amp_f32
MtrCntrl_Read_MtrCurrDax_Amp_f32
MtrCntrl_Read_Vecu_Volt_f32
MtrCntrl_Read_ModIdxSrlComSvcDft_Cnt_lgc
MtrCntrl_Read_SysState_Cnt_Enum
MtrCntrl_Read_MtrCurrOffComOffset_Cnt_u16
MtrCntrl_Read_MtrElecPol_Cnt_s8
MtrCntrl_Read_MtrPosElec_Rev_u0p16
MtrCntrl_Write_MtrCurrQaxFinalRef_Amp_f32
MtrCntrl_Write_MtrDaxVoltage_Volt_f32
MtrCntrl_Write_MtrQaxVoltage_Volt_f32
MtrCntrl_Write_ModIdx_Uls_u16p16
MtrCntrl_Write_PhaseAdvanceFinal_Rev_u0p16
MtrCntrl_Write_CommOffset_Cnt_u16
Local Functions/Macros Used by this MDD only
Header file: Ap_MtrCntrl_Cfg.h
Software Module Implementation
Initialization Functions
None.
Periodic Functions
Per: PICurrCntrl_Per1
Design Rationale
This function is responsible for calculating the amount of current to be supplied to the motor. To control the PWM profiles generated for the motor. FastDataAccessBufIndex allows the buffer synchronization between data calculated on slower periodic loop time(2 milli seconds) and are read by faster periodic run time (ie 0.125ms)
Store Module Inputs to Local copies
MtrCntrl_Read_MtrCurrQax_Amp_f32(&MtrCurrQax_Amp_T_f32);
MtrCntrl_Read_MtrCurrDax_Amp_f32(&MtrCurrDax_Amp_T_f32);
MtrCntrl_Read_Vecu_Volt_f32(&Vecu_Volt_T_f32);
MtrCntrl_Read_ModIdxSrlComSvcDft_Cnt_lgc(&ModIdxSrlComSvcDft_Cnt_T_lgc);
MtrCntrl_Read_SysState_Cnt_Enum(&SysState_Cnt_T_Enum);
FwdDataAcessBuffer_Cnt_T_u16= (ActWriteAccBufIndex_Cnt_T_u16)
MtrCurrQaxRef_Amp_T_f32=MtrCurrQaxRef_Amp_M_f32[FwdDataAcessBuffer_Cnt_T_u16];
MtrCurrDaxRef_Amp_T_f32=MtrCurrDaxRef_Amp_M_f32[FwdDataAcessBuffer_Cnt_T_u16];
PIDaxIntegralGain_Uls_T_f32=MtrDaxIntegralGain_Uls_M_f32[FwdDataAcessBuffer_Cnt_T_u16];
PIDaxPropotionalGain_Uls_T_f32=MtrDaxPropotionalGain_Uls_M_f32[FwdDataAcessBuffer_Cnt_T_u16]
PIQaxIntegralGain_Uls_T_f32=MtrQaxIntegralGain_Uls_M_f32[FwdDataAcessBuffer_Cnt_T_u16];
PIQaxPropotionalGain_Uls_T_f32=MtrQaxPropotionalGain_Uls_M_f32[FwdDataAcessBuffer_Cnt_T_u16]
ElecPosDelayComp_Rad_T_f32=MtrPosComputationDelay_Rad_M_f32[FwdDataAcessBuffer_Cnt_T_u16]
MtrVoltDaxFF_Volt_T_f32=MtrVoltDaxFF_Volt_M_f32[FwdDataAcessBuffer_Cnt_T_u16]MtrVoltQaxFF_Volt_T_f32=MtrVoltQaxFF_Volt_M_f32[FwdDataAcessBuffer_Cnt_T_u16];
Vecu_Volt_T_f32 = Limit_m(Vecu_Volt_T_f32, D_VECUMIN_VOLTS_F32, D_VECUMAX_VOLTS_F32)
Program Flow Start
Store Local copy of outputs into Module Outputs
MtrCntrl_Write_MtrCurrQaxFinalRef_Amp_f32(MtrCurrQaxFinalRef_Amp_T_f32)
MtrCntrl_Write_MtrDaxVoltage_Volt_f32(MtrDaxVoltage_Volt_T_f32)
MtrCntrl_Write_MtrQaxVoltage_Volt_f32(MtrQaxVoltage_Volt_T_f32)
MtrCntrl_Write_ModIdx_Uls_u16p16(FPM_FloatToFixed_m(ModIdx_Uls_T_u16p16))
MtrCntrl_Write_PhaseAdvanceFinal_Rev_u0p16(PhaseAdvanceFinal_Rev_T_u0p16)
MtrCntrl_Write_CommOffset_Cnt_u16(CommOffset_Cnt_T_u16)
MtrCntrl_Write_MtrVolt_Volt_f32(MtrVoltCmdFinal_Volt_T_f32)
MtrCntrl_Write_MtrCurrDaxIntg_Volt_f32(MtrCurrDaxIntg_Volt_T_f32)
MtrCntrl_Write_MtrCurrQaxIntg_Volt_f32(MtrCurrQaxIntg_Volt_T_f32)
MtrCurrQaxFinalRef_Amp_M_f32[SlowDataAccessBufIndex_Cnt_M_u16]= MtrCurrQaxFinalRef_Amp_T_f32;
MtrVoltDax_Volt_M_f32[SlowDataAccessBufIndex_Cnt_M_u16] = MtrDaxVoltage_Volt_T_f32;
MtrVoltQax_Volt_M_f32[SlowDataAccessBufIndex_Cnt_M_u16] = MtrQaxVoltage_Volt_T_f32
Program Flow End
N/A
Periodic Functions
Per: PICurrCntrl_Per2
Design Rationale
This function is responsible for calculating the amount of current to be supplied to the motor. To control the PWM profiles generated for the motor.
SlowDataAccessBufIndex allows the buffer synchronization between data calculated on faster periodic loop time(125 micro seconds) and are read by slower periodic run time (ie 2ms)
Store Module Inputs to Local copies
ReadBuffer_Cnt_T_u16 = SlowDataAccessBufIndex_Cnt_M_u16
WriteBuffer_Cnt_T_u16 = (ReadBuffer_Cnt_T_u16 & 1U) ^ 1U
SlowDataAccessBufIndex_Cnt_M_u16 = WriteBuffer_Cnt_T_u16
EstKe_VpRadpS_T_f32= Rte_IRead_PICurrCntrl_Per2_EstKe_VpRadpS_f32();
EstR_Ohm_T_f32 = Rte_IRead_PICurrCntrl_Per2_EstR_Ohm_f32();
MRFMtrVel_MtrRadpS_T_f32 = Rte_IRead_PICurrCntrl_Per2_MRFMtrVel_MtrRadpS_f32();
CorrMtrPosElec_Rev_T_f32 = Rte_IRead_PICurrCntrl_Per2_CorrMtrPosElec_Rev_f32();
MtrCurrDaxRef_Amp_T_f32 = Rte_IRead_PICurrCntrl_Per2_MtrCurrDaxRef_Amp_f32();
MtrVoltDax_Volt_T_f32 = MtrVoltDax_Volt_M_f32[ReadBuffer_Cnt_T_u16];
MtrVoltQax_Volt_T_f32 = MtrVoltQax_Volt_M_f32[ReadBuffer_Cnt_T_u16];
MtrCurrQaxFinalRef_Amp_T_f32 = MtrCurrQaxFinalRef_Amp_M_f32[ReadBuffer_Cnt_T_u16]; Program Flow Start
Rte_Call_PICurrCntrl_Per2_CP0_CheckpointReached()
Processing
Store Local copy of outputs into Module Outputs
Rte_IWrite_PICurrCntrl_Per2_DervLambdaAlphaDiag_Volt_f32(DervLambdaAlphaDiag_Volt_T_f32);
Rte_IWrite_PICurrCntrl_Per2_DervLambdaBetaDiag_Volt_f32(DervLambdaBetaDiag_Volt_T_f32);
Program Flow End
Rte_Call_PICurrCntrl_Per2_CP1_CheckpointReached()
Execution Requirements
Execution Sequence of the Module
N/A
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) in which the function is called |
PICurrCntrl_Per1 | 0.125ms | All |
PICurrCntrl_Per2 | 2ms | All |
Execution Requirements for Serial Communication Functions
Function Name | Sub-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 Module | Software Segment |
PICurrCntrl_Per1 | PICurrCntrl_CODE |
PICurrCntrl_Per2 | RTE_START_SEC_AP_PICURRCNTRL_APPL_CODE |
Local Functions
This table identifies the software segments for local functions identified in this module.
- Denotes functions that are vector call-backs only included to avoid compiler errors.
Name of Sub Module | Software Segment |
N/A |
Known Issues / Limitations With Design
The computation of commoffset and ModIndex service defeat part of FDD15D is implemented in this component inaddition to 99B requirements
The reason for the implementation is to keep the sine voltage driver common across components
Revision Control Log
Item # | Rev # | Change Description | Date | Author Initials |
1 | 1.0 | Initial release with changes for IPM | 6/12/2012 | AD/KPIT |
2 | 1.0 | Changes for memap statements added | 11/20/2012 | Selva |
3 | 2.0 | Updated for SF99B –v8 with only changes needed for voltage command integrity check for torque reasonableness | 02/24/2013 | Selva |
4 | 3.0, | Updated for SF99B –v8 | 03/21/2013 | Selva |
5 | 4.0 | Corrected for SF99B –v8 | 04/19/2013 | Selva |
6 | 5.0 | Updated for SF99B –v10 | 21-Oct-13 | Selva |
7 | 6.0 | Updated for SF99B –v10 | 7-Nov-13 | Selva |
8 | 7.0 | Updated for V12 of FDD SF99 | 27-Nov-13 | Selva |
8 - Quadrant_Detection_MDD
Module --
High-Level Description
This module takes the cumulative motor position and determines the motor direction (using a previously saved state variable and a calibration constant for hysteresis). It then computes the torque command sign from the scaled torque command and uses both of these values to determine the motor quadrant.
Figures
Component Diagram
Diagram – Function QuadDet_Per1
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 | Module Outputs | |
---|---|---|
MRFMtrTrqCmdScl_MtrNm_f32 | InstMtrDir_Cnt_s08 | |
MRFCumMtrPos_Deg_f32 | MtrQuad_Cnt_u08 |
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 |
---|---|---|---|---|
MtrTrqCmdSign_Cnt_D_s08 | 1 | -1, 1 | AP_QUADRANTDETECT_VAR_NOINIT | |
PrevCumMtrPos_Deg_M_f32 | Single Precision Float | -1 | 1 | AP_QUADRANTDETECT_VAR_INIT |
PrevInstMtrDir_Cnt_M_s08 | 1 | -1 | 1 | AP_QUADRANTDETECT_VAR_INIT |
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) |
---|---|---|---|---|
None |
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_InstMtrDirHyst_Deg_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 Name | Resolution | Units | Value |
---|---|---|---|
D_CUMMTRPOSLOLMT_DEG_F32 | Single Precision Float | Degrees | min value of MRFCumMtrPos_Deg_f32 |
D_CUMMTRPOSHILMT_DEG_F32 | Single Precision Float | Degrees | max value of MRFCumMtrPos_Deg_f32 |
D_MTRTRQCMDTOL_MTRNM_F32 | Single Precision Float | MtrNm | 0.00390625 |
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_QUADRANT1_CNT_U8 |
D_QUADRANT2_CNT_U8 |
D_QUADRANT3_CNT_U8 |
D_QUADRANT4_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 and functions / Macros that are called by the various sub modules are identified below,
Abs_f32_m()
Sign_f32_m()
Data Hiding Functions
None
Global Functions/Macros Defined by this Module
None
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.
Data | Value |
---|---|
Rte_InitValue_InstMtrDir_Cnt_s08 | 0 |
Rte_InitValue_MRFCumMtrPos_Deg_f32 | 0 |
Rte_InitValue_MRFMtrTrqCmdScl_MtrNm_f32 | 0 |
Rte_InitValue_MtrQuad_Cnt_u08 | 1 |
Initialization Functions
None
Periodic Functions
Per: _Per1
Design Rationale
None
Program Flow Start
N/A
Store Module Inputs to Local copies
MtrTrqCmdScl_MtrNm_T_f32 = Rte_IRead_QuadDet_Per1_MRFMtrTrqCmdScl_MtrNm_f32();
CumMtrPos_Deg_T_f32 = Rte_IRead_QuadDet_Per1_MRFCumMtrPos_Deg_f32();
Determine Motor Direction
Determine Instantaneous Torque Command Sign
Determine Motor Quadrant
Store Local copy of outputs into Module Outputs
Rte_IWrite_QuadDet_Per1_InstMtrDir_Cnt_s08(PrevInstMtrDir_Cnt_M_s08);
Rte_IWrite_QuadDet_Per1_MtrQuad_Cnt_u08(MtrQuad_Cnt_T_u08);
Program Flow End
N/A
Fault Recovery Functions
None
Shutdown Functions
None
Interrupt Functions
None
Serial Communication Functions
None
Execution Requirements
Execution Sequence of the Module
QuadDet_Per1 executes every 2 milliseconds.
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) in which the function is called |
---|---|---|
QuadDet_Per1 | 2 ms | WARM INIT, OPERATE, DISABLE, OFF |
Execution Requirements for Serial Communication Functions
Function Name | Sub-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 Module | Software Segment |
---|---|
QuadDet_Per1 | RTE_START_SEC_AP_QUADDET_APPL_CODE |
Local Functions
This table identifies the software segments for local functions identified in this module.
Name of Sub Module | Software Segment |
---|---|
None |
Known Issues / Limitations With Design
INLINE functions defined in globalmacro.h are not unit tested
Revision Control Log
Item # | Rev # | Change Description | Date | Author Initials |
---|---|---|---|---|
1 | 1 | Initial MDD for component based design | 23-Dec-11 | O.T. |
2 | 2.0 | Fixed Inconsistencies, UTP issues | 25-Jan-12 | OT |
9 - TorqueCmdScaling_MDD
Module -- Torque Command Scaling4.04.0
High-Level Description
The Torque Command Scale module multiplies the Torque_Command_MRF input signal by a calibration which is set during a manufacturing EOL calibration process. This calibration is provided to reduce overall system output torque variation. This scaled version of the torque command is used by all other sub functions within motor control which have a torque dependent component.
Figures
Diagram – Function Data Sharing
This diagram shows all data that is shared between functions within the module.
Diagram – Function (Name)
This diagram describes the functional characteristics and data flow of a given function.
(Note – This is not mandatory, only used where a graphical representation helps explain the function. It is left to the author’s discretion. New headers of this level (Level 3) should be created for each 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) |
MRFMtrTrqCmd_MtrNm_f32 | MRFMtrTrqCmdScl_MtrNm_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 Name | Resolution | Legal Range (min) | Legal Range (max) | Software Segment |
None |
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) |
None |
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_MinTrqCmdScl_Uls_f32 |
k_MaxTrqCmdScl_Uls_f32 |
TorqueCmdSF_Uls_f32 (NVM) |
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 |
None |
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 |
None |
Module specific Lookup Tables Constants
(This is for lookup tables (arrays) with fixed values, same name as other tables)
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,
Limit_m()
Data Hiding Functions
The data hiding functions / macros used in this module are identified below,
Rte_Call_TrqCmdScl_WriteBlock()
Rte_Pim_TorqueCmdSF_Uls_f32()
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
Periodic Functions
Per: TrqCmdScl_Per1
Design Rationale
None
Program Flow Start
Rte_Call_TrqCmdScl_Per1_CP0_CheckpointReached()
Store Module Inputs to Local copies
MRFMtrTrqCmd_MtrNm_T_f32 = Rte_IRead_TrqCmdScl_Per1_MRFMtrTrqCmd_MtrNm_f32()
TorqueCmdSF_Uls_T_f32 = *Rte_Pim_TorqueCmdSF_Uls_f32()
Apply Torque Command Scaling
Store Local copy of outputs into Module Outputs
Rte_IWrite_TrqCmdScl_Per1_MRFMtrTrqCmdScl_MtrNm_f32(MRFMtrTrqCmdScl_MtrNm_T_f32)
Program Flow End
Rte_Call_TrqCmdScl_Per1_CP1_CheckpointReached()
Flow End
N/A
Scomm: TrqCmdScl_SCom_Get
Design Rationale
None
Program Flow Start
N/A
Store Module Inputs to Local copies
None
Get Torque Command Scaling
Store Local copy of outputs into Module Outputs
None
Program Flow End
N/A
Scomm: TrqCmdScl_SCom_Set
Design Rationale
None
Program Flow Start
N/A
Store Module Inputs to Local copies
None
Set Torque Command Scaling
Store Local copy of outputs into Module Outputs
None
Program Flow End
N/A
Local Function/Macro Definitions
If these are numerous and defined in a separate source file then reference the source file only.
Function
Function Name | Type | Min | Max | UTP Tol. | |
Arguments Passed | |||||
Return Value |
Execution Requirements
Execution Sequence of the Module
TrqCmdScl_Per1 must be executed in the forward path before quadrant detection, the voltage command numerator, phase advance, voltage command denominator, and Modulation Index.
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) |
TrqCmdScl_Per1 | 2ms | ALL |
Execution Requirements for Serial Communication Functions
Function Name | Sub-Module called by (Serial Comm Function Name) |
TrqCmdScl_Scom_Get() | |
TrqCmdScl_Scom_Set() |
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 |
TrqCmdScl_Per1 |
Local Functions
This table identifies the software segments for local functions identified in this module.
Name of Sub Module | Software Segment |
None |
Known Issues / Limitations With Design
None
Revision Control Log
Item # | Rev # | Change Description | Date | Author Initials |
1 | 1.0 | Document creation and initial release for the component | 29NOV11 | VK |
2 | 1.1 | Corrections to assign EOL scaling factor to temporary variable | 02DEC11 | VK |
3 | 3 | Added checkpoints and memmap software segment is updated for static variables | 26Sep12 | Selva |
4 | 4 | Heading and format corrected | 21Nov12 | Selva |
10 - TrqCanc_MDD
Module -- TrqCanc
High-Level Description
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 | Module Outputs | |
---|---|---|
EstKe_VpRadpS_f32 | ||
MRFMtrVel_MtrRadpS_f32 | ||
MtrCurrDaxRef_Amp_f32 | ||
MtrCurrQaxRef_Amp_f32 | ||
ElecPosDelayComp_Rad_f32 | MtrCurrQaxRpl_Amp_T_f32 | |
MtrElecPol_Cnt_s8 | MtrCurrQaxCog_Amp_f32 | |
MtrPosElec_Rev_u0p16 | ||
EstKe_VpRadpS_f32 | ||
MtrCurrQax12Mag_Amp_f32 | ||
MtrCurrQax6Mag_Amp_f32 | ||
MtrCurrQax12Ph_Rad_f32 | ||
MtrCurrQax6Ph_Rad_f32 | ||
MtrCurrQax18Ph_Rad_f32 | ||
MtrCurrQax18Mag_Amp_f32 | ||
ActWriteAccBufIndex_Cnt_T_u16 | ||
ReadBuffer_Cnt_M_u16 |
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 |
---|---|---|---|---|
CogginTrqCancIndex_D_Cnt_u16 | 1 | 0 | 511 | TRQCANC_VAR_CLEARED_16 |
CoggingTrqCanc_MtrNm_D_f32 | Single precision float | -1 | 1 | TRQCANC_VAR_CLEARED_32 |
MtrCurrQax6thMag_Amp_D_f32 | Single precision float | -220 | 220 | TRQCANC_VAR_CLEARED_32 |
MtrTrqRip6thPhs_Rad_D_f32 | Single precision float | -2*pi | 2*pi | TRQCANC_VAR_CLEARED_32 |
MtrCurrQax18thMag_Amp_D_f32 | Single precision float | -220 | 220 | TRQCANC_VAR_CLEARED_32 |
MtrTrqRip18thPhs_Rad_D_f32 | Single precision float | -2*pi | 2*pi | TRQCANC_VAR_CLEARED_32 |
MtrCurrQax12thMag_Amp_D_f32 | Single precision float | -220 | 220 | TRQCANC_VAR_CLEARED_32 |
MtrTrqRip12thPhs_Rad_D_f32 | Single precision float | -2*pi | 2*pi | TRQCANC_VAR_CLEARED_32 |
MtrCurrQax6thMagFinal_Amp_D_f32 | Single precision float | -220 | 220 | TRQCANC_VAR_CLEARED_32 |
MtrTrqRip6thPhsFinal_Rev_D_f32 | Single precision float | 0 | 1 | TRQCANC_VAR_CLEARED_32 |
MtrCurrQax18thMagFinal_Amp_D_f32 | Single precision float | -220 | 220 | TRQCANC_VAR_CLEARED_32 |
MtrTrqRip18thPhsFinal_Rev_D_f32 | Single precision float | 0 | 1 | TRQCANC_VAR_CLEARED_32 |
MtrCurrQax12thMagFinal_Amp_D_f32 | Single precision float | -220 | 220 | TRQCANC_VAR_CLEARED_32 |
MtrTrqRip12thPhsFinal_Rad_D_f32 | Single precision float | -2*pi | 2*pi | TRQCANC_VAR_CLEARED_32 |
CoggingTrqMtrPosElec_Rad_D_f32 | Single precision float | -2*pi | 2*pi | TRQCANC_VAR_CLEARED_32 |
MtrCurrQax12Mag_Amp_M_ f32 | Single precision float | -220 | 220 | TRQCANC_VAR_CLEARED_32 |
MtrCurrQax12Ph_Rad _M_ f32 | Single precision float | -2*pi | 2*pi | TRQCANC_VAR_CLEARED_32 |
MtrCurrQax6Mag_Amp_ M_ f32 | Single precision float | -220 | 220 | TRQCANC_VAR_CLEARED_32 |
MtrCurrQax6Ph_Rad_ M_ f32 | Single precision float | -2*pi | 2*pi | TRQCANC_VAR_CLEARED_32 |
MtrCurrQax18Mag_Amp_ M_ f32 | Single precision float | -220 | 220 | TRQCANC_VAR_CLEARED_32 |
MtrCurrQax18Ph_Rad_ M_ f32 | Single precision float | -2*pi | 2*pi | TRQCANC_VAR_CLEARED_32 |
TrqCanc_MtrCurrQaxRpl6X_Amp_M_s6p9[][] | 2^-9 | FULL | FULL | TRQCANC_VAR_CLEARED_16 |
TrqCanc_MtrCurrQaxRpl6Y_Amp_M_s6p9[][] | 2^-9 | FULL | FULL | TRQCANC_VAR_CLEARED_16 |
TrqCanc_MtrCurrQaxRpl12X_Amp_M_s6p9[][] | 2^-9 | FULL | FULL | TRQCANC_VAR_CLEARED_16 |
TrqCanc_MtrCurrQaxRpl12Y_Amp_M_s6p9[][] | 2^-9 | FULL | FULL | TRQCANC_VAR_CLEARED_16 |
TrqCanc_MtrCurrQaxRpl18X_Amp_M_s6p9[][] | 2^-9 | FULL | FULL | TRQCANC_VAR_CLEARED_16 |
TrqCanc_MtrCurrQaxRpl18Y_Amp_M_s6p9[][] | 2^-9 | FULL | FULL | TRQCANC_VAR_CLEARED_16 |
TrqCanc_CorrecNomKe_VpRadpS_M_f32 | Single precision float | .025 | 0.075 | TRQCANC_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) |
---|---|---|---|---|
CoggingM_Amp_Str | CoggingMX_Amp_s6p9 | sint16 | FULL | FULL |
CoggingMY_Amp_s6p9 | sint16 | FULL | FULL | |
CogTrqCalPtr | Rte_Pim_CogTrqCal()[512] | Uint16 | -1 | 1 |
CogTrqCalRplCompPtr | Rte_Pim_CogTrqRplComp()[9] | Uint16 | -1 | 1 |
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_Harmonic6thElec_Uls_f32 |
k_Harmonic12thElec_Uls_f32 |
k_Harmonic18thElec_Uls_f32 |
t_MtrCurrQaxRpl_Amp_u9p7[] |
t_MtrCurrDaxRpl_Amp_u9p7[] |
t2_MtrCurrQaxRpl6X_Amp_s6p9[] |
t2_MtrCurrQaxRpl6Y_Amp_s6p9[] |
t2_MtrCurrQaxRpl12X_Amp_s6p9[] |
t2_MtrCurrQaxRpl12Y_Amp_s6p9[] |
t2_MtrCurrQaxRpl18X_Amp_s6p9[] |
t2_MtrCurrQaxRpl18Y_Amp_s6p9[] |
t_MtrVelX_MtrRadpS_T_u14p2[10] |
t_MtrTrqCancPIMagRP_Uls_u6p10[10] |
t_MtrTrqCancPIPhRP_Rev_u0p16[10] |
t_MtrCurrQaxRplPIY_Amp_u9p7[] |
t2_MtrTrqCancPIMagRP_Uls_u6p10[] |
t2_MtrTrqCancPIPhRP_Rev_u0p16[] |
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 | Units | Value |
---|---|---|---|
D_SQRT3OVR2_ULS_F32 | Single precision float | Unit less | 0.866025403784 |
D_6HARMONICNO_F32 | Single precision float | Unit less | 6 |
D_12HARMONICNO_F32 | Single precision float | Unit less | 12 |
D_COGGINGTBLRES_F32 | Single precision float | Counts | 81.48733 |
D_MAXTBLVALUE_CNT_u16 | 1 | Counts | 511 |
D_SCALERADTOCNTS_ULS_F32 | Single precision float | Unit less | 10430.3783505 |
D_30DEGREES_CNT_U16 | 1 | Counts | 5461 |
D_DEG2RAD_ULS_F32 | Singles precision float | Unit less | 0.0174532925199 |
D_REVWITHROUND_ULS_F32 | Singles precision float | Unit less | 65536.5 |
D_ONEHALF_ULS_F32 | Singles precision float | Unit less | 0.5 |
D_POSITIVEONE_CNT_S8 | 1 | Counts | 1 |
D_COGTRQ_LOOPLMT | 1 | Unit less | 128 |
D_DAXRPLTBLSZ_CNT_U8 | 1 | Counts | TableSize_m(t_MtrCurrDaxRpl_Amp_u9p7) |
D_QAXRPLTBLSZ_CNT_U8 | 1 | Counts | TableSize_m(t_MtrCurrQaxRpl_Amp_u9p7) |
D_COGTRQRPL_LOOPLMT | 1 | Counts | 3U |
D_NOOFHARMONIC_CNT_U8 | 1 | Counts | 9U |
D_MINCOGRANGE_NM_S5P10 | S5P10_T | Nm | -0.1 |
D_MINCOGRANGE_NM_S5P10 | S5P10_T | Nm | 0.1 |
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_2PI_ULS_F32 |
D_ONE_ULS_F32 |
D_ZERO_ULS_F32 |
Module specific Lookup Tables Constants
(This is for lookup tables (arrays) with fixed values, same name as other tables)
Constant Name | Resolution | Value | Software Segment |
---|---|---|---|
t_SinTbl_Cnt_u16 | Uint16 | TRQCANC_START_SEC_CONST_16 |
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,
Abs_s16_m
FPM_FloatToFixed_m
TableSize_m
FPM_FixedToFloat_m
IntplVarXY_u16_u16Xu16Y_Cnt
BilinearXYM_s16_u16Xs16YM_Cnt
sqrtf
atan2f
sinf
Rte_Pim_CogTrqCal
Rte_Pim_CogTrqRplComp
Data Hiding Functions
MtrCntrl_Read_MtrElecPol_Cnt_s8
MtrCntrl_Read_MtrPosElec_Rev_u0p16
MtrCntrl_Read_ReadFwdPthAccessBfr_Cnt_u16
Global Functions/Macros Defined by this Module
None
Local Functions/Macros Used by this MDD only
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.
Data | Value |
---|---|
EstKe_VpRadpS_f32 | Rte_IRead_TrqCanc_Init_EstKe_VpRadpS_f32 |
Initialization Functions
Per: TrqCanc_Init
Design Rationale
Update the lookup table for ripple’s
Processing
Periodic Functions
Per: TrqCanc_Per1
Design Rationale
FastDataAccessBufIndex allows the buffer synchronization between data calculated on slower periodic loop time(2 milli seconds) and are read by faster periodic run time (ie 0.125ms)
Program Flow Start
Rte_Call_TrqCanc_Per1_CP0_CheckpointReached()
Store Module Inputs to Local copies
MRFMtrVel_MtrRadpS_T_f32=Rte_IRead_TrqCanc_Per1_MRFMtrVel_MtrRadpS_f32
DaxRef_Amp_T_f32=Rte_IRead_TrqCanc_Per1_MtrCurrDaxRef_Amp_f32
QaxRef_Amp_T_f32 =Rte_IRead_TrqCanc_Per1_MtrCurrQaxRef_Amp_f32
WriteAccessBufIndex_Cnt_T_u16= (FastDataAccessBufIndex_Cnt_M_u16&1)^1;
Store Local copy of outputs into Module Outputs
Program Flow End
Rte_Call_TrqCanc_Per1_CP1_CheckpointReached()
Periodic Functions
Per: TrqCogCancRefPer1
Design Rationale
FastDataAccessBufIndex allows the buffer synchronization between data calculated on slower periodic loop time(2 milli seconds) and are read by faster periodic run time. SlowDataAccessBufIndex allows the buffer synchronization between data calculated on faster periodic loop time(125 micro seconds) and are read by slower periodic run time (ie 2ms)
Program Flow Start
N/A
Store Module Inputs to Local copies
DataAccessBfr_Cnt_T_u16 =FastDataAccessBufIndex_Cnt_M_u16
MtrCntrl_Read_MtrElecPol_Cnt_s8(&MtrElecPol_Cnt_T_s8)
MtrCntrl_Read_MtrPosElec_Rev_u0p16(&MtrPosElec_Rev_T_u0p16)
MtrPosComputDelay_Rad_T_f32=MtrPosComputationDelay_Rad_M_f32[DataAccessBfr_Cnt_T_u16]
EstKe_VpRadpS_T_f32= MtrEstKe_VpRadpS_M_f32[DataAccessBfr_Cnt_T_u16]
MtrCurrQax6Mag_Amp_T_f32 =MtrCurrQax6Mag_Amp_M_f32[DataAccessBfr_Cnt_T_u16] MtrCurrQax12Mag_Amp_T_f32=MtrCurrQax12Mag_Amp_M_f32[DataAccessBfr_Cnt_T_u16] MtrCurrQax6Ph_Rad_T_f32 =MtrCurrQax6Ph_Rad_M_f32[DataAccessBfr_Cnt_T_u16] MtrCurrQax12Ph_Rad_T_f32 =MtrCurrQax12Ph_Rad_M_f32[DataAccessBfr_Cnt_T_u16]
MtrCurrQax18Mag_Amp_T_f32=MtrCurrQax18Mag_Amp_M_f32[DataAccessBfr_Cnt_T_u16] MtrCurrQax18Ph_Rad_T_f32 =MtrCurrQax18Ph_Rad_M_f32[DataAccessBfr_Cnt_T_u16]
Store Local copy of outputs into Module Outputs
None
Program Flow End
None
Fault Recovery Functions
None
Shutdown Functions
None
Interrupt Functions
None
Serial Communication Functions
SComm: TrqCanc_Scom_ReadCogTrqCal
Design Rationale
#ifdef RTE_PTR2ARRAYBASETYPE_PASSING
FUNC(void, RTE_AP_TRQCANC_APPL_CODE) TrqCanc_Scom_ReadCogTrqCal(P2VAR(UInt16, AUTOMATIC, RTE_AP_TRQCANC_APPL_VAR) CogTrqCalPtr, UInt16 ID)
#else
FUNC(void, RTE_AP_TRQCANC_APPL_CODE) TrqCanc_Scom_ReadCogTrqCal(P2VAR(CoggingCancTrq, AUTOMATIC, RTE_AP_TRQCANC_APPL_VAR) CogTrqCalPtr, UInt16 ID)
#endif
Program Flow Start
None
Store Module Inputs to Local copies
None
Processing
Store Local copy of outputs into Module Outputs
None
Program Flow End
None
SComm: TrqCanc_Scom_SetCogTrqCal
Design Rationale
Function Name | CoggingTrqTableUpdate | Type | Min | Max | UTP Tol. |
Arguments Passed | *CogTrqCalPtr | Sint16 | -1 | 1 | |
ID | Unit16 | 0 | 4 | ||
Return Value | None |
#ifdef RTE_PTR2ARRAYBASETYPE_PASSING
FUNC(void, RTE_AP_TRQCANC_APPL_CODE) TrqCanc_Scom_SetCogTrqCal(P2CONST(UInt16, AUTOMATIC, RTE_AP_TRQCANC_APPL_DATA) CogTrqCalPtr, UInt16 ID)
#else
FUNC(void, RTE_AP_TRQCANC_APPL_CODE) TrqCanc_Scom_SetCogTrqCal(P2CONST(CoggingCancTrq, AUTOMATIC, RTE_AP_TRQCANC_APPL_DATA) CogTrqCalPtr, UInt16 ID)
#endif
Program Flow Start
None
Store Module Inputs to Local copies
None
Processing
Store Local copy of outputs into Module Outputs
None
Program Flow End
None
Local Function/Macro Definitions
CoggingTrqTableUpdate#1
Function Name | CoggingTrqTableUpdate | Type | Min | Max | UTP Tol. |
Arguments Passed | N/A | N/A | - | - | |
Return Value | N/A | N/A | N/A | N/A |
Description
SinLookup #2
Function Name | SinLookup | Type | Min | Max | UTP Tol. |
Arguments Passed | Theta_Rad_T_f32 | Float32 | --2*pi | 2*pi | |
Return Value | Result_Uls_T_f32 | Float32 | -1 | 1 |
Description
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 Name | Calling Frequency | System State(s) in which the function is called |
---|---|---|
TrqCanc_Per1 | 2ms | ALL |
TrqCogCancRefPer1 | 125us | ALL |
TrqCanc_Init | Init | At Startup |
Execution Requirements for Serial Communication Functions
Function Name | Sub-Module called by (Serial Comm Function Name) |
---|---|
TrqCanc_Scom_ReadCogTrqCal | EPS_DiagSrvc |
TrqCanc_Scom_SetCogTrqCal | EPS_DiagSrvc |
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 |
---|---|
TrqCanc_Per1 | RTE_START_SEC_AP_TRQCANC_APPL_CODE |
TrqCanc_Init | RTE_START_SEC_AP_TRQCANC_APPL_CODE |
Local Functions
This table identifies the software segments for local functions identified in this module.
Name of Sub Module | Software Segment |
---|---|
CoggingTrqTableUpdate | RTE_START_SEC_AP_TRQCANC_APPL_CODE |
SinLookup | RTE_START_SEC_AP_TRQCANC_APPL_CODE |
Known Issues / Limitations With Design
Note for UNIT TEST:
Rte_Pim_CogTrqCal and CogTrqRplComp is declared as unit16 with size of 521 with 512 values are used in the look up and 9 values are used in the harmonic table compensation.
Eventhough the values are read as uint16 it will be used as sint16 ( s5p10 preciously) with the range of -1 to 1 .
Revision Control Log
Rev # | Change Description | Date | Author Initials |
1.0 | Initial version (v8 FDD SF99B) | 23-Mar-13 | Selva |
2 | Updated to version 9 FDD SF99B | 5-June-13 | Selva |
3 | Updated to version 10 FDD SF99B | 21-Oct-13 | Selva |
4 | Updated to version 10 FDD SF99B | 23-Oct-13 | Selva |
5 | Updated to version 11 FDD SF99B | 7-Nov-13 | Selva |