This class houses the meta-parameters that TimeSeriesLibrary is responsible for writing to the database along with the BLOB (this class contains the meta parameters but not the BLOB itself).
Exemplo n.º 1
0
 /// <summary>
 /// This method copies the parameters of a time series from a TSParameters object
 /// into this TSImport object.
 /// </summary>
 /// <param name="tsp">The TSParameters object that values will be copied from</param>
 public void RecordFromTSParameters(TSParameters tsp)
 {
     TimeStepUnit     = tsp.TimeStepUnit;
     TimeStepQuantity = tsp.TimeStepQuantity;
     BlobStartDate    = tsp.BlobStartDate;
     CompressionCode  = tsp.CompressionCode;
 }
        void ChecksumTimer()
        {
            int i;

            var ts = new TSParameters
            {
                BlobStartDate = DateTime.Parse("1/1/2000"),
                CompressionCode = TSBlobCoder.currentCompressionCode,
                TimeStepQuantity = 2,
                TimeStepUnit = TSDateCalculator.TimeStepUnitCode.Day
            };
            var traces = new List<ITimeSeriesTrace>();

            for (int traceIndex = 0; traceIndex < 80; traceIndex++)
            {
                var iterList = new List<double>();
                for (int stepIndex = 0; stepIndex < nVals; stepIndex++)
                {
                    iterList.Add(1.5 * stepIndex + 0.3373);
                }
                var trace = new TSTrace { TraceNumber = traceIndex + 1 };
                trace.ValueBlob = TSBlobCoder.ConvertArrayToBlobRegular(iterList.ToArray(),
                                            TSBlobCoder.currentCompressionCode, trace);
                //trace.Checksum = new Guid().ToByteArray();
                traces.Add(trace);
            }

            // Start the timer
            DateTime timerStart = DateTime.Now;

            // Create dummy time series that we can write to the database
            for (i = 0; i < nIter; i++)
            {
                foreach(var trace in traces)
                {
                    TSBlobCoder.ComputeTraceChecksum(trace.TraceNumber, trace.ValueBlob);
                }
                TSBlobCoder.ComputeChecksum(ts, traces);
            }

            // Stop the timer
            DateTime timerEnd = DateTime.Now;
            TimeSpan timerDiff = timerEnd - timerStart;
            TimeLabelBlob.Content = String.Format("BLOBWRI --- Iterations: {0};  Duration: {1:hh\\:mm\\:ss\\.f}", i, timerDiff);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Method computes a Checksum for the timeseries.  The input to the hash includes the
 /// timeseries' BLOB of values, plus a TSParameters object that contains a short string of
 /// numbers that TimeSeriesLibrary is responsible for keeping in accord with the BLOB.
 /// </summary>
 /// <param name="tsp">TSParameters object that contains the parameters of the time series</param>
 /// <param name="traceList">collection of trace objects for the time series</param>
 /// <returns>the Checksum as a byte[16] array</returns>
 public static byte[] ComputeChecksum(TSParameters tsp, List <ITimeSeriesTrace> traceList)
 {
     // simply unpack the TSParameters object and call the overload of this method
     return(ComputeChecksum(tsp.TimeStepUnit, tsp.TimeStepQuantity, tsp.BlobStartDate, traceList));
 }
Exemplo n.º 4
0
 /// <summary>
 /// This method copies the parameters of a time series from a TSParameters object
 /// into this TSImport object.
 /// </summary>
 /// <param name="tsp">The TSParameters object that values will be copied from</param>
 public void RecordFromTSParameters(TSParameters tsp)
 {
     TimeStepUnit = tsp.TimeStepUnit;
     TimeStepQuantity = tsp.TimeStepQuantity;
     BlobStartDate = tsp.BlobStartDate;
     CompressionCode = tsp.CompressionCode;
 }