#include "foc/foc_config.h"
#include "foc/core/PI_Controller.h"
#include "foc/motor/motor_param.h"

static PI_Controller PI_Ctrl_ID = {
	//.kp = (CURRENT_BANDWITH * MOTOR_Ld),
	//.ki = (CURRENT_BANDWITH * MOTOR_R),
	//.kp = (CURRENT_BANDWITH * MOTOR_Ld),
	//.ki = (MOTOR_R/MOTOR_Ld),
	.max = (CONFIG_RATED_DC_VOL),
	.min = (-CONFIG_RATED_DC_VOL),
	.DT  = (1.0f/(float)CONFIG_IDQ_CTRL_TS),
	.Ui = 0,
};

static PI_Controller PI_Ctrl_IQ = {
	//.kp = (CURRENT_BANDWITH * MOTOR_Lq),
	//.ki = (CURRENT_BANDWITH * MOTOR_R),
	//.kp = (CURRENT_BANDWITH * MOTOR_Lq),
	//.ki = (MOTOR_R/MOTOR_Lq),
	.max = (CONFIG_RATED_DC_VOL),
	.min = (-CONFIG_RATED_DC_VOL),
	.DT  = (1.0f/(float)CONFIG_IDQ_CTRL_TS),
	.Ui = 0,
};

static PI_Controller PI_Ctrl_trq = {
	//.kp = 0.1f,
	//.ki = 0.5f,
	//.kb = 1.2f,
	.max = (0),
	.min = (0),
	.DT  = (1.0f/(float)CONFIG_SPD_CTRL_TS),
	.Ui = 0,
};

static PI_Controller PI_Ctrl_Spd = {
	//.kp = 0.1f,
	//.ki = 0.5f,
	//.kb = 1.2f,
	.max = (0),
	.min = (-0),
	.DT  = (1.0f/(float)CONFIG_SPD_CTRL_TS),
	.Ui = 0,
};


static PI_Controller PI_Ctrl_Power = {
	//.kp = (0.5f),
	//.ki = (100.0f),
	.max = (0),
	.min = 0,
	.DT  = (1.0f/(float)CONFIG_SPD_CTRL_TS),
	.Ui = 0,
};

static PI_Controller PI_Ctrl_lock = {
	//.kp = (0.0001f),
	//.ki = (0.01f),
	.max = (0),
	.min = (-0),
	.DT  = (1.0f/(float)CONFIG_SPD_CTRL_TS),
	.Ui = 0,
};

static PI_Controller PI_Ctrl_fw = {
	//.kp = (0.001f),
	//.ki = (0.003f),
	.max = (20),
	.min = (0),
	.DT  = (1.0f/(float)CONFIG_SPD_CTRL_TS),
	.Ui = 0,
};


