CurrMeas_MDD

Module Design Document

For

Current Measurement

October 5, 2016

Prepared For:

Software Engineering

Nexteer Automotive,

Saginaw, MI, USA

Prepared By:

Software Group,

Nexteer Automotive,

Saginaw, MI, USAChange History

Sl. No.DescriptionAuthorVersionDate
1Initial VersionSelva1.04- May-2015
2.0Updated to v 3.1.0 of the FDD (Merged CurrMeas_MDD and CurrMeas_MotCtrl_MDD)Selva2.029-Sep-2015
3.0Updated per design rev. 4.2.0Rijvi Ahmed3.030-Mar-2016
4.0Added design limitation and unit test consideration. Design rev. 4.5.0Rijvi Ahmed4.005-October-2016

Table of Contents

1 Introduction 5

1.1.1 Purpose 5

2 Current Measurement & High-Level Description 6

3 Design details of software module 7

3.1.1 Data Flow Diagram 7

3.1.2 Component level DFD 7

3.1.3 Function level DFD 7

4 Constant Data Dictionary 8

4.1.1 Program (fixed) Constants 8

4.1.2 Embedded Constants 8

5 Software Component Implementation 9

5.1 Sub-Module Functions 9

5.2 INIT: CurrMeasInit1 9

5.3 PERIODIC FUNCTIONS 9

5.3.2 Per: CurrMeasPer2 10

5.3.3 Per: CurrMeasPer3 10

5.4 Server Runables 10

5.4.1 Serverrunnable: CurrMeasEolGainSTsReq 10

5.4.2 Serverrunnable: CurrMeasEoloffsSTsReq 10

5.4.3 Serverrunnable: CurrMeasEoloffsReq 10

5.4.4 Serverrunnable: CurrMeasEolGainReq 11

5.4.5 Serverrunnable: CurrMeasGainReadReq 11

5.4.6 Serverrunnable: CurrMeasGainWrReq 11

5.4.7 Serverrunnable: CurrMeasOffsReadReq 11

5.4.8 Serverrunnable: CurrMeasOffsWrReq 11

5.5 Module Internal (Local) Functions 12

5.5.1 Local Function #1 PerformGainCalibration 12

5.5.2 Local Function #2 SigMaxMinGain 12

5.5.3 Local Function #3 SigMaxMinOffs 12

5.5.4 Local Function #4 ProtocolChkWI 12

5.5.5 Local Function #1 ProtocolChkEn 13

5.5.6 Local Function #2 CalcMotCurrMotAgCorrd 13

5.5.7 Local Function #3 OffsCalcABC 13

5.5.8 Local Function #4 OffsCalcDEF 14

5.5.9 Local Function #5 CalMotCurrCorrdABC 14

5.5.10 Local Function #6 CalMotCurrCorrdDEF 15

6 GLOBAL Function/Macro Definitions 16

7 Known Limitations with Design 17

8 UNIT TEST CONSIDERATION 18

Appendix A Abbreviations and Acronyms 19

Appendix B Glossary 20

Appendix C References 22

Introduction

Purpose

None

Current Measurement & High-Level Description

Refer FDD Design for High level description

Design details of software module

Graphical representation of Current Measurement

Data Flow Diagram

Component level DFD

None

Function level DFD

None

Constant Data Dictionary

Program (fixed) Constants

Embedded Constants

Local Constants

Constant NameResolutionUnitsValue
CALPROCNOTSTRTD_CNT_U081Cnt0
CALPROCSTRTD_CNT_U081Cnt1
CALPROCPASS_CNT_U081Cnt2
CALPROCPHAABCEOLOUTOFRNG_CNT_U081Cnt4
CALPROCPHADEFEOLOUTOFRNG_CNT_U081Cnt8
CALPROCPHAABCDEFEOLOUTOFRNG_CNT_U081Cnt12
CALPROCVEHSPDCNDNOTMET_CNT_U081Cnt16
CALPROCMOTVELMRFCNDNOTMET_CNT_U081Cnt32
CALPROCBOTHIVTRINACTV_CNT_U081Cnt64
DIFOFFSRNGCHKMAX_VOLT_F32Single precision floatAmpr1.0
DIFOFFSRNGCHKMIN_VOLT_F32Single precision floatAmpr-1.0
NANOSECTOSEC_ULS_F32float32Uls0.000000001
Refer DataDict.m file for other local constantsRefer DataDict.m file for other local constantsRefer DataDict.m file for other local constantsRefer DataDict.m file for other local constants

Software Component Implementation

<The detailed design of the function is provided in the FDD. The detail design shall only be added to the MDD when it is not provided in the FDD or the FDD is not adequate and clarification is needed.>

Sub-Module Functions

The sub-module functions are grouped based on similar functionality that needs to be executed in a given “State” of the system (refer States and Modes). For a given module, the MDD will identify the type and number of sub-modules required. The sub-module types are described below.

<(Note: For multiple init or per functions, insert new headers at the “Header 3” level – subset of “Sub-Module Functions section above” and follow the same sub-section design shown below . If none required, place the text “None”))>

INIT: CurrMeasInit1

Design Rationale

Init1 function is created so that it will allow a RTE model to be created in the AUTOSAR tools which allows Per-Instance Memory and calibration definition needs. The initialization function is doing nothing

Store Module Inputs to Local copies

None

(Processing of function)………

None

Store Local copy of outputs into Module Outputs

None

PERIODIC FUNCTIONS

(Note: For multiple periodic functions, insert new headers at the “Header 2” level – subset of “ Periodic Functions” and follow the same sub-section design shown below). If none required, place the text “None”)>

Per: CurrMeasPer1

Design Rationale

Refer the FDD

Store Module Inputs to Local copies

(Processing of function)………

Refer the FDD

Store Local copy of outputs into Module Outputs

Refer the FDD

Per: CurrMeasPer2

Design Rationale

Refer to FDD

Store Module Inputs to Local copies

Refer to FDD

(Processing of function)………

Refer to FDD

Store Local copy of outputs into Module Outputs

Refer to FDD

Per: CurrMeasPer3

Design Rationale

Refer to FDD

Store Module Inputs to Local copies

Refer to FDD

(Processing of function)………

Refer to FDD

Store Local copy of outputs into Module Outputs

Refer to FDD

Server Runables

Serverrunnable: CurrMeasEolGainSTsReq

Design Rationale

Refer the FDD

Serverrunnable: CurrMeasEoloffsSTsReq

Design Rationale

Refer the FDD

Serverrunnable: CurrMeasEoloffsReq

Design Rationale

Refer the FDD

Serverrunnable: CurrMeasEolGainReq

Design Rationale

Refer the FDD

Serverrunnable: CurrMeasGainReadReq

Design Rationale

Refer the FDD

Serverrunnable: CurrMeasGainWrReq

Design Rationale

Refer the FDD

Serverrunnable: CurrMeasOffsReadReq

Design Rationale

Refer the FDD

Serverrunnable: CurrMeasOffsWrReq

Design Rationale

Refer the FDD

Module Internal (Local) Functions

Local Function #1 PerformGainCalibration

Function NamePerformGainCalibrationTypeMinMax
ArgumentsNone
Return ValueNone

Description

Refer FDD.

Local Function #2 SigMaxMinGain

Function NameSigMaxMinGainTypeMinMax
ArgumentsNone
Return ValueNone

Description

Refer FDD.

Local Function #3 SigMaxMinOffs

Function NameSigMaxMinOffsTypeMinMax
ArgumentsNone
Return ValueNone

Description

Refer FDD.

Local Function #4 ProtocolChkWI

Function NameProtocolChkWITypeMinMax
MotCtrlMotCurrAdcVly1_Volt_T_f32float320.34.8
MotCtrlMotCurrAdcVly2_Volt_T_f32float320.34.8
MotCtrlMotCurrAdcVly3_Volt_T_f32float320.34.8
Return ValueProtocolChk_Cnt_T_loglbooleanFALSETRUE

Description

Refer FDD.

Local Function #1 ProtocolChkEn

Function NameProtocolChkEnTypeMinMax
Arguments PassedMotCtrlMotCurrAdcVly1AdcFaild_Cnt_T_loglbooleanFALSETRUE
MotCtrlMotCurrAdcVly2AdcFaild_Cnt_T_loglbooleanFALSETRUE
MotCtrlMotCurrAdcVly3AdcFaild_Cnt_T_loglbooleanFALSETRUE
Return ValueProtocolChkEn_Cnt_T_loglbooleanFALSETRUE

Description

Refer FDD.

Local Function #2 CalcMotCurrMotAgCorrd

Function NameCalcMotCurrMotAgCorrdTypeMinMax
MotCtrlMotAgElec_Rev_T_u0p16u0p16065535
MotCtrlMotElecMeclPolarity_Uls_T_s08Sint8-11
MotCtrlMotVelMrf_MtrRadpS_T_f32float32-13501350
Return ValueMotCtrlCurrMeasMotAgCorrd_Rad_T_f32float32-6.286.28

Description

Refer FDD.

MotCtrlMotElecMeclPolarity_Uls_T_s08 takes -1 and +1 as its values

Local Function #3 OffsCalcABC

Function NameOffsCalcABCTypeMinMax
ArgumentsMotCtrlBrdgVltg_Volt_T_f32float32626.5
MotCtrlPhaOnTiA_NanoSec_T_u32uint32071429
MotCtrlPhaOnTiB_NanoSec_T_u32uint32071429
MotCtrlPhaOnTiC_NanoSec_T_u32uint32071429
Return Value*MotCurrOffsA_Volt_T_f32float3205
*MotCurrOffsB_Volt_T_f32float3205
*MotCurrOffsC_Volt_T_f32float3205

Description

Refer FDD.

Local Function #4 OffsCalcDEF

Function NameOffsCalcDEFTypeMinMax
ArgumentsMotCtrlBrdgVltg_Volt_T_f32float32626.5
MotCtrlPhaOnTiA_NanoSec_T_u32uint32071429
MotCtrlPhaOnTiB_NanoSec_T_u32uint32071429
MotCtrlPhaOnTiC_NanoSec_T_u32uint32071429
Return Value*MotCurrOffsD_Volt_T_f32float3205
*MotCurrOffsE_Volt_T_f32float3205
*MotCurrOffsF_Volt_T_f32float3205

Description

Refer FDD.

Local Function #5 CalMotCurrCorrdABC

Function NameCalMotCurrCorrdABCTypeMinMax
MotCurrOffsA_Volt_T_f32float3205
MotCurrOffsB_Volt_T_f32float3205
MotCurrOffsC_Volt_T_f32float3205
Return ValueMotCtrlMotCurrCorrdAfloat32-200200
MotCtrlMotCurrCorrdBfloat32-200200
MotCtrlMotCurrCorrdCfloat32-200200

Description

Refer FDD.

Note: MotCtrlMotCurrCorrdA, MotCtrlMotCurrCorrdB, MotCtrlMotCurrCorrdC are not updated every runnable loop as Motor Control Manager should retain its last known good value.

Local Function #6 CalMotCurrCorrdDEF

Function NameCalMotCurrCorrdDEFTypeMinMax
MotCurrOffsD_Volt_T_f32float3205
MotCurrOffsE_Volt_T_f32float3205
MotCurrOffsF_Volt_T_f32float3205
Return ValueMotCtrlMotCurrCorrdDfloat32-200200
MotCtrlMotCurrCorrdEfloat32-200200
MotCtrlMotCurrCorrdFfloat32-200200

Description

Note: MotCtrlMotCurrCorrdA, MotCtrlMotCurrCorrdB, MotCtrlMotCurrCorrdC are not updated every runnable loop as Motor Control Manager should retain its last known good value.

GLOBAL Function/Macro Definitions

None

Known Limitations with Design

  1. In the implementation of Simulink block “CurrMeasPer2” the source code has made a decision to implement the protocol checks first then the motor control based timing checks. This leads to a scenario where the counter PhaOnTiErrCnt will only get incremented when the ABC passes the protocol check, whereas the model will increment it regardless of protocol check status. This counter is in effect used for display purposes only. So it’s okay to keep this mismatch.

UNIT TEST CONSIDERATION

  1. In the function CalMotCurrCorrdABC variables MotCtrlPhaOnTiA_NanoSec_T_u32, MotCtrlPhaOnTiB_NanoSec_T_u32 and MotCtrlPhaOnTiC_NanoSec_T_u32 are a percentage of MotCtrlPwmPerd_NanoSec_T_u32, 100% is the maximum. Therefore never use a value for MotCtrlPhaOnTiA_NanoSec_T_u32, MotCtrlPhaOnTiB_NanoSec_T_u32 and MotCtrlPhaOnTiC_NanoSec_T_u32 which is greater than MotCtrlPwmPerd_NanoSec_T_u32.

Abbreviations and Acronyms

Abbreviation or AcronymDescription

Glossary

Note: Terms and definitions from the source “Nexteer Automotive” take precedence over all other definitions of the same term. Terms and definitions from the source “Nexteer Automotive” are formulated from multiple sources, including the following:

  • ISO 9000

  • ISO/IEC 12207

  • ISO/IEC 15504

  • Automotive SPICE® Process Reference Model (PRM)

  • Automotive SPICE® Process Assessment Model (PAM)

  • ISO/IEC 15288

  • ISO 26262

  • IEEE Standards

  • SWEBOK

  • PMBOK

  • Existing Nexteer Automotive documentation

TermDefinitionSource
MDDModule Design Document
DFDData Flow Diagram

References

Ref. #TitleVersion
1AUTOSAR Specification of Memory Mapping (Link:AUTOSAR_SWS_MemoryMapping.pdf)v1.3.0 R4.0 Rev 2
2MDD GuidelineEA4 01.00.00
3Software Naming Conventions.doc1.0
4Software Design and Coding Standards.doc2.0
5Current Meaurement Design ES200A_CurrMeas_DesignSee Synergy subversion
Last modified October 12, 2025: Initial commit (1fadfc4)