Exemple #1
0
        public static LeafVarBinding SetBankThresholdVariablesEatonPDU_M2(BankThreshold threshold, DevModelConfig modelcfg)
        {
            LeafVarBinding          leafVarBinding         = new LeafVarBinding();
            int                     bankNumber             = threshold.BankNumber;
            EatonGroupEntryMib_M2   eatonGroupEntryMib_M   = new EatonGroupEntryMib_M2(bankNumber);
            EatonGroupCurrentMib_M2 eatonGroupCurrentMib_M = new EatonGroupCurrentMib_M2(bankNumber);

            if (!string.IsNullOrEmpty(threshold.BankName))
            {
                leafVarBinding.Add(eatonGroupEntryMib_M.GroupName, threshold.BankName);
            }
            else
            {
                leafVarBinding.Add(eatonGroupEntryMib_M.GroupName, "/empty");
            }
            if (threshold.MaxCurrentMT != -500f)
            {
                leafVarBinding.Add(eatonGroupCurrentMib_M.MaxCurrentMT, System.Convert.ToInt32(threshold.MaxCurrentMT * 1000f));
            }
            if (threshold.MaxCurrentMT != -500f)
            {
                leafVarBinding.Add(eatonGroupCurrentMib_M.CurrentUpperCritical, System.Convert.ToInt32(threshold.MaxCurrentMT * 1000f));
            }
            return(leafVarBinding);
        }
Exemple #2
0
        private static System.Collections.Generic.Dictionary <int, BankValueEntry> GetBankValue(System.Collections.Generic.Dictionary <string, string> result)
        {
            System.Collections.Generic.Dictionary <int, BankValueEntry> dictionary = new System.Collections.Generic.Dictionary <int, BankValueEntry>();
            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))
                {
                    BankValueEntry value = new BankValueEntry(num2);
                    dictionary.Add(num2, value);
                }
                if (num != num2)
                {
                    new BankValueMib(num2);
                    num = num2;
                }
                BankValueEntry          bankValueEntry         = dictionary[num2];
                EatonGroupCurrentMib_M2 eatonGroupCurrentMib_M = new EatonGroupCurrentMib_M2(num2);
                EatonGroupVoltageMib_M2 eatonGroupVoltageMib_M = new EatonGroupVoltageMib_M2(num2);
                EatonGroupPowerMib_M2   eatonGroupPowerMib_M   = new EatonGroupPowerMib_M2(num2);
                if (current.StartsWith(eatonGroupCurrentMib_M.CurrentValue))
                {
                    bankValueEntry.Current = System.Convert.ToString((float)System.Convert.ToInt32(text) / 1000f);
                }
                else
                {
                    if (current.StartsWith(eatonGroupVoltageMib_M.VoltageValue))
                    {
                        bankValueEntry.Voltage = System.Convert.ToString((float)System.Convert.ToInt32(text) / 1000f);
                    }
                    else
                    {
                        if (current.StartsWith(eatonGroupPowerMib_M.PowerValue))
                        {
                            bankValueEntry.Power = text;
                        }
                    }
                }
            }
            return(dictionary);
        }
Exemple #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);
        }
Exemple #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);
        }
Exemple #5
0
        private static System.Collections.Generic.Dictionary <int, BankThreshold> GetBankThreshold(System.Collections.Generic.Dictionary <string, string> result)
        {
            System.Collections.Generic.Dictionary <int, BankThreshold> dictionary = new System.Collections.Generic.Dictionary <int, BankThreshold>();
            System.Collections.Generic.IEnumerator <string>            enumerator = result.Keys.GetEnumerator();
            EatonGroupEntryMib_M2   eatonGroupEntryMib_M   = null;
            EatonGroupVoltageMib_M2 eatonGroupVoltageMib_M = null;
            EatonGroupCurrentMib_M2 eatonGroupCurrentMib_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))
                {
                    BankThreshold value = new BankThreshold(num2);
                    dictionary.Add(num2, value);
                }
                if (num != num2)
                {
                    eatonGroupEntryMib_M   = new EatonGroupEntryMib_M2(num2);
                    eatonGroupCurrentMib_M = new EatonGroupCurrentMib_M2(num2);
                    eatonGroupVoltageMib_M = new EatonGroupVoltageMib_M2(num2);
                    num = num2;
                }
                BankThreshold bankThreshold = dictionary[num2];
                if (current.StartsWith(eatonGroupEntryMib_M.GroupName))
                {
                    bankThreshold.BankName = (text.Equals(System.Convert.ToString(-1000000)) ? string.Empty : text);
                }
                else
                {
                    if (current.StartsWith(eatonGroupCurrentMib_M.MinCurrentMt))
                    {
                        bankThreshold.MinCurrentMt = (float)System.Convert.ToInt32(text) / 1000f;
                    }
                    else
                    {
                        if (current.StartsWith(eatonGroupCurrentMib_M.MaxCurrentMT))
                        {
                            bankThreshold.MaxCurrentMT = (float)System.Convert.ToInt32(text) / 1000f;
                        }
                        else
                        {
                            if (current.StartsWith(eatonGroupVoltageMib_M.MinVoltageMt))
                            {
                                bankThreshold.MinVoltageMT = (float)System.Convert.ToInt32(text) / 1000f;
                            }
                            else
                            {
                                if (!current.StartsWith(eatonGroupVoltageMib_M.MaxVoltageMT))
                                {
                                    return(new System.Collections.Generic.Dictionary <int, BankThreshold>());
                                }
                                bankThreshold.MaxVoltageMT = (float)System.Convert.ToInt32(text) / 1000f;
                            }
                        }
                    }
                }
                if (bankThreshold.MinCurrentMt == -500f)
                {
                    bankThreshold.MinCurrentMt = -300f;
                }
                if (bankThreshold.MinPowerMT == -500f)
                {
                    bankThreshold.MinPowerMT = -300f;
                }
            }
            return(dictionary);
        }