blockEncoderTimeSpan

Time span between edges of incremental encoder signals

Extends from Modelica.Blocks.Icons.DiscreteBlock (Graphical layout of discrete block component icon), BLDC.Interfaces.EncoderEvaluation (Partial evaluation of an incremental encoder).

Information

Evaluates the input signals from an IncrementalEncoder:

  • 0-track y[1] = 1 pulse per revolution with a length of 2*pi/(4*pRev)
  • A-track y[2] = pRev pulses per revolution
  • B-track y[3] = pRev pulses per revolution, displaced by 2*pi/(4*pRev)

and determines mechanical angular velocity w and mechanical angle phi:

  • w = angular velocity
  • phi = angle = integral of w

The time span from one edge of the input signals to the next is measured, thus calculating the speed of rotation: 2*pi/(4*pRev)/(time - t0). Taking both rising and falling edges of A-track and B-track into account, 4*pRev edges per revolution are observed. Note that the output is discrete w.r.t. to time, it is not differentiable. The algorithm depends on interrupts (which appear in Modelica as when-clauses). The direction of rotation has to be detected by a logic from the values of A-track and B-track. Note that this algorithm depends on the accuracy of the representation of time, but usually gives better results than counting edges during a time gate.

Parameters

TypeNameDefaultDescription
IntegerpRev (from EncoderEvaluation)Pulses per revolution
Modelica.Units.SI.Anglephi0 (from EncoderEvaluation)0Initial mechanical angle (zero position)

Connectors

TypeNameDefaultDescription
Modelica.Blocks.Interfaces.BooleanInput[3]u (from EncoderEvaluation)Encoder signals
Modelica.Blocks.Interfaces.RealOutputw (from EncoderEvaluation)Mechanical angular velocity
Modelica.Blocks.Interfaces.RealOutputphi (from EncoderEvaluation)Mechanical angle