|
|
@@ -602,11 +602,10 @@ static void* power_thread(void* arg)
|
|
|
GlobalTreeACManager* _pTreeACPowerPhData = NULL ;
|
|
|
|
|
|
memset(&_globalPowerInfo._power_info, 0, sizeof(_globalPowerInfo._power_info));
|
|
|
- int k = 0;
|
|
|
float nchYGpower = 0;
|
|
|
list_for_each_entry(_pTreeACPowerMangerTemp, &_globalPowerMangerTemp->list_Tree_AC, list_Tree_AC)
|
|
|
{
|
|
|
- if ((__globalDeviceManage._globalDevInfo.product.pwr_type==SmartPDU_Tree_AC_One||__globalDeviceManage._globalDevInfo.product.pwr_type==SmartPDU_Tree_AC_Two)&&_pTreeACPowerMangerTemp->product_ph_outputStatus==2)
|
|
|
+ if ((__globalDeviceManage._globalDevInfo.product.pwr_type==SmartPDU_Tree_AC_One||__globalDeviceManage._globalDevInfo.product.pwr_type==SmartPDU_Tree_AC_Two||__globalDeviceManage._globalDevInfo.product.pwr_type==SmartPDU_Tree_AC_Tree)&&_pTreeACPowerMangerTemp->product_ph_outputStatus==2)
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
|
@@ -614,7 +613,7 @@ static void* power_thread(void* arg)
|
|
|
memcpy(&_globalTACWarningInfo,&_globalDeviceManager->pCtrlBoard[_pTreeACPowerMangerTemp->product_saddr]._PowerWarninginfo[_pTreeACPowerMangerTemp->product_ch_addr - 1],sizeof(PowerWarningInfo));
|
|
|
gettimeofday(&tv, NULL);
|
|
|
// t = localtime(&tv.tv_sec);
|
|
|
- _globalDeviceManager->pCtrlBoard[_pTreeACPowerMangerTemp->product_saddr]._globalPowerInManger._PowerInfo[k].freq=_globalDeviceManager->pCtrlBoard[_pTreeACPowerMangerTemp->product_saddr]._globalPowerInManger._PowerInfo[k].freq> _pTreeACPowerMangerTemp->_PowerInfo.freq?_globalDeviceManager->pCtrlBoard[_pTreeACPowerMangerTemp->product_saddr]._globalPowerInManger._PowerInfo[k].freq:_pTreeACPowerMangerTemp->_PowerInfo.freq;
|
|
|
+
|
|
|
//计算总三项总数据
|
|
|
_globalPowerInfo._power_info.voltage = _pTreeACPowerMangerTemp->_PowerInfo.voltage;
|
|
|
_globalPowerInfo._power_info.current += _pTreeACPowerMangerTemp->_PowerInfo.current;
|
|
|
@@ -624,106 +623,7 @@ static void* power_thread(void* arg)
|
|
|
// _globalPowerInfo._power_info.factor = _pTreeACPowerMangerTemp->_PowerInfo.factor > _globalPowerInfo._power_info.factor ? _pTreeACPowerMangerTemp->_PowerInfo.factor : _globalPowerInfo._power_info.factor;
|
|
|
nchYGpower+=_pTreeACPowerMangerTemp->_PowerInfo.factor*_pTreeACPowerMangerTemp->_PowerInfo.power;
|
|
|
|
|
|
- if (__globalDeviceManage.triphasic_mmap)
|
|
|
- {
|
|
|
- __globalDeviceManage.triphasic_mmap->pw_o_chn[_chn].chn[k].o_consumption = _pTreeACPowerMangerTemp->_PowerInfo.consumption * 1000;
|
|
|
- __globalDeviceManage.triphasic_mmap->pw_o_chn[_chn].chn[k].o_current = _pTreeACPowerMangerTemp->_PowerInfo.current * 1000;
|
|
|
- __globalDeviceManage.triphasic_mmap->pw_o_chn[_chn].chn[k].o_power = _pTreeACPowerMangerTemp->_PowerInfo.power * 1000;
|
|
|
- __globalDeviceManage.triphasic_mmap->pw_o_chn[_chn].chn[k].o_voltage = _pTreeACPowerMangerTemp->_PowerInfo.voltage * 1000;
|
|
|
- __globalDeviceManage.triphasic_mmap->chn_info[_chn].chn_type = _pTreeACPowerMangerTemp->product_ph_type;
|
|
|
-#ifdef NORTH_USER_SPECILS
|
|
|
- uint8_t wanning = 0;
|
|
|
- if(_globalTACWarningInfo.w_voltage_up == true)
|
|
|
- {
|
|
|
- wanning++;
|
|
|
- }
|
|
|
- if(_globalTACWarningInfo.w_voltage_down == true)
|
|
|
- {
|
|
|
- wanning++;
|
|
|
- }
|
|
|
- if(_globalTACWarningInfo.w_current == true)
|
|
|
- {
|
|
|
- wanning++;
|
|
|
- }
|
|
|
- if(_globalTACWarningInfo.w_consumption == true)
|
|
|
- {
|
|
|
- wanning++;
|
|
|
- }
|
|
|
- if(_globalTACWarningInfo.w_power == true)
|
|
|
- {
|
|
|
- wanning++;
|
|
|
- }
|
|
|
- //uint16_t mask = 0xFFFF & (0 << (_chn % 16));
|
|
|
- uint16_t data_temp = 0;
|
|
|
-
|
|
|
- switch(_chn)
|
|
|
- {
|
|
|
- case 0 ... 15:
|
|
|
- {
|
|
|
- data_temp = __globalDeviceManage.north_user.fault_1_16;
|
|
|
- data_temp &= ~(1 << (_chn % 16));
|
|
|
- if(wanning > 0)
|
|
|
- {
|
|
|
- data_temp |= (1 << (_chn % 16));
|
|
|
- }
|
|
|
- __globalDeviceManage.north_user.fault_1_16 = data_temp;
|
|
|
- }
|
|
|
- break;
|
|
|
- case 16 ... 31:
|
|
|
- {
|
|
|
- data_temp = __globalDeviceManage.north_user.fault_17_32;
|
|
|
- data_temp &= ~(1 << (_chn % 16));
|
|
|
- if(wanning > 0)
|
|
|
- {
|
|
|
- data_temp |= (1 << (_chn % 16));
|
|
|
- }
|
|
|
- __globalDeviceManage.north_user.fault_17_32 = data_temp;
|
|
|
- }
|
|
|
- break;
|
|
|
- case 32 ... 47:
|
|
|
- {
|
|
|
- data_temp = __globalDeviceManage.north_user.fault_33_48;
|
|
|
- data_temp &= ~(1 << (_chn % 16));
|
|
|
- if(wanning > 0)
|
|
|
- {
|
|
|
- data_temp |= (1 << (_chn % 16));
|
|
|
- }
|
|
|
- __globalDeviceManage.north_user.fault_33_48 = data_temp;
|
|
|
- }
|
|
|
- break;
|
|
|
- case 48 ... 63:
|
|
|
- {
|
|
|
- data_temp = __globalDeviceManage.north_user.fault_49_64;
|
|
|
- data_temp &= ~(1 << (_chn % 16));
|
|
|
- if(wanning > 0)
|
|
|
- {
|
|
|
- data_temp |= (1 << (_chn % 16));
|
|
|
- }
|
|
|
- __globalDeviceManage.north_user.fault_49_64 = data_temp;
|
|
|
- }
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
-#endif
|
|
|
- }
|
|
|
|
|
|
- if(_globalPowerInfo._power_info.status==0)
|
|
|
- {
|
|
|
- _globalPowerInfo._power_info.status=_pTreeACPowerMangerTemp->_PowerInfo.status;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- _globalPowerInfo._power_info.status=0;
|
|
|
- }
|
|
|
- if (__globalDeviceManage.triphasic_mmap)
|
|
|
- {
|
|
|
- __globalDeviceManage.triphasic_mmap->pw_o_chn[_chn].chn[k].o_status = _globalPowerInfo._power_info.status;
|
|
|
- }
|
|
|
-
|
|
|
- _globalPowerInfo._power_info.NF_status=_pTreeACPowerMangerTemp->_PowerInfo.NF_status;
|
|
|
-
|
|
|
- k=k+1;
|
|
|
time_t now;
|
|
|
time(&now);
|
|
|
t = localtime(&now);
|
|
|
@@ -779,6 +679,126 @@ static void* power_thread(void* arg)
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ // 处理通道开关状态
|
|
|
+ int k = 0;
|
|
|
+ int allphOutNum=0;
|
|
|
+ int allphOpenNum=0;
|
|
|
+ list_for_each_entry(_pTreeACPowerMangerTemp, &_globalPowerMangerTemp->list_Tree_AC, list_Tree_AC)
|
|
|
+ {
|
|
|
+ //计算输出通道数和开启的输出通道数,两者相同,则认为该通道为开启状态
|
|
|
+ if (_pTreeACPowerMangerTemp->product_ph_outputStatus == 1)
|
|
|
+ {
|
|
|
+ allphOutNum++;
|
|
|
+
|
|
|
+ if (_pTreeACPowerMangerTemp->_PowerInfo.status==1)
|
|
|
+ {
|
|
|
+ allphOpenNum++;
|
|
|
+ }
|
|
|
+ _globalPowerInfo._power_info.NF_status = _pTreeACPowerMangerTemp->_PowerInfo.NF_status;
|
|
|
+ }
|
|
|
+ _globalDeviceManager->pCtrlBoard[_pTreeACPowerMangerTemp->product_saddr]._globalPowerInManger._PowerInfo[k].freq=_globalDeviceManager->pCtrlBoard[_pTreeACPowerMangerTemp->product_saddr]._globalPowerInManger._PowerInfo[k].freq> _pTreeACPowerMangerTemp->_PowerInfo.freq?_globalDeviceManager->pCtrlBoard[_pTreeACPowerMangerTemp->product_saddr]._globalPowerInManger._PowerInfo[k].freq:_pTreeACPowerMangerTemp->_PowerInfo.freq;
|
|
|
+ if (__globalDeviceManage.triphasic_mmap)
|
|
|
+ {
|
|
|
+ __globalDeviceManage.triphasic_mmap->pw_o_chn[_chn].chn[k].o_consumption = _pTreeACPowerMangerTemp->_PowerInfo.consumption * 1000;
|
|
|
+ __globalDeviceManage.triphasic_mmap->pw_o_chn[_chn].chn[k].o_current = _pTreeACPowerMangerTemp->_PowerInfo.current * 1000;
|
|
|
+ __globalDeviceManage.triphasic_mmap->pw_o_chn[_chn].chn[k].o_power = _pTreeACPowerMangerTemp->_PowerInfo.power * 1000;
|
|
|
+ __globalDeviceManage.triphasic_mmap->pw_o_chn[_chn].chn[k].o_voltage = _pTreeACPowerMangerTemp->_PowerInfo.voltage * 1000;
|
|
|
+ __globalDeviceManage.triphasic_mmap->chn_info[_chn].chn_type = _pTreeACPowerMangerTemp->product_ph_type;
|
|
|
+#ifdef NORTH_USER_SPECILS
|
|
|
+ uint8_t wanning = 0;
|
|
|
+ if (_globalTACWarningInfo.w_voltage_up == true)
|
|
|
+ {
|
|
|
+ wanning++;
|
|
|
+ }
|
|
|
+ if (_globalTACWarningInfo.w_voltage_down == true)
|
|
|
+ {
|
|
|
+ wanning++;
|
|
|
+ }
|
|
|
+ if (_globalTACWarningInfo.w_current == true)
|
|
|
+ {
|
|
|
+ wanning++;
|
|
|
+ }
|
|
|
+ if (_globalTACWarningInfo.w_consumption == true)
|
|
|
+ {
|
|
|
+ wanning++;
|
|
|
+ }
|
|
|
+ if (_globalTACWarningInfo.w_power == true)
|
|
|
+ {
|
|
|
+ wanning++;
|
|
|
+ }
|
|
|
+ // uint16_t mask = 0xFFFF & (0 << (_chn % 16));
|
|
|
+ uint16_t data_temp = 0;
|
|
|
+
|
|
|
+ switch (_chn)
|
|
|
+ {
|
|
|
+ case 0 ... 15:
|
|
|
+ {
|
|
|
+ data_temp = __globalDeviceManage.north_user.fault_1_16;
|
|
|
+ data_temp &= ~(1 << (_chn % 16));
|
|
|
+ if (wanning > 0)
|
|
|
+ {
|
|
|
+ data_temp |= (1 << (_chn % 16));
|
|
|
+ }
|
|
|
+ __globalDeviceManage.north_user.fault_1_16 = data_temp;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 16 ... 31:
|
|
|
+ {
|
|
|
+ data_temp = __globalDeviceManage.north_user.fault_17_32;
|
|
|
+ data_temp &= ~(1 << (_chn % 16));
|
|
|
+ if (wanning > 0)
|
|
|
+ {
|
|
|
+ data_temp |= (1 << (_chn % 16));
|
|
|
+ }
|
|
|
+ __globalDeviceManage.north_user.fault_17_32 = data_temp;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 32 ... 47:
|
|
|
+ {
|
|
|
+ data_temp = __globalDeviceManage.north_user.fault_33_48;
|
|
|
+ data_temp &= ~(1 << (_chn % 16));
|
|
|
+ if (wanning > 0)
|
|
|
+ {
|
|
|
+ data_temp |= (1 << (_chn % 16));
|
|
|
+ }
|
|
|
+ __globalDeviceManage.north_user.fault_33_48 = data_temp;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 48 ... 63:
|
|
|
+ {
|
|
|
+ data_temp = __globalDeviceManage.north_user.fault_49_64;
|
|
|
+ data_temp &= ~(1 << (_chn % 16));
|
|
|
+ if (wanning > 0)
|
|
|
+ {
|
|
|
+ data_temp |= (1 << (_chn % 16));
|
|
|
+ }
|
|
|
+ __globalDeviceManage.north_user.fault_49_64 = data_temp;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+#endif
|
|
|
+ }
|
|
|
+
|
|
|
+ if (__globalDeviceManage.triphasic_mmap)
|
|
|
+ {
|
|
|
+ __globalDeviceManage.triphasic_mmap->pw_o_chn[_chn].chn[k].o_status = _pTreeACPowerMangerTemp->_PowerInfo.status;
|
|
|
+ }
|
|
|
+
|
|
|
+ k = k + 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (allphOpenNum == allphOutNum)
|
|
|
+ {
|
|
|
+ _globalPowerInfo._power_info.status = 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ _globalPowerInfo._power_info.status = 0;
|
|
|
+ }
|
|
|
+
|
|
|
// 计算通道总功率因数
|
|
|
if (_globalPowerInfo._power_info.power > 0)
|
|
|
{
|