2025-01-13 16:58:59 +03:00
|
|
|
|
/**************************************************************************
|
|
|
|
|
Description: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|
|
|
|
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>.<EFBFBD>.
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 2021.11.08
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "param.h"
|
2025-01-15 11:01:26 +03:00
|
|
|
|
#include "pwm_sim.h"
|
2025-01-13 16:58:59 +03:00
|
|
|
|
|
|
|
|
|
int Unites[UNIT_QUA_UNITS][UNIT_LEN];
|
|
|
|
|
int CAN_timeout[UNIT_QUA];
|
|
|
|
|
RS_DATA_STRUCT rs_a = RS_DATA_STRUCT_DEFAULT, rs_b = RS_DATA_STRUCT_DEFAULT;
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void readInputParameters(const real_T *u) {
|
|
|
|
|
int nn = 0;
|
|
|
|
|
|
|
|
|
|
iq_norm_ADC[0][0] = _IQ(u[nn++]/NORMA_ACP);
|
|
|
|
|
iq_norm_ADC[0][1] = _IQ(u[nn++]/NORMA_ACP);
|
|
|
|
|
iq_norm_ADC[0][2] = _IQ(u[nn++]/NORMA_ACP);
|
|
|
|
|
iq_norm_ADC[0][3] = _IQ(u[nn++]/NORMA_ACP);
|
|
|
|
|
iq_norm_ADC[0][4] = _IQ(u[nn++]/NORMA_ACP);
|
|
|
|
|
iq_norm_ADC[0][5] = _IQ(u[nn++]/NORMA_ACP);
|
|
|
|
|
iq_norm_ADC[0][6] = _IQ(u[nn++]/NORMA_ACP);
|
|
|
|
|
iq_norm_ADC[0][7] = _IQ(u[nn++]/NORMA_ACP);
|
|
|
|
|
|
|
|
|
|
WRotor.iqWRotorSumFilter = _IQ(u[nn++] / PI2 / NORMA_FROTOR);
|
|
|
|
|
|
|
|
|
|
u[nn++];
|
|
|
|
|
|
|
|
|
|
edrk.Go = u[nn++];
|
|
|
|
|
|
|
|
|
|
u[nn++];
|
2025-01-15 11:01:26 +03:00
|
|
|
|
edrk.Mode_ScalarVectorUFConst = ALG_MODE_FOC_POWER;
|
2025-01-13 16:58:59 +03:00
|
|
|
|
|
2025-01-14 18:41:34 +03:00
|
|
|
|
edrk.zadanie.iq_power_zad = _IQ(0.5);
|
|
|
|
|
edrk.zadanie.iq_oborots_zad_hz = _IQ(0.5);
|
2025-01-13 16:58:59 +03:00
|
|
|
|
|
|
|
|
|
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) {
|
2025-01-14 13:26:48 +03:00
|
|
|
|
int nn = 0;
|
|
|
|
|
|
|
|
|
|
xD[nn++] = t1sim.ciA;
|
|
|
|
|
xD[nn++] = t2sim.ciA;
|
|
|
|
|
xD[nn++] = t1sim.ciB;
|
|
|
|
|
xD[nn++] = t2sim.ciB;
|
|
|
|
|
|
|
|
|
|
xD[nn++] = t3sim.ciA;
|
|
|
|
|
xD[nn++] = t4sim.ciA;
|
|
|
|
|
xD[nn++] = t3sim.ciB;
|
|
|
|
|
xD[nn++] = t4sim.ciB;
|
|
|
|
|
|
|
|
|
|
xD[nn++] = t5sim.ciA;
|
|
|
|
|
xD[nn++] = t6sim.ciA;
|
|
|
|
|
xD[nn++] = t5sim.ciB;
|
|
|
|
|
xD[nn++] = t6sim.ciB;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
xD[nn++] = t7sim.ciA;
|
|
|
|
|
xD[nn++] = t8sim.ciA;
|
|
|
|
|
xD[nn++] = t7sim.ciB;
|
|
|
|
|
xD[nn++] = t8sim.ciB;
|
|
|
|
|
|
|
|
|
|
xD[nn++] = t9sim.ciA;
|
|
|
|
|
xD[nn++] = t10sim.ciA;
|
|
|
|
|
xD[nn++] = t9sim.ciB;
|
|
|
|
|
xD[nn++] = t10sim.ciB;
|
|
|
|
|
|
|
|
|
|
xD[nn++] = t11sim.ciA;
|
|
|
|
|
xD[nn++] = t12sim.ciA;
|
|
|
|
|
xD[nn++] = t11sim.ciB;
|
|
|
|
|
xD[nn++] = t12sim.ciB;
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2025-01-14 16:36:57 +03:00
|
|
|
|
xD[nn++] = xpwm_time.Ta0_0;
|
|
|
|
|
xD[nn++] = xpwm_time.Ta0_1;
|
|
|
|
|
xD[nn++] = xpwm_time.Tb0_0;
|
|
|
|
|
xD[nn++] = xpwm_time.Tb0_1;
|
|
|
|
|
xD[nn++] = xpwm_time.Tc0_0;
|
|
|
|
|
xD[nn++] = xpwm_time.Tc0_1;
|
2025-01-14 13:26:48 +03:00
|
|
|
|
|
2025-01-14 16:36:57 +03:00
|
|
|
|
xD[nn++] = _IQtoF(edrk.Iq_to_slave);
|
|
|
|
|
xD[nn++] = _IQtoF(WRotor.iqWRotorSumFilter);
|
2025-01-14 13:26:48 +03:00
|
|
|
|
xD[nn++] = 0;
|
|
|
|
|
xD[nn++] = 0;
|
|
|
|
|
|
2025-01-14 16:36:57 +03:00
|
|
|
|
xD[nn++] = _IQtoF(WRotor.iqWRotorSumFilter);
|
2025-01-14 13:26:48 +03:00
|
|
|
|
|
2025-01-13 16:58:59 +03:00
|
|
|
|
}
|