MotorWare f2806x Module API Documentation
Module overview

Trajectory (TRAJ) Module

Description

Package overview

In this implementation the frequency of the ramp output is controlled by a precision frequency generation algorithm which relies on the modulo nature (i.e. wrap-around) of finite length variables in 28xx. One such variable, called $StepAngleMax$ (a data memory location in 28xx) in this implementation, is used as a variable to determine the minimum $ period = \frac{1}{Freq} $ of the ramp signal. Adding a fixed step value to the Angle variable causes the value in Angle to cycle at a constant rate.

\[ Angle = Angle + StepAngleMax\cdot Freq \]

At the end limit the value in $Angle$ simply wraps around and continues at the next modulo value given by the step size. For a given step size, the frequency of the ramp output (in Hz) is given by:

\[ f = \frac{StepAngle\cdot f_s}{2^m} \]

where

$ f_s $ is the sampling loop frequency in Hz
$ m $ is the number of bits in the auto wrapper variable $Angle$


From the above equation it is clear that a $StepAngle$ value of 1 gives: $f = 0.3052 Hz$ when $m = 16$ and $ f_s = 20 kHz $.
For IQmath implementation, the maximum step size in per-unit, $StepAngleMax$, for a given base frequency, $f_b$ and a defined $GLOBAL\_Q$ number is therefore computed as follows:

\[ StepAngleMax = f_b\cdot T_s\cdot 2^{GLOBAL\_Q} \]


Equivalently, by using _IQ() function for converting from a floating-point number to a _iq number, the $StepAngleMax$ can also be computed as:

\[ StepAngleMax = \_IQ(f_b\cdot T_s) \]


where $T_s$ is the sampling period in seconds.


Simulation Information

The following figure shows the Simulink Model of this block.

SimulinkModel.jpg

The following figure shows the error in the calculation by the microcontroller, and compares it agains simulation output from Simulink.
$\bullet$ Error is the microcontroller output minus Simulink output for function RAMPGEN_run().
$\bullet$ Outputs shows both microcontroller and Simulink outputs for RAMPGEN_run().

SimOutput.jpg

Configuration Information


Please see the TRAJ_init() and TRAJ_run() functions defined in traj.h for more details.

Integration Information

There is only one module in this package, the APIs can be referenced at TRAJ. The API headers can be located at traj.h. The test procedures are described at test_traj.h.

References

  1. ControlSUITE Documentation for TRAJ Module.