Exemple #1
0
 public int GetPmLevel(PmData data)
 {
     double[] levelFrequency = new double[6];
     for (int i = 0; i < 6; i++)
     {
         levelFrequency[i] = 1;
         if (data.Dewp > -10000)
         {
             levelFrequency[i] *= dataBase.DewpFrequency[data.DewpLevel, i] / dataBase.GetItemFrequency(dataBase.DewpFrequency, data.DewpLevel);
         }
         if (data.Lws > -10000)
         {
             levelFrequency[i] *= dataBase.LwsFrequency[data.LwsLevel, i] / dataBase.GetItemFrequency(dataBase.LwsFrequency, data.LwsLevel);
         }
         if (data.Pres > -10000)
         {
             levelFrequency[i] *= dataBase.PresFrequency[data.PresLevel, i] / dataBase.GetItemFrequency(dataBase.PresFrequency, data.PresLevel);
         }
         if (data.Temp > -10000)
         {
             levelFrequency[i] *= dataBase.TempFrequency[data.TempLevel, i] / dataBase.GetItemFrequency(dataBase.TempFrequency, data.TempLevel);
         }
         if (data.Cbwd > -10000)
         {
             levelFrequency[i] *= dataBase.CbwdFrequency[data.CbwdLevel, i] / dataBase.GetItemFrequency(dataBase.CbwdFrequency, data.CbwdLevel);
         }
         if (data.Hour > -10000)
         {
             levelFrequency[i] *= dataBase.HourFrequency[data.HourLevel, i] / dataBase.GetItemFrequency(dataBase.HourFrequency, data.HourLevel);
         }
         levelFrequency[i] *= dataBase.LevelFrequency[i];
     }
     return(FrequencyMax(levelFrequency));
 }
Exemple #2
0
 public bool LoadTestPmData(String path)
 {
     using (var fs = File.OpenRead(path))
     {
         using (var reader = new StreamReader(fs))
         {
             var line = reader.ReadLine();
             while (!reader.EndOfStream)
             {
                 line = reader.ReadLine();
                 var    values = line.Split(',');
                 PmData data   = new PmData();
                 data.Pid  = long.Parse(values[0]);
                 data.Dewp = int.Parse(values[1]);
                 data.Lws  = double.Parse(values[2]);
                 data.Pres = double.Parse(values[3]);
                 data.Temp = double.Parse(values[4]);
                 data.Cbwd = int.Parse(values[5]);
                 var date = values[6].Split('/');
                 data.Pdate = new DateTime(int.Parse(date[0]), int.Parse(date[1]), int.Parse(date[2]));
                 data.Hour  = int.Parse(values[7]);
                 data.Pm    = int.Parse(values[8]);
                 data.level = int.Parse(values[9]);
                 dataBase.AddTestData(data);
             }
         }
     }
     return(true);
 }
Exemple #3
0
        public void TestGetPmLevel()
        {
            PmData data = dataBase.DataList[0];

            Console.WriteLine(GetPmLevel(data));
            data.Cbwd = -114514;
            Console.WriteLine(GetPmLevel(data));
        }
Exemple #4
0
        public int GetPmLevelByDate(PmData pmdata)
        {
            double[] levelFrequency = new double[6];
            double   n = dataBase.GetItemFrequency(dataBase.DateFrequency, pmdata.DateLevel);;

            for (int i = 0; i < 6; i++)
            {
                levelFrequency[i] = dataBase.DateFrequency[pmdata.DateLevel, i] * dataBase.LevelFrequency[i] / n;
            }
            return(FrequencyMax(levelFrequency));
        }
Exemple #5
0
        public void TestData()
        {
            PmData data = new PmData();

            if (data.Pid == null)
            {
                Console.WriteLine("1");
            }
            else
            {
                Console.WriteLine(data.Pid);
            }
        }
Exemple #6
0
 public void AddTestData(PmData data)
 {
     TestList.Add(data);
 }
Exemple #7
0
 public void AddData(PmData data)
 {
     DataList.Add(data);
 }