Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define, implement and test a calibration procedure for setting the required PWM offsets #96

Open
nunoguedelha opened this issue Aug 30, 2019 · 5 comments

Comments

@nunoguedelha
Copy link
Contributor

nunoguedelha commented Aug 30, 2019

After analysis in https://github.com/dic-iit/element_torque-control-via-current/issues/59, we concluded that the motor quadratic current oscillations depending on the rotor position were due to the current offsets measured on the stator terminals (phases), while the digital PWM values computed by the inverse Clark-Park transform have no offsets, and are phase shifted by 120 degrees as expected. The offsets could be measured also on the oscilloscope. As the HES/ADC offsets had already been compensated, the current measurements offsets are solely due to the duty-cycle offsets in the PWM voltages generated by the MOSFET Bridge transistors driving the three phases of the stator.

We define and design here a procedure strategy for identifying and compensating those offsets:

  • at the startup phase of the 2FOC driver,
  • after the HES/ADC output offsets have been compensated.

Assumed pre-compensation of the HES/ADC output offsets

We consider that the HES/ADC offsets, mostly due to magnetic hysteresis in the HES core, and eventually by a not perfectly centered ADC output with respect to the full range of voltage inputs coming from the HES output (ex: IU1-RA0, IW1-RA1).

So we assume here that for a 0 A real current going through the HES sensor (pins PX1, PZ1), i.e. PWM is set to off on all phases, the current measurement on terminal A or C will return 0 A (a call to MeasAndCompIaIcCalculateIb() will set ParkParm.qIa and ParkParm.qIc to 0).

Compensation of the PWM offsets

It is important to distinguish the HES/ADC offsets from the PWM offsets for the following reasons:

  • The duty-cycle offsets in the PWM voltages generated by the MOSFET Bridge transistors result in real current offsets that cannot be compensated by a calibration of the HES/ADC measurement chain.
  • We expect the HES/ADC offsets to drift over the sensor temperature, while the PWM offsets should be stable. If the later also drift, they would probably have a drift rate different from the the HES/ADC drift, requiring different compensation solution.

Proposed compensation approach

As the instantaneous voltage on the floating central point of the windings "star" topology is not always zero Volts, any adjustment on one of the stator phases will impact the current on the other phases, which makes it very difficult to tune the PWM offsets in a configuration PWM_a = PWM_b = PWM_c = 50% (PDC1 = PDC2 = PDC3 = PWM_50_DUTY_CYCLE).

One possible approach is to calibrate the phase PWM offsets phase by phase...

We can prove that if all the three offsets PWM_a, PWM_b and PWM_c are equal, they create an homopolar field, but do not create quadrature current nor direct current oscillations ((so no torque ripple either) when applying the Clark-Park transform.

In these conditions, we consider one of the PWM voltages as the reference, and tune the other two relatively to the that reference:

  • We choose for instance the terminal B PWM_b as the reference, setting PDC2 = 50% and keeping that fixed value.
  • We set PWM_a to 50%, PWM_c to OFF, then tune PWM_a for obtaining Ia = 0.
  • We set PWM_c to 50%, PWM_a to OFF, then tune PWM_c for obtaining Ic = 0.
@nunoguedelha
Copy link
Contributor Author

@ale-git @marcoaccame

@ale-git
Copy link
Contributor

ale-git commented Sep 3, 2019

@nunoguedelha I tried to compensate both A and C PWMs with a single calibration, but it didn't work, probably because of the mutual influence. So I think that the separate calibration that you propose is more promising. It is easy to separate the double calibration of the test firmware in two single calibrations.

@ale-git
Copy link
Contributor

ale-git commented Sep 3, 2019

@nunoguedelha let's discuss it in the afternoon as planned.

@nunoguedelha
Copy link
Contributor Author

Thanks @ale-git . I won't be able to come to IIT, but we can chat on skype or telegram as you prefer.

@ale-git
Copy link
Contributor

ale-git commented Sep 6, 2019

@nunoguedelha @marcoaccame

I implemented a PWM calibration procedure (step 2 in the following calibrations list):

step 1) current calibration (as usual): with PWM off the current on phases A and C is measured as the average of 1000 readings and the values are used as current offset.

step 2) with C phase "disconnected" (transistors off) and B phase 50%, A is adjusted until Ia = 0 current is measured. Then phase A is disconnected and phase C is adjusted until Ic = 0 current is measured.

step 3) phase B is disconnected and phase A is given a PWM increment above 50%, and Ic is given a PWM decrement under 50% to generate a current. With B disconnetced Ia must be physically equal to -Ic, so the current sensing gains Ka and Kc are adjusted so that Ia = -Ic.

Step 1 and 3 are working fine, but step 2) gives different offset results for each calibration. The following plots depict the effect of the PWM calibration: a further current oscillation on a electrical cycle. The interesting thing, worthy of further study, is that the noise amplitude is well position dependent, as if the noise on phase A and C sums up for certain positions and cancels for others.

No offset calibration:

NoPWMcomp

Offset calibration:

PWMcomp

I will be back on 16 Sep.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants