flash based config testing

Dependencies:   mbed

Committer:
bwang
Date:
Wed Mar 01 00:52:47 2017 +0000
Revision:
0:941e150e78b6
first commit, reading/writing of config arrays works

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bwang 0:941e150e78b6 1 #ifndef __CONFIG_LOOP_H
bwang 0:941e150e78b6 2 #define __CONFIG_LOOP_H
bwang 0:941e150e78b6 3
bwang 0:941e150e78b6 4 #include "config_inverter.h"
bwang 0:941e150e78b6 5
bwang 0:941e150e78b6 6 #define K_LOOP_D 2.5f
bwang 0:941e150e78b6 7 #define KI_BASE_D 0.025f
bwang 0:941e150e78b6 8
bwang 0:941e150e78b6 9 #define K_LOOP_Q 6.0f
bwang 0:941e150e78b6 10 #define KI_BASE_Q 0.01f
bwang 0:941e150e78b6 11
bwang 0:941e150e78b6 12 #define F_SLOW_LOOP 100.0f
bwang 0:941e150e78b6 13
bwang 0:941e150e78b6 14 #define INTEGRAL_MAX 1.0f
bwang 0:941e150e78b6 15
bwang 0:941e150e78b6 16 /*filter strengths, 0-1.0
bwang 0:941e150e78b6 17 higher = stronger filtering*/
bwang 0:941e150e78b6 18 #define W_FILTER_STRENGTH 0.99f
bwang 0:941e150e78b6 19 #define DQ_FILTER_STRENGTH 0.95f
bwang 0:941e150e78b6 20 #define THROTTLE_FILTER_STRENGTH 0.0f
bwang 0:941e150e78b6 21
bwang 0:941e150e78b6 22
bwang 0:941e150e78b6 23 /*internally computed*/
bwang 0:941e150e78b6 24 #define KP_D (K_LOOP_D / BUS_VOLTAGE)
bwang 0:941e150e78b6 25 #define KI_D (KI_BASE_D * K_LOOP_D / BUS_VOLTAGE * 5000.0f / F_SW)
bwang 0:941e150e78b6 26
bwang 0:941e150e78b6 27 #define KP_Q (K_LOOP_Q / BUS_VOLTAGE)
bwang 0:941e150e78b6 28 #define KI_Q (KI_BASE_Q * K_LOOP_Q / BUS_VOLTAGE * 5000.0f / F_SW)
bwang 0:941e150e78b6 29
bwang 0:941e150e78b6 30 #define SLOW_LOOP_COUNTER ((int) (F_SW / F_SLOW_LOOP))
bwang 0:941e150e78b6 31
bwang 0:941e150e78b6 32 #endif