robot

Dependencies:   FastPWM3 mbed

config_loop.h

Committer:
bwang
Date:
2017-05-04
Revision:
152:6877dceec871
Parent:
150:08c13bfc7417
Child:
153:8a1f9888f003
Child:
154:0a22dcf91577

File content as of revision 152:6877dceec871:

#ifndef __CONFIG_LOOP_H
#define __CONFIG_LOOP_H

#include "config_inverter.h"

#define K_LOOP_D 0.75f
#define KI_BASE_D 0.025f

#define K_LOOP_Q 1.75f
#define KI_BASE_Q 0.01f

#define F_SLOW_LOOP 50.0f

#define INTEGRAL_MAX 1.0f

/*filter strengths, 0-1.0
  higher = stronger filtering*/
#define W_FILTER_STRENGTH 0.90f
#define DQ_FILTER_STRENGTH 0.80f
#define THROTTLE_FILTER_STRENGTH 0.0f

#define THROTTLE_FILTER_WINDOW 7
#define W_FILTER_WINDOW 3

/*internally computed*/
#define KP_D (K_LOOP_D / BUS_VOLTAGE / MODULATION_MAX)
#define KI_D (KI_BASE_D * K_LOOP_D / BUS_VOLTAGE * 5000.0f / F_SW / MODULATION_MAX)

#define KP_Q (K_LOOP_Q / BUS_VOLTAGE / MODULATION_MAX)
#define KI_Q (KI_BASE_Q * K_LOOP_Q / BUS_VOLTAGE * 5000.0f / F_SW / MODULATION_MAX)

#define SLOW_LOOP_COUNTER ((int) (F_SW / F_SLOW_LOOP))

#endif