robot

Dependencies:   FastPWM3 mbed

config_loop.h

Committer:
bwang
Date:
2017-01-25
Revision:
52:fd3d8df99287
Parent:
44:3fd6a43b91f0
Child:
56:c681001dfa46

File content as of revision 52:fd3d8df99287:

#ifndef __CONFIG_LOOP_H
#define __CONFIG_LOOP_H

#include "config_inverter.h"

#define K_LOOP 1.0f
#define KI_BASE 0.01f

#define F_SLOW_LOOP 100.0f

#define INTEGRAL_MAX 1.0f

/*integral decay, fraction per switching cycle*/
#define INTEGRAL_DECAY 0.0005f

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

/*internally computed*/
#define KP (K_LOOP / BUS_VOLTAGE * 5000.0f / F_SW)
#define KI (KI_BASE * K_LOOP / BUS_VOLTAGE * 5000.0f / F_SW)
#define SLOW_LOOP_COUNTER ((int) (F_SW / F_SLOW_LOOP))

#endif