コード例 #1
0
        private void RefreshContext()
        {
            if (InvalidContext == false)
            {
                return;
            }

            try
            {
                ConditionSchedule sch    = context.Condition.Schedules[context.Index];
                ConditionMethod   method = context.Condition.Method;

                context.RefreshCondition();
                context.Report.RefreshCondition();
                context.Value.Integral.Initialize(method.ScanTime, method.IntegralTime, sch);

                sheetArgs.Index = EWorkSheet.Title;
                OnSetSpreadSheet();

                descArgs.Name           = sch.Name;
                descArgs.RepeatMax      = sch.Repeat;
                descArgs.PrepareMaxTime = sch.PreRun * csOneMiniteMsec;
                descArgs.JudgeMaxTime   = sch.Judge * csOneMiniteMsec;
                descArgs.JudgeMax       = sch.NoOfSteady;

                OnDispState();
            }
            finally
            {
                InvalidContext = false;
            }
        }
コード例 #2
0
        public CtrlViewGraphPanel(int index, ConditionMethod method, UlDoubleBufferedSeriesCollection series)
        {
            InitializeComponent();

            Index  = index;
            Method = method;
            Initialize(series);
        }
コード例 #3
0
        private void Initialize()
        {
            recNo  = -1;
            db     = Resource.ViewDB;
            method = new ConditionMethod();

            CreateBufferedSeries();
            CreateGraph();
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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));
            }
        }
コード例 #6
0
        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;
        }
コード例 #7
0
        private void DoIntegration(ConditionMethod method)
        {
            bool repeat = true;

            OnSetToggleButtonState(false);

            while (repeat == true)
            {
                try
                {
                    context.Value.Integral.Clear();

                    descArgs.Step         = ETestStep.Integration;
                    descArgs.IntegMaxTime = method.IntegralTime * method.IntegralCount * csOneMiniteMsec;
                    descArgs.IntegCurTime = 0;
                    OnDispState();

                    Integration(method);
                    repeat = false;
                }
                catch (UlThreadTerminatedException e)
                {
                    ClearValues((int)sheetArgs.Index - 1);

                    switch ((ETestMessage)e.Code)
                    {
                    case ETestMessage.None:
                        throw e;

                    case ETestMessage.Next:
                        repeat = false;
                        break;

                    case ETestMessage.Reset:
                        repeat = true;
                        break;
                    }
                }
            }

            OnSetToggleButtonState(true);
        }
コード例 #8
0
        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++;
            }
        }
コード例 #9
0
        private void Integration(ConditionMethod method)
        {
            long ticks;
            long maxTicks       = descArgs.IntegMaxTime;
            long prevTicks      = ElapsedMilliseconds;
            long integPrevTicks = prevTicks;
            long startTicks     = prevTicks;
            long integTime      = method.IntegralTime * csOneMiniteMsec;

            int  scanCount     = 0;
            int  integCount    = 0;
            int  integMaxCount = method.IntegralCount;
            bool needInsert    = true;

            while (Terminated == false)
            {
                ticks = ElapsedMilliseconds;

                if (needInsert == true)
                {
                    needInsert = false;
                    InsertDataSheet();
                }

                if (IsTimeoutMilliseconds(prevTicks, csInvalidTime) == true)
                {
                    prevTicks                += csInvalidTime;
                    descArgs.ElapsedTime      = ticks - startTicks;
                    descArgs.TotalElapsedTime = totalWatch.ElapsedMilliseconds;
                    descArgs.IntegCurTime     = descArgs.ElapsedTime;
                    OnDispState();

                    scanCount++;
                    if (scanCount >= context.Condition.Method.ScanTime)
                    {
                        OnInvalidGraph(ticks);
                        scanCount = 0;
                    }

                    DispValues(integCount);
                    Integrate();
                }

                if (IsTimeoutMilliseconds(integPrevTicks, integTime) == true)
                {
                    SetIntegralValuesToReport(integCount);
                    DispIntegralValues(integCount);
                    InsertDataValue(integCount);

                    integPrevTicks += integTime;
                    integCount++;
                }

                if (IsTimeoutMilliseconds(startTicks, maxTicks) == true)
                {
                    descArgs.IntegCurTime = maxTicks;
                    break;
                }

                SaveDataRaw();
                Yield();
            }
        }
コード例 #10
0
        protected override void Execute()
        {
            Watch.Stop();
            totalWatch.Stop();

            DateTime                 endTime;
            TimeSpan                 elapsedTime;
            ConditionSchedule        sch;
            TestValue                value     = context.Value;
            ConditionMethod          method    = context.Condition.Method;
            List <ConditionSchedule> schedules = context.Condition.Schedules;

            try
            {
                descArgs.ScheduleCount    = 0;
                descArgs.ScheduleMax      = schedules.Count;
                descArgs.TotalElapsedTime = 0;

                for (int i = 0; i < schedules.Count; i++)
                {
                    sch = schedules[i];
                    if (sch.Use == false)
                    {
                        continue;
                    }

                    context.Index = i;
                    context.Initialize();
                    context.Report.Initialize();

                    sheetArgs.Report = context.Report;

                    value.Integral.Initialize(method.ScanTime, method.IntegralTime, sch);

                    descArgs.Name          = sch.Name;
                    descArgs.Step          = ETestStep.None;
                    descArgs.RepeatMax     = sch.Repeat;
                    descArgs.ScheduleCount = i + 1;

                    for (int j = 0; j < sch.Repeat; j++)
                    {
                        value.Integral.Clear();
                        context.Report.Clear();

                        OnClearSpreadSheet();

                        sheetArgs.Index = EWorkSheet.Title;
                        OnSetSpreadSheet();

                        descArgs.RepeatCount  = j + 1;
                        descArgs.JudgeMax     = sch.NoOfSteady;
                        descArgs.JudgeCount   = 0;
                        descArgs.JudgeMaxTime = sch.Judge * csOneMiniteMsec;
                        descArgs.JudgeCurTime = 0;
                        descArgs.IntegMaxTime = method.IntegralTime * method.IntegralCount * csOneMiniteMsec;
                        descArgs.IntegCurTime = 0;
                        OnDispState();

                        InsertDataHead();
                        prevRawTicks         = 0;
                        context.Value.Saving = true;
                        OnInvalidGraph(0);
                        Watch.Restart();
                        totalWatch.Start();

                        try
                        {
                            DoPreparation(sch);
                            DoJudgement(sch);
                            DoIntegration(method);
                        }
                        finally
                        {
                            endTime     = DateTime.Now;
                            elapsedTime = endTime.Subtract(context.Report.RegTime);

                            totalWatch.Stop();
                            Watch.Stop();
                            context.Value.Saving = false;

                            InsertAllDataRaw();

                            string capacity = GetSheetAverageValue("Total.Capacity");
                            string power    = GetSheetAverageValue("Total.Power");
                            string eer_cop  = GetSheetAverageValue("Total.EER_COP");

                            UpdateDataBook(endTime, elapsedTime, capacity, power, eer_cop, ETestState.Done);
                            SaveSpreadSheet();

                            OnClearGraph();

                            descArgs.Step = ETestStep.None;
                            OnDispState();
                        }
                    }
                }

                PostMessage(Resource.WM_TEST_NORMAL_TERMINATED);
            }
            catch (UlThreadTerminatedException)
            {
                UpdateDataBook(ETestState.Stopped);
                PostMessage(Resource.WM_TEST_ABNORMAL_TERMINATED);
            }
        }