public static LeafVarBinding SetDeviceThresholdVariablesEatonPDU_M2(DeviceThreshold threshold, DevModelConfig modelcfg) { int inputNum = 1; LeafVarBinding leafVarBinding = new LeafVarBinding(); EatonInputCurrentMib_M2 eatonInputCurrentMib_M = new EatonInputCurrentMib_M2(inputNum); EatonInputVoltageMib_M2 eatonInputVoltageMib_M = new EatonInputVoltageMib_M2(inputNum); if (threshold.MaxCurrentMT != -500f) { leafVarBinding.Add(eatonInputCurrentMib_M.MaxCurrentMT, System.Convert.ToInt32(threshold.MaxCurrentMT * 1000f)); } if (threshold.MaxVoltageMT != -500f) { leafVarBinding.Add(eatonInputVoltageMib_M.MaxVoltageMT, System.Convert.ToInt32(threshold.MaxVoltageMT * 1000f)); } if (threshold.MinVoltageMT != -500f) { leafVarBinding.Add(eatonInputVoltageMib_M.MinVoltageMt, System.Convert.ToInt32(threshold.MinVoltageMT * 1000f)); } if (threshold.MaxCurrentMT != -500f) { leafVarBinding.Add(eatonInputCurrentMib_M.CurrentUpperCritical, System.Convert.ToInt32(threshold.MaxCurrentMT * 1000f)); } if (threshold.MaxVoltageMT != -500f) { leafVarBinding.Add(eatonInputVoltageMib_M.VoltageUpperCritical, System.Convert.ToInt32(threshold.MaxVoltageMT * 1000f)); } return(leafVarBinding); }
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); }
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); }
private static DeviceValueEntry GetDeviceValue(System.Collections.Generic.Dictionary <string, string> result) { string s = "0"; DeviceValueEntry deviceValueEntry = new DeviceValueEntry(); 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(-1000); } else { if (string.IsNullOrEmpty(text)) { text = System.Convert.ToString(-500); } } int num = System.Convert.ToInt32(current.Substring(current.LastIndexOf(".") + 1)); if (num == 1) { EatonInputCurrentMib_M2 eatonInputCurrentMib_M = new EatonInputCurrentMib_M2(num); EatonInputVoltageMib_M2 eatonInputVoltageMib_M = new EatonInputVoltageMib_M2(num); EatonInputPowerMib_M2 eatonInputPowerMib_M = new EatonInputPowerMib_M2(num); float arg_B2_0 = (float)System.Convert.ToInt32(text) / 1000f; if (current.StartsWith(eatonInputCurrentMib_M.CurrentValue)) { deviceValueEntry.Current = System.Convert.ToString((float)System.Convert.ToInt32(text) / 1000f); } else { if (current.StartsWith(eatonInputVoltageMib_M.VoltageValue)) { deviceValueEntry.Voltage = System.Convert.ToString((float)System.Convert.ToInt32(text) / 1000f); } else { if (current.StartsWith(eatonInputPowerMib_M.PowerValue)) { deviceValueEntry.Power = text; } else { if (current.StartsWith(eatonInputPowerMib_M.PowerValue_VA)) { s = text; } } } } } } if (double.Parse(deviceValueEntry.Current) <= 0.0) { deviceValueEntry.Current = (double.Parse(s) / double.Parse(deviceValueEntry.Voltage)).ToString("F2"); } return(deviceValueEntry); }
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(-1000000); } else { if (text == null || string.IsNullOrEmpty(text)) { text = System.Convert.ToString(-500000); } else { if (text.Equals("Null")) { text = System.Convert.ToString(-500000); } } } int num = System.Convert.ToInt32(current.Substring(current.LastIndexOf(".") + 1)); if (num == 1) { EatonInputCurrentMib_M2 eatonInputCurrentMib_M = new EatonInputCurrentMib_M2(num); EatonInputVoltageMib_M2 eatonInputVoltageMib_M = new EatonInputVoltageMib_M2(num); float num2 = (float)System.Convert.ToInt32(text) / 1000f; if (current.StartsWith(eatonInputCurrentMib_M.MaxCurrentMT)) { deviceThreshold.MaxCurrentMT = num2; } else { if (current.StartsWith(eatonInputVoltageMib_M.MaxVoltageMT)) { deviceThreshold.MaxVoltageMT = num2; } else { if (current.StartsWith(eatonInputCurrentMib_M.MinCurrentMt)) { deviceThreshold.MinCurrentMT = num2; } else { if (!current.StartsWith(eatonInputVoltageMib_M.MinVoltageMt)) { return(null); } deviceThreshold.MinVoltageMT = num2; } } } if (deviceThreshold.MinCurrentMT == -500f) { deviceThreshold.MinCurrentMT = -300f; } if (deviceThreshold.MinPowerMT == -500f) { deviceThreshold.MinPowerMT = -300f; } } } return(deviceThreshold); }