finally wrote the winding pattern generator for an arbitrary number of phases, source:
winding pattern generator
It was written in python 3.x so you'll need to run it. It out put the phase as a number and the direction of the winding as the sign. If any of you end up using it, it would be awesome to hear suggestions, or added features or what you might like to see next.
But yeah so this is that motor winder thing I was talking about, it was accidentally lost while playikng the game of musical partions while reinstalling things on the laptop.
But I rewrote it! and here is.
It gives you a winding pattern for a n-phase, m-pole and k*2 pole motor. If you're too lazy to open up the code to look at it, here's the most important part of it:
def pattern_gin(slot_edeg, phase_slice):
phase = m.floor((slot_edeg % 180)/ phase_slice)#actually calculates the phase for the slot
if (phase % 2 == 0):#dictates the direction of each winding
if slot_edeg >= 180:
phase_sign = '+'
else:
phase_sign = '-'
else:
if slot_edeg >= 180:
phase_sign = '-'
else:
phase_sign = '+'
return phase_sign, phase
This is the function that defines the phase and direction of a winding on one stator tooth.
As the input it takes the electrical degree position and the electrical degrees of each phase and matches them up...its really not that exciting.
I've been learning haskell and I'm considering making some sort of simulator
mathjax
2013-02-24
2013-01-19
Long time no see
So hello again. Thought it was past time to make another post.
Current projects that have been happening/ happened are:
-A motor winding pattern generator for an arbitrary number of phases.
It was written in python and was made in a fairly awkward form, but I ended up deleting some of it in frustration while rewriting it.
Idea behind a pattern generator for a motor:
A permanent magnet motor consists of magnets and solenoids in some circular configuration. In order to produce torque the solenoids must be turned on when they are in the proper position. This is where the winding pattern generator comes in it creates the winding 'pattern' so that when voltage is applied to any particular phase of the motor each pole on that phase produces a force in the same direction this goes back to one of my last posts when I made a motor. This bring about babble of electrical angles which I talked about for a moment in this post. 2pi rads of electrical angle per pair of magnet poles (or you can think about it in degrees if you like), this gives a whole crap load of radians per motor but since our magnets are tessellate (positive pole up, then negative, then positive.....repeat) we really only care about how things line up within a single 2pi rads interval. So when talking about electrical angles it is useful to think of them as electrical angle mod(2pi), I kind of like to think of it as walking off the right edge of a TV screen and coming back on the left side.
This makes things easier to count and think about positionaly and bring up the question:
When do we actually want to turn on a phase?
And depending on what the goal iswant to do that answer can actually not be that straight forward. However in most cases you probably only care about getting maximum torque out of your motor. In order to produce the maximum amount of torque you want to turn your motor on when it is directly between the pole of two magnets.
This corresponds to an angle of either 0 or pi depending how you want to look at it. So how do you get all of your poles in one phase to produce torque in the same direction? By applying voltage to all of the poles in a certain interval at the same time. Ideally all of the poles in the phase would be at the same electrical angle when turned on. This ensures that they all push in the same direction. By defining a certain window of electrical degrees where sum((nth pole torque) for 0 to n poles)>0 at all times in that interval. i.e. the motor will always be pushing in the same direction.
This pattern can be calculated without too much work below is some fake code I wrote to calculate the winding pattern for an arbitrary phase motor of n even poles, and an arbitrary number of slots.
Please forgive the bastardization of code, it was really an organizational exercise to make sure the motor winder is written properly next time it gets written...hopefully this is not too nonsensical looking.
Psuedo code for motor winder:
#pretend the person already entered the number of poles, number of phases and number of slots(stator poles) and they make physical sense:
pole_num
phase_num
slot_num
#find the amount of electrical degrees to alot to each phase interval
#and the electrical degrees per slot
phase_slice = 180 / phase_num
slot_slice = pole_num * 180 /slot_num
#map the values out over all the slots and phases so you have each phase interval
#and the electrical and of each slot
slot_angles = map(lambda(n): (n * slot_slice) % 360): range(slot_num))
#phase intervals mapping not needed but good to look at sometimes to make sure everything makes sense
#phase_intervals = map(lambda(n): ( n * phase_slice) % 180): range(phase_num))
#this is the heart of the program it decides the phase number and the direction in which to wind each phase slot
defun pattern_picker (slot_angle[n], phase_slice)(
#makes and integer of each slot corresponding to the phase interval it lies on
phase = floor(slot_angle[n] % 180 /phase_slice)
#decides the direction of each slot winding on the stator
(if even?(slot_angles[n])
then (if (slot_angle[n] > 180)
then (case = "-") else(case = "+")))
(if odd?(slot_angles[n])
then (if (slot_angles[n] > 180)
then (case = "+") else(case = "-")))
#outputs the direction and phase for a given stator slot
return( string(case)+string(phase))
#gets the direction/phase for each slot
winding_pattern = map(pattern_picker(slot_angles[n], phase_slice): slot_angles, repeat(phase_slice))
print("Behold! Your winding pattern sir: \n")
for slot in range(len(slots)):
(if (slot != len(slots)) then (print(winding_pattern[slot] + ", ")
else (print(winding_pattern[slot] + "... the end"))
I'll babble more about this later and potentially post some code which will actually calculate a winding pattern.
Edit: I tweaked the code upon realizing I made a few mistakes in the pattern picker funtion with regards to the variables being passed in as well as the definition of the phase number.
Current projects that have been happening/ happened are:
-A motor winding pattern generator for an arbitrary number of phases.
It was written in python and was made in a fairly awkward form, but I ended up deleting some of it in frustration while rewriting it.
Idea behind a pattern generator for a motor:
A permanent magnet motor consists of magnets and solenoids in some circular configuration. In order to produce torque the solenoids must be turned on when they are in the proper position. This is where the winding pattern generator comes in it creates the winding 'pattern' so that when voltage is applied to any particular phase of the motor each pole on that phase produces a force in the same direction this goes back to one of my last posts when I made a motor. This bring about babble of electrical angles which I talked about for a moment in this post. 2pi rads of electrical angle per pair of magnet poles (or you can think about it in degrees if you like), this gives a whole crap load of radians per motor but since our magnets are tessellate (positive pole up, then negative, then positive.....repeat) we really only care about how things line up within a single 2pi rads interval. So when talking about electrical angles it is useful to think of them as electrical angle mod(2pi), I kind of like to think of it as walking off the right edge of a TV screen and coming back on the left side.
This makes things easier to count and think about positionaly and bring up the question:
When do we actually want to turn on a phase?
And depending on what the goal iswant to do that answer can actually not be that straight forward. However in most cases you probably only care about getting maximum torque out of your motor. In order to produce the maximum amount of torque you want to turn your motor on when it is directly between the pole of two magnets.
This corresponds to an angle of either 0 or pi depending how you want to look at it. So how do you get all of your poles in one phase to produce torque in the same direction? By applying voltage to all of the poles in a certain interval at the same time. Ideally all of the poles in the phase would be at the same electrical angle when turned on. This ensures that they all push in the same direction. By defining a certain window of electrical degrees where sum((nth pole torque) for 0 to n poles)>0 at all times in that interval. i.e. the motor will always be pushing in the same direction.
This pattern can be calculated without too much work below is some fake code I wrote to calculate the winding pattern for an arbitrary phase motor of n even poles, and an arbitrary number of slots.
Please forgive the bastardization of code, it was really an organizational exercise to make sure the motor winder is written properly next time it gets written...hopefully this is not too nonsensical looking.
Psuedo code for motor winder:
#pretend the person already entered the number of poles, number of phases and number of slots(stator poles) and they make physical sense:
pole_num
phase_num
slot_num
#find the amount of electrical degrees to alot to each phase interval
#and the electrical degrees per slot
phase_slice = 180 / phase_num
slot_slice = pole_num * 180 /slot_num
#map the values out over all the slots and phases so you have each phase interval
#and the electrical and of each slot
slot_angles = map(lambda(n): (n * slot_slice) % 360): range(slot_num))
#phase intervals mapping not needed but good to look at sometimes to make sure everything makes sense
#phase_intervals = map(lambda(n): ( n * phase_slice) % 180): range(phase_num))
#this is the heart of the program it decides the phase number and the direction in which to wind each phase slot
defun pattern_picker (slot_angle[n], phase_slice)(
#makes and integer of each slot corresponding to the phase interval it lies on
phase = floor(slot_angle[n] % 180 /phase_slice)
#decides the direction of each slot winding on the stator
(if even?(slot_angles[n])
then (if (slot_angle[n] > 180)
then (case = "-") else(case = "+")))
(if odd?(slot_angles[n])
then (if (slot_angles[n] > 180)
then (case = "+") else(case = "-")))
#outputs the direction and phase for a given stator slot
return( string(case)+string(phase))
#gets the direction/phase for each slot
winding_pattern = map(pattern_picker(slot_angles[n], phase_slice): slot_angles, repeat(phase_slice))
print("Behold! Your winding pattern sir: \n")
for slot in range(len(slots)):
(if (slot != len(slots)) then (print(winding_pattern[slot] + ", ")
else (print(winding_pattern[slot] + "... the end"))
I'll babble more about this later and potentially post some code which will actually calculate a winding pattern.
Edit: I tweaked the code upon realizing I made a few mistakes in the pattern picker funtion with regards to the variables being passed in as well as the definition of the phase number.
2012-05-29
Long story short I got swallowed up this school year and not much got done on a projects front. It was really en escapade of screwing up in some respects from a project stand point which can be gotten into later.
Things that did happen:
-made a generator (read: BLDC motor) for a class, which was really a rework of an existing generator, really the only reason parts of the old generator were used was because its stator was the right dimensions. But its rotor was remade and the stator was rewound and hall effect sensors were added. It was rewound at 50RPM/V, the target was ~100RPM/V; but because I can't do math that didn't quite turn out. Pretty much lesson here is the average voltage of a rectified 3phase is not the same as the average value of a rectified sine wave... and don't do math at 3am. luckily in the. many thanks to alex and erich in helping getting the rotor machined.
Another project was a tool post holder for the lathe/mill combo thingy that was acquired a while ago. The 'millathe' is Maximat7 made in Austria god knows how long ago and probably weighs close to 75kg
Long story short there's been a good amount of fail in recent projects due to messing up details. Devils always is in the details but this leaves rooms for revisions and what not. Considering the pain it is to make boards I'll probably transition to getting boards fabricated by a third party and using a lot more surface mount components. DIL packages have been getting a bit old and clunky and it would be nice to have sexy well done boards with less errors than I would make.
Things that did happen:
-made a generator (read: BLDC motor) for a class, which was really a rework of an existing generator, really the only reason parts of the old generator were used was because its stator was the right dimensions. But its rotor was remade and the stator was rewound and hall effect sensors were added. It was rewound at 50RPM/V, the target was ~100RPM/V; but because I can't do math that didn't quite turn out. Pretty much lesson here is the average voltage of a rectified 3phase is not the same as the average value of a rectified sine wave... and don't do math at 3am. luckily in the. many thanks to alex and erich in helping getting the rotor machined.
| shiny insides |
| less shiny generator outsides |
| Stator before rewind |
| Stator after rewind/adding sensors |
| tool post sitting on tool post holder it looks like a zebra because the mill spindle wasn't level and i was too lazy to change it, I like to consider this a stylistic plus. |
the failgatedrivetroller was supposed to be a gate driver board for a 3 phase bridge
| failgatedrivecontroller has 2 mistakes: mirrored to arduino pinout and forgot the all important ground |
| The horrible mezzanine thing was made to swap the pinout of the arduino. |
Long story short there's been a good amount of fail in recent projects due to messing up details. Devils always is in the details but this leaves rooms for revisions and what not. Considering the pain it is to make boards I'll probably transition to getting boards fabricated by a third party and using a lot more surface mount components. DIL packages have been getting a bit old and clunky and it would be nice to have sexy well done boards with less errors than I would make.
Either way that's whats been happening over the lat few months and I'm going to start a new post to separate this post from a more technical one and shall be babbling about motors among other things.
Labels:
misc
2011-10-23
Things getting done: The beginning of Big Motor
I unfortunately have other things to do than post on the internet but I feel obligated to update this every once in a while so for the maybe one or two people who stumble here by accident so please sit down and enjoy the beginnings of Big Motor (the motor that will supersede small motor). For a scale reference on this motor the air gap OD is 10.5" and the magnets are doubled up to for super poles with 2 magnets per pole, making this a 30 pole 36 slot machine. The model isn't fully done yet, I'm still deciding if I want to attempt getting a second stator of the same type and doing a transverse flux concentrating geometry to avoid magnet reluctance. The attempted result would be a ridiculously high flux linkage and by ridiculous, that is to say something that would just almost saturate the iron with a few 2-5mm of air gap. The operating goal of this linkage would be 1. High torque for low current (hence avoiding magnet reluctance) 2. Avoiding higher harmonics of eddy current losses induced by quickly changing back emf from the magnets (taken care of by the larger air gap). Since these goals are directly at odds with one another some FEMM simulations will be under way to see how achievable this will be. Either way enjoy the picture its Big Motors initial design without any fancy pants transversefluxyness (note: the model isnt done yet).
![]() |
| Big Motor....its big |
Labels:
big motor
2011-10-03
Power Supply and Vehicle Update
I have been quite busy with school so I'm just going to post some pretty pictures of some of the progress made towards the electric vehicle and power supply. First off here is the transformer. Because I wanted to experiment it is made of a pair of toroids. It is litzed because this will be run at ~300kHz min making skin depth and eddy currents an issue. The turns ratio is 4:1 and its meant to operate at 120VRMS on the primary side drawing around 10A minimum.
| just the primary |
| with the secondary |
The wire is the same stuff used on my motor, its nice because the low gauge makes winding easy, however it has a gnarly polyamideimide coating with astoundingly good mechanical and electrical characteristics coating which much to my chagrin cannot be burned off in a solder pot or removed with standard solvents such as acetone. The easiest ways of removing the coating without a sketchy solvent seems to be sand paper (labor intensive) or propane (not the neatest). At the moment torching it is easiest despite the bits of semi scorched insulation it leaves behind. However to stop the thermal gradient from crawling up the wires and leaving a bunch of damaged insulation I recommend covering the wires in a wet paper towel up to where you want the insulation gone.
On the mechanical side of things I hacked apart a pair of bike frames to be used in the electric vehicle.
| Initial bike frame |
| A pair of bikes that were attacked by a sawzall |
....however work needs to get done so until next time.
2011-09-10
small motor completed with sensors
The small motor has been done for a few weeks now with hall effect sensors included. so here's a picture.
Looking back on the design its not half bad besides need for the mounting set up, next time the bearings will at least be flush with the motor face if not inset a bit. The next step in this project is to build a vehicle for this motor. I already have an idea in my head along the lines of a mini bike/ scooter, if you've ever seen The Worlds Fastest Indian this will will be a scooter more akin to the motorcycle in that movie rather than a normal bike where one sits more upright. In the mean time I have some bicycle frames to chop into usable tubing and some CADing to do. Also I have a couple side projects and random ideas to post about in the near future with include tranverse flux motors high power AC/DC converters.
Looking back on the design its not half bad besides need for the mounting set up, next time the bearings will at least be flush with the motor face if not inset a bit. The next step in this project is to build a vehicle for this motor. I already have an idea in my head along the lines of a mini bike/ scooter, if you've ever seen The Worlds Fastest Indian this will will be a scooter more akin to the motorcycle in that movie rather than a normal bike where one sits more upright. In the mean time I have some bicycle frames to chop into usable tubing and some CADing to do. Also I have a couple side projects and random ideas to post about in the near future with include tranverse flux motors high power AC/DC converters.
Labels:
Small motor
2011-08-20
hall effect sensors (yay) + less abominable sprocket mount
So as this is being written those hall effect sensors in my last post are drying in place on the stator with 3 poles in between each sensor woot, hopefully I'll post pictures of that soon enough or at least in a timely manner unlike every other post on here. Those hall effect sensors aren't the only thing happening though. I got my hands on an aluminum round ... more like an aluminum patty it was .5"thick x4"diam. These flat dimensions were ideal for making something well... much more flat to replace the last janky rig. This new sprocket adapter consists of a single aluminum flange with a bit of an inset and some small standoffs, the standoffs are only needed until I get some pan head screws to inset into the base of the flange rather than the current socket cap ones.
On the new flange there are only 3 slots for screws rather than six, six is really over kill. To mill these slots I was going to try a easy method of screwing a fat bolt through the middle of the plate and sticking it in a collet block. Unfortunately that didn't quit go as planned and the adapter lost a chunk out of the side.
Unfortunately the collet really needed to be cranked into the block and we were missing the proper spanner wrench to tighten it in there, as seen above the collet wasn't quite tight enough to hold that bolt. Thankfully the slotting worked just fine on an indexing head.
Despite having a bite out of the side it works just fine.
On the new flange there are only 3 slots for screws rather than six, six is really over kill. To mill these slots I was going to try a easy method of screwing a fat bolt through the middle of the plate and sticking it in a collet block. Unfortunately that didn't quit go as planned and the adapter lost a chunk out of the side.
Top and bottom before attempt with collet block.
| after indexing head and collet block |
| Sprocket adapter flangey thing from its good side |
Anyway hopefully this glue will dry soon so I can:
A. hopefully close this motor and never open it again until it dies a fiery death from over current.
B.post about it.
A. hopefully close this motor and never open it again until it dies a fiery death from over current.
B.post about it.
Labels:
Small motor
Subscribe to:
Posts (Atom)
