You are on page 1of 80

Umrechnung Training

Number Handling in ECU


(Umrechnung)

1 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Trainer information
RBEI/EES

 Mahesh Hegde (RBEI/EES2)


 Phone: +91(80)6657-1979
 E-mail: mahesh.hegde@in.bosch.com

 Jagannath N R (RBEI/EES1)
 Phone: +91(80)6657-1342
 E-mail: jagannath.nr@in.bosch.com

2 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Agenda:
• Significance of umrechnung.
• Types of umrechnung.
• How to define new umrechnung?
• How to take care of change in umrechnung in code?
• Umrechnung for parameters for the controllers/library
functions.
• Case study (Temperature and Time umrechnung)

3 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Agenda:
• Significance of umrechnung.
• Types of umrechnung.
• How to define new umrechnung?
• How to take care of change in umrechnung in code?
• Umrechnung for parameters for the controllers/library
functions.
• Case study (Temperature and Time umrechnung)

4 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Task: Voltage to Temperature, how?

Environment Temperature

23.3° C
Driver
Voltage to
Temperature Display
ADC conversion
On Dashboard
Air Temp Sensor
INCA

2V
CPU
23.3° C
ECU
Testing Tool

Diesel Systems
5 Internal | RBIN/ESD | 01.12.2006 | FIT_D_Seminartitel_JJMMTT_E | © Robert Bosch India Ltd reserves all rights even in the event
of industrial property rights. We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Implementation Types

• Integer Arithmetic

• Floating-point Arithmetic

Diesel Systems
6 Internal | RBIN/ESD | 01.12.2006 | FIT_D_Seminartitel_JJMMTT_E | © Robert Bosch India Ltd reserves all rights even in the event
of industrial property rights. We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Structure of floating point number


Single-precision 32-bit

Double-precision 64 bit

Diesel Systems
7 Internal | RBIN/ESD | 01.12.2006 | FIT_D_Seminartitel_JJMMTT_E | © Robert Bosch India Ltd reserves all rights even in the event
of industrial property rights. We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Comparison
Integer Arithmetic Floating-point Arithmetic
Variable data type and size Fixed 4-Byte IEEE Format
Limited range and resolution for Extended range and resolution
representation of Physical Data for representation of Physical
Data
Simpler program/code Complex program/code
implementation implementation
Faster calculation of results Slower calculation of results
Obtaining desired accuracy Accuracy and resolution are
and resolution requires always guaranteed
special techniques
(Conversion formula)

Diesel Systems
8 Internal | RBIN/ESD | 01.12.2006 | FIT_D_Seminartitel_JJMMTT_E | © Robert Bosch India Ltd reserves all rights even in the event
of industrial property rights. We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Usage of Float: The Pros and The Cons


• Advantage

• Accuracy

• Disadvantage

• Unnecessary precision most of the time(74.3286412)


86412

• Resource Consumption almost doubles

• Internal conversions – Float <-> Binary

• Limited Floating point registers in FPU of Core


Diesel Systems
9 Internal | RBIN/ESD | 01.12.2006 | FIT_D_Seminartitel_JJMMTT_E | © Robert Bosch India Ltd reserves all rights even in the event
of industrial property rights. We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Integer Arithmetic – Data Types and Sizes

int 8, unsigned int 8 (1-byte)


int 16, unsigned int 16 (2-bytes)
int 32, unsigned int 32 (4-bytes)

Diesel Systems
10 Internal | RBIN/ESD | 01.12.2006 | FIT_D_Seminartitel_JJMMTT_E | © Robert Bosch India Ltd reserves all rights even in the event
of industrial property rights. We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Integer Arithmetic – Considerations

• Range and Resolution of representation for Physical Values

• Range – Max, Min, Offset

• Resolution – Linear, Non-linear

• Arithmetic Calculation Exceptions

Diesel Systems
11 Internal | RBIN/ESD | 01.12.2006 | FIT_D_Seminartitel_JJMMTT_E | © Robert Bosch India Ltd reserves all rights even in the event
of industrial property rights. We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Integer Arithmetic – Range & Resolution

• Consider a Physical Value ranging from 0 – 20

• How can it be represented with Integers?


• Option 1 : with a resolution of 1.0
• Option 2 : with a resolution of 0.1
• Option 3 : with a variable resolution
• Option 4 : with an offset & constant resolution

Diesel Systems
12 Internal | RBIN/ESD | 01.12.2006 | FIT_D_Seminartitel_JJMMTT_E | © Robert Bosch India Ltd reserves all rights even in the event
of industrial property rights. We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Integer Arithmetic – Range & Resolution

Option 1: with resolution 1.0


Diesel Systems
13 Internal | RBIN/ESD | 01.12.2006 | FIT_D_Seminartitel_JJMMTT_E | © Robert Bosch India Ltd reserves all rights even in the event
of industrial property rights. We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Integer Arithmetic – Range & Resolution

Option 2: with resolution 0.1


Diesel Systems
14 Internal | RBIN/ESD | 01.12.2006 | FIT_D_Seminartitel_JJMMTT_E | © Robert Bosch India Ltd reserves all rights even in the event
of industrial property rights. We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Integer Arithmetic – Range & Resolution

Option 3: with variable resolution


0.1+0.01* phy
Diesel Systems
15 Internal | RBIN/ESD | 01.12.2006 | FIT_D_Seminartitel_JJMMTT_E | © Robert Bosch India Ltd reserves all rights even in the event
of industrial property rights. We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Integer Arithmetic – Range & Resolution

Option 4: with offset 5 and 0.1


resolution
16 Internal | RBIN/ESD | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Integer Arithmetic – Range & Resolution


• Formulae used in above examples…

• Options 1 & 2: INT = (PHY / RES)

• Option 3: INT = ( PHY / (a + b * PHY) ) --> Here RES


varies

• Option 4: INT = ( (OFF + PHY) / RES )


• General Formulae we use…

Where a0,a1,b0 and b1 are constants

Diesel Systems
17 Internal | RBIN/ESD | 01.12.2006 | FIT_D_Seminartitel_JJMMTT_E | © Robert Bosch India Ltd reserves all rights even in the event
of industrial property rights. We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Integer Arithmetic – Calculation Exceptions


• Addition Overflows

• Subtraction Underflows

• Multiplication Overflows

• Division by Zero

Diesel Systems
18 Internal | RBIN/ESD | 01.12.2006 | FIT_D_Seminartitel_JJMMTT_E | © Robert Bosch India Ltd reserves all rights even in the event
of industrial property rights. We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Data Types in EDC/ME Systems


• sint8, uint8 (1-byte)

• sint16, uint16 (2-bytes)

• sint32, uint32 (4-bytes)

Where are these types defined in EDC17? Why?


medc17\core\_inc\std_type.h
Example:
typedef unsigned char uint8;
typedef signed short sint16;
typedef signed long sint32;

Diesel Systems
19 Internal | RBIN/ESD | 01.12.2006 | FIT_D_Seminartitel_JJMMTT_E | © Robert Bosch India Ltd reserves all rights even in the event
of industrial property rights. We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Example of Integer Arithmetic


implementation
Integer Arithmetic
P_In Facto
r
Exampl 5.123 * 0.02
e Conversion to Integer Form

5123 2

Multiplication

10246
Extra Calculation to be done in
P_In x P_Out /100
the code
102
Facto
r

0.102 Conversion - Back to Float

Diesel Systems
20 Internal | RBIN/ESD | 01.12.2006 | FIT_D_Seminartitel_JJMMTT_E | © Robert Bosch India Ltd reserves all rights even in the event
of industrial property rights. We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Example of Integer Arithmetic


implementation
Code for the example looks like

P_Out = SrvB_MulDiv16(P_In, factor, FACT_RES_REV);

Where
FACT_RES_REV = 1/(FACT_RES)
And FACT_RES = 0.01

Diesel Systems
21 Internal | RBIN/ESD | 01.12.2006 | FIT_D_Seminartitel_JJMMTT_E | © Robert Bosch India Ltd reserves all rights even in the event
of industrial property rights. We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Computation Method (Umrechnung)?

AirSys_pIntak AirSys_pInta
e ke

UmRechnung:
A computation formula tag associated with
every variable that defines a method such that
the
values that hold a physical significance are
actually transformed to integer-format for use
by the ECU

22 Internal | EDP3_SpdGov_CSC | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property
rights. We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Computation Method
User
(Umrechnung)
How does it Work? Compu methods INCA
info

Compu
methods
a2l
pavast files DAMOS Phy. Value
and Build (Float)
hex
c and h files
INTEGERS

Offline

23 Internal | EDP3_SpdGov_CSC | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property
rights. We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Agenda:
• Significance of umrechnung.
• Types of umrechnung.
• How to define new umrechnung?
• How to take care of change in umrechnung in code?
• Umrechnung for parameters for the controllers/library
functions.
• Case study (Temperature and Time umrechnung)

24 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Umrechnung Type Umrechnung

Verbal Rational
(Ex:- HeSrv_swtPopVis)

Integer Float
(resolution) (int = phy)
10^-38 - 10^+38

Physical Quantity Non Physical Quantity


(With unit – Pres_hPa, EngN) (Without unit – OneToOne, Fact )

RAT_FUNC - Rational Function


TAB_VERB - Verbal Table

25 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Integer Umrechnung
Internal values for calculations are in integer and resulting output is
converted to physical value for display to external world.

Quantization step is termed as resolution.

Physical/Non Physical Quantity –>


1) Check the physical range and desired resolution
2) Derive data type to ensure there would not be any over/underflow
3) Define Umrechnung, Resolution (System Constant) with required Unit

Ex –
Int = Phy / Resolution (Resolution is a fraction in most of the cases)
| | |
| | ------------------ Constant value with unit
| ----------------------------- Physical value with unit
------------------------------------- Internal Value

26 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training
Float Umrechnung
Should be used only in very complex calculations where more accuracy is
required.

Internal and physical values are in float and does not need any
conversion formula, always internal = physical.

Physical/Non Physical Quantity –>


Ex :
Int = Phy
| |
| ----------------------------- Physical value with Unit
------------------------------------- Internal Value

We need to have one umrechnung for each unit.


Ex: One Umrechnung for mg/s unit and one for Kg/s.

27 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Verbal Umrechnung
It is like enumeration data type and always used for non-physical quantity

Internal values are matched to pre defined words (physical value).

Non Physical Quantity –>


Ex –
0 = Bank 1
1 = Bank 2
| |
| ----------------------------- Physical value without Unit
------------------------------------- Internal Value without Unit

28 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Agenda:
• Significance of umrechnung.
• Types of umrechnung.
• How to define new umrechnung?
• How to take care of change in umrechnung in code?
• Umrechnung for parameters for the controllers/library
functions.
• Case study (Temperature and Time umrechnung)

29 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Naming Convention for Umrechnung

<DdDd>[_Un][_DT][_Qu]_COMPU[_VERB]

DdDd: designator of the computation method


Un : physical unit e.g. Trq (torque), optional.
DT : data type , only if it is necessary.
Qu : quantization, optional. e.g. q0p5 for 0.5 quantization
Qu-Structure : q<number>p<number>; q for quantization and p for point
COMPU : Identification for Computation Methods
VERB : optional, only for verbal conversion tables. It is used to convert an
internal value to physical text.

Applications hint:
• The extensions Un, DT, Qu are optional and written in small letters.

http://www2.intranet.bosch.com/ds/esq/100_topics/202_ProcessPortal/300_Engineering/311_ComponentDesign/001_Guidelines/P
MT_SE_NamingConventions.pdf

30 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Naming Convention for System constants

Fixed system constants:


Constants that never have to be mapped to a specific project.

Stable system constants:


Could be adapted on customer requirements.

<CC>_]<DDDD>[_<DDDD>]
CC: component name. Name of the component is not optional for local system consta
DDDD: description, e.g. of a feature<capital letter>[<capital letter>|<number>
Only capital letters and numbers are used.

For more information see Chapter 8.6 of


http://www2.intranet.bosch.com/ds/esq/100_topics/202_ProcessPortal/300_Engineering/311_ComponentDesign/001_Guidelines/P
MT_SE_NamingConventions.pdf

31 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Naming Convention for System constants

djustable System Constants:


sed for conditional compilation or Variant type C.

<CC>_]<DDDD>[_<DDDD>]_SC
C: Name of the component is optional.
DDD: description, e.g. of a feature<capital letter>[<capital letter>|<number>]
nly capital letters and numbers are used.

For more information See Chapter 8.6 of


http://www2.intranet.bosch.com/ds/esq/100_topics/202_ProcessPortal/300_Engineering/311_ComponentDesign/001_Guidelines/P
MT_SE_NamingConventions.pdf

32 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Example 1: Physical Quantity

Resolution
Unit

33 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

34 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Example 2: Verbal

35 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Example 3: Float Umrechnung

36 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Example 4: Physical Quantity with offset


Temp_Cels:
Int= (Phy – TEMP_NULL_C)/TEMP_RES ; Where TEMP_NULL_C =
-273.14

37 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Example 5: Physical Quantity with resolution greater than 1(20


Km)

38 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Example: tiTime(h, Time_Hr) =lSum(Km, LengthKm) / vAvrg(Km/h,


Vel_Km_p_h);
In Code:
tiTime = SrvB_MulDiv16(lSum,(LENGTH_KM_RES*TIMEHR_RES_REV
*VELKMPH_RES_REV),vAvrg);

39 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Example 6: Physical Quantity – Inverse umrechnung

Int = 1/(CONST * phy)

40 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Agenda:
• Significance of umrechnung.
• Types of umrechnung.
• How to define new umrechnung?
• How to take care of change in umrechnung in
code?
• Umrechnung for parameters for the controllers/library
functions.
• Case study (Temperature and Time umrechnung)

41 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Handling Calculation Exceptions


Use library functions to avoid following exceptions:
Addition Overflows
Subtraction Underflows
Multiplication Overflows
Division by Zero

Note: In some cases Division by ZERO should be avoided by passing


MAX(0x1,Var) as below. In this example OxiCat_mHCAvrg value will be wrong
when OxiCat_tiRgnActv is 0
otherwise.

Diesel Systems
42 Internal | RBIN/ESD | 01.12.2006 | FIT_D_Seminartitel_JJMMTT_E | © Robert Bosch India Ltd reserves all rights even in the event
of industrial property rights. We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Addition/Subtraction:

A = B +/- C ;
Here all the three variables should be having same umrechnung
and hence the same unit.
Exception is Temp_Cels umrechnung.

Comparison:

stA = ( bool ) ( A Compared with B ) ;


Here A and B variables has to be of same umrechnung and unit.

43 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Multiplication:

Case 1: Umrechnung of output variable is same as umrechnung of


one input
A(Pres_hPa) = B(Pres_hPa) * C(Fact4) ;
Example:
/* Pressure difference across PFlt due to empty filter and ash */
pDiffAshVolCor_s16 = SrvB_MulDiv16( pDiffPFlt_s16,
facAshVolCor_s16,
FACT4_RES_REV );

44 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Multiplication:

Case 2: Umrechnung of output variable is not same as any input


variable
A(dmNOx_mg_p_s) = B(NoxMassPerTime) * C(Fact) ;
Example:
/* Change the resolution of ASMod_dmNOxEG from
NOxMassPerTime to dmNOx_mg_p_s */
dmNO2Tot = SrvB_Mul16(SrvB_MulShRight32(dmNOxEG,
facCnvCatNO2 , FACT_NRM_EXP), SYS_CONST);
Where SYS_CONST = DM_NOX_RES_REV/ NOXMPT_RES_REV

45 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Division:

Case 1: Umrechnung of numerator and denominator are same


A(RatSoot) = B(mSoot_g) / C(mSoot_g) ;

Example:
rSotMsDvt = SrvB_MulDiv16( mSotDvt , RATSOOT_RES_REV ,
mSotSimMon );

46 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Division:
Case 2: Umrechnung of numerator and denominator are different
A(Res_hPaHrPerCM) = B(Pres_hPa) / C(AirVolPerTime) ;
Example:
/* consider int. conversions for p, dv,R*/ /* R = p_diff / dv */
resFlwRaw = SrvB_MulDiv16(pDiffSot, ADPT_RES_CONV,
dvolPFltEG) ;
Where ADPT_RES_CONV
= (ST_RES_REV * DVOL_RES_INV)/PRES_HPA_RES_INV

47 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Some more points on coding

• Whenever Mul and Div are involved use SrvB_MulDiv16 or SrvB_MulDiv32.


Ex:
resFlwRaw = SrvB_MulDiv16(pDiffSot, ADPT_RES_CONV, dvolPFltEG) ;
Do not code as
resFlwRaw = SrvB_Div16(SrvB_Mul16(pDiffSot, ADPT_RES_CONV),
dvolPFltEG) ;

• Whenever division is by value which is power of 2 use SrvB_MulShRight32


or SrvB_MulShRight16.
Ex: resFlwRaw = SrvB_MulDiv16(pDiffSot, facTPFltDs, FACT_RES_REV) ;
Code it as
resFlwRaw = SrvB_MulShRight16(pDiffSot, facTPFltDs, FACT_NRM_EXP);

• Whenever more than one system constants are involved in a calculation,


derive a new system constant from them and use it.

48 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training
Points we should be aware of during coding of Pavast and
Pacoin files

While adding/changing a message

Data Type

Umrechnung

49 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training
Points we should be aware of during coding of Pavast and
Pacoin files

While adding/changing a measuring point

Data Type

Umrechnung

50 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training
Points we should be aware of during coding of Pavast and
Pacoin files
While adding/changing a calibration parameter

Data Type

Umrechnung

Same umrechnung as _C

Unit

51 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

More on System constants


• Check the physical value of system constant in a2l file
M:\<view_name>\medc17\bin\*.a2l

• Check internal value of system constant in M:\<view_name


>\medc17\tmp\src\data\_merged_dat.c
OR
M:\<view_name>\medc17\tmp\include\data\<module_name>_dat.h

• Make sure that when you divide or multiply two system constants
value is always complete integer.
Ex: SYSCONST_A(0.05), SYSCONST_B(0.1).
SYSCONST_C = SYSCONST_A/SYSCONST_B =0.5
Can not be used in c or h file.

SYSCONST_C = SYSCONST_B/SYSCONST_A = 2
This can be used directly in c or h file.

52 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Conversion from one umrechnung to other:

A(g/s, AirMsPrTime_q0p01_COMPU) Best Solution


=B(Kg/h,InjMsPrTime_q0p001_COMPU);
Step 1: Kg/h-> g/s
A = SrvB_MulDiv16(B, 1000,3600);
Step 2: Resolution conversion
A = SrvB_MulDiv16(A, AIRMSPRTIME_Q0P01_RES_REV,
INJMSPRTIME_Q0P001_RES_REV);
OR
A = SrvB_Div16(B,NRM_CONST); Where
NRM_CONST =(3600/1000) *(INJMSPRTIME_Q0P001_RES_REV/
AIRMSPRTIME_Q0P01_RES_REV)

53 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Float ----Integer conversion

Message in Float has to be converted to integer in module where Integer


calculation is used.

Float message

Ex:
/* r32 to integer conversion */
dmSOxUnldLamCor =
(sint32) ((real32)NSCLd_dmSOxUnldLamCor)/(real32)(DM_SOX2_RES_FL));

54 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Integer ----Float conversion

Message in Integer format has to be converted to float in module where Float


calculation is used.

Integer Variable

Ex:
facTempNSCAge = SrvX_IpoCurveS16( tCatAge, NSCLd_facTempNSCAge_CUR );
/* ############### Integration of the factor Thermal Degradation of NSC ####### */
facNSCAge_r32 = (real32) ( facNSCAge_r32) +
( ((real32)facTempNSCAge / (real32)FACT_NSC_RES_REV)
* ((real32)DT/(real32)NORM_SEC_US) ));

55 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

32 bit Integrator Implementation:

InjMsPrTime_q0p001_COMPU AirMs_q0p1_COMPU
sint16 sint16

56 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

32 bit Integrator Implementation:

Initialization

Integration

Output Calc

DT – raster time in µs

57 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

32 bit Integrator Implementation:

DT – raster time in µs
For 100 ms task DT = 100,000

OXICAT_HCMASSINTEG_NRM =
(KGH_TO_KGS * NORM_SEC_US *
INJMSPRTIMEQ0P001_RES_REV)/
(MASS_CONV_KG2G * AIRMSQ0P1_RES_REV)

KGH_TO_KGS = 3600
NORM_SEC_US = 1,000,000 µs
MASS_CONV_KG2G = 1000

58 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Agenda:
• Significance of umrechnung.
• Types of umrechnung.
• How to define new umrechnung?
• How to take care of change in umrechnung in code?
• Umrechnung for parameters for the
controllers/library functions.
• Case study (Temperature and Time umrechnung)

59 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Controllers Functions

60 Internal | Department | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights. We reserve all
rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Umrechnung for Controllers – Gain Parameter

Case -1 :- Both input and Output are having same


umrechnung

• By default the standard umrechnung definitions are available


for the gain parameters of the various controllers if the
resolution (umrechnung) of the input and output of the
controller are same.

Case -2 :- Both input and Output are having


different umrechnung

• Resolution cancellation due to different Input and Output


physical quantities (umrechnung) can be done by defining the
new umrechnung for the gain parameters.
This has to be done even though resolutions are same.

61 Internal | Department | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights. We reserve all
rights of disposal such as copying and passing on to third parties.
Umrechnung Training

P Controller – Gain Parameter


1) When Input and output with same physical unit and resolution
Use Kp

2) When Input and output with different physical unit and resolutions.
Ex. Input = Pressure  Pres_hPa , Output = %  Prc
Resolution cancellation for Input and Output can be done by defining the new
umrechnung for the gain parameters.

Define a new DAMOS umrechnung: Kp_Pres_hPa2Prc


Int = (PRES_HPA_RES/ PRC_RES) * KP_RES_REV*Phys

Physical unit : %/hPa

62 Internal | Department | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights. We reserve all
rights of disposal such as copying and passing on to third parties.
Umrechnung Training

I Controller – Gain Parameter


1) When Input and output with same physical unit and resolution
Use Ki

2) When Input and output with different physical unit and resolutions.
Ex. Input = Pressure  Pres_hPa , Output = %  Prc
Resolution cancellation for Input and Output can be done by defining the new
umrechnung for the gain parameters.

Define a new DAMOS umrechnung: Ki_Pres_hPa2Prc


Int = (PRES_HPA_RES/ PRC_RES) * KI_RES_REV*Phys

Physical unit : %/hPa.s

63 Internal | Department | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights. We reserve all
rights of disposal such as copying and passing on to third parties.
Umrechnung Training

DT1 Controller – Gain Parameter


1) When Input and output with same physical unit and resolution
Use Kd

2) When Input and output with different physical unit and resolutions.
Ex. Input = Pressure  Pres_hPa , Output = %  Prc
Resolution cancellation for Input and Output can be done by defining the new
umrechnung for the gain parameters.

Define a new DAMOS umrechnung: Kd_Pres_hPa2Prc


Int = (PRES_HPA_RES/ PRC_RES) * KD_RES_REV*Phys

Physical unit : %/hPa.s

64 Internal | Department | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights. We reserve all
rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Umrechnung for Filters – Time Parameter

• By default the standard umrechnung definitions are available


for the time parameter for PT1, DT1.

TimeDelay_s
TimeDelay_ms

• Both fo these umrechungs are defined as inverse


umrechung.

65 Internal | Department | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights. We reserve all
rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Output of MAP/CUR used as time parameter for controller library


function:
Never use inverse umrechnung for the CUR/MAP.
Why?

X - Input 0 100
Y Physical 0.1 s 100 s
Y Internal 1000 1 Conversion: Int = 100/phy

Expected Result:
If input X is 50 -> expected output is around 50.05 s

Actual result with inverse umrechnung:


After interpolation internal value: 500
physical value: 0.2 s

66 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Output of MAP/CUR used as time parameter for controller library


function:
Never use inverse umrechnung for the CUR/MAP.

TimeDelay_s_Lin_16

Step 1: Interpolation of CUR with linear Umrechnung


TimeDelay_s_Lin_16
tiLamSensPT1 = SrvX_IpoCurveS16 (ASMod_dmExhMnfDs, ASMod_tiLamSensPT1_CUR
Step 2: Then convert variable withTimeDelay_s_Lin_16 to TimeDelay_
tiLamSensPT1_T1Rec = (uint)(CONV_T1_16_TO_1_T1_32 / tiLamSensPT1) ;
rLamRecEGSensSim =
SrvX_PT1S16(rLamRec,&PT1StateLamRec,tiLamSensPT1_T1Rec,DT);
67 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Umrechnung for debouncing – Time Parameter

• By default the standard umrechnung definitions are available


for the time parameter of debounce function.

Time_s
Time_ms
TimeDeb

68 Internal | Department | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights. We reserve all
rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Umrechnung for On/Off delay – Time Parameter

• By default the standard umrechnung definitions are available


for the TurnOn/Off delay parameter .

Time_Dt

69 Internal | Department | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights. We reserve all
rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Ramp Function – Slope Parameter

Input and output should be of same physical unit and


resolution.

Umrechnung for the slope parameters should be defined as


below:
Ex: Input and output are having Temp_Cels umrechung.
RmpTemp:
Int = (1/ TEMP_RES)/RMP_RES) *Phys

Physical unit : deg K/s

70 Internal | Department | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights. We reserve all
rights of disposal such as copying and passing on to third parties.
Umrechnung Training

SW Timer – DifferenceSWTimer

Library function SrvB_DiffSWTmrS16/


SrvB_DiffSWTmrS32 returns time difference with 0.01 s
resolution.

Example:
Timer_Diff_mp = SrvB_DiffSWTmrS16(&TimerVar16)

Timer_Diff_mp should be having Time_s or Time_ms


umrechung.

71 Internal | Department | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights. We reserve all
rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Agenda:
• Significance of umrechnung.
• Types of umrechnung.
• How to define new umrechnung?
• How to take care of change in umrechnung in code?
• Umrechnung for parameters for the controllers/library
functions.
• Case study (Temperature and Time umrechnung)

72 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training
Temperature Umrechung
Internal calculations should be in Kelvin, Only to display in INCA deg
C is used.

Frequently used Temp Umrechnungs :-

Temp_Cels –> Used only to display deg C physical value


int = (phy – TEMP_NULL_C) / TEMP_RES
TEMP_NULL_C = -273.14 , TEMP_RES = 0.1
Ex- Phy = 100 deg C, Int = 3731

Note :-
1> If the internal calculations to be carried out in Kelvin, offset compensati
is not required, phy value gets displayed in INCA in deg C
2> If the internal calculations to be carried out in deg Cels, offset
compensation is required – clarify at the beginning of the task.

73 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Temp_Kelv –> Used to display temperature in Deg K


int = phy / TEMP_RES
Ex- Phy = 100 Deg C, Int = 3731, Phy = 373.1 Deg K

TempDiff_Kelv –> Used where difference of two temperatures is taken ( in


terms of deviation ), display in Deg K

int = phy / TEMP_RES

T_Dvt = T_ActVal – T_DesVal

1> Input Temperatures T_ActVal, T_DesVal in Temp_Cels / Temp_Kelv


2> Output temperature T_Dvt is in TempDiff_Kelv
3> No offset compensation is needed
4> Output temperature T_Dvt displays in Deg K in INCA

74 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Addition of two temperature variables in Temp_Cels:


In Kelvin.
tSum_degC = SrvB_Add32(tTemp1_degC,tTemp2_degC) ;
In Celsius.
tSum_degC = SrvB_Sub32(SrvB_Add32(tTemp1_degC,tTemp2_degC),
TEMP_CELS_ZERO) ;
TEMP_CELS_ZERO = 0.0 deg C with Temp_Cels umrechnung.

Subtraction of two temperature variables in Temp_Cels/Temp_Kelv:


tSum_degK(Temp_DiffKelv) = SrvB_Sub16(tTemp1_deg,tTemp2_deg) ;

Always use TempDiff_Kelv umrechnung when you subtract two


temperature variables having Temp_Cels or Temp_Kelv
umrechnung.

75 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Multiplication of temperature variable using Temp_Cels:

Operation:
tAftMul(Temp_Cels) = tB4Mul(Temp_Cels) * PFlt_facBlwBy_C(Fact);

In Kelvin.
tAftMul = SrvB_MulShRight16(tB4Mul, PFlt_facBlwBy_C, FACT_NRM_EXP);

In Celsius.
tAftMul = SrvB_MulShRight16(SrvB_Sub16(tB4Mul, TEMP_CELS_ZERO),
PFlt_facBlwBy_C, FACT_NRM_EXP);
tAftMul = SrvB_Add16(tB4Mul, TEMP_CELS_ZERO);

TEMP_CELS_ZERO = 0.0 deg C with Temp_Cels umrechnung.

76 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Division of temperature variable using Temp_Cels:

Operation:
rTemp(Fact) = tNum(Temp_Cels) / tDen(Temp_Cels);

In Kelvin.
rTemp = SrvB_MulDiv16(tNum,FACT_RES_REV,tDen);

In Celsius.
rTemp = SrvB_MulDiv16(SrvB_Sub16(tNum, TEMP_CELS_ZERO),
FACT_RES_REV, SrvB_Sub16(tDen, TEMP_CELS_ZERO));

TEMP_CELS_ZERO = 0.0 deg C with Temp_Cels umrechnung.

77 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Time Umrechung:
Frequently used Time Umrechnungs :-

Time_s –> Used to display physical value in s and used for output of the
SW timer.
Resolution is 0.01 s. Ex- Phy = 10 s, Int = 1000

Time_ms –> Used to display physical value in ms.


Resolution is 10 ms. Ex- Phy = 10 ms, Int = 1

TimeDeb –> Used for time parameters for SrvX_Debounce function.


Resolution is 10 ms. Ex- Phy = 100 ms, Int = 10

TimeDelay_s –> Used for reciprocal time used in Controller library


functions.
int = 1 /((1e6 / (2**16 * 2**16)) * phy)
Int = 4294.967296/Phy. Ex- Phy = 10 s, Int = 429

Time_Dt –> Used for delay time parameters.


Resolution is 1 micro s. Ex- Phy = 10 s, Int = 10000000
78 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Summary:
• Basics of umrechnung.
• Types of umrechnung.
• Defining new umrechnung.
• Taking care of change in umrechnung in code.
• Umrechnung for parameters for the controllers/library
functions.
• Temperature and few time related umrechnung

79 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights.
We reserve all rights of disposal such as copying and passing on to third parties.
Umrechnung Training

Questions ?

Thank You

80 Internal | RBIN/EDP3 | 29/05/2006 | © Robert Bosch India Ltd reserves all rights even in the event of industrial property rights. We reserve all
rights of disposal such as copying and passing on to third parties.

You might also like