You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
2.4 KiB
C

/*
* HVCELL.h
*
* Author: Aleksey Gerasimenko
* gerasimenko.aleksey.n@gmail.com
*/
#include <math.h>
#include <stdint.h>
#include "framework.h"
#include "DSP2833x_Device.h" // DSP2833x Headerfile Include File
#include "DSP2833x_Examples.h"
#ifndef SYSCTRL_HVCELL_H_
#define SYSCTRL_HVCELL_H_
namespace SYSCTRL
{
struct HVCELLConfiguration
{
Uint16 cell_level;
//UnitSwitchingFreq switching_freq;
HVCELLConfiguration():
cell_level(0)
//switching_freq(SWITCHING_FREQ_2500)
{}
};//HVCELLConfiguration
class HVCELL
{
public:
enum mode_t {UNDEFINED, CONFIGURATE, OPERATIONAL};
private:
mode_t m_mode;
private:
ControlOrder m_control_order;
//UnitSwitchingFreq m_switching_freq;
Uint16 m_cell_level;
Uint16 m_cell_error;
Uint16 m_pwm_version[3];
CellState m_cell_state[3][13];
float m_cell_dc_voltage[3][13];
Uint16 m_cell_version[3][13];
Uint32 m_cpu_cpld_version;
float m_data_u;
float m_data_v;
float m_data_w;
private:
float m_dc_voltage_a;
float m_dc_voltage_b;
float m_dc_voltage_c;
bool m_fault_cell;
Uint16 m_cell_error_fault;
CellState m_cell_state_fault[3][13];
public:
HVCELL();
void configure(HVCELLConfiguration& config);
mode_t get_mode();
bool compare(mode_t mode);
public:
void send_syn_signal();
void send_control_order();
void set_cell_level();
void get_pwm_version();
void get_cell_state();
void get_cell_dc_voltage();
void get_cell_version();
void send_modulate_data();
void get_cpu_cpld_version();
private:
void (HVCELL::*p_send_syn_signal)();
void _send_syn_signal();
void (HVCELL::*p_send_control_order)();
void _send_control_order();
void (HVCELL::*p_set_cell_level)();
void _set_cell_level();
void (HVCELL::*p_get_pwm_version)();
void _get_pwm_version();
void (HVCELL::*p_get_cell_state)();
void _get_cell_state();
void (HVCELL::*p_get_cell_dc_voltage)();
void _get_cell_dc_voltage();
void (HVCELL::*p_get_cell_version)();
void _get_cell_version();
void (HVCELL::*p_send_modulate_data)();
void _send_modulate_data();
void (HVCELL::*p_get_cpu_cpld_version)();
void _get_cpu_cpld_version();
void _empty();
//
};//class HVCELL
} /* namespace SYSCTRL */
#endif /* SYSCTRL_HVCELL_H_ */