robot

Dependencies:   FastPWM3 mbed

Committer:
bwang
Date:
Tue Nov 13 17:46:23 2018 +0000
Revision:
252:38644631ed97
Parent:
240:2aaffa217627
11/13/2018 12:45 - hitting <return> on empty line prints "\r>", so that hitting enter after intially connecting to the controller generates a prompt

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bwang 185:5c102874b490 1 /*
bwang 185:5c102874b490 2 *derived macros for the controller
bwang 185:5c102874b490 3 *don't change these unless you know what you're doing!
bwang 185:5c102874b490 4 */
bwang 185:5c102874b490 5
bwang 185:5c102874b490 6 #ifndef __DERIVED_H
bwang 185:5c102874b490 7 #define __DERIVED_H
bwang 185:5c102874b490 8
bwang 196:7172e6e28867 9 #include "hardware.h"
bwang 189:760cd81a7633 10 #include "prefs.h"
bwang 185:5c102874b490 11
bwang 189:760cd81a7633 12 /*max modulation depth at which inverter is still linear*/
bwang 185:5c102874b490 13 #define LINEAR_MODULATION_MAX (2.f * LINEAR_DTC_MAX - 1.f)
bwang 185:5c102874b490 14
bwang 185:5c102874b490 15 /*internally computed loop parameters*/
bwang 190:01674f19f9ce 16 #define KP_D (_K_LOOP_D / _BUS_VOLTAGE / LINEAR_MODULATION_MAX)
bwang 190:01674f19f9ce 17 #define KI_D (_KI_BASE_D * _K_LOOP_D / _BUS_VOLTAGE * 5000.0f / _F_SW / LINEAR_MODULATION_MAX)
bwang 185:5c102874b490 18
bwang 190:01674f19f9ce 19 #define KP_Q (_K_LOOP_Q / _BUS_VOLTAGE / LINEAR_MODULATION_MAX)
bwang 190:01674f19f9ce 20 #define KI_Q (_KI_BASE_Q * _K_LOOP_Q / _BUS_VOLTAGE * 5000.0f / _F_SW / LINEAR_MODULATION_MAX)
bwang 185:5c102874b490 21
bwang 240:2aaffa217627 22 #define KP_W (_K_LOOP_W)
bwang 240:2aaffa217627 23 #define KI_W (_KI_BASE_W * _K_LOOP_W * 5000.0f / _F_SW)
bwang 240:2aaffa217627 24
bwang 189:760cd81a7633 25 #define SLOW_LOOP_COUNTER ((int) (_F_SW / _F_SLOW_LOOP))
bwang 185:5c102874b490 26
bwang 185:5c102874b490 27 #endif