Ver código fonte

北向用户特别寄存器总告警

liyi 1 ano atrás
pai
commit
ad95ffc1c7
2 arquivos alterados com 40 adições e 5 exclusões
  1. 9 0
      pro/config/cfg.h
  2. 31 5
      pro/src/app.c

+ 9 - 0
pro/config/cfg.h

@@ -263,6 +263,15 @@
     #define CHANNEL_DELAY                       8
     #define PROD_POWER_TYPE                     5
     //#define NOT_USE_CONTROL
+#elif (defined PRJ_IP_AC_I1_O1)
+    #define LANGUAGE                            0
+    #define SMPLE_TIME                          30          //ms
+    #define SAVE_TIME                           60000       //ms
+    #define CASCADE_CNT                         0
+
+    #define PHASE_GROUP                         8
+    #define CHANNEL_DELAY                       8
+    #define PROD_POWER_TYPE                     0
 #else
     #error define a PRJ_XXXX please!
 #endif

+ 31 - 5
pro/src/app.c

@@ -1111,11 +1111,11 @@ static void* power_thread(void* arg)
                     uint32_t p_data = 0;
                     for(int i = 0; i < 3;i++)
                     {
-                        c_data +=  (_globalDeviceManager->triphasic_mmap->i_total.pw_i_total[i].i_total_consumption / 100);
-                        p_data +=  (_globalDeviceManager->triphasic_mmap->i_total.pw_i_total[i].i_total_power / 10);                      
+                        c_data +=  (_globalDeviceManager->triphasic_mmap->i_total.pw_i_total[i].i_total_consumption);
+                        p_data +=  (_globalDeviceManager->triphasic_mmap->i_total.pw_i_total[i].i_total_power);                      
                     }
-                    __globalDeviceManage.north_user.total_elec_energy = c_data;
-                    __globalDeviceManage.north_user.total_power = p_data;
+                    __globalDeviceManage.north_user.total_elec_energy = c_data / 100;
+                    __globalDeviceManage.north_user.total_power = p_data / 10;
                     __globalDeviceManage.north_user.frequency = _globalDeviceManager->_globalPowerManger._PowerInfo.freq * 100;         
 #endif
             }
@@ -1191,11 +1191,16 @@ static void* power_thread(void* arg)
             bool nTotalAup = _globalDeviceManager->_globalPowerManger._PowerWarninginfo.w_current;
             bool nTotalPower = _globalDeviceManager->_globalPowerManger._PowerWarninginfo.w_power;
             bool nTotalConsumption = _globalDeviceManager->_globalPowerManger._PowerWarninginfo.w_consumption;
-
+#ifdef NORTH_USER_SPECILS
+                uint8_t total_wanning = 0;
+#endif
             if (_globalTotalPowerInfo._power_info.voltage >= _globalDeviceManager->_globalPowerManger.global_over_manager.product_vol_upper_threshold &&
                 abs(_globalDeviceManager->_globalPowerManger.global_over_manager.product_vol_upper_threshold) >= 0.05)
             {
                 _globalDeviceManager->_globalPowerManger._PowerWarninginfo.w_voltage_up = true;
+#ifdef NORTH_USER_SPECILS
+                total_wanning ++;
+#endif
             }
             else
                 _globalDeviceManager->_globalPowerManger._PowerWarninginfo.w_voltage_up = false;
@@ -1204,6 +1209,9 @@ static void* power_thread(void* arg)
                 abs(_globalDeviceManager->_globalPowerManger.global_over_manager.product_vol_lower_threshold) >= 0.05)
             {
                 _globalDeviceManager->_globalPowerManger._PowerWarninginfo.w_voltage_down = true;
+#ifdef NORTH_USER_SPECILS
+                total_wanning ++;
+#endif
             }
             else
                 _globalDeviceManager->_globalPowerManger._PowerWarninginfo.w_voltage_down = false;
@@ -1212,6 +1220,9 @@ static void* power_thread(void* arg)
                 abs(_globalDeviceManager->_globalPowerManger.global_over_manager.product_cur_upper_threshold) >= 0.05)
             {
                 _globalDeviceManager->_globalPowerManger._PowerWarninginfo.w_current = true;
+#ifdef NORTH_USER_SPECILS
+                total_wanning ++;
+#endif
             }
             else
                 _globalDeviceManager->_globalPowerManger._PowerWarninginfo.w_current = false;
@@ -1220,6 +1231,9 @@ static void* power_thread(void* arg)
                 abs(_globalDeviceManager->_globalPowerManger.global_over_manager.product_pwr_upper_threshold) >= 0.05)
             {
                 _globalDeviceManager->_globalPowerManger._PowerWarninginfo.w_power = true;
+#ifdef NORTH_USER_SPECILS
+                total_wanning ++;
+#endif
             }
             else
                 _globalDeviceManager->_globalPowerManger._PowerWarninginfo.w_power = false;
@@ -1228,9 +1242,21 @@ static void* power_thread(void* arg)
                 abs(_globalDeviceManager->_globalPowerManger.global_over_manager.product_pwrcon_upper_threshold) >= 0.05)
             {
                 _globalDeviceManager->_globalPowerManger._PowerWarninginfo.w_consumption = true;
+#ifdef NORTH_USER_SPECILS
+                total_wanning ++;
+#endif
             }
             else
                 _globalDeviceManager->_globalPowerManger._PowerWarninginfo.w_consumption = false;
+#ifdef NORTH_USER_SPECILS
+            if (__globalDeviceManage.triphasic_mmap)
+            {
+                if(total_wanning)
+                    __globalDeviceManage.north_user.total_wanning = 1;
+                else
+                    __globalDeviceManage.north_user.total_wanning = 0;
+            }
+#endif
 
             // 报警信息及动作
             if (_globalDeviceManager->_globalPowerManger._PowerWarninginfo.w_voltage_up && !nTotalVup)