NXP Semiconductors DSP56800E User Manual
NXP Semiconductors DSP56800E User Manual

NXP Semiconductors DSP56800E User Manual

Gmclib digital signal controller

Advertisement

Quick Links

GMCLIB User's Guide
DSP56800E
Document Number: DSP56800EGMCLIBUG
Rev. 2, 10/2015

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the DSP56800E and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for NXP Semiconductors DSP56800E

  • Page 1 GMCLIB User's Guide DSP56800E Document Number: DSP56800EGMCLIBUG Rev. 2, 10/2015...
  • Page 2 GMCLIB User's Guide, Rev. 2, 10/2015 Freescale Semiconductor, Inc.
  • Page 3: Table Of Contents

    Contents Section number Title Page Chapter 1 Library Introduction..................................5 Library integration into project (CodeWarrior™ Development Studio) ...............7 Chapter 2 Algorithms in detail GMCLIB_Clark................................17 GMCLIB_ClarkInv................................ 18 GMCLIB_Park................................20 GMCLIB_ParkInv................................21 GMCLIB_DecouplingPMSM............................23 GMCLIB_ElimDcBusRipFOC............................27 GMCLIB_ElimDcBusRip.............................. 31 GMCLIB_SvmStd................................36 GMCLIB_SvmIct................................51 2.10 GMCLIB_SvmU0n................................ 55 2.11 GMCLIB_SvmU7n................................
  • Page 4 GMCLIB User's Guide, Rev. 2, 10/2015 Freescale Semiconductor, Inc.
  • Page 5: Introduction

    1.1 Introduction 1.1.1 Overview This user's guide describes the General Motor Control Library (GMCLIB) for the family of DSP56800E core-based digital signal controllers. This library contains optimized functions. 1.1.2 Data types GMCLIB supports several data types: (un)signed integer, fractional, and accumulator.
  • Page 6 1.1.4 Supported compilers GMCLIB for the DSP56800E core is written in assembly language with C-callable interface. The library is built and tested using the following compilers: • CodeWarrior™ Development Studio For the CodeWarrior™ Development Studio, the library is delivered in the gmclib.lib file.
  • Page 7: Library Integration Into Project (Codewarrior™ Development Studio)

    Chapter 1 Library The interfaces to the algorithms included in this library are combined into a single public interface include file, gmclib.h. This is done to lower the number of files required to be included in your application. 1.1.5 Special issues 1.
  • Page 8 Library integration into project (CodeWarrior™ Development Studio) 2. Choose File > New > Bareboard Project, so that the "New Bareboard Project" dialog appears. 3. Type a name of the project, for example, MyProject01. 4. If you don't use the default location, untick the “Use default location” checkbox, and type the path where you want to create the project folder;...
  • Page 9 Chapter 1 Library Figure 1-3. Connection selection 7. From the options given, select the Simple Mixed Assembly and C language, and click Finish. See Figure 1-4. Figure 1-4. Language choice The new project is now visible in the left-hand part of CodeWarrior™ Development Studio.
  • Page 10 Library integration into project (CodeWarrior™ Development Studio) 2. Expand the Resource node and click Linked Resources. See Figure 1-6. Figure 1-6. Project properties 3. Click the 'New…' button on the right-hand side. 4. In the dialog that appears (see Figure 1-7), type this variable name into the Name box: FSLESL_LOC 5.
  • Page 11 Chapter 1 Library Figure 1-7. New variable 1.2.3 Library folder addition To use the library, add it into the CodeWarrior Project tree dialog. 1. Right-click the MyProject01 node in the left-hand part and click New > Folder, or select File > New > Folder from the menu. A dialog appears. 2.
  • Page 12 Library integration into project (CodeWarrior™ Development Studio) Figure 1-8. Folder link Figure 1-9. Projects libraries paths 1.2.4 Library path setup GMCLIB requires MLIB and GFLIB to be included too. Therefore, the following steps show the inclusion of all dependent modules. 1.
  • Page 13 Chapter 1 Library 2. Expand the C/C++ Build node, and click Settings. 3. In the right-hand tree, expand the DSC Linker node, and click Input. See Figure 1-11. 4. In the third dialog Additional Libraries, click the 'Add…' icon, and a dialog appears. 5.
  • Page 14 Library integration into project (CodeWarrior™ Development Studio) Figure 1-11. Linker setting 14. In the tree under the DSC Compiler node, click Access Paths. 15. In the Search User Paths dialog (#include “…”), click the 'Add…' icon, and a dialog will appear. 16.
  • Page 15 Chapter 1 Library Figure 1-12. Library include path addition Figure 1-13. Compiler setting The final step is typing the #include syntax into the code. Include the library into the main.c file. In the left-hand dialog, open the Sources folder of the project, and double- click the main.c file.
  • Page 16 Library integration into project (CodeWarrior™ Development Studio) GMCLIB User's Guide, Rev. 2, 10/2015 Freescale Semiconductor, Inc.
  • Page 17: Algorithms In Detail

    Chapter 2 Algorithms in detail 2.1 GMCLIB_Clark GMCLIB_Clark function calculates the Clarke transformation, which is used to transform values (flux, voltage, current) from the three-phase coordinate system to the two-phase (α-β) orthogonal coordinate system, according to the following equations: Equation 1 Equation 2 2.1.1 Available versions This function is available in the following versions:...
  • Page 18: Gmclib_Clarkinv

    GMCLIB_ClarkInv 2.1.2 Declaration The available GMCLIB_Clark functions have the following declarations: void GMCLIB_Clark_F16(const GMCLIB_3COOR_T_F16 *psIn, GMCLIB_2COOR_ALBE_T_F16 *psOut) 2.1.3 Function use The use of the GMCLIB_Clark function is shown in the following example: #include "gmclib.h" static GMCLIB_2COOR_ALBE_T_F16 sAlphaBeta; static GMCLIB_3COOR_T_F16 sAbc; void Isr(void);...
  • Page 19 Chapter 2 Algorithms in detail 2.2.1 Available versions This function is available in the following versions: • Fractional output - the output is the fractional portion of the result; the result is within the range <-1 ; 1). The result may saturate. The available versions of the GMCLIB_ClarkInv function are shown in the following...
  • Page 20: Gmclib_Park

    GMCLIB_Park 2.3 GMCLIB_Park GMCLIB_Park function calculates the Park transformation, which transforms values (flux, voltage, current) from the stationary two-phase (α-β) orthogonal coordinate system to the rotating two-phase (d-q) orthogonal coordinate system, according to the following equations: Equation 6 Equation 7 where: •...
  • Page 21: Gmclib_Parkinv

    Chapter 2 Algorithms in detail 2.3.3 Function use The use of the GMCLIB_Park function is shown in the following example: #include "gmclib.h" static GMCLIB_2COOR_ALBE_T_F16 sAlphaBeta; static GMCLIB_2COOR_DQ_T_F16 sDQ; static GMCLIB_2COOR_SINCOS_T_F16 sAngle; void Isr(void); void main(void) /* Alpha, Beta structure initialization */ sAlphaBeta.f16Alpha = FRAC16(0.0);...
  • Page 22 GMCLIB_ParkInv 2.4.1 Available versions This function is available in the following versions: • Fractional output - the output is the fractional portion of the result; the result is within the range <-1 ; 1). The result may saturate. The available versions of the GMCLIB_ParkInv function are shown in the following table:...
  • Page 23: Gmclib_Decouplingpmsm

    Chapter 2 Algorithms in detail void Isr(void) /* Inverse Park Transformation calculation */ GMCLIB_ParkInv_F16(&sDQ, &sAngle, &sAlphaBeta); 2.5 GMCLIB_DecouplingPMSM GMCLIB_DecouplingPMSM function calculates the cross-coupling voltages to eliminate the d-q axis coupling that causes nonlinearity of the control. The d-q model of the motor contains cross-coupling voltage that causes nonlinearity of the control.
  • Page 24 GMCLIB_DecouplingPMSM Figure 2-1. The d-q PMSM model To eliminate the nonlinearity, the cross-coupling voltage is calculated using the GMCLIB_DecouplingPMSM algorithm, and feedforwarded to the d and q voltages. The decoupling algorithm is calculated using the following equations: Equation 11 where: •...
  • Page 25: Where

    Chapter 2 Algorithms in detail Equation 13 where: • k are the scaling coefficients • i is the maximum current • u is the maximum voltage • ω is the maximum electrical speed el_max The k and k parameters must be set up properly. The principle of the algorithm is depicted in Figure 2-2 Figure 2-2.
  • Page 26 GMCLIB_DecouplingPMSM The available versions of the GMCLIB_DecouplingPMSM function are shown in the following table: Table 2-5. Function versions Function name Input/output type Result type GMCLIB_DecouplingPMSM_F16 Input GMCLIB_2COOR_DQ_T_F16 void GMCLIB_2COOR_DQ_T_F16 frac16_t Parameters GMCLIB_DECOUPLINGPMSM_T_A32 Output GMCLIB_2COOR_DQ_T_F16 The PMSM decoupling with a 16-bit fractional d-q voltage, current inputs, and a 16- bit fractional electrical speed input.
  • Page 27: Gmclib_Elimdcbusripfoc

    Chapter 2 Algorithms in detail void Isr(void); void main(void) /* Voltage D, Q structure initialization */ sVoltageDQ.f16D = FRAC16(0.0); sVoltageDQ.f16Q = FRAC16(0.0); /* Current D, Q structure initialization */ sCurrentDQ.f16D = FRAC16(0.0); sCurrentDQ.f16Q = FRAC16(0.0); /* Speed initialization */ f16AngularSpeed = FRAC16(0.0); /* Motor parameters for decoupling Kd = 40, Kq = 20 sDecouplingParam.a32KdGain = ACC32(40.0);...
  • Page 28 GMCLIB_ElimDcBusRipFOC Equation 15 Equation 16 where: • U * is the direct-α duty cycle ratio α • U * is the direct-β duty cycle ratio β • U is the direct-α voltage α • U is the quadrature-β voltage β If the fractional arithmetic is used, the FOC and DC-bus voltages have their scales, which take place in Equation 14 on page...
  • Page 29 Chapter 2 Algorithms in detail Equation 19 GMCLIB_ElimDcBusRipFOC function compensates an amplitude of the direct-α and the quadrature-β component of the stator-reference voltage vector in the fractional arithmetic, using the formula shown in the following equations: Equation 20 Equation 21 where: •...
  • Page 30 GMCLIB_ElimDcBusRipFOC Figure 2-3. Results of the DC-bus voltage ripple elimination 2.6.1 Available versions This function is available in the following versions: • Fractional output - the output is the fractional portion of the result; the result is within the range <-1 ; 1). The result may saturate. The available versions of the GMCLIB_ElimDcBusRipFOC function are shown in the...
  • Page 31 Chapter 2 Algorithms in detail Table 2-6. Function versions (continued) Function name Input type Output type Result type Compensation of a 16-bit fractional two-phase system input to a 16-bit fractional two-phase system, using a 16-bit fractional DC-bus voltage information. The DC- bus voltage input is within the fractional range <0 ;...
  • Page 32: Gmclib_Elimdcbusrip

    GMCLIB_ElimDcBusRip GMCLIB_ElimDcBusRip function is used for a correct PWM duty cycle output calculation, based on the measured DC-bus voltage. The side effect is the elimination of the the DC-bus voltage ripple in the output PWM duty cycle. This function can be used with any kind of space vector modulation;...
  • Page 33 Chapter 2 Algorithms in detail Equation 25 where: • U is the scaled FOC voltage • U is the scaled measured DC-bus voltage dcbus • U is the FOC voltage scale FOC_max • U is the DC-bus voltage scale dcbus_max Thus, the modulation index in the fractional representation is expressed as follows : Equation 26 where:...
  • Page 34 GMCLIB_ElimDcBusRip GMCLIB_ElimDcBusRip function can be used in general motor-control applications, and it provides elimination of the voltage ripple on the DC-bus of the power stage. Figure 2-4 shows the results of the DC-bus ripple elimination, while compensating the ripples of the rectified voltage, using a three-phase uncontrolled rectifier. Figure 2-4.
  • Page 35 Chapter 2 Algorithms in detail The available versions of the GMCLIB_ElimDcBusRip function are shown in the following table: Table 2-7. Function versions Function name Input type Output type Result type GMCLIB_ElimDcBusRip_F16sas frac16_t GMCLIB_2COOR_ALBE_T_F16 void acc32_t GMCLIB_2COOR_ALBE_T_F16 Compensation of a 16-bit fractional two-phase system input to a 16-bit fractional two-phase system using a 16-bit fractional DC-bus voltage information and a 32-bit accumulator modulation index.
  • Page 36 GMCLIB_SvmStd /* Ripple elimination calculation */ GMCLIB_ElimDcBusRip_F16sas(f16UDcBus, a32IdxMod, &sUAlBe, &sUAlBeComp); 2.8 GMCLIB_SvmStd GMCLIB_SvmStd function calculates the appropriate duty-cycle ratios, which are needed for generation of the given stator-reference voltage vector, using a special standard space vector modulation technique. GMCLIB_SvmStd function for calculating the duty-cycle ratios is widely used in modern electric drives.
  • Page 37 Chapter 2 Algorithms in detail The top and bottom switches are working in a complementary mode; for example, if the top switch S is on, then the corresponding bottom switch S is off, and vice versa. Considering that the value 1 is assigned to the ON state of the top switch, and value 0 is assigned to the ON state of the bottom switch, the switching vector [a, b, c] can be defined.
  • Page 38: Gmclib_Svmstd

    GMCLIB_SvmStd Equation 31 The three-phase stator voltages - U , and U , are transformed using the Clark transformation into the direct-α and the quadrature-β components of the two-phase orthogonal coordinate system. The transformation results are listed in Table 2-9. Table 2-9.
  • Page 39 Chapter 2 Algorithms in detail Figure 2-6. Basic space vectors Referring to this principle, the objective of the standard space vector modulation is an approximation of the reference stator voltage vector U , with an appropriate combination of the switching patterns, composed of basic space vectors. The graphical explanation of this objective is shown in Figure 2-7 Figure...
  • Page 40 GMCLIB_SvmStd Figure 2-7. Projection of reference voltage vector in the respective sector The stator reference voltage vector U is phase-advanced by 30° from the direct-α, and thus can be generated with an appropriate combination of the adjacent basic switching states U and U .
  • Page 41 Chapter 2 Algorithms in detail Figure 2-8. Detail of the voltage vector projection in the respective sector In this case, the reference stator voltage vector U is located in sector I, and can be generated using the appropriate duty-cycle ratios of the basic switching states U .
  • Page 42 GMCLIB_SvmStd Equation 33 Considering that normalized magnitudes of basic space vectors are |U | = |U | = 2 / √3, and by the substitution of the trigonometric expressions sin 60° and tan 60° by their quantities 2 / √3, and √3, respectively, the Equation 33 on page 42 can be rearranged for the unknown duty-cycle ratios T...
  • Page 43 Chapter 2 Algorithms in detail Figure 2-9. Projection of the reference voltage vector in the respective sector GMCLIB User's Guide, Rev. 2, 10/2015 Freescale Semiconductor, Inc.
  • Page 44 GMCLIB_SvmStd Figure 2-10. Detail of the voltage vector projection in the respective sector The equations describing those auxiliary time-duration components are as follows: Equation 36 Equations in Equation 36 on page 44 have been created using the sine rule. The resultant duty-cycle ratios T / T and T / T are then expressed in terms of the auxiliary time-duration components, defined by...
  • Page 45 Chapter 2 Algorithms in detail Using these equations, and also considering that the normalized magnitudes of the basic space vectors are |U | = |U | = 2 / √3 , the equations expressed for the unknown duty- cycle ratios of basic space vectors T / T and T / T can be expressed as follows: Equation 38...
  • Page 46 GMCLIB_SvmStd Equation 41 The modified Inverse Clark transformation projects the quadrature-u component into β , as shown in Figure 2-11 Figure 2-12, whereas voltages generated by the ref1 conventional Inverse Clark transformation project the direct-u component into u α ref1 Figure 2-11.
  • Page 47 Chapter 2 Algorithms in detail Figure 2-12. Reference voltages U , and U ref1 ref2 ref3 The sector identification tree shown in Figure 2-13 can be a numerical solution of the approach shown in GMCLIB_SvmStd_Img8. Figure 2-13. Identification of the sector number In the worst case, at least three simple comparisons are required to precisely identify the sector of the stator reference voltage vector.
  • Page 48 GMCLIB_SvmStd located as shown in Figure 2-9. The variables t , and t , which represent the switching duty-cycle ratios of the respective three-phase system, are calculated according to the following equations: Equation 42 where T is the switching period, and t_1 and t_2 are the duty-cycle ratios of the basic space vectors given for the respective sector;...
  • Page 49 Chapter 2 Algorithms in detail Figure 2-14. Standard space vector modulation technique — center-aligned PWM Figure 2-15 shows the waveforms of the duty-cycle ratios, calculated using standard space vector modulation. For the accurate calculation of the duty-cycle ratios, direct-α, and quadrature-β components of the stator reference voltage vector, it must be considered that the duty cycle cannot be higher than one (100 %);...
  • Page 50 GMCLIB_SvmStd Figure 2-15. Standard space vector modulation technique 2.8.1 Available versions This function is available in the following versions: • Fractional output - the output is the fractional portion of the result; the result is within the range <0 ; 1). The result may saturate. GMCLIB User's Guide, Rev.
  • Page 51 Chapter 2 Algorithms in detail The available versions of the GMCLIB_SvmStd function are shown in the following table. Table 2-12. Function versions Function name Input type Output type Result type GMCLIB_SvmStd_F16 GMCLIB_2COOR_ALBE_T_F16 GMCLIB_3COOR_T_F16 uint16_t Standard space vector modulation with a 16-bit fractional stationary (α-β) input and a 16-bit fractional three-phase output.
  • Page 52 GMCLIB_SvmIct GMCLIB_SvmIct function calculates the appropriate duty-cycle ratios, which are needed for generation of the given stator-reference voltage vector using the general sinusoidal modulation technique. GMCLIB_SvmIct function calculates the appropriate duty-cycle ratios, needed for generation of the given stator reference voltage vector using the conventional Inverse Clark transformation.
  • Page 53 Chapter 2 Algorithms in detail Use the Inverse Clark transformation for transforming values such as flux, voltage, and current from an orthogonal rotating coordination system (u ) to a three-phase rotating α β coordination system (u , and u ). The original equations of the Inverse Clark transformation are scaled here to provide the duty-cycle ratios in the range <0 ;...
  • Page 54: Gmclib_Svmict

    GMCLIB_SvmIct Figure 2-16. Inverse Clark transform modulation technique For an accurate calculation of the duty-cycle ratios and the direct-α and quadrature-β components of the stator reference voltage vector, the duty cycle cannot be higher than one (100 %); in other words, the assumption must be met.
  • Page 55 Chapter 2 Algorithms in detail The available versions of the GMCLIB_SvmIct function are shown in the following table: Table 2-14. Function versions Function name Input type Output type Result type GMCLIB_SvmIct_F16 GMCLIB_2COOR_ALBE_T_F16 GMCLIB_3COOR_T_F16 uint16_t General sinusoidal space vector modulation with a 16-bit fractional stationary (α-β) input and a 16-bit fractional three-phase output.
  • Page 56: Gmclib_Svmu0N

    GMCLIB_SvmU0n GMCLIB_SvmU0n function calculates the appropriate duty-cycle ratios, which are needed for generation of the given stator-reference voltage vector using the general sinusoidal modulation technique. GMCLIB_SvmU0n function for calculating of duty-cycle ratios is widely used in modern electric drives. This function calculates the appropriate duty-cycle ratios, which are needed for generating the given stator reference voltage vector using a special space vector modulation technique called space vector modulation with O nulls, where only...
  • Page 57 Chapter 2 Algorithms in detail Figure 2-17. Space vector modulation technique with O nulls — center-aligned PWM Figure Figure 2-17 shows calculated waveforms of the duty cycle ratios using space vector modulation with O nulls. For an accurate calculation of the duty-cycle ratios, direct-α, and quadrature-β components of the stator reference voltage vector, consider that the duty cycle cannot be higher than one (100 %);...
  • Page 58 GMCLIB_SvmU0n Figure 2-18. Space vector modulation technique with O nulls 2.10.1 Available versions This function is available in the following versions: • Fractional output - the output is the fractional portion of the result; the result is within the range <0 ; 1). The result may saturate. GMCLIB User's Guide, Rev.
  • Page 59 Chapter 2 Algorithms in detail The available versions of the GMCLIB_SvmU0n function are shown in the following table: Table 2-15. Function versions Function name Input type Output type Result type GMCLIB_SvmU0n_F16 GMCLIB_2COOR_ALBE_T_F16 GMCLIB_3COOR_T_F16 uint16_t General sinusoidal space vector modulation with a 16-bit fractional stationary (α-β) input, and a 16-bit fractional three-phase output.
  • Page 60 GMCLIB_SvmU7n GMCLIB_SvmU7n function calculates the appropriate duty-cycle ratios, which are needed for generation of the given stator-reference voltage vector, using the general sinusoidal modulation technique. GMCLIB_SvmU7n function for calculating the duty-cycle ratios is widely used in modern electric drives. This function calculates the appropriate duty-cycle ratios, which are needed for generating the given stator reference voltage vector using a special space vector modulation technique called space vector modulation with O nulls, where only...
  • Page 61 Chapter 2 Algorithms in detail Figure 2-19. Space vector modulation technique with O nulls — center-aligned PWM Figure Figure 2-19 shows calculated waveforms of the duty-cycle ratios using Space Vector Modulation with O nulls. For an accurate calculation of the duty-cycle ratios, direct-α, and quadrature-β components of the stator reference voltage vector, it must be considered that the duty cycle cannot be higher than one (100 %);...
  • Page 62 GMCLIB_SvmU7n Figure 2-20. Space vector modulation technique with O nulls 2.11.1 Available versions This function is available in the following versions: • Fractional output - the output is the fractional portion of the result; the result is within the range <0 ; 1). The result may saturate. GMCLIB User's Guide, Rev.
  • Page 63 Chapter 2 Algorithms in detail The available versions of the GMCLIB_SvmU7n function are shown in the following table: Table 2-16. Function versions Function name Input type Output type Result type GMCLIB_SvmU7n_F16 GMCLIB_2COOR_ALBE_T_F16 GMCLIB_3COOR_T_F16 uint16_t General sinusoidal space vector modulation with a 16-bit fractional stationary (α-β) input and a 16-bit fractional three-phase output.
  • Page 64: Gmclib_Svmu7N

    GMCLIB_SvmU7n GMCLIB User's Guide, Rev. 2, 10/2015 Freescale Semiconductor, Inc.
  • Page 65 Appendix A Library types A.1 bool_t bool_t type is a logical 16-bit type. It is able to store the boolean variables with two states: TRUE (1) or FALSE (0). Its definition is as follows: typedef unsigned short bool_t; The following figure shows the way in which the data is stored by this type: Table A-1.
  • Page 66 uint16_t Table A-2. Data storage Value Integer A.3 uint16_t uint16_t type is an unsigned 16-bit integer type. It is able to store the variables within the range <0 ; 65535>. Its definition is as follows: typedef unsigned short uint16_t; The following figure shows the way in which the data is stored by this type: Table A-3.
  • Page 67 Appendix A Library types uint32_t type is an unsigned 32-bit integer type. It is able to store the variables within the range <0 ; 4294967295>. Its definition is as follows: typedef unsigned long uint32_t; The following figure shows the way in which the data is stored by this type: Table A-4.
  • Page 68 int16_t A.6 int16_t int16_t type is a signed 16-bit integer type. It is able to store the variables within the range <-32768 ; 32767>. Its definition is as follows: typedef short int16_t; The following figure shows the way in which the data is stored by this type: Table A-6.
  • Page 69 Appendix A Library types A.8 frac8_t frac8_t type is a signed 8-bit fractional type. It is able to store the variables within the range <-1 ; 1). Its definition is as follows: typedef char frac8_t; The following figure shows the way in which the data is stored by this type: Table A-8.
  • Page 70 frac32_t Table A-9. Data storage (continued) 0.47357 -0.75586 To store a real number as frac16_t, use the FRAC16 macro. A.10 frac32_t frac32_t type is a signed 32-bit fractional type. It is able to store the variables within the range <-1 ; 1). Its definition is as follows: typedef long frac32_t;...
  • Page 71 Appendix A Library types Table A-11. Data storage Value Sign Integer Fractional 255.9921875 -256.0 -1.0 13.7890625 -89.71875 To store a real number as acc16_t, use the ACC16 macro. A.12 acc32_t acc32_t type is a signed 32-bit accumulator type. It is able to store the variables within the range <-65536 ;...
  • Page 72 GMCLIB_3COOR_T_F16 A.13 GMCLIB_3COOR_T_F16 GMCLIB_3COOR_T_F16 structure type corresponds to the three-phase stationary coordinate system, based on the A, B, and C components. Each member is of the frac16_t data type. The structure definition is as follows: typedef struct frac16_t f16A; frac16_t f16B;...
  • Page 73 Appendix A Library types A.15 GMCLIB_2COOR_DQ_T_F16 GMCLIB_2COOR_DQ_T_F16 structure type corresponds to the two-phase rotating coordinate system, based on the D and Q orthogonal components. Each member is of the frac16_t data type. The structure definition is as follows: typedef struct frac16_t f16D;...
  • Page 74 FALSE GMCLIB_2COOR_SINCOS_T_F16 structure type corresponds to the two-phase coordinate system, based on the Sin and Cos components of a certain angle. Each member is of the frac16_t data type. The structure definition is as follows: typedef struct frac16_t f16Sin; frac16_t f16Cos;...
  • Page 75 Appendix A Library types void main(void) bVal = TRUE; /* bVal = TRUE */ A.20 FRAC8 FRAC8 macro serves to convert a real number to the frac8_t type. Its definition is as follows: #define FRAC8(x) ((frac8_t)((x) < 0.9921875 ? ((x) >= -1 ? (x)*0x80 : 0x80) : 0x7F)) The input is multiplied by 128 (=2 ).
  • Page 76 FRAC32 A.22 FRAC32 FRAC32 macro serves to convert a real number to the frac32_t type. Its definition is as follows: #define FRAC32(x) ((frac32_t)((x) < 1 ? ((x) >= -1 ? (x)*0x80000000 : 0x80000000) : 0x7FFFFFFF)) The input is multiplied by 2147483648 (=2 ).
  • Page 77 #define ACC32(x) ((acc32_t)((x) < 65535.999969482421875 ? ((x) >= -65536 ? (x)*0x8000 : 0x80000000) : 0x7FFFFFFF)) The input is multiplied by 32768 (=2 ). The output is limited to the range <0x80000000 ; 0x7FFFFFFF>, which corresponds to <-65536.0 ; 65536.0-2 >. #include "mlib.h"...
  • Page 78 GMCLIB User's Guide, Rev. 2, 10/2015 Freescale Semiconductor, Inc.
  • Page 79 How to Reach Us: Information in this document is provided solely to enable system and software implementers to use Freescale products. There are no express Home Page: or implied copyright licenses granted hereunder to design or fabricate freescale.com any integrated circuits based on the information in this document. Web Support: Freescale reserves the right to make changes without further notice to any products herein.

Table of Contents