Exemplo n.º 1
0
        public const double ARH_TO_SHOW_INCREMENT = 0.05; //相对湿度的增量

        public static void GetAtmosphereTables(out double[] temps, out double[] svps, out double[] arhs)
        {
            //获取温度列表
            double startTemp = (double)TEMP_MIN;;  //TODO: xaml中改成绑定常量的形式

            temps = new double[TEMP_LENGTH];
            //获取温度对应的饱和水蒸气分压力列表
            svps = new double[TEMP_LENGTH];

            //要显示的相对湿度列表
            arhs = new double[ARH_LINE_COUNT];
            //mcs = new double[ARH_LINE_COUNT][];
            for (int i = 0; i < ARH_LINE_COUNT; i++)
            {
                arhs[i] = ARH_TO_SHOW_MIN + i * ARH_TO_SHOW_INCREMENT;
                //mcs[i] = new double[TEMP_LENGTH];
            }

            for (int i = 0; i < TEMP_LENGTH; i++)
            {
                temps[i]   = startTemp;
                startTemp += TEMP_INCREMENT;

                svps[i] = HSAtmosphere.SaturationVaporPressure(temps[i]);
            }
        }
Exemplo n.º 2
0
        void InitChart()
        {
            LinesDatabase.GetAtmosphereTables(out _tempsList, out _svpList, out _arhToShowList);
            for (int j = 0; j < LinesDatabase.ARH_LINE_COUNT; j++)
            {
                LineSeries ls = new LineSeries
                {
                    Values            = new ChartValues <ObservablePoint> {
                    },
                    LineSmoothness    = 0,
                    Fill              = Brushes.Transparent,
                    PointGeometrySize = 0,
                    //DataLabels = true,
                };

                VisualElement ve = new VisualElement
                {
                    HorizontalAlignment = HorizontalAlignment.Left,
                    VerticalAlignment   = VerticalAlignment.Bottom,
                    UIElement           = new HSVEControl(_arhToShowList[j])
                };
                double lastX     = 0;
                double lastY     = 0;
                bool   hasShowEV = false;
                for (int i = 0; i < LinesDatabase.TEMP_LENGTH; i++)
                {
                    //数据计算
                    double mc = HSAtmosphere.MoistureContent(_svpList[i], _arhToShowList[j], _pressure);
                    var    op = new ObservablePoint(mc, _tempsList[i]);
                    //显示线
                    ls.Values.Add(op);
                    if (!hasShowEV)
                    {
                        if (_tempsList[i] >= LinesDatabase.TEMP_MAX)
                        {
                            hasShowEV = true;
                            lastX     = mc;
                            lastY     = _tempsList[i];
                        }
                        else if (mc >= LinesDatabase.MC_MAX)
                        {
                            hasShowEV = true;
                            lastX     = LinesDatabase.MC_MAX;
                            lastY     = _tempsList[i];
                        }
                    }
                }
                _seriesCollection.Add(ls);
                //显示标志
                ve.X = lastX;
                ve.Y = lastY;
                _cartesianVisuals.Add(ve);
            }
        }
Exemplo n.º 3
0
 public void UpdateChart(double pressure)
 {
     for (int j = 0; j < LinesDatabase.ARH_LINE_COUNT; j++)
     {
         double lastX     = 0;
         double lastY     = 0;
         bool   hasShowEV = false;
         for (int i = 0; i < LinesDatabase.TEMP_LENGTH; i++)
         {
             //数据计算
             double mc = HSAtmosphere.MoistureContent(_svpList[i], _arhToShowList[j], pressure);
             // var op = new ObservablePoint(mc, _tempsList[i]);
             //显示线
             ObservablePoint op = (ObservablePoint)_seriesCollection[j].Values[i];
             op.X = mc;
             op.Y = _tempsList[i];
             if (!hasShowEV)
             {
                 if (_tempsList[i] >= LinesDatabase.TEMP_MAX)
                 {
                     hasShowEV = true;
                     lastX     = mc;
                     lastY     = _tempsList[i];
                 }
                 else if (mc >= LinesDatabase.MC_MAX)
                 {
                     hasShowEV = true;
                     lastX     = LinesDatabase.MC_MAX;
                     lastY     = _tempsList[i];
                 }
             }
         }
         //SeriesCollection.Add(ls);
         //显示标志
         _cartesianVisuals[j].X = lastX;
         _cartesianVisuals[j].Y = lastY;
         //CartesianVisuals.Add(ve);
     }
 }
Exemplo n.º 4
0
 public HSAtmosphereViewModel()
 {
     _atmosphere = new HSAtmosphere();
 }