Exemplo n.º 1
0
        IEnumerable <IDataPoint> IArchive.ReadData(int historianID, string startTime, string endTime, bool timeSorted)
        {
            ulong startTimestamp = (ulong)TimeTag.Parse(startTime).ToDateTime().Ticks;
            ulong endTimestamp   = (ulong)TimeTag.Parse(endTime).ToDateTime().Ticks;

            return(ReadDataStream(m_clientDatabase.Read(startTimestamp, endTimestamp, new[] { (ulong)historianID })));
        }
Exemplo n.º 2
0
        IEnumerable <IDataPoint> IArchive.ReadData(IEnumerable <int> historianIDs, string startTime, string endTime, bool timeSorted)
        {
            ulong startTimestamp = (ulong)TimeTag.Parse(startTime).ToDateTime().Ticks;
            ulong endTimestamp   = (ulong)TimeTag.Parse(endTime).ToDateTime().Ticks;

            return(ReadDataStream(m_clientDatabase.Read(startTimestamp, endTimestamp, historianIDs.Select(pointID => (ulong)pointID))));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Sets the boundaries for the x-axis.
        /// </summary>
        /// <param name="startTimeString">A string representation of the lower x-axis boundary.</param>
        /// <param name="endTimeString">A string representation of the upper x-axis boundary.</param>
        public void SetInterval(string startTimeString, string endTimeString)
        {
            DateTime startTime = TimeTag.Parse(startTimeString).ToDateTime();
            DateTime endTime   = TimeTag.Parse(endTimeString).ToDateTime();

            if (startTime > endTime)
            {
                throw new ArgumentException("startTime > endTime");
            }

            ClearHistory();
            m_xAxis.Minimum = null;
            m_xAxis.Maximum = null;
            m_yAxis.Minimum = null;
            m_yAxis.Maximum = null;

            m_xAxis.Minimum = startTime;
            m_xAxis.Maximum = endTime;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Creates a new instance of the <see cref="HistorianViewUserControl"/> class.
        /// </summary>
        public HistorianViewUserControl()
        {
            m_archiveFiles     = new List <ArchiveFile>();
            m_metadata         = new List <MetadataWrapper>();
            m_contextMenuItems = new List <MenuItem>();
            m_visibleColumns   = new HashSet <string>();

            InitializeComponent();
            InitializeChartWindow();

            StartTime = TimeTag.Parse("*-5M").ToDateTime();
            EndTime   = TimeTag.Parse("*").ToDateTime();
            m_currentTimeCheckBox.IsChecked = true;

            string[] lastArchiveLocations = ConfigurationFile.Current.Settings.General["ArchiveLocations", true].ValueAs("").Split('|').Where(archiveLocation => !string.IsNullOrWhiteSpace(archiveLocation) && File.Exists(archiveLocation)).ToArray();

            if (lastArchiveLocations == null || lastArchiveLocations.Length == 0)
            {
                // See if a local archive folder exists with a valid archive
                string defaultArchiveLocation = FilePath.GetAbsolutePath("Archive");

                if (Directory.Exists(defaultArchiveLocation))
                {
                    lastArchiveLocations = Directory.GetFiles(defaultArchiveLocation, "*_archive.d");
                }

                if (lastArchiveLocations == null || lastArchiveLocations.Length == 0)
                {
                    // See if a local statistics folder exists with a valid archive
                    defaultArchiveLocation = FilePath.GetAbsolutePath("Statistics");

                    if (Directory.Exists(defaultArchiveLocation))
                    {
                        lastArchiveLocations = Directory.GetFiles(defaultArchiveLocation, "*_archive.d");
                    }
                }
            }

            if (lastArchiveLocations != null && lastArchiveLocations.Length > 0)
            {
                OpenArchives(lastArchiveLocations);
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// Returns an <see cref="IDataPoint"/> object for this <see cref="SerializableTimeSeriesDataPoint"/>.
 /// </summary>
 /// <returns>An <see cref="IDataPoint"/> object.</returns>
 public IDataPoint Deflate()
 {
     // TODO: Eliminate the need for this by modifying ArchiveFile to use IDataPoint internally.
     return(new ArchiveDataPoint(HistorianID, TimeTag.Parse(Time), Value, Quality));
 }
Exemplo n.º 6
0
 /// <summary>
 /// Reads <see cref="ArchiveDataPoint"/>s from the <see cref="ArchiveFile"/>.
 /// </summary>
 /// <param name="historianIDs">Historian identifiers for which <see cref="ArchiveDataPoint"/>s are to be retrieved.</param>
 /// <param name="startTime"><see cref="String"/> representation of the start time (in UTC) for the <see cref="ArchiveDataPoint"/>s to be retrieved.</param>
 /// <param name="endTime"><see cref="String"/> representation of the end time (in UTC) for the <see cref="ArchiveDataPoint"/>s to be retrieved.</param>
 /// <param name="timeSorted">Indicates whether the data retrieved from the archive should be time sorted.</param>
 /// <returns><see cref="IEnumerable{T}"/> object containing zero or more <see cref="ArchiveDataPoint"/>s.</returns>
 public IEnumerable <IDataPoint> ReadData(IEnumerable <int> historianIDs, string startTime, string endTime, bool timeSorted = true)
 {
     return(ReadData(historianIDs, TimeTag.Parse(startTime), TimeTag.Parse(endTime), timeSorted));
 }