Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: Optimize/Optimize.cpp
- Revision:
- 38:07cb4ae6c1bd
- Parent:
- 37:ba7ebf4f8a78
- Child:
- 39:80b38a8e1787
--- a/Optimize/Optimize.cpp Sun Nov 27 11:36:54 2016 +0000
+++ b/Optimize/Optimize.cpp Tue Nov 29 00:31:18 2016 +0000
@@ -2,6 +2,7 @@
#include "config_motor.h"
#include "Optimize.h"
+#include "MathHelpers.h"
#include "optimize_constants.h"
void get_mtpa_dq(float tau, float *d, float *q) {
@@ -29,7 +30,7 @@
}
void get_mtpa_is_dq(float is, float *d, float *q) {
- *d = (-FLUX_LINKAGE + sqrtf(FLUX_LINKAGE * FLUX_LINKAGE + 8 * (Ld - Lq) * (Ld - Lq) * is * is)) / (4.f * (Ld - Lq));
+ *d = (-FLUX_LINKAGE + sqrtf(PSI2 + 8 * Lx * Lx * is * is)) / (4.f * Lx);
*q = sqrtf(is * is - *d * *d);
}
@@ -41,14 +42,4 @@
else {
return s0 + s1 * (tau - TAU0);
}
-}
-
-float acbrt(float x0) {
- union { int ix; float x; };
-
- x = x0; // x can be viewed as int.
- ix = 0x2a5137a0 + ix / 3; // Initial guess.
- x = 0.33333333f*(2.0f*x + x0 / (x * x)); // Newton step.
-
- return x;
}
\ No newline at end of file