Example #1
0
        //Timerset 1000 milisec for writetextfile , callfunction clientsenddata for control and plotgraph
        private void Timer2_Tick(object sender, EventArgs e)
        {
            //callFunction
            setDayStatus();
            setTimesDisplay();
            RunPostAsync();

            //show monitor control
            WindDirectionControl.Text = String.Format("{0:0.000}", _Weather_Info.Wind_Dir);
            WindSpeedControl.Text     = String.Format("{0:0.000}", _Weather_Info.Wind_Speed);

            //Write data to textfile
            if (_Weather_Info.WindDirCanWrite && _Weather_Info.WindSpeedCanWrite)
            {
                Logger loggers = LogManager.GetCurrentClassLogger();
                loggers.Info(_Weather_Info.WindDirRaw.ToString() + ";" + _Weather_Info.Wind_Dir.ToString() + ";" + _Weather_Info.Wind_Dir_Min.ToString() + ";" + _Weather_Info.Wind_Dir_Max.ToString() + ";" +
                             _Weather_Info.WindSpeedRaw.ToString() + ";" + _Weather_Info.Wind_Speed.ToString() + ";" + _Weather_Info.Wind_Speed_Min.ToString() + ";" + _Weather_Info.Wind_Speed_Max.ToString() + ";" +
                             _Weather_Info.Temperature.ToString() + ";" + _Weather_Info.Humidity.ToString() + ";" + _Weather_Info.AirPresure.ToString() + ";" + _DataControl_Info.WindSpeedControl.ToString());
            }

            //call class point to plotgraph
            DataPoints._Weather_Info = this._Weather_Info;

            //plotgraph control page
            if (!IsEnable)
            {
                PoltGraphDataControl();
            }

            if (this._Weather_Info != null)
            {
                stopwatch.Start();
                TimeSpan timeSpan = stopwatch.Elapsed;
                double   timess   = timeSpan.TotalSeconds;

                WindspeedCon.AddPoint(timess, _Weather_Info.Wind_Speed);

                Datacontrol_Graph.GraphPane.XAxis.Scale.Max = timess + 1;

                if (WindspeedCon.Points.Count < MaxX)
                {
                    Datacontrol_Graph.GraphPane.XAxis.Scale.Min = 1;
                }
                else
                {
                    Datacontrol_Graph.GraphPane.XAxis.Scale.Min = WindspeedCon.Points[0].X;
                }

                Datacontrol_Graph.AxisChange();
                Datacontrol_Graph.Invalidate();
            }
        }
Example #2
0
        //plotgraph
        private void PoltGraphDataControl()
        {
            GraphPane myPane = Datacontrol_Graph.GraphPane;

            myPane.XAxis.Scale.Min     = 0;
            myPane.XAxis.Scale.Max     = 86400;
            myPane.YAxis.Scale.Min     = 0;
            myPane.YAxis.Scale.MaxAuto = true;

            myPane.Title.Text       = "Graph Compensation Parameter";
            myPane.XAxis.Title.Text = "Time";
            myPane.YAxis.Title.Text = "M/s";

            WindspeedCon = myPane.AddCurve("WindSpeed (m/s)", new RollingPointPairList(MaxX), Color.Red, SymbolType.None);
            WindspeedCon.Line.IsSmooth = false;
            WindspeedCon.Line.Width    = 5F;

            Datacontrol_Graph.AxisChange();
            Datacontrol_Graph.Invalidate();

            IsEnable = true;
        }