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

70 lines
2.2 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.

/*
* Inverter.h
*
* Created on: 31 окт. 2016 г.
* Author: titov
*/
#ifndef SOURCE_DRIVER_INVERTER_H_
#define SOURCE_DRIVER_INVERTER_H_
#include "IInverter.hh"
#include "../peripheral/IPwm.hh"
#include "IDiscreteOutput.hh"
namespace driver {
class Inverter : public IInverter {
protected:
bool pulse_enable; //!< Флаг необходимости включить импульсы.
bool pulse_release; //!< Флаг состояния импульсов.
bool disabled_u; //!< Признак отключения фазы U.
bool disabled_v; //!< Признак отключения фазы V.
bool disabled_w; //!< Признак отключения фазы W.
peripheral::IPwm & phase_u; //!< Управление фазой U.
peripheral::IPwm & phase_v; //!< Управление фазой V.
peripheral::IPwm & phase_w; //!< Управление фазой W.
driver::IDiscreteOutput & pulse_en;
float Tp; //!< Период цикла - единица относительного времени.
float _Ta;
float _Tb;
float _Tc;
//! Функция пересчета отностельного времени в уставку порога срабатывания ШИМ.
unsigned int TxToTreshold(float Tx) {
return (Tx * 0.5f + 0.5f) * Tp;
}
//!Функция проверяет уставку времени.
bool checkTime( float time ) {
return time <= 1.0f and time >= -1.0f;
}
public:
/*! Конструктор объекта драйвера инвертора.
* \param[in] u - Выход ШИМ, фаза U.
* \param[in] u - Выход ШИМ, фаза V.
* \param[in] u - Выход ШИМ, фаза W.
*/
Inverter( peripheral::IPwm & u, peripheral::IPwm & v, peripheral::IPwm & w, driver::IDiscreteOutput & pulse );
void enPulse(); //!< \copydoc IInverter::enPulse()
void disPulse(); //!< \copydoc IInverter::disPulse()
void pwm(float Ta, float Tb, float Tc); //!< \copydoc IInverter::pwm(float, float, float)
const float & getTa() { return _Ta; }
const float & getTb() { return _Tb; }
const float & getTc() { return _Tc; }
const bool & isPulseEnable() { return pulse_release; }
};
}
#endif /* SOURCE_DRIVER_INVERTER_H_ */