Merged in raiden00/nuttx (pull request #668)

Master

* libdsp: initial commit

* libdsp: cosmetics

* stm32f334-disco/buckboost: use a PID controller from libdsp

* stm32_adc.h: fix typo

* stm32_dac.c: set OUTEN bit for DAC1CH2 and DAC2CH1

* stm32_hrtim: cosmetic changes

* power/motor: direction parameter is now int8 + add overload fault

* libdsp: all floats with f-sufix

    libdsp: add precision option for library

    libdsp: add debug option for library and assertions in functions

    libdsp: add current samples correction for SVM3

    libds: add some motor control specific functions

    libdsp: add basic speed observer

    libdsp: fix phase shift in SMO observer

    libdsp: add more logic to FOC

    config/sim/dsptest: add dsptest configuration

* libdsp/lib_motor.c: remove unused comparation

* libdsp/lib_observer.c: update some comments

Approved-by: GregoryN <gnutt@nuttx.org>
This commit is contained in:
Mateusz Szafoni
2018-07-07 17:04:57 +00:00
committed by GregoryN
parent 3cd1ccfa48
commit 8416d9a966
17 changed files with 1507 additions and 179 deletions
+15 -1
View File
@@ -72,6 +72,9 @@
void clarke_transform(FAR abc_frame_t *abc,
FAR ab_frame_t *ab)
{
DEBUGASSERT(abc != NULL);
DEBUGASSERT(ab != NULL);
ab->a = abc->a;
ab->b = ONE_BY_SQRT3_F*abc->a + TWO_BY_SQRT3_F*abc->b;
}
@@ -94,10 +97,13 @@ void clarke_transform(FAR abc_frame_t *abc,
void inv_clarke_transform(FAR ab_frame_t *ab,
FAR abc_frame_t *abc)
{
DEBUGASSERT(ab != NULL);
DEBUGASSERT(abc != NULL);
/* Assume non-power-invariant transform and balanced system */
abc->a = ab->a;
abc->b = -ab->a/2 + SQRT3_BY_TWO_F*ab->b;
abc->b = -0.5f*ab->a + SQRT3_BY_TWO_F*ab->b;
abc->c = -abc->a - abc->b;
}
@@ -121,6 +127,10 @@ void park_transform(FAR phase_angle_t *angle,
FAR ab_frame_t *ab,
FAR dq_frame_t *dq)
{
DEBUGASSERT(angle != NULL);
DEBUGASSERT(ab != NULL);
DEBUGASSERT(dq != NULL);
dq->d = angle->cos * ab->a + angle->sin * ab->b;
dq->q = angle->cos * ab->b - angle->sin * ab->a;
}
@@ -145,6 +155,10 @@ void inv_park_transform(FAR phase_angle_t *angle,
FAR dq_frame_t *dq,
FAR ab_frame_t *ab)
{
DEBUGASSERT(angle != NULL);
DEBUGASSERT(dq != NULL);
DEBUGASSERT(ab != NULL);
ab->a = angle->cos * dq->d - angle->sin * dq->q;
ab->b = angle->cos * dq->q + angle->sin * dq->d;
}