×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Simulating Synchronous AC Motor FOC

Simulating Synchronous AC Motor FOC

Simulating Synchronous AC Motor FOC

(OP)
Hello,

I hope this question concerning implementing an FOC motor controller is appropriate for this forum.

I'm currently working on an open source 3 phase synchronous AC motor controller (hardware and software) using the STM32F303 microcontroller platform. In the interest of having the firmware also be open source, I am creating it from scratch, rather than leveraging existing proprietary motor control libraries.

I think I finally understand Field Oriented Control and have implemented a good bit of the firmware for this. However, I've decided to first do some simulations prior to hooking it up to a real motor. For this purpose I'm utilizing the D3.js Javascript library to plot the various variables involved in FOC in a web browser. However, I'm having difficulty conceptualizing how to simulate a motor. This is the subject of my question.

In the Field Oriented Control algorithm, there are the following measured motor inputs:
Phase A, B, and C instantaneous current measurements (only 2 actually need to be measured, 3rd is inferred from the fact that A + B + C = 0).
Absolute rotor position

In torque control mode there are Torque (q) and Flux (d) reference values, which are utilized by independent PI controllers to maintain the Torque and Flux of the motor.

The final output is 3 phase sine waves with 120 degree phase shifts. This will get fed to an SVPWM stage in the actual firmware, but is omitted in the simulation.

Feeding back the 3 phase output to the measured 3 phase motor current is straightforward enough (just copying the values). I'm stumped on how to simulate the rotation of the motor though. This would seem to require at least the following parameters: motor pole pair count, motor load, current speed of motor.

Given this information, how would I update the motor rotor position input? I would think this would involve calculating the torque, from the amount of current which is being supplied to the motor and the load which must be overcome. The number of pole pairs would determine the degree of rotation for a full cycle.

Any thoughts on this would be greatly appreciated. I can host the simulation on my website, if it would help to have some code to look at, though it is still lacking interactive controls currently.

Best regards,

Element Green

RE: Simulating Synchronous AC Motor FOC

EG; I think you're missing the keys you need or you'd probably have the rotation part of the simulation falling on your toe. You must completely understand the Clarke and Park transforms as they speak to the rotational positions. Hunt them down and I think you'll see how to proceed.

Keith Cress
kcress - http://www.flaminsystems.com

RE: Simulating Synchronous AC Motor FOC

(OP)
Thank you for the reply Keith.

I am already using the Clarke and Park transforms as well as the inverse of the two.

I agree, it seems like I'm missing something obvious. The current absolute rotor angle is used as an input to the Park and inverse Park transforms. What is still not clicking for me is how to update the motor angle, based on the other parameters. The FOC algorithm is run at regular intervals and in this case I'm running it 10 times a second (slower than real time). I plan on using a time factor which can be used in the simulation (10:1, 100:1, 1000:1, etc) to slow it down in a defined manner.

I've attached the current standalone HTML/Javascript file (should be possible to load it in a web browser from the file system) that I have for the simulation if that would help clarify what it is I'm trying to do. The FOC algorithm is in the evaDriveProcess() function. The last lines of the function show some commented out code relating to updating the motorAngle, which is the last piece I'm trying to solve.

Some notes:
- Using integer fractions instead of floating point to be as close as possible to the final optimized fixed point math firmware.
- When multiplying by fractions, half of the divisor is added to the dividend for integer truncation rounding.
- Using a sin array table with linear interpolation to be as close as possible to the firmware.
- All of the FOC parameters are in the Javascript object called 'drive' at the top of the file.

I was looking at equations for Angular Acceleration which might be on the right track? It seems like updating the motorAngle depends on the torque, load angular mass (drive.motorAngularMass), and accumulated speed (drive.motorSpeed). What I'm still unsure of is how to calculate the instantaneous torque (assuming a 100% efficient motor is this purely a function of the electrical power driving the 3 phases?). With known torque and angular mass it should be possible to calculate the angular acceleration, which can then be used to update the accumulated motorSpeed parameter and thus calculate the absolute rotor position based on the time factor and number of motor pole pairs. Seems like I'm getting closer, could use some hand holding though.

Best regards,

Element Green

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources