示例#1
0
        private static System.Collections.Generic.Dictionary <int, OutletValueEntry> GetOutletValue(System.Collections.Generic.Dictionary <string, string> result)
        {
            System.Collections.Generic.Dictionary <int, OutletValueEntry> dictionary = new System.Collections.Generic.Dictionary <int, OutletValueEntry>();
            System.Collections.Generic.IEnumerator <string> enumerator = result.Keys.GetEnumerator();
            int num = 0;

            while (enumerator.MoveNext())
            {
                string current = enumerator.Current;
                string text    = result[current];
                if ("\0".Equals(text))
                {
                    text = System.Convert.ToString(-1000);
                }
                else
                {
                    if (string.IsNullOrEmpty(text))
                    {
                        text = System.Convert.ToString(-500);
                    }
                }
                int num2 = System.Convert.ToInt32(current.Substring(current.LastIndexOf(".") + 1));
                if (!dictionary.ContainsKey(num2))
                {
                    OutletValueEntry value = new OutletValueEntry(num2);
                    dictionary.Add(num2, value);
                }
                if (num != num2)
                {
                    new OutletValueMib(num2);
                    num = num2;
                }
                OutletValueEntry         outletValueEntry        = dictionary[num2];
                EatonOutletCurrentMib_M2 eatonOutletCurrentMib_M = new EatonOutletCurrentMib_M2(num2);
                EatonOutletVoltageMib_M2 eatonOutletVoltageMib_M = new EatonOutletVoltageMib_M2(num2);
                EatonOutletPowerMib_M2   eatonOutletPowerMib_M   = new EatonOutletPowerMib_M2(num2);
                if (current.StartsWith(eatonOutletCurrentMib_M.CurrentValue))
                {
                    outletValueEntry.Current = System.Convert.ToString((float)System.Convert.ToInt32(text) / 1000f);
                }
                else
                {
                    if (current.StartsWith(eatonOutletVoltageMib_M.VoltageValue))
                    {
                        outletValueEntry.Voltage = System.Convert.ToString((float)System.Convert.ToInt32(text) / 1000f);
                    }
                    else
                    {
                        if (current.StartsWith(eatonOutletPowerMib_M.PowerValue))
                        {
                            outletValueEntry.Power = text;
                        }
                    }
                }
            }
            return(dictionary);
        }
示例#2
0
        public static LeafVarBinding SetOutletThresholdVariablesEatonPDU_M2(OutletThreshold threshold, DevModelConfig modelcfg)
        {
            LeafVarBinding           leafVarBinding          = new LeafVarBinding();
            int                      outletNumber            = threshold.OutletNumber;
            EatonOutletEntryMib_M2   eatonOutletEntryMib_M   = new EatonOutletEntryMib_M2(outletNumber);
            EatonOutletVoltageMib_M2 eatonOutletVoltageMib_M = new EatonOutletVoltageMib_M2(outletNumber);
            EatonOutletCurrentMib_M2 eatonOutletCurrentMib_M = new EatonOutletCurrentMib_M2(outletNumber);

            if (!string.IsNullOrEmpty(threshold.OutletName))
            {
                leafVarBinding.Add(eatonOutletEntryMib_M.OutletName, threshold.OutletName);
            }
            else
            {
                leafVarBinding.Add(eatonOutletEntryMib_M.OutletName, "/empty");
            }
            if (threshold.MaxCurrentMT != -500f)
            {
                leafVarBinding.Add(eatonOutletCurrentMib_M.MaxCurrentMT, System.Convert.ToInt32(threshold.MaxCurrentMT * 1000f));
            }
            if (threshold.MaxVoltageMT != -500f)
            {
                leafVarBinding.Add(eatonOutletVoltageMib_M.MaxVoltageMT, System.Convert.ToInt32(threshold.MaxVoltageMT * 1000f));
            }
            if (threshold.MinVoltageMT != -500f)
            {
                leafVarBinding.Add(eatonOutletVoltageMib_M.MinVoltageMt, System.Convert.ToInt32(threshold.MinVoltageMT * 1000f));
            }
            if (threshold.MaxCurrentMT != -500f)
            {
                leafVarBinding.Add(eatonOutletCurrentMib_M.CurrentUpperCritical, System.Convert.ToInt32(threshold.MaxCurrentMT * 1000f));
            }
            if (threshold.MaxVoltageMT != -500f)
            {
                leafVarBinding.Add(eatonOutletVoltageMib_M.VoltageUpperCritical, System.Convert.ToInt32(threshold.MaxVoltageMT * 1000f));
            }
            return(leafVarBinding);
        }
示例#3
0
        public static System.Collections.Generic.List <LeafVarBinding> GetValuesRequestEatonPDU_M2(DevModelConfig modelcfg, DevRealConfig realcfg)
        {
            int num        = 1;
            int portNum    = realcfg.portNum;
            int bankNum    = realcfg.bankNum;
            int sensorNum  = realcfg.sensorNum;
            int contactNum = realcfg.contactNum;

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

            leafVarBinding.Add(EatonPDUBaseMib_M2.Mac);
            for (int l = 1; l <= num; l++)
            {
                EatonInputCurrentMib_M2 eatonInputCurrentMib_M = new EatonInputCurrentMib_M2(l);
                leafVarBinding.Add(eatonInputCurrentMib_M.CurrentValue);
                EatonInputVoltageMib_M2 eatonInputVoltageMib_M = new EatonInputVoltageMib_M2(l);
                leafVarBinding.Add(eatonInputVoltageMib_M.VoltageValue);
                EatonInputPowerMib_M2 eatonInputPowerMib_M = new EatonInputPowerMib_M2(1);
                leafVarBinding.Add(eatonInputPowerMib_M.PowerValue);
                leafVarBinding.Add(eatonInputPowerMib_M.PowerValue_VA);
            }
            for (int j = 1; j <= contactNum; j++)
            {
                EatonSensorContactMib_M2 eatonSensorContactMib_M = new EatonSensorContactMib_M2(j);
                leafVarBinding.Add(eatonSensorContactMib_M.ContactStatus);
            }
            for (int k = 1; k <= sensorNum; k++)
            {
                EatonSensorTemperatureMib_M2 eatonSensorTemperatureMib_M = new EatonSensorTemperatureMib_M2(k);
                leafVarBinding.Add(eatonSensorTemperatureMib_M.TemperatureValue);
                EatonSensorHumidityMib_M2 eatonSensorHumidityMib_M = new EatonSensorHumidityMib_M2(k);
                leafVarBinding.Add(eatonSensorHumidityMib_M.HumidityValue);
            }
            list.Add(leafVarBinding);
            if (portNum > 0)
            {
                LeafVBBuilder leafVBBuilder = new LeafVBBuilder(3, portNum);
                leafVBBuilder.BuildVbByIndex(list, delegate(int i, LeafVarBinding leafVb)
                {
                    EatonOutletVoltageMib_M2 eatonOutletVoltageMib_M = new EatonOutletVoltageMib_M2(i);
                    leafVb.Add(eatonOutletVoltageMib_M.VoltageValue);
                    EatonOutletCurrentMib_M2 eatonOutletCurrentMib_M = new EatonOutletCurrentMib_M2(i);
                    leafVb.Add(eatonOutletCurrentMib_M.CurrentValue);
                    EatonOutletPowerMib_M2 eatonOutletPowerMib_M = new EatonOutletPowerMib_M2(i);
                    leafVb.Add(eatonOutletPowerMib_M.PowerValue);
                });
            }
            if (bankNum > 0)
            {
                LeafVBBuilder leafVBBuilder2 = new LeafVBBuilder(2, bankNum);
                leafVBBuilder2.BuildVbByIndex(list, delegate(int i, LeafVarBinding leafVb)
                {
                    EatonGroupCurrentMib_M2 eatonGroupCurrentMib_M = new EatonGroupCurrentMib_M2(i);
                    leafVb.Add(eatonGroupCurrentMib_M.CurrentValue);
                    EatonGroupPowerMib_M2 eatonGroupPowerMib_M = new EatonGroupPowerMib_M2(i);
                    leafVb.Add(eatonGroupPowerMib_M.PowerValue);
                });
            }
            return(list);
        }
示例#4
0
        public static System.Collections.Generic.List <VarBinding> GetThresholdsRequestEatonPDU_M2(DevModelConfig modelcfg, DevRealConfig realcfg)
        {
            int num       = 1;
            int portNum   = realcfg.portNum;
            int bankNum   = realcfg.bankNum;
            int sensorNum = realcfg.sensorNum;

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

            leafVarBinding.Add(EatonPDUBaseMib_M2.Mac);
            leafVarBinding.Add(EatonPDUBaseMib_M2.FWversion);
            leafVarBinding.Add(EatonPDUBaseMib_M2.DeviceName);
            for (int i = 1; i <= num; i++)
            {
                EatonInputCurrentMib_M2 eatonInputCurrentMib_M = new EatonInputCurrentMib_M2(i);
                leafVarBinding.Add(eatonInputCurrentMib_M.MaxCurrentMT);
                EatonInputVoltageMib_M2 eatonInputVoltageMib_M = new EatonInputVoltageMib_M2(i);
                leafVarBinding.Add(eatonInputVoltageMib_M.MinVoltageMt);
                leafVarBinding.Add(eatonInputVoltageMib_M.MaxVoltageMT);
            }
            for (int j = 1; j <= sensorNum; j++)
            {
                EatonSensorTemperatureMib_M2 eatonSensorTemperatureMib_M = new EatonSensorTemperatureMib_M2(j);
                leafVarBinding.Add(eatonSensorTemperatureMib_M.MinTemperatureMt);
                leafVarBinding.Add(eatonSensorTemperatureMib_M.MaxTemperatureMT);
                EatonSensorHumidityMib_M2 eatonSensorHumidityMib_M = new EatonSensorHumidityMib_M2(j);
                leafVarBinding.Add(eatonSensorHumidityMib_M.MinHumidityMt);
                leafVarBinding.Add(eatonSensorHumidityMib_M.MaxHumidityMT);
            }
            list.Add(leafVarBinding);
            LeafVarBinding leafVarBinding2 = new LeafVarBinding();

            for (int k = 1; k <= bankNum; k++)
            {
                EatonGroupEntryMib_M2 eatonGroupEntryMib_M = new EatonGroupEntryMib_M2(k);
                leafVarBinding2.Add(eatonGroupEntryMib_M.GroupName);
                EatonGroupCurrentMib_M2 eatonGroupCurrentMib_M = new EatonGroupCurrentMib_M2(k);
                leafVarBinding2.Add(eatonGroupCurrentMib_M.MaxCurrentMT);
            }
            if (bankNum > 0)
            {
                list.Add(leafVarBinding2);
            }
            if (portNum > 0)
            {
                int           nodes         = 4;
                LeafVBBuilder leafVBBuilder = new LeafVBBuilder(nodes, portNum);
                System.Collections.Generic.List <LeafVarBinding> list2 = new System.Collections.Generic.List <LeafVarBinding>();
                leafVBBuilder.BuildVbByIndex(list2, delegate(int index, LeafVarBinding leafVb)
                {
                    EatonOutletEntryMib_M2 eatonOutletEntryMib_M = new EatonOutletEntryMib_M2(index);
                    leafVb.Add(eatonOutletEntryMib_M.OutletName);
                    EatonOutletVoltageMib_M2 eatonOutletVoltageMib_M = new EatonOutletVoltageMib_M2(index);
                    leafVb.Add(eatonOutletVoltageMib_M.MinVoltageMt);
                    leafVb.Add(eatonOutletVoltageMib_M.MaxVoltageMT);
                    EatonOutletCurrentMib_M2 eatonOutletCurrentMib_M = new EatonOutletCurrentMib_M2(index);
                    leafVb.Add(eatonOutletCurrentMib_M.MaxCurrentMT);
                });
                foreach (LeafVarBinding current in list2)
                {
                    list.Add(current);
                }
            }
            return(list);
        }
示例#5
0
        private static System.Collections.Generic.Dictionary <int, OutletThreshold> GetOutletThreshold(System.Collections.Generic.Dictionary <string, string> result)
        {
            System.Collections.Generic.Dictionary <int, OutletThreshold> dictionary = new System.Collections.Generic.Dictionary <int, OutletThreshold>();
            System.Collections.Generic.IEnumerator <string> enumerator = result.Keys.GetEnumerator();
            EatonOutletEntryMib_M2   eatonOutletEntryMib_M             = null;
            EatonOutletCurrentMib_M2 eatonOutletCurrentMib_M           = null;
            EatonOutletVoltageMib_M2 eatonOutletVoltageMib_M           = null;
            EatonOutletControlMib_M2 eatonOutletControlMib_M           = null;
            int num = 0;

            while (enumerator.MoveNext())
            {
                string current = enumerator.Current;
                string text    = result[current];
                if ("\0".Equals(text))
                {
                    text = System.Convert.ToString(-1000000);
                }
                else
                {
                    if (text == null || string.IsNullOrEmpty(text))
                    {
                        text = System.Convert.ToString(-500000);
                    }
                }
                int num2 = System.Convert.ToInt32(current.Substring(current.LastIndexOf(".") + 1));
                if (!dictionary.ContainsKey(num2))
                {
                    OutletThreshold value = new OutletThreshold(num2);
                    dictionary.Add(num2, value);
                }
                if (num != num2)
                {
                    eatonOutletEntryMib_M   = new EatonOutletEntryMib_M2(num2);
                    eatonOutletCurrentMib_M = new EatonOutletCurrentMib_M2(num2);
                    eatonOutletVoltageMib_M = new EatonOutletVoltageMib_M2(num2);
                    num = num2;
                }
                OutletThreshold outletThreshold = dictionary[num2];
                if (current.StartsWith(eatonOutletCurrentMib_M.MaxCurrentMT))
                {
                    outletThreshold.MaxCurrentMT = (float)System.Convert.ToInt32(text) / 1000f;
                }
                else
                {
                    if (current.StartsWith(eatonOutletVoltageMib_M.MaxVoltageMT))
                    {
                        outletThreshold.MaxVoltageMT = (float)System.Convert.ToInt32(text) / 1000f;
                    }
                    else
                    {
                        if (current.StartsWith(eatonOutletCurrentMib_M.MinCurrentMt))
                        {
                            outletThreshold.MinCurrentMt = (float)System.Convert.ToInt32(text) / 1000f;
                        }
                        else
                        {
                            if (current.StartsWith(eatonOutletVoltageMib_M.MinVoltageMt))
                            {
                                outletThreshold.MinVoltageMT = (float)System.Convert.ToInt32(text) / 1000f;
                            }
                            else
                            {
                                if (current.StartsWith(eatonOutletEntryMib_M.OutletName))
                                {
                                    outletThreshold.OutletName = (text.Equals(System.Convert.ToString(-1000000)) ? string.Empty : text);
                                }
                                else
                                {
                                    if (!current.StartsWith(eatonOutletControlMib_M.ControlSequenceDelay))
                                    {
                                        return(new System.Collections.Generic.Dictionary <int, OutletThreshold>());
                                    }
                                    outletThreshold.OffDelayTime = System.Convert.ToInt32(text);
                                    outletThreshold.OnDelayTime  = System.Convert.ToInt32(text);
                                }
                            }
                        }
                    }
                }
                if (outletThreshold.MinCurrentMt == -500f)
                {
                    outletThreshold.MinCurrentMt = -300f;
                }
                if (outletThreshold.MinPowerMT == -500f)
                {
                    outletThreshold.MinPowerMT = -300f;
                }
            }
            return(dictionary);
        }