public TestReport(TestContext context) { this.context = context; Method = new ConditionMethod(); Note = new ConditionNote(); Rated = new ConditionRated(); ValueSheets = new Dictionary <string, ReportSheet>(); DataRaw = new DataRawCollection(context); }
public void RefreshCondition() { ConditionSchedule sch = context.Condition.Schedules[context.Index]; ConditionNote note = context.Condition.Note; Note.Company = note.Company; Note.Name = note.Name; Note.No = note.No; Note.Observer = note.Observer; Note.Maker = note.Maker; Note.Model1 = note.Model1; Note.Serial1 = note.Serial1; Note.Model2 = note.Model2; Note.Serial2 = note.Serial2; Note.Model3 = note.Model3; Note.Serial3 = note.Serial3; Note.ExpDevice = note.ExpDevice; Note.Refrigerant = note.Refrigerant; Note.RefCharge = note.RefCharge; Note.Memo = note.Memo; EIndoorMode mode = sch.IndoorMode; if (mode == EIndoorMode.NotUsed) { mode = EIndoorMode.Cooling; } ConditionRated rated = context.Condition.Rateds[EConditionRated.Total][(int)mode]; Rated.Capacity = rated.Capacity; Rated.PowerInput = rated.PowerInput; Rated.EER_COP = rated.EER_COP; Rated.Voltage = rated.Voltage; Rated.Current = rated.Current; Rated.Frequency = rated.Frequency; Rated.PM_IDU = rated.PM_IDU; Rated.PM_ODU = rated.PM_ODU; Rated.Wiring = rated.Wiring; (ValueSheets["ID A #1"] as ReportCalorieSheet).Set(sch.Indoor1DB, sch.Indoor1WB, sch.OutdoorDB, sch.OutdoorWB); (ValueSheets["ID A #2"] as ReportCalorieSheet).Set(sch.Indoor1DB, sch.Indoor1WB, sch.OutdoorDB, sch.OutdoorWB); (ValueSheets["ID B #1"] as ReportCalorieSheet).Set(sch.Indoor2DB, sch.Indoor2WB, sch.OutdoorDB, sch.OutdoorWB); (ValueSheets["ID B #2"] as ReportCalorieSheet).Set(sch.Indoor2DB, sch.Indoor2WB, sch.OutdoorDB, sch.OutdoorWB); (ValueSheets["ID A TC"] as ReportThermoSheet).Set(sch.Indoor1DB, sch.Indoor1WB, sch.OutdoorDB, sch.OutdoorWB); (ValueSheets["ID A TC"] as ReportThermoSheet).Reinitialize(); (ValueSheets["ID B TC"] as ReportThermoSheet).Set(sch.Indoor2DB, sch.Indoor2WB, sch.OutdoorDB, sch.OutdoorWB); (ValueSheets["ID B TC"] as ReportThermoSheet).Reinitialize(); (ValueSheets["OD TC"] as ReportThermoSheet).Set(sch.Indoor1DB, sch.Indoor1WB, sch.OutdoorDB, sch.OutdoorWB); (ValueSheets["OD TC"] as ReportThermoSheet).Reinitialize(); }
public TestCondition(TestValue value) { Control = null; Schedules = new List <ConditionSchedule>(); Method = new ConditionMethod(); Note = new ConditionNote(); Rateds = new Dictionary <EConditionRated, List <ConditionRated> >(); Rateds.Add(EConditionRated.Total, new List <ConditionRated>() { new ConditionRated(), new ConditionRated() }); Rateds.Add(EConditionRated.ID11, new List <ConditionRated>() { new ConditionRated(), new ConditionRated() }); Rateds.Add(EConditionRated.ID12, new List <ConditionRated>() { new ConditionRated(), new ConditionRated() }); Rateds.Add(EConditionRated.ID21, new List <ConditionRated>() { new ConditionRated(), new ConditionRated() }); Rateds.Add(EConditionRated.ID22, new List <ConditionRated>() { new ConditionRated(), new ConditionRated() }); ThermocoupleDic = new Dictionary <string, string>(); PressureDic = new Dictionary <string, string>(); Pressures = new List <MeasureRow>(); for (int i = 0; i < Resource.Client.Devices.Recorder.PressureLength; i++) { Pressures.Add(new MeasureRow(null, "none", $"Pressure.{i + 1}", i + 1)); } TC1 = new List <MeasureRow>(); TC2 = new List <MeasureRow>(); TC3 = new List <MeasureRow>(); for (int i = 0; i < Resource.Client.Devices.Recorder.ThermocoupleLength / 3; i++) { TC1.Add(new MeasureRow(null, "none", $"ID1.TC.{i + 1:d3}", i + 1)); TC2.Add(new MeasureRow(null, "none", $"ID2.TC.{i + 1:d3}", i + 1)); TC3.Add(new MeasureRow(null, "none", $"OD.TC.{i + 1:d3}", i + 1)); } }
private void SetDataBook() { ValueRow row; ConditionNote note = context.Report.Note; ConditionRated rated = context.Report.Rated; ConditionMethod method = context.Report.Method; DataBookDataSet set = context.DB.DataBookSet; context.Report.RecNo = context.DB.GetGenNo("GN_DATABOOK"); context.Report.RegTime = DateTime.Now; set.RecNo = context.Report.RecNo; set.UserNo = Resource.UserNo; set.BeginTime = context.Report.RegTime.ToString(Resource.csDateTimeFormat); set.EndTime = set.BeginTime; set.ElapsedTime = "00 00:00:00"; set.TestLine = context.Handle; set.IntegCount = method.IntegralCount; set.IntegTime = method.IntegralTime; set.ScanTime = method.ScanTime; set.Company = note.Company; set.TestName = note.Name; set.TestNo = note.No; set.Observer = note.Observer; set.Maker = note.Maker; set.Model1 = note.Model1; set.Serial1 = note.Serial1; set.Model2 = note.Model2; set.Serial2 = note.Serial2; set.Model3 = note.Model3; set.Serial3 = note.Serial3; set.ExpDevice = note.ExpDevice; set.Refrige = note.Refrigerant; set.RefCharge = note.RefCharge; row = context.Value.Calcurated["Total.Capacity"]; set.Capacity = $"{rated.Capacity.ToString(row.Format)} {row.Unit.ToDescription}"; row = context.Value.Calcurated["Total.Power"]; set.PowerInput = $"{rated.PowerInput.ToString(row.Format)} {row.Unit.ToDescription}"; row = context.Value.Calcurated["Total.EER_COP"]; set.EER_COP = $"{rated.EER_COP.ToString(row.Format)} {row.Unit.ToDescription}"; set.PowerSource = $"{rated.Voltage}V / {rated.Current}A / {rated.Frequency}Hz / {EnumHelper.GetNames<EWT330Wiring>()[(int)rated.Wiring]}"; set.TotalCapacity = "0.0 kcal/h"; set.TotalPower = "0.0 W"; set.TotalEER_COP = "0.0 kcal/hW"; set.Memo = note.Memo; set.State = ETestState.Testing; }
private void SetSpreadSheetTitleItems(TestSpreadSheetArgs sheet) { ValueRow row; ConditionNote note = sheet.Report.Note; ConditionRated rated = sheet.Report.Rated; reportSheet.BeginUpdate(); sheet.Report.Lock(); try { foreach (KeyValuePair <string, Dictionary <string, Cell> > tags in sheetTags.Sheets) { if (tags.Key == "Raw Data") { sheetTags.SetWorkSheetVisible(tags.Key, false); continue; } bool sheetUse = sheet.Report.ValueSheets[tags.Key].Use; sheetTags.SetWorkSheetVisible(tags.Key, sheetUse); if (sheetUse == false) { continue; } tags.Value["{300}"].Value = note.Company; tags.Value["{302}"].Value = note.Name; tags.Value["{304}"].Value = note.No; tags.Value["{306}"].Value = note.Observer; tags.Value["{308}"].Value = note.Maker; tags.Value["{310}"].Value = note.Model1; tags.Value["{312}"].Value = note.Serial1; tags.Value["{314}"].Value = note.Model2; tags.Value["{316}"].Value = note.Serial2; string str = note.Model3 + " / " + note.Serial3; if (str.Trim() == "/") { tags.Value["{318}"].Value = ""; } else { tags.Value["{318}"].Value = str; } tags.Value["{320}"].Value = $"{sheet.Report.ValueSheets[tags.Key].IndoorDB:f2} / {sheet.Report.ValueSheets[tags.Key].IndoorWB:f2} ℃"; if (sheet.Report.ValueSheets[tags.Key].IndoorUse == EIndoorUse.NotUsed) { tags.Value["{322}"].Value = sheet.Report.ValueSheets[tags.Key].IndoorUse.ToDescription(); } else { tags.Value["{322}"].Value = $"{sheet.Report.ValueSheets[tags.Key].IndoorUse.ToDescription()}, {sheet.Report.ValueSheets[tags.Key].IndoorMode.ToDescription()}"; } row = context.Value.Calcurated["Total.Capacity"]; tags.Value["{301}"].Value = $"{rated.Capacity.ToString(row.Format)} {row.Unit.ToDescription}"; row = context.Value.Calcurated["Total.Power"]; tags.Value["{303}"].Value = $"{rated.PowerInput.ToString(row.Format)} {row.Unit.ToDescription}"; row = context.Value.Calcurated["Total.EER_COP"]; tags.Value["{305}"].Value = $"{rated.EER_COP.ToString(row.Format)} {row.Unit.ToDescription}"; tags.Value["{307}"].Value = $"{rated.Voltage}V / {rated.Current}A / {rated.Frequency}Hz / {EnumHelper.GetNames<EWT330Wiring>()[(int)rated.Wiring]}"; tags.Value["{309}"].Value = note.ExpDevice; tags.Value["{311}"].Value = note.Refrigerant; tags.Value["{313}"].Value = note.RefCharge; tags.Value["{315}"].Value = sheet.Report.RegTime.ToString(Resource.csDateTimeFormat); tags.Value["{321}"].Value = $"{sheet.Report.ValueSheets[tags.Key].OutdoorDB:f2} / {sheet.Report.ValueSheets[tags.Key].OutdoorWB:f2} ℃";; if (sheet.Report.ValueSheets[tags.Key].OutdoorDP == EEtcUse.Use) { tags.Value["{323}"].Value = $"{sheet.Report.ValueSheets[tags.Key].OutdoorUse.ToDescription()}, DP Used"; } else { tags.Value["{323}"].Value = $"{sheet.Report.ValueSheets[tags.Key].OutdoorUse.ToDescription()}"; } tags.Value["{299}"].Value = note.Memo; if (tags.Key.EndsWith("TC") == false) { tags.Value["{365}"].Value = " " + sheet.Report.ValueSheets[tags.Key].NozzleName; } string cellTag; for (int i = 0; i < 7; i++) { cellTag = "{" + $"min-{i + 1}" + "}"; tags.Value[cellTag].Value = (i < sheet.Report.Method.IntegralCount) ? $"{(i + 1) * sheet.Report.Method.IntegralTime} min" : ""; } foreach (KeyValuePair <string, ReportRow> sheetRow in sheet.Report.ValueSheets[tags.Key].Rows) { cellTag = "{" + sheetRow.Value.Tag + "}"; if (sheetRow.Key.EndsWith("Nozzle") == false) { if (sheetRow.Value.Row == null) { tags.Value[cellTag].Value = ""; } else { tags.Value[cellTag].Value = sheetRow.Value.Row.Unit.ToDescription; } } if (tags.Key.EndsWith("TC") == true) { if (sheetRow.Value.Row == null) { tags.Value[cellTag].Value = ""; } else { cellTag = "{" + sheetRow.Value.Tag + "-N}"; tags.Value[cellTag].Value = sheetRow.Value.Alias; } } } } } finally { sheet.Report.Unlock(); reportSheet.EndUpdate(); } }
public void Initialize() { RecNo = -1; RegTime = DateTime.Now; ConditionSchedule sch = context.Condition.Schedules[context.Index]; ReportSheet sheet; ConditionMethod method = context.Condition.Method; Method.IntegralCount = method.IntegralCount; Method.IntegralTime = method.IntegralTime; Method.ScanTime = method.ScanTime; Method.CoolingCapacity = method.CoolingCapacity; Method.HeatingCapacity = method.HeatingCapacity; Method.AirFlow = method.AirFlow; Method.Enthalpy = method.Enthalpy; Method.Pressure = method.Pressure; Method.DiffPressure = method.DiffPressure; Method.AtmPressure = method.AtmPressure; Method.AutoControllerSetting = method.AutoControllerSetting; Method.UsePowerMeterIntegral = method.UsePowerMeterIntegral; ConditionNote note = context.Condition.Note; Note.Company = note.Company; Note.Name = note.Name; Note.No = note.No; Note.Observer = note.Observer; Note.Maker = note.Maker; Note.Model1 = note.Model1; Note.Serial1 = note.Serial1; Note.Model2 = note.Model2; Note.Serial2 = note.Serial2; Note.Model3 = note.Model3; Note.Serial3 = note.Serial3; Note.ExpDevice = note.ExpDevice; Note.Refrigerant = note.Refrigerant; Note.RefCharge = note.RefCharge; Note.Memo = note.Memo; EIndoorMode mode = sch.IndoorMode; if (mode == EIndoorMode.NotUsed) { mode = EIndoorMode.Cooling; } EUnitCapacity unitCapa = (mode == EIndoorMode.Cooling) ? method.CoolingCapacity : method.HeatingCapacity; context.Value.SetUnitTo(EUnitType.Capacity, (int)unitCapa); context.Value.SetUnitTo(EUnitType.EER_COP, (int)unitCapa); ConditionRated rated = context.Condition.Rateds[EConditionRated.Total][(int)mode]; Rated.Capacity = rated.Capacity; Rated.PowerInput = rated.PowerInput; Rated.EER_COP = rated.EER_COP; Rated.Voltage = rated.Voltage; Rated.Current = rated.Current; Rated.Frequency = rated.Frequency; Rated.PM_IDU = rated.PM_IDU; Rated.PM_ODU = rated.PM_ODU; Rated.Wiring = rated.Wiring; lock (ValueSheets) { string nozzleName; string nozzleState = "O,O,O,O"; List <CoefficientDataRow> coeff = Resource.Settings.Coefficients; ValueSheets.Clear(); nozzleName = $"Nozzle ({coeff[0].Nozzle1:f0}/{coeff[0].Nozzle2:f0}/{coeff[0].Nozzle3:f0}/{coeff[0].Nozzle4:f0})"; sheet = new ReportCalorieSheet(context, "ID1", "ID11", sch.Indoor1DB, sch.Indoor1WB, sch.Indoor1Use, sch.Indoor1Mode1, sch.OutdoorDB, sch.OutdoorWB, sch.OutdoorUse, sch.OutdoorDpSensor, nozzleName, nozzleState); sheet.Use = (sch.Indoor1Use == EIndoorUse.Indoor) ? true : false; ValueSheets.Add("ID A #1", sheet); nozzleName = $"Nozzle ({coeff[1].Nozzle1:f0}/{coeff[1].Nozzle2:f0}/{coeff[1].Nozzle3:f0}/{coeff[1].Nozzle4:f0})"; sheet = new ReportCalorieSheet(context, "ID1", "ID12", sch.Indoor1DB, sch.Indoor1WB, sch.Indoor1Use, sch.Indoor1Mode2, sch.OutdoorDB, sch.OutdoorWB, sch.OutdoorUse, sch.OutdoorDpSensor, nozzleName, nozzleState); sheet.Use = (sch.Indoor1Use == EIndoorUse.Indoor) ? true : false; ValueSheets.Add("ID A #2", sheet); nozzleName = $"Nozzle ({coeff[2].Nozzle1:f0}/{coeff[2].Nozzle2:f0}/{coeff[2].Nozzle3:f0}/{coeff[2].Nozzle4:f0})"; sheet = new ReportCalorieSheet(context, "ID2", "ID21", sch.Indoor2DB, sch.Indoor2WB, sch.Indoor2Use, sch.Indoor2Mode1, sch.OutdoorDB, sch.OutdoorWB, sch.OutdoorUse, sch.OutdoorDpSensor, nozzleName, nozzleState); sheet.Use = (sch.Indoor2Use == EIndoorUse.Indoor) ? true : false; ValueSheets.Add("ID B #1", sheet); nozzleName = $"Nozzle ({coeff[3].Nozzle1:f0}/{coeff[3].Nozzle2:f0}/{coeff[3].Nozzle3:f0}/{coeff[3].Nozzle4:f0})"; sheet = new ReportCalorieSheet(context, "ID2", "ID22", sch.Indoor2DB, sch.Indoor2WB, sch.Indoor2Use, sch.Indoor2Mode2, sch.OutdoorDB, sch.OutdoorWB, sch.OutdoorUse, sch.OutdoorDpSensor, nozzleName, nozzleState); sheet.Use = (sch.Indoor2Use == EIndoorUse.Indoor) ? true : false; ValueSheets.Add("ID B #2", sheet); sheet = new ReportThermoSheet(context, "ID1", "", sch.Indoor1DB, sch.Indoor1WB, sch.Indoor1Use, sch.Indoor1Mode1, sch.OutdoorDB, sch.OutdoorWB, sch.OutdoorUse, sch.OutdoorDpSensor, "", ""); if (sheet.Use == true) { sheet.Use = (sch.Indoor1Use == EIndoorUse.Indoor) ? true : false; } ValueSheets.Add("ID A TC", sheet); sheet = new ReportThermoSheet(context, "ID2", "", sch.Indoor2DB, sch.Indoor2WB, sch.Indoor2Use, sch.Indoor2Mode1, sch.OutdoorDB, sch.OutdoorWB, sch.OutdoorUse, sch.OutdoorDpSensor, "", ""); if (sheet.Use == true) { sheet.Use = (sch.Indoor2Use == EIndoorUse.Indoor) ? true : false; } ValueSheets.Add("ID B TC", sheet); sheet = new ReportThermoSheet(context, "OD", "", sch.Indoor1DB, sch.Indoor1WB, sch.Indoor1Use, sch.Indoor1Mode1, sch.OutdoorDB, sch.OutdoorWB, sch.OutdoorUse, sch.OutdoorDpSensor, "", ""); if (sheet.Use == true) { sheet.Use = (sch.OutdoorUse == EOutdoorUse.Outdoor) ? true : false; } ValueSheets.Add("OD TC", sheet); } DataRaw.Clear(); foreach (KeyValuePair <string, ValueRow> row in context.Value.Calcurated) { if (row.Value.Save == true) { DataRaw.Rows.Add(row.Key, new DataRaw(-1, row.Value)); } } foreach (KeyValuePair <string, ValueRow> row in context.Value.Measured) { if (row.Value.Save == true) { DataRaw.Rows.Add(row.Key, new DataRaw(-1, row.Value)); } } DataRaw.Count = DataRaw.Rows.Count / 600; if ((DataRaw.Rows.Count % 600) != 0) { DataRaw.Count++; } }