blockEncoderTimeAndCount
Extends from Modelica.Blocks.Interfaces.DiscreteBlock (Base class of discrete control blocks), 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 of2*pi/(4*pRev) - A-track
y[2]=pRevpulses per revolution - B-track
y[3]=pRevpulses per revolution, displaced by2*pi/(4*pRev)
and determines mechanical angular velocity w and mechanical angle phi:
- w = angular velocity
- phi = angle = integral of w
During the samplePeriod all rising and falling edges of A-track and B-track are counted.
The direction of rotation has to be detected by a logic from the values of A-track and B-track.
From the time span between first and last edge within the samplePeriod and the count of edges,
the angular velocity can be calculated: w=(count - 1)*2*pi(4*pRev)/(t_last - t_first).
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).
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| SI.Time | samplePeriod (from DiscreteBlock) | Sample period of component | |
| SI.Time | startTime (from DiscreteBlock) | 0 | First sample time instant |
| Integer | pRev (from EncoderEvaluation) | Pulses per revolution | |
| Modelica.Units.SI.Angle | phi0 (from EncoderEvaluation) | 0 | Initial mechanical angle (zero position) |
Connectors
| Type | Name | Default | Description |
|---|---|---|---|
| Modelica.Blocks.Interfaces.BooleanInput[3] | u (from EncoderEvaluation) | Encoder signals | |
| Modelica.Blocks.Interfaces.RealOutput | w (from EncoderEvaluation) | Mechanical angular velocity | |
| Modelica.Blocks.Interfaces.RealOutput | phi (from EncoderEvaluation) | Mechanical angle |