Razvalyaev
dde0a37088
#5 Векторное что-то считает, но: - без подключения к двигателю формируется вроде корректное трехуровневое напряжение. при подключении не всегда: - при порядке фаз CBA, BAC: более-менее синусный ток на втором ПЧ (на первом кривой синус) и трехуровневое напряжение - при порядке фаз ABC,: более-менее синусный ток на первом ПЧ (на втором кривой синус), но без трехуровнего напряжения (???) - при попытке векторного управления двигателем почему-то будто ограничена скважность и она менятся в очень небольшом диапазоне - скалярное в этой ветке не сделано еще
181 lines
6.6 KiB
C
181 lines
6.6 KiB
C
/**************************************************************************
|
|
Description: Ïîñëå çàãðóçêè ïðîöåññîðà ôóíêöèÿ âûçûâàåòñÿ îäèí ðàç
|
|
è èíèöèàëèçèðóåò óïðàâëÿþùèå ðåãèñòðû ïðîöåññîðà
|
|
TMS320F28335/TMS320F28379D.
|
|
|
|
Àâòîð: Óëèòîâñêèé Ä.È.
|
|
Äàòà ïîñëåäíåãî îáíîâëåíèÿ: 2021.10.04
|
|
**************************************************************************/
|
|
|
|
|
|
#include "init28335.h"
|
|
|
|
#define FREQ_TIMER_3 (FREQ_PWM*2)
|
|
|
|
void init28335(void) {
|
|
init_simple_scalar();
|
|
|
|
edrk.flag_second_PCH = 0;
|
|
|
|
edrk_init_variables_matlab();
|
|
init_global_time_struct(FREQ_TIMER_3);
|
|
|
|
Init_Adc_Variables();
|
|
|
|
svgen_pwm24_1.phase_sequence = SIMULINK_SEQUENCE;
|
|
svgen_pwm24_2.phase_sequence = SIMULINK_SEQUENCE;
|
|
|
|
edrk.zadanie.iq_Izad = _IQ(1);
|
|
edrk.disable_alg_u_disbalance = 1;
|
|
edrk.zadanie.iq_limit_power_zad = _IQ(1);
|
|
|
|
edrk.flag_enable_update_hmi = 1;
|
|
|
|
|
|
edrk.temper_limit_koeffs.sum_limit = _IQ(1);
|
|
simple_scalar1.fzad_add_max = _IQ(FZAD_ADD_MAX);
|
|
//edrk.Mode_ScalarVectorUFConst = ALG_MODE_SCALAR_POWER;
|
|
edrk.Mode_ScalarVectorUFConst = ALG_MODE_FOC_OBOROTS;
|
|
|
|
edrk.zadanie.iq_power_zad = _IQ(1);
|
|
edrk.zadanie.iq_oborots_zad_hz = _IQ(1);
|
|
|
|
edrk.MasterSlave = MODE_MASTER;
|
|
edrk.master_theta;
|
|
edrk.master_Iq;
|
|
edrk.iq_power_kw_another_bs = edrk.P_to_master;
|
|
edrk.tetta_to_slave;
|
|
edrk.Iq_to_slave;
|
|
edrk.P_to_master;
|
|
|
|
uf_alg.winding_displacement_bs1;
|
|
|
|
//edrk.zadanie.iq_set_break_level = _IQ(2500 / NORMA_ACP);
|
|
|
|
control_station.setup_time_detect_active[CONTROL_STATION_TERMINAL_RS232] = 50;
|
|
//analog_zero.iqU_1 = 2048;
|
|
//analog_zero.iqU_2 = 2048;
|
|
} //void init28335(void)
|
|
|
|
void edrk_init_variables_matlab(void)
|
|
{
|
|
|
|
initVectorControl();
|
|
InitXPWM(FREQ_PWM);
|
|
InitPWM_Variables(edrk.flag_second_PCH);
|
|
|
|
//#if(SENSOR_ALG==SENSOR_ALG_23550)
|
|
// rotorInit();
|
|
//#endif
|
|
//#if(SENSOR_ALG==SENSOR_ALG_22220)
|
|
// // 22220
|
|
// rotorInit_22220();
|
|
//#endif
|
|
|
|
control_station.clear(&control_station);
|
|
|
|
edrk_init_matlab();
|
|
|
|
|
|
init_ramp_all_zadanie();
|
|
init_all_limit_koeffs();
|
|
|
|
|
|
control_station.array_cmd[CONTROL_STATION_TERMINAL_RS232][CONTROL_STATION_CMD_SET_IZAD] = NOMINAL_SET_IZAD;
|
|
control_station.array_cmd[CONTROL_STATION_TERMINAL_RS232][CONTROL_STATION_CMD_SET_KM] = 0;
|
|
control_station.array_cmd[CONTROL_STATION_TERMINAL_RS232][CONTROL_STATION_CMD_SET_U_ZARYAD] = NOMINAL_U_ZARYAD;
|
|
control_station.array_cmd[CONTROL_STATION_TERMINAL_RS232][CONTROL_STATION_CMD_SET_K_U_DISBALANCE] = NOMINAL_SET_K_U_DISBALANCE;
|
|
control_station.array_cmd[CONTROL_STATION_TERMINAL_RS232][CONTROL_STATION_CMD_SET_K_PLUS_U_DISBALANCE] = 0;
|
|
control_station.array_cmd[CONTROL_STATION_TERMINAL_RS232][CONTROL_STATION_CMD_SET_LIMIT_POWER] = NOMINAL_SET_LIMIT_POWER;
|
|
control_station.array_cmd[CONTROL_STATION_TERMINAL_RS232][CONTROL_STATION_CMD_UFCONST_VECTOR] = 1;
|
|
control_station.array_cmd[CONTROL_STATION_TERMINAL_RS232][CONTROL_STATION_CMD_SCALAR_FOC] = 0;
|
|
control_station.array_cmd[CONTROL_STATION_TERMINAL_RS232][CONTROL_STATION_CMD_ENABLE_ON_CHARGE] = 0;
|
|
control_station.array_cmd[CONTROL_STATION_TERMINAL_RS232][CONTROL_STATION_CMD_GO] = 1;
|
|
|
|
control_station.array_cmd[CONTROL_STATION_TERMINAL_RS232][CONTROL_STATION_CMD_DISABLE_ON_PUMP] = 0;
|
|
control_station.array_cmd[CONTROL_STATION_TERMINAL_RS232][CONTROL_STATION_CMD_ENABLE_ON_CHARGE] = 0;
|
|
control_station.array_cmd[CONTROL_STATION_TERMINAL_RS232][CONTROL_STATION_CMD_DISABLE_ON_QTV] = 0;
|
|
control_station.array_cmd[CONTROL_STATION_TERMINAL_RS232][CONTROL_STATION_CMD_DISABLE_ON_UMP] = 0;
|
|
control_station.array_cmd[CONTROL_STATION_TERMINAL_RS232][CONTROL_STATION_CMD_MANUAL_DISCHARGE] = 0;
|
|
|
|
control_station.array_cmd[CONTROL_STATION_TERMINAL_RS232][CONTROL_STATION_CMD_ROTOR_POWER] = 0;
|
|
control_station.array_cmd[CONTROL_STATION_TERMINAL_RS232][CONTROL_STATION_CMD_DISABLE_INTERRUPT_SYNC] = 0;
|
|
control_station.array_cmd[CONTROL_STATION_TERMINAL_RS232][CONTROL_STATION_CMD_DISABLE_INTERRUPT_TIMER2] = 0;
|
|
control_station.array_cmd[CONTROL_STATION_TERMINAL_RS232][CONTROL_STATION_CMD_STOP_LOGS] = 0;
|
|
|
|
control_station.array_cmd[CONTROL_STATION_INGETEAM_PULT_RS485][CONTROL_STATION_CMD_SET_U_ZARYAD] = NOMINAL_U_ZARYAD;
|
|
control_station.array_cmd[CONTROL_STATION_MPU_SVU_CAN][CONTROL_STATION_CMD_SET_U_ZARYAD] = NOMINAL_U_ZARYAD;
|
|
|
|
control_station.array_cmd[CONTROL_STATION_TERMINAL_RS232][CONTROL_STATION_CMD_WDOG_OFF] = 0;
|
|
|
|
|
|
for (int i = 0; i < CONTROL_STATION_CMD_LAST; i++)
|
|
control_station.array_cmd[CONTROL_STATION_TERMINAL_CAN][i] = control_station.array_cmd[CONTROL_STATION_TERMINAL_RS232][i];
|
|
|
|
|
|
ramp_all_zadanie(2);
|
|
|
|
set_zadanie_u_charge_matlab();
|
|
init_Uin_rms();
|
|
}
|
|
|
|
void edrk_init_matlab(void)
|
|
{
|
|
|
|
edrk.Uzad_max = _IQ(K_STATOR_MAX); // ìàêñ àìïëèòóäà â Êì äëÿ ìèíèìàëüíîãî èìïóëüñà = DEF_PERIOD_MIN_MKS
|
|
edrk.iq_bpsi_normal = _IQ(BPSI_NORMAL / NORMA_FROTOR);
|
|
// edrk.iq_bpsi_max = _IQ(BPSI_MAXIMAL/NORMA_FROTOR);
|
|
// edrk.iq_f_provorot = _IQ(F_PROVOROT/NORMA_FROTOR);
|
|
|
|
edrk.flag_enable_update_hmi = 1;
|
|
|
|
|
|
edrk.zadanie.ZadanieU_Charge = NOMINAL_U_ZARYAD;
|
|
edrk.zadanie.iq_ZadanieU_Charge = _IQ(NOMINAL_U_ZARYAD / NORMA_ACP);
|
|
|
|
edrk.zadanie.iq_set_break_level = _IQ(NOMINAL_U_BREAK_LEVEL / NORMA_ACP);
|
|
|
|
control_station.setup_time_detect_active[CONTROL_STATION_TERMINAL_RS232] = 50;
|
|
}
|
|
|
|
void set_zadanie_u_charge_matlab(void)
|
|
{
|
|
|
|
// edrk.ZadanieU_Charge = edrk.ZadanieU_Charge_RS;
|
|
|
|
// edrk.iq_ZadanieU_Charge = _IQ(edrk.ZadanieU_Charge/NORMA_ACP);
|
|
|
|
if (edrk.zadanie.ZadanieU_Charge <= 100)
|
|
{
|
|
edrk.iqMIN_U_ZPT = _IQ(-50.0 / NORMA_ACP);
|
|
edrk.iqMIN_U_IN = _IQ(-50.0 / NORMA_ACP);
|
|
}
|
|
else
|
|
{
|
|
|
|
edrk.iqMIN_U_ZPT = _IQ(edrk.zadanie.ZadanieU_Charge * MIN_U_PROC / NORMA_ACP);
|
|
edrk.iqMIN_U_IN = _IQ(edrk.zadanie.ZadanieU_Charge * MIN_U_PROC / NORMA_ACP);
|
|
|
|
}
|
|
|
|
if (edrk.zadanie.ZadanieU_Charge < LEVEL_DETECT_U_SMALL)
|
|
{
|
|
edrk.iqMAX_U_ZPT_Predzaryad = _IQ(edrk.zadanie.ZadanieU_Charge * MAX_U_PROC_SMALL / NORMA_ACP);
|
|
edrk.iqMAX_U_ZPT_Global = edrk.iqMAX_U_ZPT_Predzaryad + _IQ(ADD_U_MAX_GLOBAL_SMALL / NORMA_ACP); // +500V
|
|
|
|
}
|
|
else
|
|
{
|
|
edrk.iqMAX_U_ZPT_Predzaryad = _IQ(edrk.zadanie.ZadanieU_Charge * MAX_U_PROC / NORMA_ACP);
|
|
edrk.iqMAX_U_ZPT_Global = edrk.iqMAX_U_ZPT_Predzaryad + _IQ(ADD_U_MAX_GLOBAL / NORMA_ACP); // +200V
|
|
|
|
if (edrk.iqMAX_U_ZPT_Global > U_D_MAX_ERROR_GLOBAL)
|
|
edrk.iqMAX_U_ZPT_Global = U_D_MAX_ERROR_GLOBAL;
|
|
}
|
|
|
|
edrk.iqMAX_U_ZPT = edrk.iqMAX_U_ZPT_Global;//_IQ(edrk.zadanie.ZadanieU_Charge*MAX_U_PROC/NORMA_ACP);
|
|
edrk.iqMAX_U_IN = _IQ(edrk.zadanie.ZadanieU_Charge * MAX_U_PROC / NORMA_ACP);
|
|
|
|
edrk.zadanie.iq_set_break_level = _IQ(NOMINAL_U_BREAK_LEVEL / NORMA_ACP);
|
|
|
|
} |