WOLFRAM SYSTEM MODELER

SinCosEncoder

Evaluation of a sinusoidal encoder

Diagram

Wolfram Language

In[1]:=
SystemModel["Modelica.Blocks.Examples.SinCosEncoder"]
Out[1]:=

Information

This information is part of the Modelica Standard Library maintained by the Modelica Association.

This examples demonstrates robust evaluation of a sin-cos-encoder.

The sin-cos-encoder provides four tracks:

  • cosine
  • minus sine
  • sine
  • minus cosine

All four tracks have the same amplitude and the same offset > amplitude. Offset is used to detect loss of a track. To remove offset, (minus sine) is subtracted from (sine) and (minus cosine) from (cosine), resulting in a cosine and a sine signal with doubled amplitude but without offset.

Interpreting cosine and sine as real and imaginary part of a phasor, one could calculate the angle of the phasor (i.e. transform rectangular coordinates to polar coordinates). This is not very robust if the signals are superimposed with some noise. Therefore the phasor is rotated by an angle that is obtained by a controller. The controller aims at imaginary part equal to zero. The resulting angle is continuous, i.e. differentiating the angle results in 2*π*frequency. If desired, the angle can be wrapped to the interval [-π, +π].

Components (12)

ramp

Type: Ramp

Description: Generate ramp signal

cosB

Type: CosineVariableFrequencyAndAmplitude

Description: Generate cosine signal with variable frequency and amplitude

cosBminus

Type: CosineVariableFrequencyAndAmplitude

Description: Generate cosine signal with variable frequency and amplitude

sinA

Type: SineVariableFrequencyAndAmplitude

Description: Generate sine signal with variable frequency and amplitude

sinAminus

Type: SineVariableFrequencyAndAmplitude

Description: Generate sine signal with variable frequency and amplitude

feedbackCos

Type: Feedback

Description: Output difference between commanded and feedback input

feedbackSin

Type: Feedback

Description: Output difference between commanded and feedback input

rotator

Type: Rotator

Description: Rotates space phasor

integrator

Type: Integrator

Description: Output the integral of the input signal with optional reset

der1

Type: Der

Description: Derivative of input (= analytic differentiations)

wrapAngle

Type: WrapAngle

Description: Wrap angle to interval ]-pi,pi] or [0,2*pi[

toPolar

Type: ToPolar

Description: Converts a space phasor to polar coordinates