/// <summary> /// Gets the history of a specific storage site and environmental factor. /// </summary> /// <param name="siteId">The ID of the storage site to get the history for.</param> /// <param name="factor">The factor to get the history for.</param> /// <param name="startTime">Start time of the period to get value for.</param> /// <param name="endTime">End time of the period to get value for.</param> /// <param name="maxPoints">Optional upper bound of points for data density reduction.</param> /// <returns>Returns the matching values.</returns> public IEnumerable <DataPoint> GetHistory(Guid siteId, EnvironmentalFactor factor, DateTime startTime, DateTime endTime, int?maxPoints) { StorageSite site = LocationsService.GetStorageSite(siteId); IEnumerable <DataPoint> history = EnvironmentalDataRepository.GetHistory(site, factor, startTime, endTime); if (maxPoints.HasValue && history.Count() > maxPoints) { history = DataDensityReducer.ReduceDensity(history, maxPoints.Value); } return(history); }
/// <summary> /// Gets the min and max values for a specific storage site and environmental factor. /// </summary> /// <param name="siteId">The ID of the storage site to get the history for.</param> /// <param name="factor">The factor to get the history for.</param> /// <param name="startTime">Start time of the period to get value for.</param> /// <param name="endTime">End time of the period to get value for.</param> /// <returns>Returns the extrema.</returns> public Extrema GetExtrema(Guid siteId, EnvironmentalFactor factor, DateTime startTime, DateTime endTime) { StorageSite site = LocationsService.GetStorageSite(siteId); return(EnvironmentalDataRepository.GetExtrema(site, factor, startTime, endTime)); }
/// <summary> /// Gets the latest value for a specific storage site and environmental factor. /// </summary> /// <param name="siteId">The ID of the storage site to get the latest value for.</param> /// <param name="factor">The factor to get the latest value for.</param> /// <returns>Returns the latest value, or null.</returns> public DataPoint GetLatestValue(Guid siteId, EnvironmentalFactor factor) { StorageSite site = LocationsService.GetStorageSite(siteId); return(EnvironmentalDataRepository.GetLatestValue(site, factor)); }