示例#1
0
        public static System.Collections.Generic.List <VarBinding> GetThresholdsRequestApcPDU(DevModelConfig modelcfg, DevRealConfig realcfg, int sensorNum)
        {
            int num     = 1;
            int bankNum = modelcfg.bankNum;

            System.Collections.Generic.List <VarBinding> list = new System.Collections.Generic.List <VarBinding>();
            LeafVarBinding leafVarBinding = new LeafVarBinding();

            leafVarBinding.Add(ApcPDUBaseMib.Mac);
            leafVarBinding.Add(ApcPDUBaseMib.FWversion);
            leafVarBinding.Add(ApcPDUBaseMib.DeviceName);
            for (int i = 1; i <= num; i++)
            {
                ApcDeviceConfigMib apcDeviceConfigMib = new ApcDeviceConfigMib(i);
                leafVarBinding.Add(apcDeviceConfigMib.MinPowerConfig);
                leafVarBinding.Add(apcDeviceConfigMib.MaxPowerConfig);
                ApcPhaseConfigMib apcPhaseConfigMib = new ApcPhaseConfigMib(i);
                leafVarBinding.Add(apcPhaseConfigMib.MinCurrentConfig);
                leafVarBinding.Add(apcPhaseConfigMib.MaxCurrentConfig);
            }
            for (int j = 1; j <= bankNum; j++)
            {
                ApcBankConfigMib apcBankConfigMib = new ApcBankConfigMib(j);
                leafVarBinding.Add(apcBankConfigMib.MinCurrentConfig);
                leafVarBinding.Add(apcBankConfigMib.MaxCurrentConfig);
            }
            for (int k = 1; k <= sensorNum; k++)
            {
                ApcSensorConfigMib apcSensorConfigMib = new ApcSensorConfigMib(k);
                leafVarBinding.Add(apcSensorConfigMib.MaxTemperature);
                leafVarBinding.Add(apcSensorConfigMib.MinHumidity);
            }
            list.Add(leafVarBinding);
            return(list);
        }
示例#2
0
        public static System.Collections.Generic.List <LeafVarBinding> SetDeviceThresholdVariablesApcPDU(DeviceThreshold threshold, DevModelConfig modelcfg)
        {
            int inputNum = 1;

            System.Collections.Generic.List <LeafVarBinding> list = new System.Collections.Generic.List <LeafVarBinding>();
            ApcDeviceConfigMib apcDeviceConfigMib = new ApcDeviceConfigMib(inputNum);
            ApcPhaseConfigMib  apcPhaseConfigMib  = new ApcPhaseConfigMib(inputNum);
            LeafVarBinding     leafVarBinding     = new LeafVarBinding();
            LeafVarBinding     leafVarBinding2    = new LeafVarBinding();

            if (threshold.MaxPowerMT != -500f)
            {
                leafVarBinding.Add(apcDeviceConfigMib.MinPowerConfig, 0);
                leafVarBinding.Add(apcDeviceConfigMib.NearPowerConfig, 1);
                leafVarBinding2.Add(apcDeviceConfigMib.MaxPowerConfig, System.Convert.ToInt32(threshold.MaxPowerMT * 10f / 1000f));
                leafVarBinding2.Add(apcDeviceConfigMib.NearPowerConfig, System.Convert.ToInt32(threshold.MaxPowerMT * 10f / 1000f));
            }
            if (threshold.MinPowerMT != -500f)
            {
                leafVarBinding2.Add(apcDeviceConfigMib.MinPowerConfig, System.Convert.ToInt32(threshold.MinPowerMT * 10f / 1000f));
            }
            if (threshold.MaxCurrentMT != -500f)
            {
                leafVarBinding.Add(apcPhaseConfigMib.MinCurrentConfig, 0);
                leafVarBinding.Add(apcPhaseConfigMib.NearCurrentConfig, 1);
                leafVarBinding2.Add(apcPhaseConfigMib.MaxCurrentConfig, System.Convert.ToInt32(threshold.MaxCurrentMT));
                leafVarBinding2.Add(apcPhaseConfigMib.NearCurrentConfig, System.Convert.ToInt32(threshold.MaxCurrentMT));
            }
            if (threshold.MinCurrentMT != -500f)
            {
                leafVarBinding2.Add(apcPhaseConfigMib.MinCurrentConfig, System.Convert.ToInt32(threshold.MinCurrentMT));
            }
            list.Add(leafVarBinding);
            list.Add(leafVarBinding2);
            return(list);
        }
示例#3
0
        private static DeviceThreshold GetDeviceThreshold(System.Collections.Generic.Dictionary <string, string> result)
        {
            DeviceThreshold deviceThreshold = new DeviceThreshold();

            System.Collections.Generic.IEnumerator <string> enumerator = result.Keys.GetEnumerator();
            while (enumerator.MoveNext())
            {
                string current = enumerator.Current;
                string text    = result[current];
                if ("\0".Equals(text))
                {
                    text = System.Convert.ToString(-10000);
                }
                else
                {
                    if (text == null || string.IsNullOrEmpty(text))
                    {
                        text = System.Convert.ToString(-5000);
                    }
                    else
                    {
                        if (text.Equals("Null"))
                        {
                            text = System.Convert.ToString(-5000);
                        }
                    }
                }
                int num = System.Convert.ToInt32(current.Substring(current.LastIndexOf(".") + 1));
                if (num == 1)
                {
                    ApcDeviceConfigMib apcDeviceConfigMib = new ApcDeviceConfigMib(num);
                    ApcPhaseConfigMib  apcPhaseConfigMib  = new ApcPhaseConfigMib(num);
                    if (current.StartsWith(apcDeviceConfigMib.MinPowerConfig))
                    {
                        deviceThreshold.MinPowerMT  = (float)System.Convert.ToInt32(text) / 10f;
                        deviceThreshold.MinPowerMT *= 1000f;
                    }
                    else
                    {
                        if (current.StartsWith(apcDeviceConfigMib.MaxPowerConfig))
                        {
                            deviceThreshold.MaxPowerMT  = (float)System.Convert.ToInt32(text) / 10f;
                            deviceThreshold.MaxPowerMT *= 1000f;
                        }
                        else
                        {
                            if (current.StartsWith(apcPhaseConfigMib.MinCurrentConfig))
                            {
                                deviceThreshold.MinCurrentMT = (float)System.Convert.ToInt32(text);
                            }
                            else
                            {
                                if (current.StartsWith(apcPhaseConfigMib.MaxCurrentConfig))
                                {
                                    deviceThreshold.MaxCurrentMT = (float)System.Convert.ToInt32(text);
                                }
                            }
                        }
                    }
                }
            }
            return(deviceThreshold);
        }