MotorControlModuleSDFM_TMS3.../Projects/EFC_Communication/UMLibrary/driver/InverterSync.cpp
2024-06-07 11:12:56 +03:00

46 lines
1.6 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*!\file
* \brief \todo Описание файла.
*/
/*
* InverterSync.cpp
*
* Created on: 19 июн. 2019 г.
* Author: titov
*/
#include "InverterSync.hh"
driver::InverterSync::InverterSync(peripheral::IPwm & u, peripheral::IPwm & v,
peripheral::IPwm & w,
driver::IDiscreteOutput & pulse) : Inverter( u, v, w, pulse ) {}
void driver::InverterSync::pwm( float Ta, float Tb, float Tc ) {
if( checkTime( Ta ) and checkTime( Tb ) and checkTime( Tc ) ) {
//core::CriticalSection cs_0;
phase_u.setThreshold( TxToTreshold( _Ta = Ta ) );
phase_v.setThreshold( TxToTreshold( _Tb = Tb ) );
phase_w.setThreshold( TxToTreshold( _Tc = Tc ) );
} else {
phase_u.setThreshold( TxToTreshold( _Ta = 0 ) );
phase_v.setThreshold( TxToTreshold( _Tb = 0 ) );
phase_w.setThreshold( TxToTreshold( _Tc = 0 ) );
}
if( pulse_enable ) { // Если необходимо включить импульсы,
phase_u.enableOutput(); // то включаем импульсы, так как
phase_v.enableOutput(); // новая правильная уставка уже записана.
phase_w.enableOutput();
pulse_enable = false; // Оставляем флаг что не нужно включать импульсы.
pulse_release = true; // Оставляем флаг что импульсы уже включены.
}
}