Инвертор запустился. Были перепутаны верхние и нижние ключи
This commit is contained in:
parent
a6023bbdcb
commit
8418069d9a
@ -292,11 +292,11 @@ void simple_scalar(int n_alg, int n_wind_pump,
|
||||
if (n_alg==2)
|
||||
mzz_zad_int = zad_intensiv_q(simple_scalar1.mzz_add_2, simple_scalar1.mzz_add_2, mzz_zad_int, mzz_zad);
|
||||
|
||||
// myq_temp = _IQdiv(mzz_zad, simple_scalar1.iq_mzz_max_for_fzad);
|
||||
myq_temp = _IQdiv(mzz_zad, simple_scalar1.iq_mzz_max_for_fzad);
|
||||
|
||||
// myq_temp = _IQmpy( myq_temp, fzad_add_max);
|
||||
myq_temp = _IQsat( myq_temp, simple_scalar1.fzad_add_max, 0);
|
||||
|
||||
// fzad_add = myq_temp;
|
||||
fzad_add = myq_temp;
|
||||
|
||||
|
||||
fzad_int = zad_intensiv_q(fzad_add, fzad_add, fzad_int, fzad);
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
#define FREQ_PWM 450 //800 /* ÷àñòîòà ØÈÌà */ //3138 // 2360//2477 //
|
||||
|
||||
#define DEF_PERIOD_MIN_MKS 80 //60 // áåðåì ìèíèìàëüíîå âðåìÿ ðàáîòû êëþ÷à = 2*TK_MIN_TIME_MKS = 30 ñ çàïàñîì
|
||||
#define DEF_PERIOD_MIN_MKS 0 //60 // áåðåì ìèíèìàëüíîå âðåìÿ ðàáîòû êëþ÷à = 2*TK_MIN_TIME_MKS = 30 ñ çàïàñîì
|
||||
// + TK_DEAD_TIME_MKS + 5mks çàïàñ = 60
|
||||
#define DEF_PERIOD_MIN_BR_XTICS 165
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
// раскомментировать, если есть сдвиг между обмотками ГЭД (30 град.)
|
||||
#define SHIFT
|
||||
|
||||
#define SIMULINK_SEQUENCE V_PWM24_PHASE_SEQ_REVERS_BAC
|
||||
#define SIMULINK_SEQUENCE V_PWM24_PHASE_SEQ_NORMAL_ABC
|
||||
/* V_PWM24_PHASE_SEQ_NORMAL_ABC, - не то
|
||||
V_PWM24_PHASE_SEQ_NORMAL_BCA, - похоже на правду
|
||||
V_PWM24_PHASE_SEQ_NORMAL_CAB, - жопа
|
||||
|
@ -31,8 +31,9 @@ void init28335(void) {
|
||||
//svgen_pwm24_1.phase_sequence = SIMULINK_SEQUENCE;
|
||||
//svgen_pwm24_2.phase_sequence = SIMULINK_SEQUENCE;
|
||||
|
||||
edrk.zadanie.iq_Izad = _IQ(0.5);
|
||||
edrk.disable_alg_u_disbalance = 1;
|
||||
edrk.zadanie.iq_Izad = _IQ(1);
|
||||
edrk.disable_alg_u_disbalance = 0;
|
||||
edrk.zadanie.iq_limit_power_zad = _IQ(1);
|
||||
//analog_zero.iqU_1 = 2048;
|
||||
//analog_zero.iqU_2 = 2048;
|
||||
} //void init28335(void)
|
||||
@ -79,17 +80,54 @@ void edrk_init_matlab(void)
|
||||
edrk.iq_bpsi_normal = _IQ(BPSI_NORMAL / NORMA_FROTOR);
|
||||
// edrk.iq_f_provorot = _IQ(F_PROVOROT/NORMA_FROTOR);
|
||||
|
||||
//init_simple_scalar();
|
||||
|
||||
//edrk.flag_enable_update_hmi = 1;
|
||||
|
||||
|
||||
|
||||
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);
|
||||
|
||||
init_simple_scalar();
|
||||
|
||||
edrk.flag_enable_update_hmi = 1;
|
||||
|
||||
|
||||
edrk.zadanie.ZadanieU_Charge = 2500;
|
||||
edrk.zadanie.iq_ZadanieU_Charge = _IQ(2500 / NORMA_ACP);
|
||||
edrk.temper_limit_koeffs.sum_limit = _IQ(1);
|
||||
simple_scalar1.fzad_add_max = _IQ(FZAD_ADD_MAX);
|
||||
edrk.Mode_ScalarVectorUFConst = ALG_MODE_SCALAR_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;
|
||||
|
||||
|
||||
}
|
||||
|
||||
void set_zadanie_u_charge_matlab(void)
|
||||
{
|
||||
|
||||
// edrk.ZadanieU_Charge = edrk.ZadanieU_Charge_RS;
|
||||
//edrk.ZadanieU_Charge = edrk.ZadanieU_Charge_RS;
|
||||
|
||||
// edrk.iq_ZadanieU_Charge = _IQ(edrk.ZadanieU_Charge/NORMA_ACP);
|
||||
//edrk.iq_ZadanieU_Charge = _IQ(edrk.ZadanieU_Charge/NORMA_ACP);
|
||||
|
||||
if (edrk.zadanie.ZadanieU_Charge<=100)
|
||||
{
|
||||
|
@ -56,26 +56,67 @@ void mcu_simulate_step(void)
|
||||
|
||||
calc_norm_ADC(0);
|
||||
|
||||
vectorControlConstId(edrk.zadanie.iq_power_zad_rmp, edrk.zadanie.iq_oborots_zad_hz_rmp,
|
||||
WRotorPBus.RotorDirection1, WRotor.iqWRotorCalcBeforeRegul1,
|
||||
edrk.Mode_ScalarVectorUFConst,
|
||||
edrk.MasterSlave, edrk.zadanie.iq_Izad, wd,
|
||||
edrk.master_theta, edrk.master_Iq, edrk.iq_power_kw_another_bs,
|
||||
&edrk.tetta_to_slave, &edrk.Iq_to_slave, &edrk.P_to_master,
|
||||
0, 0);
|
||||
|
||||
test_calc_vect_dq_pwm24_Ing(vect_control.iqTheta, vect_control.iqUdKm, vect_control.iqUqKm,
|
||||
edrk.disable_alg_u_disbalance,
|
||||
edrk.zadanie.iq_kplus_u_disbalance_rmp, edrk.zadanie.iq_k_u_disbalance_rmp,
|
||||
filter.iqU_1_fast, filter.iqU_2_fast,
|
||||
0,
|
||||
edrk.Uzad_max,
|
||||
edrk.MasterSlave,
|
||||
edrk.flag_second_PCH,
|
||||
&edrk.Kplus, &edrk.Uzad_to_slave);
|
||||
analog.PowerFOC = edrk.P_to_master;
|
||||
Fzad = vect_control.iqFstator;
|
||||
Izad_out = edrk.Iq_to_slave;
|
||||
if (edrk.Mode_ScalarVectorUFConst == ALG_MODE_SCALAR_OBOROTS || edrk.Mode_ScalarVectorUFConst == ALG_MODE_SCALAR_POWER)
|
||||
{
|
||||
#if(_ENABLE_PWM_LINES_FOR_TESTS_PWM)
|
||||
PWM_LINES_TK_20_ON;
|
||||
#endif
|
||||
simple_scalar(1, 0,
|
||||
WRotor.iqWRotorCalcBeforeRegul1, WRotor.iqWRotorCalcBeforeRegul1, edrk.zadanie.iq_oborots_zad_hz_rmp,
|
||||
edrk.temper_limit_koeffs.sum_limit,
|
||||
edrk.zadanie.iq_Izad_rmp, edrk.iq_bpsi_normal,
|
||||
analog.iqIm,
|
||||
// analog.iqU_1_long+analog.iqU_2_long,
|
||||
edrk.zadanie.iq_ZadanieU_Charge_rmp + edrk.zadanie.iq_ZadanieU_Charge_rmp,
|
||||
analog.iqIin_sum,
|
||||
edrk.zadanie.iq_power_zad_rmp, (filter.PowerScalar + edrk.iq_power_kw_another_bs),
|
||||
edrk.master_Izad, edrk.MasterSlave,
|
||||
&Fzad, &Uzad1, &Uzad2, &Izad_out);
|
||||
|
||||
test_calc_simple_dq_pwm24_Ing(Fzad, Uzad1, edrk.disable_alg_u_disbalance,
|
||||
edrk.zadanie.iq_kplus_u_disbalance, edrk.zadanie.iq_k_u_disbalance, filter.iqU_1_fast, filter.iqU_2_fast,
|
||||
0,
|
||||
edrk.Uzad_max,
|
||||
edrk.master_theta,
|
||||
Uzad1, //edrk.master_Uzad,
|
||||
edrk.MasterSlave,
|
||||
edrk.flag_second_PCH,
|
||||
&edrk.Kplus, &edrk.tetta_to_slave, &edrk.Uzad_to_slave);
|
||||
|
||||
} // end ALG_MODE_SCALAR
|
||||
else
|
||||
{
|
||||
if (edrk.flag_second_PCH == 0) {
|
||||
wd = uf_alg.winding_displacement_bs1;
|
||||
}
|
||||
else {
|
||||
wd = uf_alg.winding_displacement_bs2;
|
||||
}
|
||||
|
||||
analog_dq_calc_external(wd, uf_alg.tetta);
|
||||
|
||||
vectorControlConstId(edrk.zadanie.iq_power_zad_rmp, edrk.zadanie.iq_oborots_zad_hz_rmp,
|
||||
WRotorPBus.RotorDirection1, WRotor.iqWRotorCalcBeforeRegul1,
|
||||
edrk.Mode_ScalarVectorUFConst,
|
||||
edrk.MasterSlave, edrk.zadanie.iq_Izad, wd,
|
||||
edrk.master_theta, edrk.master_Iq, edrk.iq_power_kw_another_bs,
|
||||
&edrk.tetta_to_slave, &edrk.Iq_to_slave, &edrk.P_to_master,
|
||||
0, 0);
|
||||
|
||||
test_calc_vect_dq_pwm24_Ing(vect_control.iqTheta, vect_control.iqUdKm, vect_control.iqUqKm,
|
||||
edrk.disable_alg_u_disbalance,
|
||||
edrk.zadanie.iq_kplus_u_disbalance_rmp, edrk.zadanie.iq_k_u_disbalance_rmp,
|
||||
filter.iqU_1_fast, filter.iqU_2_fast,
|
||||
0,
|
||||
edrk.Uzad_max,
|
||||
edrk.MasterSlave,
|
||||
edrk.flag_second_PCH,
|
||||
&edrk.Kplus, &edrk.Uzad_to_slave);
|
||||
analog.PowerFOC = edrk.P_to_master;
|
||||
Fzad = vect_control.iqFstator;
|
||||
Izad_out = edrk.Iq_to_slave;
|
||||
}// end ALG_MODE_FOC
|
||||
|
||||
if (xpwm_time.one_or_two_interrupts_run == PWM_ONE_INTERRUPT_RUN)
|
||||
write_swgen_pwm_times(PWM_MODE_RELOAD_FORCE);
|
||||
|
@ -32,26 +32,42 @@ void readInputParameters(const real_T *u) {
|
||||
edrk.Go = u[nn++];
|
||||
|
||||
u[nn++];
|
||||
edrk.Mode_ScalarVectorUFConst = ALG_MODE_FOC_POWER;
|
||||
|
||||
edrk.zadanie.iq_power_zad = _IQ(0.5);
|
||||
edrk.zadanie.iq_oborots_zad_hz = _IQ(0.5);
|
||||
|
||||
edrk.MasterSlave = MODE_MASTER;
|
||||
edrk.master_theta;
|
||||
edrk.master_Iq;
|
||||
edrk.iq_power_kw_another_bs;
|
||||
edrk.tetta_to_slave;
|
||||
edrk.Iq_to_slave;
|
||||
edrk.P_to_master;
|
||||
|
||||
uf_alg.winding_displacement_bs1;
|
||||
} //void input_param(unsigned short num, unsigned short val)
|
||||
|
||||
|
||||
void writeOutputParameters(real_T* xD) {
|
||||
int nn = 0;
|
||||
|
||||
//xD[nn++] = t2sim.ciA;
|
||||
//xD[nn++] = t1sim.ciA;
|
||||
//xD[nn++] = t2sim.ciB;
|
||||
//xD[nn++] = t1sim.ciB;
|
||||
//
|
||||
//xD[nn++] = t4sim.ciA;
|
||||
//xD[nn++] = t3sim.ciA;
|
||||
//xD[nn++] = t4sim.ciB;
|
||||
//xD[nn++] = t3sim.ciB;
|
||||
//
|
||||
//xD[nn++] = t6sim.ciA;
|
||||
//xD[nn++] = t5sim.ciA;
|
||||
//xD[nn++] = t6sim.ciB;
|
||||
//xD[nn++] = t5sim.ciB;
|
||||
|
||||
//xD[nn++] = t1sim.ciB;
|
||||
//xD[nn++] = t2sim.ciB;
|
||||
//xD[nn++] = t1sim.ciA;
|
||||
//xD[nn++] = t2sim.ciA;
|
||||
|
||||
//xD[nn++] = t3sim.ciB;
|
||||
//xD[nn++] = t4sim.ciB;
|
||||
//xD[nn++] = t3sim.ciA;
|
||||
//xD[nn++] = t4sim.ciA;
|
||||
//
|
||||
//xD[nn++] = t5sim.ciB;
|
||||
//xD[nn++] = t6sim.ciB;
|
||||
//xD[nn++] = t5sim.ciA;
|
||||
//xD[nn++] = t6sim.ciA;
|
||||
|
||||
xD[nn++] = t1sim.ciA;
|
||||
xD[nn++] = t2sim.ciA;
|
||||
xD[nn++] = t1sim.ciB;
|
||||
|
@ -15,18 +15,18 @@ TimerSimHandle t12sim;
|
||||
|
||||
void Simulate_Timers(void)
|
||||
{
|
||||
SimulateMainPWM(&t1sim, xpwm_time.Ta0_0);
|
||||
SimulatePWM(&t2sim, xpwm_time.Ta0_1);
|
||||
SimulatePWM(&t3sim, xpwm_time.Tb0_0);
|
||||
SimulatePWM(&t4sim, xpwm_time.Tb0_1);
|
||||
SimulatePWM(&t5sim, xpwm_time.Tc0_0);
|
||||
SimulatePWM(&t6sim, xpwm_time.Tc0_1);
|
||||
SimulatePWM(&t7sim, xpwm_time.Ta1_0);
|
||||
SimulatePWM(&t8sim, xpwm_time.Ta1_1);
|
||||
SimulatePWM(&t9sim, xpwm_time.Tb1_0);
|
||||
SimulatePWM(&t10sim, xpwm_time.Tb1_1);
|
||||
SimulatePWM(&t11sim, xpwm_time.Tc1_0);
|
||||
SimulatePWM(&t12sim, xpwm_time.Tc1_1);
|
||||
SimulateMainPWM(&t1sim, xpwm_time.Ta0_1);
|
||||
SimulateSimplePWM(&t2sim, xpwm_time.Ta0_0);
|
||||
SimulateSimplePWM(&t3sim, xpwm_time.Tb0_1);
|
||||
SimulateSimplePWM(&t4sim, xpwm_time.Tb0_0);
|
||||
SimulateSimplePWM(&t5sim, xpwm_time.Tc0_1);
|
||||
SimulateSimplePWM(&t6sim, xpwm_time.Tc0_0);
|
||||
SimulateSimplePWM(&t7sim, xpwm_time.Ta1_1);
|
||||
SimulateSimplePWM(&t8sim, xpwm_time.Ta1_0);
|
||||
SimulateSimplePWM(&t9sim, xpwm_time.Tb1_1);
|
||||
SimulateSimplePWM(&t10sim, xpwm_time.Tb1_0);
|
||||
SimulateSimplePWM(&t11sim, xpwm_time.Tc1_1);
|
||||
SimulateSimplePWM(&t12sim, xpwm_time.Tc1_0);
|
||||
}
|
||||
|
||||
void Init_Timers(void)
|
||||
@ -52,12 +52,16 @@ void initSimulateTim(TimerSimHandle* tsim, int period, double step)
|
||||
{
|
||||
tsim->dtsim.stateDt = 1;
|
||||
tsim->TPr = period;
|
||||
tsim->TxCntPlus = step;
|
||||
tsim->TxCntPlus = step*2;
|
||||
tsim->dtsim.DtCntPeriod = (int)(DT / hmcu.SimSampleTime);
|
||||
}
|
||||
|
||||
void SimulateMainPWM(TimerSimHandle* tsim, int compare)
|
||||
{
|
||||
#ifdef UNITED_COUNTER
|
||||
tsim->tcntAuxPrev = tsim->tcntAux;
|
||||
tsim->tcntAux += tsim->TxCntPlus;
|
||||
#endif
|
||||
if (simulateTimAndGetCompare(tsim, compare))
|
||||
mcu_simulate_step();
|
||||
simulateActionActionQualifierSubmodule(tsim);
|
||||
@ -65,9 +69,9 @@ void SimulateMainPWM(TimerSimHandle* tsim, int compare)
|
||||
simulateTripZoneSubmodule(tsim);
|
||||
}
|
||||
|
||||
void SimulatePWM(TimerSimHandle* tsim, int compare)
|
||||
void SimulateSimplePWM(TimerSimHandle* tsim, int compare)
|
||||
{
|
||||
simulateTimAndGetCompare(tsim, compare);
|
||||
simulateTimAndGetCompare(tsim, compare, 0);
|
||||
simulateActionActionQualifierSubmodule(tsim);
|
||||
//tsim->ciA = tsim->dtsim.ciA_DT;
|
||||
//tsim->ciB = tsim->dtsim.ciB_DT;
|
||||
@ -76,11 +80,17 @@ void SimulatePWM(TimerSimHandle* tsim, int compare)
|
||||
}
|
||||
|
||||
|
||||
int simulateTimAndGetCompare(TimerSimHandle *tsim, int compare)
|
||||
int simulateTimAndGetCompare(TimerSimHandle* tsim, int compare)
|
||||
{
|
||||
int interruptflag = 0;
|
||||
|
||||
#ifdef UNITED_COUNTER
|
||||
tsim->tcntAuxPrev = t1sim.tcntAuxPrev;
|
||||
tsim->tcntAux = t1sim.tcntAux;
|
||||
#else
|
||||
tsim->tcntAuxPrev = tsim->tcntAux;
|
||||
tsim->tcntAux += tsim->TxCntPlus;
|
||||
#endif
|
||||
|
||||
if (tsim->tcntAux > tsim->TPr) {
|
||||
tsim->tcntAux -= tsim->TPr * 2.;
|
||||
|
@ -4,6 +4,8 @@
|
||||
#define PWM_SIM
|
||||
|
||||
|
||||
#define UNITED_COUNTER
|
||||
|
||||
// Äëÿ ìîäåëèðîâàíèÿ Event Manager
|
||||
// ... Dead-Band Submodule
|
||||
typedef struct
|
||||
@ -44,14 +46,13 @@ extern TimerSimHandle t11sim;
|
||||
extern TimerSimHandle t12sim;
|
||||
|
||||
|
||||
|
||||
void Simulate_Timers(void);
|
||||
void Init_Timers(void);
|
||||
|
||||
|
||||
void initSimulateTim(TimerSimHandle* tsim, int period, double step);
|
||||
void SimulateMainPWM(TimerSimHandle* tsim, int compare);
|
||||
void SimulatePWM(TimerSimHandle* tsim, int compare);
|
||||
void SimulateSimplePWM(TimerSimHandle* tsim, int compare);
|
||||
int simulateTimAndGetCompare(TimerSimHandle* tsim, int compare);
|
||||
void simulateActionActionQualifierSubmodule(TimerSimHandle* tsim);
|
||||
void simulateDeadBendSubmodule(TimerSimHandle* tsim);
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "xp_write_xpwm_time.h"
|
||||
#include "global_time.h"
|
||||
#include "PWMTools.h"
|
||||
#include "alg_simple_scalar.h"
|
||||
|
||||
#include <params.h>
|
||||
#include <params_alg.h>
|
||||
|
14
init.m
14
init.m
@ -27,17 +27,17 @@ NP = 0.08;
|
||||
|
||||
% номинальные величины ГЭД
|
||||
% ... мощность на валу, Вт
|
||||
Pnom = 6300e3;
|
||||
Pnom = 5000e3*2;
|
||||
% ... линейное напряжение, В (rms)
|
||||
Unom = 3300;
|
||||
Unom = 3000;
|
||||
% ... механическая скорость, об/мин
|
||||
NmNom = 180;
|
||||
NmNom = 165;
|
||||
% ... число пар полюсов
|
||||
Pp = 6;
|
||||
% ... коэффициент мощности
|
||||
CosFi = 0.87;
|
||||
% ... КПД
|
||||
Eff = 0.968;
|
||||
Eff = 0.962;
|
||||
% ... приведенный к валу момент инерции, кг*м^2
|
||||
J = 87e3*0.5;
|
||||
% ... полная мощность, ВА
|
||||
@ -62,8 +62,8 @@ Rs = 11.8e-3;%
|
||||
Xls = 72.7e-3;%72.7e-3;%Ом
|
||||
Rr = 11.1e-3*2.0;%*0.8;%Ом
|
||||
Xlr = 85.5e-3;%Ом
|
||||
Xm = 2.9322;%2.87;%Îì
|
||||
Fe = 18;%Ãö
|
||||
Xm = 2.87 * 1.5;%2.87;%Îì
|
||||
Fe = 12;%Ãö
|
||||
Lls = Xls/(Fe*PI2);%Гн
|
||||
Llr = Xlr/(Fe*PI2);%Гн
|
||||
Lm = Xm/(Fe*PI2);%Гн
|
||||
@ -71,7 +71,7 @@ Lm = Xm/(Fe*PI2);%
|
||||
% ёмкость на входе INU, Ф
|
||||
Cdc = 50e-3;
|
||||
% снаберы в INU
|
||||
Csn = Pnom/(1000*WeNom*Unom^2)/10;%Ô (0.5 - ò.ê. ïðåîáðàçîâàòåëåé äâà)
|
||||
Csn = Pnom/(1000*WeNom*Unom^2)/10*0.5;%Ô (0.5 - ò.ê. ïðåîáðàçîâàòåëåé äâà)
|
||||
Rsn = 2*Ts/Csn*10;%Ом
|
||||
|
||||
% постоянная времени фильтра для тока ГЭД, c
|
||||
|
BIN
inu_23550.slx
Normal file
BIN
inu_23550.slx
Normal file
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user