matlab_23550/Inu/app_wrapper/app_io.c
Razvalyaev 20a0a62cc8 #3 Переструктурирован проект, начата работа над улучшением модуля ШИМ (open #4)
- Папка app_wrapper содержит модули для управления приложением МК: инициализция, входы/выходы, вызов функций приложения

- Папка xilinx_wrapper содержит модули для имитации xilinx (на будущее, хочу вытащить в отдельные sfunction)

- Папка Src содержит исходный код приложения МК

- В корне Inu файлы для запуска приложения (модулей app_wrapper) и run_bat для компиляции sfunction
2025-01-17 10:19:40 +03:00

118 lines
2.6 KiB
C

/**************************************************************************
Description: Ôóíêöèè äëÿ ïðè¸ìà è âûäà÷è ïàðàìåòðîâ.
Àâòîð: Óëèòîâñêèé Ä.È.
Äàòà ïîñëåäíåãî îáíîâëåíèÿ: 2021.11.08
**************************************************************************/
#include "app_io.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;
}