Exemplo n.º 1
0
 public void CopyData(GraphLayer g, int intervalSec)
 {
     _startTime = _DataArray[_firstIndex].Key.AddYears(-1);
     g.ClearData();
     for (int i = _firstIndex; i != _lastIndex; ++i)
     {
         i %= _sizeArray;
         g.UpdateData(_DataArray[i].Value, _DataArray[i].Key.AddTicks(-_startTime.Ticks));
     }
     g.UpdateAsis(_DataArray[_firstIndex].Key, _DataArray[_firstIndex].Key.AddSeconds(intervalSec));
 }
Exemplo n.º 2
0
 public void CopyData(GraphLayer g, int intervalSec)
 {
     _startTime = _DataArray[_firstIndex].Key.AddYears(-1);
     g.ClearData();
     for (int i = _firstIndex; i != _lastIndex; ++i)
     {
         i %= _sizeArray;
         g.UpdateData(_DataArray[i].Value, _DataArray[i].Key.AddTicks(-_startTime.Ticks));
     }
     g.UpdateAsis(_DataArray[_firstIndex].Key, _DataArray[_firstIndex].Key.AddSeconds(intervalSec));
 }
Exemplo n.º 3
0
        private void ReadPortData(byte[] inBuf, int rxIndex)
        {
            //case GetFlowCommand : // расход
            //      FlowTemp = 0;
            //      FlowTemp = getchar();
            //      FlowTemp = (FlowTemp << 8) + getchar();
            //      FlowTemp = (FlowTemp << 8) + getchar();
            //      FlowTemp = (FlowTemp << 8) + getchar();

            if (inBuf[rxIndex] == GetFlowCommand)
            {
                txtDebug.Text = string.Format("{0:X2} {1:X2} {2:X2} {3:X2} {4:X2}",
                                              inBuf[rxIndex], inBuf[rxIndex + 1], inBuf[rxIndex + 2], inBuf[rxIndex + 3], inBuf[rxIndex + 4]);


                //int y = BitConverter.ToInt32(inBuf, rxIndex+1);
                int y = (((int)inBuf[rxIndex + 1]) << 24) +
                        (((int)inBuf[rxIndex + 2]) << 16) +
                        (((int)inBuf[rxIndex + 3]) << 8) +
                        ((int)inBuf[rxIndex + 4]);


                if (y > Math.Max(_maxVal * 10, 30 * 1000))
                {
                    return;                                        //Всплески
                }
                txtValue.Text    = y.ToString();
                txtValueMin.Text = (y - _minVal).ToString();

                y -= _minVal;

                _yMidArr[_yIndex] = y;
                _yIndex++;
                _yIndex %= _yMidCnt;

                int temp = 0;
                for (int i = 0; i < _yMidCnt; i++)
                {
                    temp += _yMidArr[(i + _yIndex) % _yMidCnt];
                }
                txtMidValue.Text = (temp / _yMidCnt).ToString();

                if (_status == Status.Start)
                {
                    txtLogValuemiMin.AppendText(y.ToString() + "\r\n");
                    txtLogMaxdelValue.AppendText(((double)_maxVal / (double)y).ToString() + "; " + ((double)y * 1000.0 / _maxVal).ToString() + "\r\n");

                    DateTime x = DateTime.Now.AddTicks(-_timeStart.Ticks);
                    _graphLayer.UpdateData(y / 1000.0, x, (double)y / _maxVal); //Делим в литры!
                    _dataSaveLayer.UpdateData(y / 1000.0, x);
                }
            }
        }