Datasheet
13. Internal Representation of Physical Quantities
Since the algorithm uses fixed point arithmetic, an internal representation of the physical quantities was chosen, in order
to represent with sufficient resolution the quantities, to reduce to the minimum the necessary calculations, and to
manage the great part of applications. The internal representation conforms to the following guidelines:
Angles: a complete round angle (2) is represented with the number 65536; doing this, the complete angles
interval [0, 2) (where 0 is included, 2 is NOT included) can be represented with SHORT numbers in the
interval [0, 65536), that is [0, 65535].
Trigonometric quantities: the results of sin() and cos() operations are amplified by 16384, so they are
comprised between -16384 (corresponding to -1) and +16384 (corresponding to +1).
Voltages: internally the voltages are amplified by 64, allowing the (signed) representation of the maximum
quantity of 511.9V; at the same time the resolution is (1/64)=0.015625V which is enough for our purposes.
Currents: the currents are amplified by 1024, allowing us to manage currents up to 32A with the resolution of
around 1 mA.
Resistances: the resistances are amplified by 256, allowing us to manage resistances up to 128 Ohm, with a
good resolution.
Inductances: the inductances are amplified by 16384, and the maximum allowed inductance is lesser than 2
Henry.
Magnetic flux: it is amplified by 4096, and the maximum allowed flux is lesser than 8 Volt*sec (Weber).
Time: the time is represented with multiplies of the base quantity given by the sampling period; when the
sampling frequency is chosen to be 8kHz, the time base is 125s.
Angular velocity: the angular velocity is calculated as the difference of two phase samples for each other 4
sampling periods, so the amplification of the internal representation is 4*(65536/2pi)/Sampling Frequency.
The complete list of the conversion constants can be found in the header file “const_def.h”.