03.08.2013 Views

Embedded Software and Motor Control Libraries for PXR40xx

Embedded Software and Motor Control Libraries for PXR40xx

Embedded Software and Motor Control Libraries for PXR40xx

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

MC Library Testing<br />

At this point, the <strong>Embedded</strong> <strong>Software</strong> <strong>and</strong> <strong>Motor</strong> <strong>Control</strong> <strong>Libraries</strong> <strong>for</strong> M<strong>PXR40xx</strong> is<br />

linked with the user project file, <strong>and</strong> hence the library functions can be exploited <strong>and</strong><br />

flawlessly compiled/linked with the user application.<br />

2.13 MC Library Testing<br />

In order to validate the implementation of the <strong>Embedded</strong> <strong>Software</strong> <strong>and</strong> <strong>Motor</strong> <strong>Control</strong><br />

<strong>Libraries</strong> <strong>for</strong> M<strong>PXR40xx</strong>, the comparison of results from the MATLAB Reference Model<br />

<strong>and</strong> outputs from the tested library function is used. To ensure the <strong>Embedded</strong> <strong>Software</strong><br />

<strong>and</strong> <strong>Motor</strong> <strong>Control</strong> <strong>Libraries</strong> <strong>for</strong> M<strong>PXR40xx</strong> precision, two test methods are used:<br />

• Matlab Simulink Toolbox based testing (refer to MCLib Testing based on the<br />

MATLAB Simulink Toolbox } <strong>for</strong> more details).<br />

• Target-in-loop based testing (refer to MCLib target-in-loop Testing based on the<br />

SFIO Toolbox <strong>for</strong> detailed in<strong>for</strong>mation).<br />

The Figure 2-24 shows the testing principle:<br />

• Input vector represents the test vector which enters simultaneously into the<br />

Reference Model <strong>and</strong> into the Unit Under Test (UUT).<br />

• Reference Model (RM) implements the real model of the UUT. For simple<br />

functions, the models are a part of the MATLAB Simulink Toolbox. Advanced<br />

functions such as filters or controllers had been designed separately.<br />

• By the type of test method used, the Unit Under Test (UUT) may be:<br />

• Bit Accurate Model (BAM) - the "C" implementation of the tested function<br />

compiled in the MATLAB environment. The compilation result, called the<br />

binary MEX-file, is a dynamically-linked subroutine that the MATLAB<br />

interpreter can load <strong>and</strong> execute.<br />

• SFIO Model represents the tested function running directly on the target MCU.<br />

Results from the UUT <strong>and</strong> Reference Model are saved in the final report, together with<br />

the calculated error which is simply the difference between the output value from the<br />

Reference Model <strong>and</strong> the output value from the UUT, recalculated to an equivalent<br />

precision. The equivalent precision is different based on the <strong>Embedded</strong> <strong>Software</strong> <strong>and</strong><br />

<strong>Motor</strong> <strong>Control</strong> <strong>Libraries</strong> <strong>for</strong> M<strong>PXR40xx</strong> implementation. For the 32-bit fixed-point <strong>and</strong><br />

single precision floating point implementations the output precision is recalculated to<br />

+/-1LSB in 16-bit arithmetic <strong>for</strong> non-approximation functions <strong>and</strong> +/-3LSB in 16-bit<br />

arithmetic <strong>for</strong> approximation functions. For the 16-bit fixed-point implementation the<br />

output precision is recalculated to +/-1LSB in 12-bit arithmetic <strong>for</strong> non-approximation<br />

functions <strong>and</strong> +/-3LSB <strong>for</strong> approximation functions in 12-bit arithmetic.<br />

<strong>Embedded</strong> <strong>Software</strong> <strong>and</strong> <strong>Motor</strong> <strong>Control</strong> <strong>Libraries</strong> <strong>for</strong> <strong>PXR40xx</strong>, Rev. 1.0<br />

132 Freescale Semiconductor, Inc.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!