public DataSluLamp5(Wlst.client.SluCtrlDataMeasureReply.DataSluCtrlLamp info, int sluId, int ctrlId, int state) : base(info, state) { SluId = sluId; CtrlId = ctrlId; this.CtrlPhyId = NewDataViewModel.GetPhyIdByRtuId(sluId, ctrlId); }
public DataLampItem(Wlst.client.SluCtrlDataMeasureReply.DataSluCtrlLamp tt, int index) { Index = index; //lvf 2018年5月31日16:48:35 物联网单灯 信息方式不同于往常控制器 if (SluId > 1700000 && SluId < 1800000) { ControlId = tt.CtrlId; var t = Wlst.Sr.SlusglInfoHold.Services.SluSglInfoHold.MySlef.Get(tt.CtrlId); if (t == null) { return; } ControlName = t.CtrlName; SluId = Wlst.Sr.SlusglInfoHold.Services.SluSglInfoHold.MySlef.GetCtrlField(tt.CtrlId); } else { ControlId = Wj2090Module.Services.CommonSlu.GetPhyIdByCtrl(tt.SluId, tt.CtrlId); ControlName = Wj2090Module.Services.CommonSlu.GetNameByCtrl(tt.SluId, tt.CtrlId); SluId = tt.SluId; } LightNum = tt.LampId; PowerLever = tt.PowerLevel + "%"; if (tt.DateCtrlCreate > -1) { SampleTime = new DateTime(tt.DateCtrlCreate).ToString("yyyy-MM-dd HH:mm:ss"); } V = tt.Voltage.ToString("f2"); A = tt.Current.ToString("f2"); //lvf 2019年5月7日09:19:52 有功功率乘以0.98 var bs = 1.0; var bss = Wlst.Cr.CoreMims.SystemOption.GetOption(1002); if (string.IsNullOrEmpty(bss) == false) { bs = Convert.ToDouble(bss.Trim()); } //ActivePower = (tt.ActivePower).ToString("f2"); ActivePower = (tt.ActivePower * bs).ToString("f2"); //lvf 2018年11月13日16:25:56 计算无功功率 (ui2-p2)^-2 if ((tt.Voltage * tt.Current) < (tt.ActivePower * bs)) { ReactivePower = "0.00"; } else { ReactivePower = Math.Sqrt(Math.Pow(tt.Voltage * tt.Current, 2) - Math.Pow((tt.ActivePower * bs), 2)).ToString("f2"); } Electricity = tt.Electricity.ToString("f2"); IntControlStatus = tt.StateWorkingOn; IntLightStatus = tt.Fault; LeakageStatus = tt.IsLeakage ? "漏电" : "正常"; IntPowerStatus = tt.PowerStatus; ElectricityTotal = tt.ElectricityTotal.ToString("f2"); ActiveTime = (tt.ActiveTime / 60).ToString("f2"); ActiveTimeTotal = (tt.ActiveTimeTotal / 60).ToString("f2"); var states = tt.State; if (states == 0) { States = "正常"; } if (states == 1) { States = "电压越上限"; } if (states == 2) { States = "电压越下限"; } if (states == 3) { States = "通信故障"; } if (tt.Voltage > 0 && tt.ActivePower > 0 && tt.Current > 0) { var x = (tt.ActivePower * bs) / (tt.Voltage * tt.Current); //var x = (tt.ActivePower) / (tt.Voltage * tt.Current); if (x > 1 && x < 1.2) { x = 1; } //var y =(Math.Truncate(x * 10000) / 10000.0f).ToString("0.0000"); PwFactor = x.ToString("f2") + ""; } else { PwFactor = "--"; } if (states == 3) { V = tt.Voltage.ToString("f2"); A = tt.Current.ToString("f2"); //ActivePower = (tt.ActivePower).ToString("f2"); ActivePower = (tt.ActivePower * bs).ToString("f2"); //lvf 2018年11月13日16:25:56 计算无功功率 (ui2-p2)^-2 if ((tt.Voltage * tt.Current) < (tt.ActivePower * bs)) { ReactivePower = "0.00"; } else { ReactivePower = Math.Sqrt(Math.Pow(tt.Voltage * tt.Current, 2) - Math.Pow((tt.ActivePower * bs), 2)).ToString("f2"); } Electricity = tt.Electricity.ToString("f2"); IntControlStatus = tt.StateWorkingOn; IntLightStatus = tt.Fault; LeakageStatus = "--"; IntPowerStatus = 0; ElectricityTotal = "--"; ActiveTime = "--"; ActiveTimeTotal = "--"; IsCtrlStop = "--"; PwFactor = "--"; // ControlStatus = "通信故障"; } if (tt.DateCtrlCreate < 0) { SampleTime = "终端报警数据"; V = "--"; A = "--"; PwFactor = "--"; ActiveTime = "--"; ActiveTimeTotal = "--"; ElectricityTotal = "--"; Electricity = "--"; ActivePower = "--"; ReactivePower = "--"; } }
//public DataLampItemInfo(DataSluCtrlLampEx tt, int index) // : base(tt, index) //{ // DateCreate = new DateTime(tt.DateCreate ).ToString("yyyy-MM-dd HH:mm:ss"); // IsCtrlStop = tt.IsCtrlStop ? "停运" : "正常"; //} public DataLampItemInfo(Wlst.client.SluCtrlDataMeasureReply.DataSluCtrlLamp tt, int index) : base(tt, index) { DateCreate = "--"; IsCtrlStop = "--"; }
public DataSluCtrlLampVm(Wlst.client.SluCtrlDataMeasureReply.DataSluCtrlLamp info, int states) { if (info.Electricity < 0) { Electricity = "0"; ElectricityTotal = "0"; } else { Electricity = info.Electricity.ToString("f2") + ""; ElectricityTotal = info.ElectricityTotal.ToString("f2"); } if (info.ActiveTime < 0) //ActiveTimeTotal { ActiveTimeTotal = "0"; ActiveTime = "0"; } else { ActiveTime = (info.ActiveTime / 60).ToString("f2"); ActiveTimeTotal = (info.ActiveTimeTotal / 60).ToString("f2"); } if (states == 0) { States = "正常"; } if (states == 1) { States = "电压越上限"; } if (states == 2) { States = "电压越下限"; } if (states == 3) { States = "通信故障"; } if (states == 3) { this.ActivePower = "--"; this.Current = "--"; this.Voltage = "--"; LampId = info.LampId; PowerStatus = "--"; IsLeakage = "--"; StateWorkingOn = "--"; Fault = "--"; PwFactor = "--"; } else { this.ActivePower = info.ActivePower.ToString("f2"); this.Current = info.Current.ToString("f2"); this.Voltage = info.Voltage.ToString("f2"); LampId = info.LampId; PowerStatus = info.PowerStatus == 0 ? "正常" : info.PowerStatus == 1 ? "功率越上限" : "功率越下限"; IsLeakage = info.IsLeakage ? "漏电" : "正常"; StateWorkingOn = info.StateWorkingOn == 0 ? "正常亮灯" : info.StateWorkingOn == 1 ? "调档节能" : info.StateWorkingOn == 2 ? "调光" + info.PowerLevel + "%" : "关灯"; if (info.Voltage > 0 && info.ActivePower > 0 && info.Current > 0) { var x = info.ActivePower / (info.Voltage * info.Current); if (x > 1 && x < 1.2) { x = 1; } PwFactor = (x.ToString("f2")); } else { PwFactor = "--"; } var str = "正常"; if (info.Fault == 1) { str = "光源故障"; } else if (info.Fault == 2) { str = "补偿电容故障"; } else if (info.Fault == 3) { str = "意外灭灯"; } else if (info.Fault == 4) { str = "意外亮灯"; } else if (info.Fault == 5) { str = "自熄灯"; } else if (info.Fault == 6) { str = "控制器断电告警"; } else if (info.Fault == 7) { str = "继电器故障"; } Fault = str; if (info.DateCtrlCreate < 0) { Voltage = "无"; ActivePower = "无"; ActiveTime = "无"; ActiveTimeTotal = "无"; Electricity = "无"; ElectricityTotal = "无"; PowerStatus = "无"; Current = "无"; } } DBCode = "--"; DBLamp = "--"; if (Sr.SlusglInfoHold.Services.SluSglInfoHold.MySlef.Info. ContainsKey(info.SluId)) { var t = Sr.SlusglInfoHold.Services.SluSglInfoHold.MySlef.Info[info.SluId]; foreach (var tt in t.CtrlLst) { if (tt.CtrlId == info.CtrlId) { DBCode = tt.BarCodeId + ""; DBLamp = tt.LampCode; break; } } } }
public DataSluCtrlLampVm(Wlst.client.SluCtrlDataMeasureReply.DataSluCtrlLamp info, int states) { if (info.Electricity < 0) { Electricity = "0"; ElectricityTotal = "0"; } else { Electricity = info.Electricity.ToString("f2") + ""; ElectricityTotal = info.ElectricityTotal.ToString("f2"); } if (info.ActiveTime < 0) //ActiveTimeTotal { ActiveTimeTotal = "0"; ActiveTime = "0"; } else { ActiveTime = (info.ActiveTime / 60).ToString("f2"); ActiveTimeTotal = (info.ActiveTimeTotal / 60).ToString("f2"); } if (states == 0) { States = "正常"; } if (states == 1) { States = "电压越上限"; } if (states == 2) { States = "电压越下限"; } if (states == 3) { States = "通信故障"; } if (states == 3) { this.ActivePower = "--"; this.Current = "--"; this.Voltage = "--"; LampId = info.LampId; PowerStatus = "--"; IsLeakage = "--"; StateWorkingOn = "--"; Fault = "--"; PwFactor = "--"; } else { //lvf 2019年5月7日09:19:52 有功功率乘以0.98 var bs = 1.0; var bss = Wlst.Cr.CoreMims.SystemOption.GetOption(1002); if (string.IsNullOrEmpty(bss) == false) { bs = Convert.ToDouble(bss.Trim()); } this.ActivePower = (info.ActivePower * bs).ToString("f2"); //this.ActivePower = (info.ActivePower).ToString("f2"); this.Current = info.Current.ToString("f2"); this.Voltage = info.Voltage.ToString("f2"); LampId = info.LampId; PowerStatus = info.PowerStatus == 0 ? "正常" : info.PowerStatus == 1 ? "功率越上限" : "功率越下限"; IsLeakage = info.IsLeakage ? "漏电" : "正常"; StateWorkingOn = info.StateWorkingOn == 0 ? "正常亮灯" : info.StateWorkingOn == 1 ? "调档节能" : info.StateWorkingOn == 2 ? "调光节能" : "关灯"; if (info.Voltage > 0 && info.ActivePower > 0 && info.Current > 0) { var x = (info.ActivePower * bs) / (info.Voltage * info.Current); if (x > 1 && x < 1.2) { x = 1; } //var y = (Math.Truncate(x * 10000) / 10000.0f).ToString("0.0000"); PwFactor = (x.ToString("f2")); } else { PwFactor = "--"; } var str = "正常"; if (info.Fault == 1) { str = "光源故障"; } else if (info.Fault == 2) { str = "补偿电容故障"; } else if (info.Fault == 3) { str = "意外灭灯"; } else if (info.Fault == 4) { str = "意外亮灯"; } else if (info.Fault == 5) { str = "自熄灯"; } else if (info.Fault == 6) { str = "控制器断电告警"; } else if (info.Fault == 7) { str = "继电器故障"; } Fault = str; if (info.DateCtrlCreate < 0) { Voltage = "无"; ActivePower = "无"; ActiveTime = "无"; ActiveTimeTotal = "无"; Electricity = "无"; ElectricityTotal = "无"; PowerStatus = "无"; Current = "无"; } } DBCode = "--"; DBLamp = "--"; if (Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems. ContainsKey(info.SluId)) { var t = Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems[info.SluId] as Wlst.Sr.EquipmentInfoHolding.Model.Wj2090Slu; if (t != null && t.WjSluCtrls.ContainsKey(info.CtrlId)) { DBCode = t.WjSluCtrls[info.CtrlId].BarCodeId.ToString(""); DBLamp = t.WjSluCtrls[info.CtrlId].LampCode; } } }