Documentation search search close
CONTENTS
https://www.speedgoat.com/help/slrt/page/icon_documentation.jpg
v10.0.1.x for R2026a
View other versions

Cam and Crank - Crank Encoder v3

Cam and Crank - Crank Encoder v3 — The Crank Encoder generates a binary crankshaft signal based on the defined number of teeth, the number of missing teeth, the duty cycle and speed.

Library

Simulink® Real-Time™ - Speedgoat

Description

The Crank Encoder module generates a binary crankshaft signal based on the defined number of teeth, the number of missing teeth, the duty cycle and speed. The module integrates the crankshaft speed to obtain the shaft position. The optional position output port allows the shaft position to be used in the user model. The crank tooth pattern is repeated every 360 degrees. The shaft position is wrapped between 0 and 720 degrees to match one cycle of the Cam Encoder module.

Ports

Outputs
Position

The current angle of the crankshaft module. The range is between 0 and 720 degrees.

Inputs
Speed

This optional input port defines the crankshaft speed in rpm. The speed can be negative, which represents reverse rotation.

Duty Cycle

This optional input allows you to alter the duty cycle of the crank teeth during model execution. Values between 0.0 and 1.0 are accepted.

Parameters

Tab: Module Setup
Configurable I/O Module ID

This parameter associates a code module block with a configurable I/O module setup block. Set this value to match the Module ID defined in the setup block of the required configurable I/O module.

Channel Vector

A vector of channels this driver block entity will access. You can specify channels in the range 1-N (N = the number of channels implemented in your specific configuration file defined in the Setup block). The width of this vector also defines the subsequent size of some of the following parameters if scalar expansion applies. With a single block, all the channels of the block are synchronized.

Sample Time

Defines the base sample time at which this driver block gets its sample hit. This parameter can also be set to -1 for inherited sample time. The units are in seconds.

Crank Encoder Tabulator
Initial Angle Vector

This parameter sets the crankshaft angle at model start. The angle is defined in degrees. The crankshaft will start turning from this position. Use this parameter to emulate multiple mechanically coupled crankshafts, which each have different angle offsets. This parameter is only visible if your configuration file features Crank Encoder version 3.8 or later.

Initial Speed (rpm) Vector

This parameter defines the default speed of the crankshaft. The default speed value is used initially at model start until a new speed value is received at the input port of the block.

Number of Crank Teeth Vector

This parameter defines the number of teeth of the crankshaft. Note that the number of teeth also includes any missing teeth.

Number of Missing Crank Teeth Vector

This parameter defines the number of missing teeth of the crankshaft. The missing teeth appear at the end of each turn.

Initial Crank Teeth Duty Cycle Vector

This parameter defines the default duty cycle of the crank teeth. Valid values are between 0.0 and 1.0. The default duty cycle is used initially at model start. The duty cycle can be changed during model execution by using the optional duty cycle input port.

Invert Crankshaft Signal Output

This checkbox defines the polarity of the crank signal.

Input and Output Port Configuration Tabulator
Show Speed Input Port

This checkbox enables the optional speed input port of the driver block.

Show Duty Cycle Input Port

This checkbox enables the optional duty cycle input port of the driver block.

Show Position Output Port

This checkbox enables the optional crankshaft position output port of the driver block.