This third video in the series shows how to implement field-oriented control (FOC) algorithms, including field-weakening on a microcontroller using C code generated from the controller model. Using Embedded Coder®, learn how to generate efficient floating- or fixed-point C code for implementing on a TI C2000 microcontroller. Watch how to evaluate the FOC and field-weakening algorithms running on the microcontroller.
Now that we have verified our controllers and industrial simulation, we are ready to deploy to embedded microcontroller. If you remember we are using TIC 2000 motor to control kit, and the code you generate from Motor Control box that is standard, ANSI C code, which means you can target to any processor. In this case, this reference example shows how to partition the model so that the algorithm package into a separate model and it is separate from ABC and position sensor measurement and PWM right. So the key point here is you can generate rhythmicity code, that include current and ISP will control and integrate this code into your motor control application. So a benefit of taking every mistake code is, you can swap the code and pass to the other and other target processor.
So MathWork has offered TIC 2000 Hardware's support package for generating embedded code. It is in ads on free,with hardware support package. And personally I have experience with customer who are only interested in generating mystikal and they want to integrate into their existing legacy quico of the IO drivers in serial port transmission. We also have customer who like to generate the entire code including the IO driver box, or PWM output and ABC digital IO feedback. So inside the Library of TIC 2000 support package, we also have many of choice for optimized blocks for generating efficiency code. So now we will see how to deploy the algorithm to TIC 2000 microprocessor.
We can automatically generate code either floating or fixed point, download the model to a target and pass it. Here is our model. It is exactly the same model we verified before in the simulation. And now we will generate a code from the control algorithm so I turn on the sample. So you can see how her little brown the fingers and the speed of romp-in slower than that now I'm starting the process of co-generation. Both our mistake and driver code generate. It is then compile and download on the processor. As we can see in the generation report all the general coal is open and accessible to us we have generally about 4,000 lines of the ziko.
Now we open the host model. Notice that we have mepa was weakening control has been permanent. So we have a capability to turn around the field weakening control and start stop multipotent. And we can also come in our speak and we also able to observe the signals of the feedback. Now we run the started running a motor. And here's how we're set up now I'm showing you how to increase the speed coming in from 500 RPM to 4,000 RPN. Whereas the base B notice that I'm showing you assistant system here. So if must be reached one per unit, which is close to this base B.
We can see the speed tracks nicely come in this beat. However, as we try to come in to 5,000 RPM. Which is beyond the base before for something. You will see the speed response in the couldn't follow the yellow because we are not being able to feel weakening control yet. And now we are checking the IP signal. To verify that come in and the thieves are still zero in this case. Now I would like to be able to field weakening control. So all the feedback become negative and see how does the speed response react the
above one per unit. So now you can see the response is able to tracking one per unit above by manipulating the ID currency reference to be negative.
So another crossing about motor control said is you can also use processor in the loop to test capabilities by embedded coder. So what it does is a desktop simulation you can see the control code running on the target and simulating with your motor. And the inverter models running smoothly. This is really helpful for testing a generator code on the target processor. You can also do code programming. If you remember we have been talking about one of the changing of the orientation control is running at high simple rate 50 microseconds. So it is very efficient. In this case, you can see our control current control is only take 5 microseconds which is pretty efficient or for 15 microseconds simple time. With the Simulink you can also target your FPGA. If you need fast or simple. We have examples showing you how to automatically generate the HDL and implement your motor control FGPAs.
To recap, we have been through the entire work for Ford Motor control, processor corroboration, motor parameter estimation, power modeling control design, and generation and implementation. And as you can see here, the motor control based covers the entire end to end workflow. For modeling the motor and inverter we introduce the simscap electrical to allow you to model different video of your physical model. For design control reasons we talk about the Simulink Control Design to help you analyze and look to video gains. Nassp another list the embedded coder with fixed point Designer tool box allow you to generate efficient code without any target microprocessor. Hopefully with these capabilities, you can speed up your development process on the motor control application.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .Select web site
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.