コード例 #1
0
        public void GenerateData(bool isFail)
        {
            int numEntries, i;
            int minRPM, maxRPM, temp;
            double kmp, hsuPer;
            range minRPMRange = new range();
            range maxRPMRange = new range();
            range hsuRange = new range();
            range tempRange = new range();
            dataTableList = new CustomerDataTableList();
            if (isFail == false)
            {
                hsuRange.min = 50;
                hsuRange.max = 65;
            }
            else
            {
                hsuRange.min = 65;
                hsuRange.max = 70;
            }

            numEntries = random.Next(4, 6);
            CalMinRPMRange(ref minRPMRange);
            CalMaxRPMRange(minRPMRange, ref maxRPMRange);
            CalMaxTempGenerator(ref tempRange);
            avgKval = 0;
            avgHsuPer = 0;
            for (i = 0; i < numEntries; i++)
            {
                minRPM = random.Next(minRPMRange.min, minRPMRange.max);
                maxRPM = random.Next(maxRPMRange.min, maxRPMRange.max);
                hsuPer = CalHSUPerGenerator(hsuRange);
                temp = random.Next(tempRange.min, tempRange.max);
                kmp = CalKMPGenerator();
                avgKval += kmp;
                avgHsuPer += hsuPer;
                dataTableList.AddData(new CustomerDataTable(i + 1, minRPM, maxRPM, temp, kmp, hsuPer));
            }
            avgKval /= numEntries;
            avgHsuPer /= numEntries;
        }
コード例 #2
0
        private bool CreateData(ref CustomerData data, ref CustomerDataTableList dataTable)
        {
            CustomerDataTable tmpTable = new CustomerDataTable();
            String imagePath;
            bool ret = CheckValue();
            if (!ret)
                return ret;
            imagePath = Helper.SaveImageCapture(captureImageBox.Image.Bitmap, txt_vehNo.Text);
            data.AddCustomerData(txt_vehNo.Text,
                                cmb_category.Text,
                                cmb_vehMake.Text,
                                cmb_vehModel.Text,
                                txt_fuelTupe.Text,
                                txt_validUpto.Text,
                                txt_regYear.Text,
                                txt_result.Text,
                                imagePath);
            dataTable = generator.GetDataTableList();
            #if XMLDone
            for (int i = 0; i < grd_dataTable.RowCount-1; i++)
            {
                tmpSrno = Convert.ToInt32(grd_dataTable.Rows[i].Cells["srno"].Value.ToString());
                tmpRmpMin = Convert.ToInt32(grd_dataTable.Rows[i].Cells["rpmMin"].Value.ToString());
                tmpRpmMax = Convert.ToInt32(grd_dataTable.Rows[i].Cells["rpmMax"].Value.ToString());
                tmpOilTemp = Convert.ToInt32(grd_dataTable.Rows[i].Cells["oilTemp"].Value.ToString());
                tmpKval = Convert.ToDouble(grd_dataTable.Rows[i].Cells["kVal"].Value.ToString());
                tmpHsuper = Convert.ToDouble(grd_dataTable.Rows[i].Cells["hsuPer"].Value.ToString());

                tmpTable.AddCustomerDataTable(tmpSrno, tmpRmpMin, tmpRpmMax, tmpOilTemp, tmpKval, tmpHsuper);
                dataTable.AddData(tmpTable);
            }
            #endif
            return true;
        }