|
@@ -41,6 +41,7 @@ void* power_thread(void* arg)
|
|
|
GlobalTreeACManager* pTreeAPowerInfo; //三相子电源信息
|
|
GlobalTreeACManager* pTreeAPowerInfo; //三相子电源信息
|
|
|
GlobalTreeACManager* _pTreeACPowerMangerTemp = NULL ;
|
|
GlobalTreeACManager* _pTreeACPowerMangerTemp = NULL ;
|
|
|
PowerWarningInfo _globalPowerWarningInfo ;
|
|
PowerWarningInfo _globalPowerWarningInfo ;
|
|
|
|
|
+ PowerWarningInfo _globalTACWarningInfo;
|
|
|
float Vavg[3]={0.0,0.0,0.0};
|
|
float Vavg[3]={0.0,0.0,0.0};
|
|
|
int VavgTimes[3]={0,0,0};
|
|
int VavgTimes[3]={0,0,0};
|
|
|
struct tm* t ;
|
|
struct tm* t ;
|
|
@@ -490,6 +491,7 @@ void* power_thread(void* arg)
|
|
|
case TREE_AC_TYPE:
|
|
case TREE_AC_TYPE:
|
|
|
{
|
|
{
|
|
|
GlobalTreeACManager* _pTreeACPowerPhData = NULL ;
|
|
GlobalTreeACManager* _pTreeACPowerPhData = NULL ;
|
|
|
|
|
+
|
|
|
memset(&_globalPowerInfo._power_info, 0, sizeof(_globalPowerInfo._power_info));
|
|
memset(&_globalPowerInfo._power_info, 0, sizeof(_globalPowerInfo._power_info));
|
|
|
int k = 0;
|
|
int k = 0;
|
|
|
list_for_each_entry(_pTreeACPowerMangerTemp, &_globalPowerMangerTemp->list_Tree_AC, list_Tree_AC)
|
|
list_for_each_entry(_pTreeACPowerMangerTemp, &_globalPowerMangerTemp->list_Tree_AC, list_Tree_AC)
|
|
@@ -499,7 +501,7 @@ void* power_thread(void* arg)
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
memcpy(&_pTreeACPowerMangerTemp->_PowerInfo,&_globalDeviceManager->_all_ctrl_board[_pTreeACPowerMangerTemp->product_saddr]._PowerInfo[_pTreeACPowerMangerTemp->product_ch_addr - 1],sizeof(PowerInfo));
|
|
memcpy(&_pTreeACPowerMangerTemp->_PowerInfo,&_globalDeviceManager->_all_ctrl_board[_pTreeACPowerMangerTemp->product_saddr]._PowerInfo[_pTreeACPowerMangerTemp->product_ch_addr - 1],sizeof(PowerInfo));
|
|
|
- memcpy(&_pTreeACPowerMangerTemp->_PowerWarninginfo,&_globalDeviceManager->_all_ctrl_board[_pTreeACPowerMangerTemp->product_saddr]._PowerWarninginfo[_pTreeACPowerMangerTemp->product_ch_addr - 1],sizeof(PowerWarningInfo));
|
|
|
|
|
|
|
+ memcpy(&_globalTACWarningInfo,&_globalDeviceManager->_all_ctrl_board[_pTreeACPowerMangerTemp->product_saddr]._PowerWarninginfo[_pTreeACPowerMangerTemp->product_ch_addr - 1],sizeof(PowerWarningInfo));
|
|
|
gettimeofday(&tv, NULL);
|
|
gettimeofday(&tv, NULL);
|
|
|
// t = localtime(&tv.tv_sec);
|
|
// t = localtime(&tv.tv_sec);
|
|
|
//计算总三项总数据
|
|
//计算总三项总数据
|
|
@@ -547,8 +549,45 @@ void* power_thread(void* arg)
|
|
|
log_d("ph_ch%d insert data error.\n", _pTreeACPowerMangerTemp->product_ch_id);
|
|
log_d("ph_ch%d insert data error.\n", _pTreeACPowerMangerTemp->product_ch_id);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ // 判断阈值状态
|
|
|
|
|
+ if (_globalTACWarningInfo.w_voltage_up != _pTreeACPowerMangerTemp->_PowerWarninginfo.w_voltage_up && _globalTACWarningInfo.w_voltage_up)
|
|
|
|
|
+ {
|
|
|
|
|
+ _pTreeACPowerMangerTemp->_PowerWarninginfo.w_voltage_up = _globalTACWarningInfo.w_voltage_up;
|
|
|
|
|
+ /*高电压 */
|
|
|
|
|
+ dev_Alarm_T_AC_message(_globalDeviceManager, _pTreeACPowerMangerTemp, ENABLE_TAC_V_UP);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (_globalTACWarningInfo.w_voltage_down != _pTreeACPowerMangerTemp->_PowerWarninginfo.w_voltage_down && _globalTACWarningInfo.w_voltage_down)
|
|
|
|
|
+ {
|
|
|
|
|
+ _pTreeACPowerMangerTemp->_PowerWarninginfo.w_voltage_down = _globalTACWarningInfo.w_voltage_down;
|
|
|
|
|
+ /*低电压 */
|
|
|
|
|
+ dev_Alarm_T_AC_message(_globalDeviceManager, _pTreeACPowerMangerTemp, ENABLE_TAC_V_DOWN);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (_globalTACWarningInfo.w_current != _pTreeACPowerMangerTemp->_PowerWarninginfo.w_current && _globalTACWarningInfo.w_current)
|
|
|
|
|
+ {
|
|
|
|
|
+ _pTreeACPowerMangerTemp->_PowerWarninginfo.w_current = _globalTACWarningInfo.w_current;
|
|
|
|
|
+ /*高电流 */
|
|
|
|
|
+ dev_Alarm_T_AC_message(_globalDeviceManager, _pTreeACPowerMangerTemp, ENABLE_TAC_A_UP);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (_globalTACWarningInfo.w_power != _pTreeACPowerMangerTemp->_PowerWarninginfo.w_power && _globalTACWarningInfo.w_power)
|
|
|
|
|
+ {
|
|
|
|
|
+ _pTreeACPowerMangerTemp->_PowerWarninginfo.w_power = _globalTACWarningInfo.w_power;
|
|
|
|
|
+ /*高功率 */
|
|
|
|
|
+ dev_Alarm_T_AC_message(_globalDeviceManager, _pTreeACPowerMangerTemp, ENABLE_TAC_W_UP);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (_globalTACWarningInfo.w_consumption != _pTreeACPowerMangerTemp->_PowerWarninginfo.w_consumption && _globalTACWarningInfo.w_consumption)
|
|
|
|
|
+ {
|
|
|
|
|
+ _pTreeACPowerMangerTemp->_PowerWarninginfo.w_consumption = _globalTACWarningInfo.w_consumption;
|
|
|
|
|
+ /*高耗电 */
|
|
|
|
|
+ dev_Alarm_T_AC_message(_globalDeviceManager, _pTreeACPowerMangerTemp, ENABLE_TAC_P_UP);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (_globalTACWarningInfo.w_phase_loss != _pTreeACPowerMangerTemp->_PowerWarninginfo.w_phase_loss && _globalTACWarningInfo.w_phase_loss)
|
|
|
|
|
+ {
|
|
|
|
|
+ _pTreeACPowerMangerTemp->_PowerWarninginfo.w_phase_loss = _globalTACWarningInfo.w_phase_loss;
|
|
|
|
|
+ /*缺项 */
|
|
|
|
|
+ dev_Alarm_T_AC_message(_globalDeviceManager, _pTreeACPowerMangerTemp, ENABLE_TAC_STIME);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
_globalTotalPowerInfo._power_info.voltage = _globalPowerInfo._power_info.voltage ;
|
|
_globalTotalPowerInfo._power_info.voltage = _globalPowerInfo._power_info.voltage ;
|
|
|
_globalTotalPowerInfo._power_info.current += _globalPowerInfo._power_info.current ;
|
|
_globalTotalPowerInfo._power_info.current += _globalPowerInfo._power_info.current ;
|
|
|
_globalTotalPowerInfo._power_info.power += _globalPowerInfo._power_info.power ;
|
|
_globalTotalPowerInfo._power_info.power += _globalPowerInfo._power_info.power ;
|