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.
AnalyticOptimize/optimize_constants.h
- Committer:
- bwang
- Date:
- 2016-12-12
- Revision:
- 40:22aede3d096f
- Parent:
- Optimize/optimize_constants.h@ 32:b31423041c4e
File content as of revision 40:22aede3d096f:
#ifndef __CONFIG_OPTIMIZE
#define __CONFIG_OPTIMIZE
#include "config_motor.h"
#include <math.h>
/*
* Precomputed constants for analytic IPM optimization
*/
#define Lx (Ld-Lq)
#define Lx2 (Lx * Lx)
#define Lx3 (Lx2 * Lx)
#define Lx4 (Lx2 * Lx2)
#define Lx6 (Lx2 * Lx4)
#define P2 (POLE_PAIRS * POLE_PAIRS)
#define P3 (POLE_PAIRS * P2)
#define P4 (P2 * P2)
#define P6 (P4 * P2)
#define P8 (P4 * P4)
#define PSI2 (FLUX_LINKAGE * FLUX_LINKAGE)
#define PSI4 (PSI2 * PSI2)
#define PSI8 (PSI4 * PSI4)
#define K1 (27.f * Lx2 * P4 * PSI2)
#define K2 (243.f * 3.f * Lx4 * P8 * PSI4)
#define K3 (1024.f * 3.f * Lx6 * P6)
#define K1_13 (powf(K1, 1.f / 3))
#define K3_13 (14.537f * Lx2 * P2) //K3^(1/3)
#define SQRTK3 (-55.426f * Lx3 * P3)
#define cA (-8.80514f)
#define cB (0.605707f / (Lx2 * P2))
#define cC (2.93505f)
#define cD (-0.201902f / (Lx2 * P2))
#define cE (2.3094f * FLUX_LINKAGE / (Lx2 * POLE_PAIRS))
#define c0 (1.25992f)
#define c2 (0.4424414f * Lx2 / (P2 * PSI4))
#define c4 (-0.6214814f * Lx4 / (P4 * PSI8))
#define TAU0 (K1 / SQRTK3)
#define s0 (1.3415f * K1 / K3_13)
#define s1 (-3.81274f * Lx * POLE_PAIRS)
#define cU (-0.2887f)
#define cV (0.5f)
#define cF (0.25f * Lq/(Ld * Lq-Ld * Ld) * FLUX_LINKAGE)
#define cG (FLUX_LINKAGE / Ld)
#define cH (1 / (Ld * Ld))
#define cI (0.25f * FLUX_LINKAGE / (Lq - Ld))
#endif