Частота вентилятора понижена до 1 кГц
This commit is contained in:
parent
7a214b1304
commit
d007cf4c89
Binary file not shown.
@ -23,6 +23,7 @@ uint32_t EPwmTimerIntCount[17];
|
||||
uint16_t EPwm_DB_Direction[17];
|
||||
volatile uint16_t PwmBrake100 = PERIOD_BRAKE;
|
||||
volatile uint16_t PwmMotor100 = PERIOD_MOTOR;
|
||||
volatile uint16_t PwmFan100 = PERIOD_FAN;// от 20 до 100% регулировать
|
||||
|
||||
|
||||
|
||||
@ -70,7 +71,7 @@ void PWMAllInit(void)
|
||||
PWMInit(PWM_B, PwmMotor100, COMPLIMENTARY);//<2F><><EFBFBD>
|
||||
PWMInit(PWM_C, PwmMotor100, COMPLIMENTARY);//<2F><><EFBFBD>
|
||||
PWMInit(PWM_BRAKE, PwmBrake100, INDEPENDED);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
PWMInit(3, PwmMotor100, INDEPENDED);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
PWMInit(3, PwmFan100, INDEPENDED);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
//11 <20> 12 <20><><EFBFBD> SDFM
|
||||
PWMInit(11, PwmMotor100, INDEPENDED);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* pwm_init.h
|
||||
*
|
||||
* Created on: 21 àâã. 2023 ã.
|
||||
* Created on: 21 <EFBFBD><EFBFBD><EFBFBD>. 2023 <EFBFBD>.
|
||||
* Author: seklyuts
|
||||
*/
|
||||
#include "f28x_project.h"
|
||||
@ -15,6 +15,10 @@
|
||||
#define FREQUENCY_BRAKE 200000.0 //Hz
|
||||
#define FREQUENCY_MOTOR 10000.0 //Hz
|
||||
#define EPWM_DB_mkS 3.0 //mkS
|
||||
#define FREQUENCY_FAN 1000.0 //Hz
|
||||
|
||||
|
||||
#define PERIOD_FAN (SYS_PWM_FREQUENCY/2.0/FREQUENCY_FAN)
|
||||
|
||||
#define PERIOD_BRAKE (SYS_PWM_FREQUENCY/2.0/FREQUENCY_BRAKE) //Tic
|
||||
#define PERIOD_MOTOR (SYS_PWM_FREQUENCY/2.0/FREQUENCY_MOTOR) //Tic
|
||||
|
@ -15,6 +15,8 @@ volatile uint16_t counter2=0 ;
|
||||
volatile uint16_t Rele=0;
|
||||
volatile uint16_t testMode = 0;
|
||||
|
||||
//uint16_t PWM_Vent1;
|
||||
|
||||
void frmmstr_run(void)
|
||||
{
|
||||
static uint16_t diod = 0;
|
||||
@ -52,5 +54,6 @@ static uint16_t diod = 0;
|
||||
FMSTR_Recorder();
|
||||
FMSTREnableClr();
|
||||
Gpio95out(Rele);
|
||||
// EPwm3Regs.CMPA.bit.CMPA = PWM_Vent1;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* vector.c
|
||||
*
|
||||
* Created on: 20 <EFBFBD><EFBFBD><EFBFBD><EFBFBD>. 2023 <EFBFBD>.
|
||||
* Created on: 20 сент. 2023 г.
|
||||
* Author: seklyuts
|
||||
*/
|
||||
|
||||
@ -23,9 +23,9 @@
|
||||
#define IMAX (IMAX_A*BIT_MAX/FACTOR_CURRENT_MOTOR_A)
|
||||
|
||||
typedef struct {
|
||||
int16_t Value16in; //
|
||||
int16_t Value16filtered; //
|
||||
int32_t Value32; //
|
||||
int16_t Value16in; // Нефильрованное значение
|
||||
int16_t Value16filtered; // Фильрованное значение
|
||||
int32_t Value32; // Конечное напряжение тренировки
|
||||
int16_t ShiftFilter; // Filters
|
||||
} Filtered;
|
||||
|
||||
@ -145,7 +145,7 @@ void vectorInitCurrLoop(void)
|
||||
|
||||
CurrLoop.piId.Ref = 0; // Input: reference set-point
|
||||
CurrLoop.piId.Fbk = 0; // Input: feedback
|
||||
CurrLoop.piId.uCorr = 0; // Input: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
CurrLoop.piId.uCorr = 0; // Input: Коррекция выхода, для устранения перекретных связей
|
||||
CurrLoop.piId.Out = 0; // Output: controller output
|
||||
CurrLoop.piId.Kp = PI_REG_I_PROPOR; // Parameter: proportional loop gain
|
||||
CurrLoop.piId.Ki = PI_REG_I_INTEGR; // Parameter: integral gain
|
||||
@ -159,7 +159,7 @@ void vectorInitCurrLoop(void)
|
||||
|
||||
CurrLoop.piIq.Ref = 0; // Input: reference set-point
|
||||
CurrLoop.piIq.Fbk = 0; // Input: feedback
|
||||
CurrLoop.piIq.uCorr = 0; // Input: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
CurrLoop.piIq.uCorr = 0; // Input: Коррекция выхода, для устранения перекретных связей
|
||||
CurrLoop.piIq.Out = 0; // Output: controller output
|
||||
CurrLoop.piIq.Kp = PI_REG_I_PROPOR; // Parameter: proportional loop gain
|
||||
CurrLoop.piIq.Ki = PI_REG_I_INTEGR; // Parameter: integral gain
|
||||
@ -174,13 +174,13 @@ void vectorInitCurrLoop(void)
|
||||
void vectorResCurrLoop(void)
|
||||
{
|
||||
CurrLoop.piId.Ref = 0; // Input: reference set-point
|
||||
CurrLoop.piId.uCorr = 0; // Input: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
CurrLoop.piId.uCorr = 0; // Input: Коррекция выхода, для устранения перекретных связей
|
||||
CurrLoop.piId.Out = 0; // Output: controller output
|
||||
CurrLoop.piId.v1 = 0; // Data: pre-saturated controller output
|
||||
CurrLoop.piId.i1 = 0; // Data: integrator storage: ui(k-1)
|
||||
|
||||
CurrLoop.piIq.Ref = 0; // Input: reference set-point
|
||||
CurrLoop.piIq.uCorr = 0; // Input: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
CurrLoop.piIq.uCorr = 0; // Input: Коррекция выхода, для устранения перекретных связей
|
||||
CurrLoop.piIq.Out = 0; // Output: controller output
|
||||
CurrLoop.piIq.v1 = 0; // Data: pre-saturated controller output
|
||||
CurrLoop.piIq.i1 = 0; // Data: integrator storage: ui(k-1)
|
||||
@ -250,14 +250,14 @@ void vector_klark_park(uint16_t SectorOn, int16_t CurrentA, int16_t CurrentB, in
|
||||
|
||||
/* if (Inputs->UpdateUdc)
|
||||
{
|
||||
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Udc <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Umax <20> Umin <20> <20><>-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
//Запоминаем Udc для контура тока(ограничение Umax и Umin в ПИ-регуляторе)
|
||||
Outputs->Udc = PmsmVect.UdcFilter.Output;
|
||||
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> 0 <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
//Защита от деления на 0 и отрицательных чисел
|
||||
if (Outputs->Udc <= 0.0f)
|
||||
Outputs->Udc = VOLTAGE_UDC;
|
||||
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>(<28><><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
//Расчет коэффициента для расчета скважности ШИМ(один раз делим, потом каждый цикл ШИМ умножаем, это эффективнее)
|
||||
PmsmVect.UdcPwmFactor = 1.0f/Outputs->Udc;
|
||||
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
//Сброс флага
|
||||
Inputs->UpdateUdc = false;
|
||||
}*/
|
||||
|
||||
@ -292,7 +292,7 @@ void vector_klark_park(uint16_t SectorOn, int16_t CurrentA, int16_t CurrentB, in
|
||||
vectorIabc.c = (float)CurrentC * FactorCurrent;
|
||||
}
|
||||
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
// преобразование Кларк
|
||||
|
||||
vectorI2ph.Alfa = vectorIabc.a;
|
||||
vectorI2ph.Beta = _IQmpy((vectorIabc.a +_IQmpy2(vectorIabc.b)),_IQ(ONEbySQRT3)); //vectorI2ph.Beta = _IQmpy((vectorIabc.b - vectorIabc.c),_IQ(ONEbySQRT3));
|
||||
@ -303,7 +303,7 @@ void vector_klark_park(uint16_t SectorOn, int16_t CurrentA, int16_t CurrentB, in
|
||||
vectorSinCos.sin = ((float)sin_int)/32768.0;
|
||||
vectorSinCos.cos = ((float)cos_int)/32768.0;
|
||||
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
// преобразование Парка
|
||||
vectorIdq.d = _IQmpy(vectorI2ph.Alfa,vectorSinCos.cos) + _IQmpy(vectorI2ph.Beta,vectorSinCos.sin);
|
||||
vectorIdq.q = _IQmpy(vectorI2ph.Beta,vectorSinCos.cos) - _IQmpy(vectorI2ph.Alfa,vectorSinCos.sin);
|
||||
|
||||
@ -312,7 +312,7 @@ void vector_klark_park(uint16_t SectorOn, int16_t CurrentA, int16_t CurrentB, in
|
||||
// AngleErr = Angle_test - vectorSinCos.Angle;
|
||||
|
||||
|
||||
// CurrLoop.piIq.Ref = Inputs->IqRef;//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// CurrLoop.piIq.Ref = Inputs->IqRef;//Заданное
|
||||
|
||||
if (FABS(CurrLoop.piIq.Ref) > CurrLoop.CurrentLimit)
|
||||
{
|
||||
@ -328,7 +328,7 @@ void vector_klark_park(uint16_t SectorOn, int16_t CurrentA, int16_t CurrentB, in
|
||||
// CurrLoop.piId.Umax = CurrLoop.piIq.Umax = Inputs->Udc;
|
||||
// CurrLoop.piId.Umin = CurrLoop.piIq.Umin = -CurrLoop.piIq.Umax;
|
||||
#ifdef UCORR_ENABLE
|
||||
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
//Перекрестные связи
|
||||
float Velectr = VFbk * CurrLoop.VelElectrFactor;
|
||||
CurrLoop.piId.uCorr = Velectr * CurrLoop.PhaseInduct * CurrLoop.piIq.Fbk;
|
||||
CurrLoop.piIq.uCorr = -Velectr * (CurrLoop.FluxLinkage + CurrLoop.PhaseInduct * CurrLoop.piId.Fbk);
|
||||
@ -348,7 +348,7 @@ void vector_klark_park(uint16_t SectorOn, int16_t CurrentA, int16_t CurrentB, in
|
||||
PI_MACRO(CurrLoop.piIq);
|
||||
PI_MACRO(CurrLoop.piId);
|
||||
|
||||
/*<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Uq <20> Ud*/
|
||||
/*Пропорциональное ограничение напряжений Uq и Ud*/
|
||||
// Test1 = my_sqrtf(Test2);
|
||||
|
||||
|
||||
@ -356,7 +356,7 @@ void vector_klark_park(uint16_t SectorOn, int16_t CurrentA, int16_t CurrentB, in
|
||||
|
||||
|
||||
|
||||
if (Ulim > UmaxVolt)// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if (Ulim > UmaxVolt)// максимальное напряжение в вольтах
|
||||
{
|
||||
if(Ulim > ZERO_LVL)
|
||||
{
|
||||
@ -402,7 +402,7 @@ float my_sqrtf(float x)
|
||||
return x * x0;
|
||||
}
|
||||
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// Фильтр сигнала
|
||||
int16_t Filter(int16_t inValue, Filtered *Struct) {
|
||||
(*Struct).Value16in = inValue;
|
||||
(*Struct).Value32+=(int32_t)((*Struct).Value16in)-(int32_t)((*Struct).Value16filtered);
|
||||
|
Loading…
Reference in New Issue
Block a user