Alight sin/cos encoder of motenergy motor with SEVCON

General Discussion about large electric scooters and motorcycles and other things with no pedals.
Post Reply
User avatar
sanfox
10 µW
10 µW
Posts: 5
Joined: Mar 27, 2015 12:14 am

Alight sin/cos encoder of motenergy motor with SEVCON

Post by sanfox » Jun 01, 2017 8:14 am

I try to make instruction “How to alight sin/cos encoder of motenergy motor with of without SEVCON”.
Information collected from different sources. Guys, who have deal with it, please confirm this information or correct it.
At the picture below you can see encoder location inside of the ME1302 motor.
motor.JPG
motor.JPG (76.52 KiB) Viewed 477 times
So to tune the encoder we must go thru several steps.

1. Mechanical alignment by measuring values with oscilloscope.

Note from motenergy drawing below.
“Sensor timing: with BEMF oscilloscope probe attached to M1 and ground probe attached to M2, the BEMF rising edge zero cross should lead the sin wave (sensor pin A to sensor pin C gnd) zero cross by 20 electrical degrees of the BEMF waveform.”

As the rotor has 8 magnets (4 pole pares) by one rotation of rotor we have four electrical rotations of BEMF. So the 20 electrical degrees of the BEMF equal to 5 degrees of rotor rotation. That is not so simple to hit this value. At the graphs below you can see waves comparison in two scales of x – axis.
GRAPH1.JPG
GRAPH1.JPG (64.77 KiB) Viewed 95 times
GRAPH2.JPG
GRAPH2.JPG (66.68 KiB) Viewed 95 times
Using home made oscilloscope attached to soundcard line in measuring waves looks like this.
Oscilloscope.JPG
Oscilloscope.JPG (93.45 KiB) Viewed 95 times
Connection of soundcard oscilloscope to the motor showed below.
connection to motor.jpg
(153.35 KiB) Downloaded 5 times
2. PMAC encoder commission by Sevcon DVT macros.

a) Set peak torque to 0.0 Nm – this should prevent torque being applied to the motor during testing and alignment. This is only necessary if your setup allows you to rotate your motor by another means i.e dynamometer. If this is not possible and you will use the Gen 4 to spin up the motor then leave this set to its current value.
Peak torque.JPG
Peak torque.JPG (27.37 KiB) Viewed 95 times
b) Commission Sin Cos Encoder (Check of sinusoidal curve amlitudes )

1). Turn the controller off then on again.
2). Spin the motor with manual power (hand spin the motor).
3). After spinning – use the helper and bring up “pmac encoder”
encoder commision.JPG
encoder commision.JPG (49.29 KiB) Viewed 95 times
4). Click “commission sincos encoder”.
5). Turn the controller off then on again.
6). Check sine and cosine peak and trough voltages:
- Peak voltages should not exceed 4.5 Volts.
- Trough voltages should not descend below 500 mV.
- Peak to trough swing on sine and cosine should exceed 1.0 Volts.
3. Adjusting the encoder offset

Note from motenergy drawing:
“If timing the sensor using a Sevcon controller, the encoder position should be within +/-3 degrees of zero.”
1). Verify that peak torque is still set to zero.
2). Ensure that Ud and Uq values are being monitored via a TPDO.
UdUq.JPG
UdUq.JPG (53.36 KiB) Viewed 95 times
3). If the previous steps were performed correctly, you should now see the Ud and Uq items being monitored
UdUq_log.JPG
UdUq_log.JPG (73.67 KiB) Viewed 477 times
You can now specify a “Filename” (bottom right of the screen capture), while preserving the .csv extension and you are ready to take a trace using the control buttons at the top of the window. Press the “Reset” button (looks like a rewind button), followed by the “Start trace” button (looks like a play button) to start a new trace.
1) AT THIS POINT YOU ARE READY TO TAKE A TRACE
2) In order to be able to read the Ud and Uq values accurately, you need to turn the electric motor externally (using a power drill for example, or the vehicle’s own inertia). If possible to use some external power to turn the motor, then you can start a trace as explained above and collect the information (use the “Stop trace” button – looks more like a pause button). If that is not possible, then you can drive the motor using our Gen4 controller and when reaching full speed, select neutral or remove motoring torque to the Gen4 controller and start a trace as the motor starts to decelerate. Note: You must have 0 neutral braking set and the bridge still enabled to successfully trace this,
3) Once the trace was stopped (it is automatically saved in the “C:\C6944\DVT\veh_if_log” folder), you can use the built in utility (“PMAC Encoder” button on the main page of the DVT Helper) to look at the offset angle.
Graph voltage vector.JPG
Graph voltage vector.JPG (75.2 KiB) Viewed 95 times
4) Click on the “Graph Voltage Vectors” button in the “PMAC Encoder Alignment” window and you will be prompted to select the trace file you collected in the previous steps. Once you select the appropriate file, you will see a new window that shows the encoder alignment. In the screen capture above, the encoder is slightly misaligned (you see the graph points form a bar tilted slightly to the left of the Y axis). To correct the encoder alignment, pick a point in the middle of that bar made of multiple points and click the mouse on it). You will see an alignment value display in the textbox below the graph. Press the “Subtract Calculated Angle from Offset” button to commit the new alignment value to the Gen4 controller.
5) Recycle power to the Gen4 controller key switch and repeat the test to verify that the encoder is properly aligned. If the motor is spinning in the forward direction, a well aligned encoder will produce a bar that is positive and along the Y axis in the graph above.
3250 km in hybrid mode
My car discription at http://www.evalbum.com/5316

User avatar
methods
10 GW
10 GW
Posts: 4976
Joined: Aug 08, 2008 12:08 pm
Location: Santa Cruz CA
Contact:

Re: Alight sin/cos encoder of motenergy motor with SEVCON

Post by methods » Jun 01, 2017 10:13 am

OMG... this is solid gold.

Thank you for taking the time to post this!
This is very valuable information for those attempting to get up and running. I am going to cross-link it with some other Sevcon related material.

thanks,
-methods
"One test is worth a thousand opinions"

User avatar
sanfox
10 µW
10 µW
Posts: 5
Joined: Mar 27, 2015 12:14 am

Re: Alight sin/cos encoder of motenergy motor with SEVCON

Post by sanfox » Jun 02, 2017 1:51 am

Encoder angle from voltage vectors
During forward rotation, points without field weakening must locates on the Ud axis or a little to the left of it. When the field weakening starts, points begin moving further to the left.
So a properly configured encoder will prevent voltage in quadrant 1!
Ud Uq axes.JPG
Ud Uq axes.JPG (34.07 KiB) Viewed 464 times
Maximising the Output Efficiency

Making small changes to the offset angle of only one degree at a time is a good way to see how the alignment of the encoder affects the efficiency of the motor. The above method does not provide an exact encoder offset value. This is due to a cross coupling effect where it is normal for some q-axis current to be seen on the d-axis and vice versa, even for a perfectly aligned motor. However, by keeping a constant torque demand and monitoring the motor speed instead, you can get a better idea of what adjustments should be made to the offset.
Remember, the main objective here is to get maximum motor output for a given input. Keep the torque demand constant and perform more adjustments to the offset angle. You should find that for different offsets, the motor speed will stabilize at different values. It may take a while for the speed to level out, but with some experimentation you should be able to find a more accurate offset value.
You can graph the voltage vectors to double check the encoder angle after using this technique.

This process slightly reminds for me an ignition distributor tuning at idling speed alignment on internal combustion engine.
3250 km in hybrid mode
My car discription at http://www.evalbum.com/5316

User avatar
methods
10 GW
10 GW
Posts: 4976
Joined: Aug 08, 2008 12:08 pm
Location: Santa Cruz CA
Contact:

Re: Alight sin/cos encoder of motenergy motor with SEVCON

Post by methods » Sep 24, 2017 11:02 am

Back to the top...

Since we have a member with only 4 posts who clearly described a way to solve a tough problem that a lot of us run into....

At Calfee Design we use an automated calibration station that works by measuring freewheel power while adjusting timing to converge on the correct setting.

At Motenergy they clock the magnets using a jig... so every one is the same.
For Early Zero motors the magnets are randomly set and require both angular clocking and amplitude (depth)
For later Zero motors (and Motenergy) the amplitude is solved with a better chip.
No idea if later model Zero motors still require clocking...

But we are seeing a lot of these in the field, DVT is tough to use, and this should help bound the problem.

Rumors are there is some software out there that Zero Dealers use to calibrate the Encoder while the bike is fully assembled.
Super useful ah?

I am desperately hungry to refactor some of the tools I have seen (written in Python) (over to) LabVIEW... but my days of running 100 - 1000 hour projects for free are over. I have to work to eat, so I focus on what pays... then I have kids... startup companies... and of course big wave season is coming.

-methods
"One test is worth a thousand opinions"

SkateScepterGuy
1 mW
1 mW
Posts: 14
Joined: Jan 04, 2015 1:48 pm

Re: Alight sin/cos encoder of motenergy motor with SEVCON

Post by SkateScepterGuy » Nov 14, 2017 2:39 pm

Sanfox, thanks for posting this. VERY helpful in setting up the encoder angle. I was able to get mine set up though oddly enough when I had it set "properly" with 0 degrees of offset my motor would make a weird grind / groaning noise on moderate to hard acceleration. With several butt dyno test rides I found a happy medium of 6 degrees offset where the motor seemed to work fine, was close to 0 but wouldn't make any noises or controller cut off on hard acceleration.

Unfortunately, I always get this fault message. 0x46c2 "Sincosin Tracking Warn". Even if I have the encoder offset set perfectly on the vertical line.

Any ideas what would cause this?

User avatar
sanfox
10 µW
10 µW
Posts: 5
Joined: Mar 27, 2015 12:14 am

Re: Alight sin/cos encoder of motenergy motor with SEVCON

Post by sanfox » Nov 20, 2017 6:32 am

I thihk that the warning means sin/cos voltage values is out of normal commission range.
sincos mistake.JPG
(80.99 KiB) Not downloaded yet
3250 km in hybrid mode
My car discription at http://www.evalbum.com/5316

Post Reply