|
|
@@ -1543,11 +1543,12 @@ void* shm_thread(void *arg)
|
|
|
memcpy(&pShmData, _globalDeviceManager->g_shm_Data, sizeof(smartPDU_shm_data));
|
|
|
if (_globalDeviceManager->g_shm_Data->bPDUSet > 0) // 已更新
|
|
|
{
|
|
|
- int nselect=_globalDeviceManager->g_shm_Data->nSelectPowerCH;
|
|
|
- int nIndex=0;
|
|
|
- if (nselect==0)
|
|
|
+ int nselect = _globalDeviceManager->g_shm_Data->nSelectPowerCH;
|
|
|
+ int nIndex = 0;
|
|
|
+ if (nselect == 0)
|
|
|
{
|
|
|
//_globalDeviceManager->_globalPowerManger;
|
|
|
+
|
|
|
_globalDeviceManager->g_shm_Data->fV = _globalDeviceManager->_globalPowerManger._PowerInfo.voltage;
|
|
|
_globalDeviceManager->g_shm_Data->fA = _globalDeviceManager->_globalPowerManger._PowerInfo.current;
|
|
|
_globalDeviceManager->g_shm_Data->fW = _globalDeviceManager->_globalPowerManger._PowerInfo.power;
|
|
|
@@ -1559,36 +1560,72 @@ void* shm_thread(void *arg)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ int nselectPH = _globalDeviceManager->g_shm_Data->nSelectPh;
|
|
|
list_for_each_entry(_globalPowerMangerTemp, &_globalDeviceManager->_globalPowerManger.list, list)
|
|
|
{
|
|
|
nIndex += 1;
|
|
|
if (nselect <= nIndex)
|
|
|
- break;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if ((_globalDeviceManager->_globalDevInfo.product_pwr_type == SmartPDU_Tree_AC_Tree||
|
|
|
+ _globalDeviceManager->_globalDevInfo.product_pwr_type == SmartPDU_Tree_AC_One ||
|
|
|
+ _globalDeviceManager->_globalDevInfo.product_pwr_type == SmartPDU_Tree_AC_One_B) &&
|
|
|
+ _globalDeviceManager->g_shm_Data->bT_ACType == 1&&nselectPH>0)
|
|
|
+ {
|
|
|
+ nIndex=0;
|
|
|
+ GlobalTreeACManager *_pTreeACPowerPhData = NULL;
|
|
|
+ int k = 0;
|
|
|
+ list_for_each_entry(_pTreeACPowerPhData, &_globalPowerMangerTemp->list_Tree_AC, list_Tree_AC)
|
|
|
+ {
|
|
|
+ k += 1;
|
|
|
+ if (nselectPH <= nIndex)
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (_pTreeACPowerPhData)
|
|
|
+ {
|
|
|
+ _globalDeviceManager->g_shm_Data->fV = _pTreeACPowerPhData->_PowerInfo.voltage;
|
|
|
+ _globalDeviceManager->g_shm_Data->fA = _pTreeACPowerPhData->_PowerInfo.current;
|
|
|
+ _globalDeviceManager->g_shm_Data->fW = _pTreeACPowerPhData->_PowerInfo.power;
|
|
|
+ _globalDeviceManager->g_shm_Data->fF = _pTreeACPowerPhData->_PowerInfo.factor;
|
|
|
+ _globalDeviceManager->g_shm_Data->fS = _pTreeACPowerPhData->_PowerInfo.consumption;
|
|
|
+ _globalDeviceManager->g_shm_Data->nStatus = _pTreeACPowerPhData->_PowerInfo.status;
|
|
|
+ _globalDeviceManager->g_shm_Data->fT = _globalDeviceManager->g_modebus_read.temprature;
|
|
|
+ _globalDeviceManager->g_shm_Data->fH = _globalDeviceManager->g_modebus_read.humidity;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ _globalDeviceManager->g_shm_Data->fV = _globalPowerMangerTemp->_PowerInfo.voltage;
|
|
|
+ _globalDeviceManager->g_shm_Data->fA = _globalPowerMangerTemp->_PowerInfo.current;
|
|
|
+ _globalDeviceManager->g_shm_Data->fW = _globalPowerMangerTemp->_PowerInfo.power;
|
|
|
+ _globalDeviceManager->g_shm_Data->fF = _globalPowerMangerTemp->_PowerInfo.factor;
|
|
|
+ _globalDeviceManager->g_shm_Data->fS = _globalPowerMangerTemp->_PowerInfo.consumption;
|
|
|
+ _globalDeviceManager->g_shm_Data->nStatus = _globalPowerMangerTemp->_PowerInfo.status;
|
|
|
+ _globalDeviceManager->g_shm_Data->fT = _globalDeviceManager->g_modebus_read.temprature;
|
|
|
+ _globalDeviceManager->g_shm_Data->fH = _globalDeviceManager->g_modebus_read.humidity;
|
|
|
}
|
|
|
- // GlobalPowerInfo _globalPowerInfo;
|
|
|
- // memset(&_globalPowerInfo._power_info, 0, sizeof(PowerInfo));
|
|
|
- // memcpy(&_globalPowerInfo._power_info,
|
|
|
- // &_globalDeviceManager->_all_ctrl_board[0]._PowerInfo[0],
|
|
|
- // sizeof(PowerInfo));
|
|
|
- _globalDeviceManager->g_shm_Data->fV = _globalPowerMangerTemp->_PowerInfo.voltage;
|
|
|
- _globalDeviceManager->g_shm_Data->fA = _globalPowerMangerTemp->_PowerInfo.current;
|
|
|
- _globalDeviceManager->g_shm_Data->fW = _globalPowerMangerTemp->_PowerInfo.power;
|
|
|
- _globalDeviceManager->g_shm_Data->fF = _globalPowerMangerTemp->_PowerInfo.factor;
|
|
|
- _globalDeviceManager->g_shm_Data->fS = _globalPowerMangerTemp->_PowerInfo.consumption;
|
|
|
- _globalDeviceManager->g_shm_Data->nStatus = _globalPowerMangerTemp->_PowerInfo.status;
|
|
|
- _globalDeviceManager->g_shm_Data->fT = _globalDeviceManager->g_modebus_read.temprature;
|
|
|
- _globalDeviceManager->g_shm_Data->fH = _globalDeviceManager->g_modebus_read.humidity;
|
|
|
}
|
|
|
}
|
|
|
else if (_globalDeviceManager->g_shm_Data->bPDUSet == 0)
|
|
|
{ // 等于于0则更新pdu数据
|
|
|
- int nMaxCh=0;
|
|
|
+ int nMaxCh = 0;
|
|
|
list_for_each_entry(_globalPowerMangerTemp, &_globalDeviceManager->_globalPowerManger.list, list)
|
|
|
{
|
|
|
- nMaxCh+=1;
|
|
|
+ nMaxCh += 1;
|
|
|
+ }
|
|
|
+ _globalDeviceManager->g_shm_Data->nMaxCh = nMaxCh;
|
|
|
+ if ((_globalDeviceManager->_globalDevInfo.product_pwr_type == SmartPDU_Tree_AC_Tree||
|
|
|
+ _globalDeviceManager->_globalDevInfo.product_pwr_type == SmartPDU_Tree_AC_One ||
|
|
|
+ _globalDeviceManager->_globalDevInfo.product_pwr_type == SmartPDU_Tree_AC_One_B))
|
|
|
+ {
|
|
|
+ _globalDeviceManager->g_shm_Data->bT_ACType = 1;
|
|
|
}
|
|
|
- _globalDeviceManager->g_shm_Data->nMaxCh = nMaxCh;
|
|
|
- _globalDeviceManager->g_shm_Data->bPDUSet = 1;
|
|
|
+ else
|
|
|
+ {
|
|
|
+ _globalDeviceManager->g_shm_Data->bT_ACType = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ _globalDeviceManager->g_shm_Data->bPDUSet = 1;
|
|
|
}
|
|
|
else
|
|
|
{ // 小于0 则主程序已析构退出重新等待加载
|