Razvalyaev
45beae3740
- почему-то будто ограничена скважность и она менятся в очень небольшом диапазоне- второй ПЧ делает работает почему-то хуже при обоих управлениях - синусоиды при векторном в целом ровнее, чем при скалярном
118 lines
2.6 KiB
C
118 lines
2.6 KiB
C
/**************************************************************************
|
|
Description: Ôóíêöèè äëÿ ïðè¸ìà è âûäà÷è ïàðàìåòðîâ.
|
|
|
|
Àâòîð: Óëèòîâñêèé Ä.È.
|
|
Äàòà ïîñëåäíåãî îáíîâëåíèÿ: 2021.11.08
|
|
**************************************************************************/
|
|
|
|
#include "param.h"
|
|
#include "pwm_sim.h"
|
|
|
|
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;
|
|
|
|
// Èçìåíÿåò çíà÷åíèå ïàðàìåòðà
|
|
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.iqWRotorCalcBeforeRegul1 = _IQ(u[nn++] / PI2 / NORMA_FROTOR);
|
|
|
|
u[nn++];
|
|
|
|
edrk.Go = u[nn++];
|
|
|
|
u[nn++];
|
|
} //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;
|
|
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;
|
|
|
|
// Òîëüêî äëÿ ïðîñìîòðà
|
|
xD[nn++] = xpwm_time.Ta0_0;
|
|
xD[nn++] = xpwm_time.Ta0_1;
|
|
xD[nn++] = xpwm_time.Ta1_0;
|
|
xD[nn++] = xpwm_time.Ta1_1;
|
|
|
|
xD[nn++] = xpwm_time.Tb0_0;
|
|
xD[nn++] = xpwm_time.Tb0_1;
|
|
xD[nn++] = xpwm_time.Tb1_0;
|
|
xD[nn++] = xpwm_time.Tb1_1;
|
|
|
|
xD[nn++] = xpwm_time.Tc0_0;
|
|
xD[nn++] = xpwm_time.Tc0_1;
|
|
xD[nn++] = xpwm_time.Tc1_0;
|
|
xD[nn++] = xpwm_time.Tc1_1;
|
|
|
|
} |