Bayley Wang / foc-ed_in_the_bot_compact

robot

Dependencies:   FastPWM3 mbed

config_loop.h

Committer:
bwang
Date:
3 weeks ago
Revision:
155:7c6005933d4c
Parent:
152:6877dceec871
Child:
157:a9b2002994d5

File content as of revision 155:7c6005933d4c:

#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 DQ_FILTER_STRENGTH 0.80f

/*windows for median filtering*/
#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