In the  previous sections a model of a basic caged induction motor was presented. A custom simulator was used to run a simple trajectory open loop using V/f (constant volt seconds) command reference.
In this section we add to the simulator, a simple closed loop control model that demonstrates field oriented control for an induction motor.
In keeping with that presented in the previous sections, we set the simulator to run in the Rotating Frame (physical model with no D/Q transformations). We also enable space vector PWM (simulations in the previous sections used analog voltages applied to the motor terminals).
Other changes to the simulator:
DC bus voltage is changed from 600 VDC to 100 VDC.The trajectory command of 10 seconds is maintained but the maximum speed command is changed from 50 radians/sec to 1 radians/sec.The simulator runs entirely in floating point double precision format. However, I thought it may be useful to demonstrate the control portion of the simulator running in both double precision (64 bit) and fixed precision (32 bit) formats.
In line with experimenting with the fixed 32 bit format, it made sense to me to look at the control solutions for induction motors provided by the TI C2000 motor control SOC's. 
TI C2000 SOC's are designed specifically for motor control applications. These chips are designed to implement control algorithms written entirely using fixed point arithmetic. Current C2000 (C28) devices employ 32 bit fixed math operations. Newer versions of these devices (C29) employ 32 and 64 bit fixed math operations. Both device types can also perform single and double precision floating operations, but with less efficiency then cpu cores such as the ARM R5 or A72.
For the C2000 family of devices, TI includes examples for basic implementations of field oriented control of an induction motor without any feedforward elements added to the control.
For the purposes of the following demonstration, we use one example provided by TI for sensored field oriented induction motor control that fits very nicely with the induction motor simulation model provided in the previous sections. 
This example is outlined in the following TI application note.<link to "sprabp8.pdf">
Specifically, the simple control scheme oulined in Figure 9 of this document is what we will be implemented in the simulator. This block diagram is shown below.
<image "Block_Diagram.png">
In the actual C2000 code development environment (SDK), the control shown in the block diagram above is described by C code in the following document (specifically the code starting "BUILDLEVEL==LEVEL5" on page 17 of this document).<link to "HVACI_Sensored.c.pdf">
Using references from "HVACI_Sensored.c" above, two versions of this control are added to the simulator, labed fixed and double.
Using full double precision math, the following algorithm was used<link to "controlSuite_double_sim.hpp">
For the case for which this implementation runs using 32 bit fixed point math, this algorithm was used <link to "controlSuite_fixed_sim.hpp">
The code in both files above use macros provided by the TI C2000 SDK. In each casethese macros had to be translated into a form suitable for the simulator.<link to controlSuite_TI_IQMath_ref.h.pdf>
For the double precision floating point test, the macros shown in the following files were used.<link to "FOC_tests_double_sim.hpp.pdf">. In this case it was a relatively simple process to translate from the TI Fixed Point format (IQMath) to double precision floating point.
However, for the fixed point test, a little work was involved in the translation because TI does not provide the IQMath implementation in the form of simulation code.Fortunately, there happens to be a 32 bit fixed point execution model written in C providedby Michal Getka, Ivan Voras and Tim Harkrick (<add citation>) that can be used as a drop-in for TI IQMath.<link to "fptc.h.pdf">Modifying TI's macros using functions provided in the file above allowed a direct transition to 32 bit fixed point simulation.<link to "FOC_tests_fixed_sim.hpp.pdf>
To run the simulation for the induction motor using the control defined controlSuite_double_sim.hpp or controlSuite_fixed_sim.hpp, some parameters were changed relative to the open loop simulation used in the previous section.
The maximum speed (electrical frequency) for the 10 second test trajectory was reduced to 1 radian/sec. The DC bus voltage was reduced from 600 VDC to 100 VDC. Also, the portion of the simulator dealing with voltage control to the induction motor was changed from analog to PWM running at 20 KHz.
Plots of is1 (phase 1 stator current), ir1 (phase 1 rotor current), and vs1 (line to neutral voltage of phase 1 stator)  and the command velocity omegad are shown below (both double and fixed simulations show similar results).
<is1.png><ir1.png><vs1_vn.png><omagad.png>
Finally, a comparison of the actual velocity omega_r for the simulation when run using "double precision" control (FOC_tests_double_sim.hpp) and "fixed point" control (FOC_tests_fixed_sim.hpp)
< omega_r_double.png ><omega_r_fixed.png >
These results show equivalence using a control implemented in double precision floating point math and control implemented in fixed point math.
However, this is not to say that both double and fixed implementations are interchangable.For example, if an application requires a high degree of feedback resolution, the double implementation will provide better performance.
However, these results do suggest future tests using 64 bit fixed point math which can be provided by TI's new C29 family of devices.
Michael E. AielloPrincipal Design Engineer - Electrical Engineeringaerotech.com | +1-412-967-6897