Encoder Definition

This MotoHawk™ block configures ControlCore's resources so that it can process a crank encoder and/or a cam encoder in order for it to utilize crank-synchronous blocks and features. Inclusion of this block within a model allows engine speed and crank position determination and is a prerequisite to the use of other crank-synchronous blocks/features such as the Spark Sequence block. Many encoder configurations are supported.

Block ID

motohawk_encoder_def

Library

MotoHawk_lib/Encoders

Description

 

Overview

MotoHawk™ has features specially designed to synchronize to rotating machinery, such as the crankshaft of an internal combustion engine. It does this by monitoring electronic signals from a crank sensor and/or a cam sensor. A crank sensor is mounted near a crank encoder wheel, which has teeth like a gear, but usually has a pattern encoded into the teeth. This pattern allows MotoHawk™ to calculate not only how fast the engine crankshaft is spinning, but to also decipher instantaneous crank angle engine position.

The Encoder Definition block configures ControlCore so that it may perform such engine synchronization tasks for all the Supported Encoders. Other MotoHawk™ blocks in the Encoder Blocks group allow access to engine speed, the current engine position, the encoder synchronization state, notification of an encoder fault and what encoder fault occurred. Other blocks can adjust the top-dead-center (TDC) offset or the phase at runtime. Crank synchronous triggers are also made available via the MotoHawk ™ Trigger block.

Block Parameters provides specific details on the block's mask settings

TPU / eTPU

Some engine controllers utilize microcontrollers like the MPC5xx and MPC55xx that include a time-processing unit (TPU). This processor enhances encoder and other calculation activities. MotoHawk™ makes use of this extensively when it is available to assign edge-detection, timer, and pulse production activities so as to achieve precise timing and allow the control actuators like fuel injectors and spark coils. The MotoHawk™ block set allows access to features in the TPU in an abstract way that is ideal for combustion engine control. Custom TPU code is not supported by MotoHawk™ at this time.

A TPU is essentially an independent microcontroller designed for such tasks as timing control, I/O handling, serial communications, motor control and engine control applications. The TPU has its own core and memory system, and thus can perform complex timing and I/O management independently of the CPU. It typically operates by detecting edges in the crank and cam signals, after any hardware conditioning of the input signals supplied, such as from variable reluctance (VR) devices.

Cam and Crank Sensor Arrangements

Cam and Crank Sensor Configuration

A crank sensor allows the absolute angle position about an engine revolution to be determined. If it is a 4-stroke engine then the crank encoder wheel will spin twice per engine cycle, once through combustion and exhaust strokes (phase 0), and another through the intake and compression strokes (phase 1). The crank sensor alone cannot be used in such a setup to determine the absolute crank angle position within the engine cycle because it can't determine phase. Thus it can't (by itself) determine whether, when it decodes the zero degree before firing TDC position, whether that position is not infact 360 degrees before firing TDC (i.e. in the other half cycle). A 4-stroke is said to have an engine cycle duration of 720 crank angle degrees (720degCA).

In this situation an engine may also be equipped with a cam sensor. When a cam and a crank sensor exist together MotoHawk™ shall utilize the crank sensor for absolute engine position determination and use the cam sensor to provide the half cycle (phase) information. So the crank sensor is able to determine that the position is either zero degrees before firing TDC or 360 degrees before firing TDC and the cam is used to determine which of those two position is correct.

Most commonly such systems report the Encoder State to be ENC_SYNC_CAM_SYNC when encoder synchronization has occurred. It implies that the crank encoder has synchronized (and thus crank angle position can be discerned), and that the cam has synchronized so half cycle information can be determined. The cam is potentially in fault if the encoder state were to change back to ENC_SYNC_CAM_UNKNOWN, which implies that the system is no longer able to trust its half cycle determination.

Crank Only Sensor Configuration

A 2-stroke need only support a crank sensor because the engine cycle equates to a single engine revolution. The engine cycle duration for a 2-stroke is only 360 crank angle degrees. However a 4-stroke could also utilize a crank only sensor configuration.

4-strokes that only support a crank encoder either need to use alternative half cycle sensing strategies (like looking for the compression stroke by examining engine speed and/or pressure) or they are designed such that knowing what the absolute position is won't impact upon actuator control. For instance a wasted spark system that fires on every TDC and is only utilized with batch fuelling does not need to resolve crank position beyond knowing position within any engine revolution. That is there is no need to ever resolve what half cycle the system is in.

Most commonly such systems report the Encoder State to be ENC_SYNC_CAM_UNKNOWN when crank encoder synchronization has occurred. It implies that the crank encoder has synchronized (and thus crank angle position can be discerned), and that a cam does not exist.

Cam Only Sensor Configuration

Another 4-stroke crank position encoding scheme is to utilize just a cam encoder. Such encoders implicitly resolve half cycle information because they spin at cam speeds. Crank angle position can be implicitly implied by a cam only setup. Such an encoder passes straight through the ENC_SYNC_CAM_UNKNOWN Encoder State to the ENC_SYNC_CAM_SYNC encoder state.

The engine controller typically treats a cam only sensor arrangement as a crank encoder and thus the engine controller's crank input should be used when connecting such a pattern to the controller.

Multiple Cam Configurations

Multiple cam encoders generally exist when the engine utilizes a variable cam phaser arrangement where multiple cams exist. A V-engine configuration that utilizes variable exhaust and intake cams would support 4 cam sensors. Variable Cam Phaser control is discussed in further detail here. Importantly, from the Encoder Definition block's perspective, only one of these cams shall be utilized to determine half-cycle information for the crank encoder. Specifically only the cam sensor that feeds into the CAM resource is considered. The behavior of a multiple cam system is the same as for a single cam and crank sensor arrangement so far as the operation of the crank-synchronous features offered by MotoHawk™ is concerned. These features do not consider that there is more than one source of half cycle information.

Supported Encoders

MotoHawk™ supports a variety of crank and cam encoder patterns.

Encoder Strokes Cam Uses CamDelay Comment

3x(20 Minus 2)

Hyundai 60

4 6 Plus 1(retard) No 60 equidistant teeth rotating a crankshaft speed arranged as 3 groups of 20 teeth with 2 adjacent teeth missing in each group. Uses cam synchronization.
60 minus 6 4 Camless N/A 60 equidistant teeth with 6 uniquely distributed missing teeth to provide multiple synchronization points.
4 Halfmoon Yes
2 N/A N/A

60 minus 1

4 Camless N/A 60 equidistant teeth with 1 tooth missing. This encoder is of the N teeth with X missing style.
4 Halfmoon No
4 Tooth Cam N/A

60 minus 2

(58X)

4 Camless N/A 60 equidistant teeth with 2 adjacent teeth missing. This encoder is of the N teeth with X missing style.
4 Halfmoon No
4 Tooth Cam N/A
4 Variable Halfmoon No
4 Variable X-Tooth PWM No
4 Duramax Cam No
4 X Plus 1 CAM No 60 equidistant teeth with 2 adjacent teeth missing. CAM has X equally spaced teeth with an additional tooth between one pair.

60 minus 4

4 Camless N/A 60 equidistant teeth with 4 adjacent teeth missing. This encoder is of the N teeth with X missing style.
4 Tooth Cam No
4 X Plus 1 CAM No 60 equidistant teeth with 4 adjacent teeth missing. CAM has X equally spaced teeth with an additional tooth between one pair.
48 minus 2 4 Camless N/A 48 equidistant teeth with two adjacent missing teeth rotating at crank shaft speed. This encoder is of the N teeth with X missing style.
4 Tooth Cam No
4 Halfmoon No
2 N/A N/A
36 minus 1 4 Camless N/A 36 equidistant teeth with a single missing tooth rotating at crank shaft speed. This encoder is of the N teeth with X missing style.
4 Halfmoon No
4 Tooth Cam No
4 Coyote Cam No
4 36P1 No
4 Cam Speed N/A 36 equidistant teeth rotating at cam speed. 18 teeth are observed per engine revolution.
36 minus 2 4 Camless N/A 36 equidistant teeth with adjacent missing teeth rotating at crank shaft speed. This encoder is of the N teeth with X missing style.
2 N/A N/A
4 Halfmoon No
4 Tooth Cam No
4 3 Teeth No 36 equidistant teeth with adjacent missing teeth rotating at crank shaft speed, CAM has 3 equidistant teeth rotating at cam speed.
4 4 minus 1 No 36 equidistant teeth with adjacent missing teeth rotating at crank shaft speed, CAM has 4 equidistant teeth with 1 missing rotating at cam speed.
4 X Plus 1 CAM No 36 equidistant teeth with adjacent missing teeth rotating at crank shaft speed, CAM has X equally spaced teeth with an additional tooth between one pair.
4 Variable Halfmoon No 36 equidistant teeth with adjacent missing teeth rotating at crank shaft speed, CAM is a single tooth that describes 360degCA that can move relative to the crank.
4 Variable X-Tooth PWM No 36 equidistant teeth with adjacent missing teeth rotating at crank shaft speed, CAM has X equally spaced teeth with half of those teeth "wide" and the remaining teeth "narrow".
34 minus 2 4 Camless N/A 34 equidistant teeth with two adjacent missing tooth. This encoder is of the N teeth with X missing style.
4 Halfmoon No
2 N/A N/A
32 minus 2 4 Camless N/A 32 equidistant teeth with two adjacent missing tooth. This encoder is of the N teeth with X missing style.
4 Halfmoon No
4 Variable Halfmoon No
4 Variable PWM No
2 N/A N/A
24 minus 2 4 Camless N/A 24 equidistant teeth with a two adjacent missing tooth. This encoder is of the N teeth with X missing style.
4 Halfmoon No
2 N/A N/A
24 minus 1 4 Camless N/A 24 equidistant teeth with a single missing tooth. This encoder is of the N teeth with X missing style.
4 Halfmoon No
4 Tooth Cam No
2 N/A N/A
12 minus 1 4 Camless N/A 12 equidistant teeth with a single missing tooth. This encoder is of the N teeth with X missing style.
4 Halfmoon No
4 Tooth Cam No
30 Minus 5 4 Camless N/A 30 equidistant teeth with 5 uniquely distributed missing teeth to provide multiple synchronization points.
36X 4 Tooth Cam No 36 equidistant teeth rotating a crankshaft speed with cam synchronization.
12X 4 Halfmoon treated as a Tooth Cam No 12 teeth per revolution rotating at crank speed and 1 tooth on the cam rotating at cam speed to provide synchronization. Treat 1st observed crank tooth after cam edge as TDC#1.
4 Tooth Cam No
2 Tooth Cam N/A 12 teeth per revolution on the crank and 1 tooth per revolution on the cam to provide synchronization. Both rotating at the same speed. Treat 1st observed crank tooth after cam edge as TDC#1.
6X 2 Halfmoon treated as a Tooth Cam N/A 6 teeth per revolution on the crank and 1 tooth per revolution on the cam to provide synchronization. Both rotating at the same speed. Treat 1st observed crank tooth after cam edge as TDC#1.
2 Tooth Cam No
4X 4 Camless N/A 4 teeth per revolution (8 teeth per cycle), one tooth per engine cylinder. Treats 1st observed tooth as TDC#1.
4 Halfmoon No 4 teeth per revolution. Cam used for synchronization.
4 Tooth Cam No
4 Cam Speed N/A 4 teeth per revolution rotating at cam speed, so 2 teeth per engine revolution. Treats 1st observed tooth after cam edge as TDC#1.
3X 4 Camless N/A 3 teeth per revolution (6 teeth per cycle), one tooth per engine cylinder. Treats 1st observed tooth after cam edge as TDC#1.
4 Halfmoon No 3 teeth per revolution. Cam used for synchronization.
4 Tooth Cam No
4 Hyundai 4X Cam No
2X 4 1X Plus 1 No 2 teeth per revolution rotating at crank speed. Cam used for synchronization. First crank tooth observed after cam synchronization is treated as TDC#1.
8X PWM 4 Camspeed N/A 8 equidistant teeth on a wheel rotating at camspeed. One tooth is greater than 25° wide. The remaining 7 teeth are narrower than 20°.
8 plus 1 4 Cam Speed N/A 8 equidistant teeth rotating at cam speed with an additional tooth located no later than midway between two equidistant teeth for synchronization. 4 teeth are observed per engine revolution.
GM 24Xe 4 Camless N/A 24 teeth of varying pulse widths.
4 Halfmoon Yes

24 shifted 1

(24 with 1 tooth advanced)

4 Camless N/A 24 equidistant teeth (15°) rotating at crankshaft speed, except one tooth is placed 7.5° BEFORE its evenly spaced location in respect to the direction of rotation.

12 shifted 1

(12 with 1 tooth advanced)

4 Cam Speed N/A 12 equidistant teeth (30°) rotating at camshaft speed, except one tooth is placed 15° BEFORE its evenly spaced location in respect to the direction of rotation.

24 retarded 1

(24 with 1 tooth retarded)

4 Cam Speed N/A 24 equidistant teeth (15°) rotating at camshaft speed, except one tooth is placed 7.5° AFTER its evenly spaced location in respect to the direction of rotation.

20 minus 10

(5x[4 minus 2])

4 Halfmoon N/A 20 equidistant teeth rotating a crankshaft speed arranged as 5 groups of 4 teeth with 2 adjacent teeth missing in each group. Uses cam synchronization.
2x(18 minus 2) 4 Kohiki N/A 36 equidistant teeth rotating a crankshaft speed arranged as 2 groups of 18 teeth with 2 adjacent teeth missing in each group. Uses cam synchronization.
3x(12 minus 2) 4 6 Teeth Minus 2 Plus 2 N/A 36 equidistant teeth rotating a crankshaft speed arranged as 3 groups of 12 teeth with 2 adjacent teeth missing in each group. Uses cam synchronization.
36 plus 1 4 Camless N/A 36 equidistant teeth rotating at crank speed with an additional tooth located midway between two equidistant teeth for synchronization. This encoder is of the N teeth plus 1 style.
4 Halfmoon No
4 Tooth Cam No
4 Cam Speed N/A 36 equidistant teeth rotating at cam speed with an additional tooth located midway between two equidistant teeth for synchronization. 18 teeth are observed per engine revolution.
4 X Plus 1 CAM No 36 equidistant teeth additional tooth located midway between two normal teeth. CAM has 12 or less equally spaced teeth with an additional tooth between one pair.
12 plus 1 4 Camless N/A 12 equidistant teeth rotating at crank speed with an additional tooth located midway between two equidistant teeth for synchronization. This encoder is of the N teeth plus 1 style.
4 Halfmoon No
4 Tooth Cam No
4 Cam Speed N/A 12 equidistant teeth rotating at cam speed with an additional tooth located midway between two equidistant teeth for synchronization. 6 teeth are observed per engine revolution.
6 plus 1 4 Camless N/A 6 equidistant teeth rotating at crank speed with an additional tooth located midway between two equidistant teeth for synchronization. This encoder is of the N teeth plus 1 style.
4 Halfmoon No
4 Tooth Cam No
4 Cam Speed N/A 6 equidistant teeth rotating at cam speed with an additional tooth located midway between two equidistant teeth for synchronization. 3 teeth are observed per engine revolution.

Block Parameters

Parameter Field Values Comments/Description
Crank / Cam Type Pull-down menu Select CAM/Crank Type for Encoder, from a long list. Note that this setting will load specific versions of code into the TPU, and therefore, cannot be calibrated.
Signal Interface     Select crank / cam sensor input type, usually one of the two types listed here. The crank sensor is used to determine both the engine RPM and absolute angle within a given cycle. If it is a 4-stroke engine, then the crank encoder wheel will spin twice per total engine cycle, once through combustion and exhaust strokes (phase 0), and another through the intake and compression strokes (phase 1). Because the crank sensor alone cannot be used to determine phase, often an engine is equipped with an additional cam sensor.
VR Crank Variable Reluctance sensor  - passive circuit, and does not require a supply voltage. Picks up the flux as ferromagnetic metal moves by, such as the iron in a gear tooth.
Digital Crank Hall-effect sensor - active circuit, with an amplifier, and it requires a 5V supply voltage and ground, and supplies a 5V digital square wave output.
Crank Sync Polarity * Rising Edge/Falling Edge Select which signal edge to use to detect crank teeth.
Crank Pullup Weak/Strong Select the pull-up resistor type to be used with the input pin; effective only if available with the ECU in use (not all ECUs have selectable resistors).
Cam Sync Polarity * Rising Edge/Falling Edge Select which signal edge to use to detect Cam phase
Cam Pullup Weak/Strong Select the pull-up resistor type to be used with the input pin; effective only if available with the ECU in use (not all ECUs have selectable resistors).
Mechanical to Electrical Angle Offset (degrees before TDC1) Numeric Value The crank sensor may be mounted anywhere on the engine block, but the wheel itself will typically be mounted such that its missing teeth will line up with top dead center (TDC) of cylinder 1, at some relative angle. This angle may be marked on the engine block itself as a small raised line. The angle offset is literally the angle in degrees from the sensor to that line. Sometimes this number is available on mechanical drawings, otherwise, measurement is necessary. The number provided in this block is the default at startup, but it can be adjusted at run-time by using the Encoder TDC Offset block. Often, the Encoder TDC Offset block is used with a Calibration Block as input; the value in this field is just set to a nominal value.
Redundant Mechanical to Electrical Angle Offset (degrees before TDC1) Numeric Value When a redundant capable encoder is selected, this field becomes available. It allows an offset to be applied to the redundant input in the same way as Mechanical to Electrical Angle Offset (above). It can be later adjusted with teh Secondary Encoder TDC Offset block. Often, the Encoder TDC Offset block is used with a Calibration Block as input; the value in this field is just set to a nominal value.
Cam Delay (degrees Crank Angle) Numeric Value Enter value for cam delay in degrees. This parameter is intended for use during calibration. Cam Delay is only applicable to certain encoders per the supported encoders table. The appropriate value is encoder specific.
Crank Teeth from CAM Edge to Crank Tooth 0 (may be -1) Integer Value See here for a definition of this attribute. Not applicable to all encoders. Using the value of -1 to start with is recommended. The value can be refined once everything else is working. A value of -1 allows ControlCore to utilize a suitable value.
Teeth to Ignore Before Attempting Synchronization Numeric Value [0 to 255] Some encoders observe noise that leads to false tooth detection as rotation begins. These false teeth may lead to falsely flagging encoder errors and premature synchronization. This attribute provides a mechanism to allow the false teeth to be ignored. The first X teeth, as defined by this attribute, are not used by the encoder in its efforts to synchronize. The default value of this attribute is zero, which prevents this attribute from affecting sychronization. Not all encoders support this attribute at this time. Those encoders that don't support the attribute will assume a value of zero, regardless of the setting applied.
Time Delay before attempting synchronization (ms) Numeric Value [0 to 65535] Some encoders observe noise that leads to false tooth detection as rotation begins. These false teeth may lead to falsely flagging encoder errors and premature synchronization. This attribute provides a mechanism to allow the false teeth to be ignored. A timer is started when the encoder observes the first tooth. The encoder shall not use any of the teeth observed before this timer expires in its efforts to synchronize. The default value of this attribute is zero, which prevents this attribute from affecting sychronization. The timer will not start until Teeth to Ignore Before Attempting Synchronization have been observed, though the two attributes are not typically utilized together. Note that the timer may, depending upon the capability of the target, only have the granularity of the RTI. Thus the encoder may wait slightly longer than the specified time before synchronization is attempted. The synchronization state shall report zero speed until the timer has expired. Most targets support this attribute, but those that don't assume the value is zero.
TDC Angles (degrees after TDC1) [0 260 180 540] (default) Supply both the number and angle of cylinders in the engine. Note that firing order is not what is required, but actual angles, from 0 to 720. (The convention is to use numbers between 360 and 720 to represent crank angles in phase 1). Firing order would be insufficient unless all of the cylinders were spaced evenly.
Crank Aligned with Cam Check box (enable) Applicable to only certain encoders and then for only certain implementations. Some 3X/4X encoders use this attribute as does the 36P1 cam. Check if the crank and cam align (see link for details).
Use adaptive arming on the VR Crank input where supported Check box (enable) VR signal conditioning circuitry may exist to allow the Crank signal arming thresholds to be adapted via hardware and/or software to optimum levels. Optimal arming may help reject false teeth events from being observed. A fixed arming threshold is utilized when this check box is not checked. The attribute is ignored when the target does not support adaptive arming.
Use adaptive arming on the VR Cam input where supported Check box (enable) VR signal conditioning circuitry may exist to allow the Cam signal arming thresholds to be adapted via hardware and/or software to optimum levels. Optimal arming may help reject false teeth events from being observed. A fixed arming threshold is utilized when this check box is not checked. The attribute is ignored when the target does not support adaptive arming.
Allow cylinder setup to be calibrated Check box (enable) Check to allow calibration of parameters. Useful especially if software is intended to be used on more than one engine setup, and the number, angles, and sensor setups for those engines must be configured via calibration.
Max Number of Cylinders Numeric Value With Calibration enabled, specify the maximum number of cylinders, which helps allocate space in data structures in the programming.
Default Number of Cylinders Numeric Value Specify the default number of cylinders, which assigns an  initial number of cylinders which can be adjusted in calibration.
Read Access Level 0-8 Sets security level 1 lowest, 8 highest, for user access to read value. A setting of zero indicates unsecured access is allowed.
Write Access Level 0-8 Sets security level 1 lowest, 8 highest, for user access to write value. A setting of zero indicates unsecured access is allowed.
Use uploaded calibration values Check box (enable) Use the values as set in the calibration.
Group String    'System | Encoder' (default) Determines Folder name and hierarchy. Use "|" character between folder names to delineate subfolder structure.

* NOTE: Only one edge of the pulses on each signal is detected, either the rising or falling edge. Typically, one of these edges is sharper and cleaner. A slowly-changing edge is subject to more variability. Use of an oscilloscope to determine which edge appears sharper is recommended.