Show / Hide Table of Contents

Class FixedValueParameterDataAccess

A class which represents data access for parameters which have a fixed value, i.e. some static value. See ParameterDataAccessBase documentation for more information.

Inheritance
System.Object
ParameterDataAccessBase
FixedValueParameterDataAccess
Implements
IParameterDataAccess
System.IDisposable
Inherited Members
ParameterDataAccessBase.DefaultSampleTime
ParameterDataAccessBase.SampleSizeCap
ParameterDataAccessBase.CurrentPosition
ParameterDataAccessBase.AssignErrorDefinition(ErrorDefinition)
ParameterDataAccessBase.OnInvalidated()
ParameterDataAccessBase.ValidateStartPositionOfPda()
ParameterDataAccessBase.GuardAgainstInvocationWhenInvalidated()
ParameterDataAccessBase.ValidateArguments<T, TU, TV>(Int32, T[], TU[], TV[])
ParameterDataAccessBase.ValidateArguments<T, TU>(Int32, T[], TU[])
ParameterDataAccessBase.ValidateStartAndEndTime(Int64, Int64)
ParameterDataAccessBase.GoTo(Int64)
ParameterDataAccessBase.GoTo(Double)
ParameterDataAccessBase.SetSampleIncrement(Int64)
ParameterDataAccessBase.SetSampleIncrement(Double)
ParameterDataAccessBase.Dispose()
ParameterDataAccessBase.Dispose(Boolean)
ParameterDataAccessBase.ValidateSampleTime()
ParameterDataAccessBase.SampleTime
ParameterDataAccessBase.CurrentTime
ParameterDataAccessBase.Session
ParameterDataAccessBase.ErrorDefinition
ParameterDataAccessBase.DemandTimerange
ParameterDataAccessBase.ParameterIdentifier
ParameterDataAccessBase.UseSubSampledChannels
ParameterDataAccessBase.Invalid
Namespace: MESL.SqlRace.Domain.Functions
Assembly: MESL.SqlRace.Domain.dll
Syntax
public class FixedValueParameterDataAccess : ParameterDataAccessBase, IParameterDataAccess, IDisposable

Constructors

FixedValueParameterDataAccess(Session, Double)

Initializes a new instance of the FixedValueParameterDataAccess class.

Declaration
public FixedValueParameterDataAccess(Session session, double fixedValue)
Parameters
Type Name Description
Session session

The session.

System.Double fixedValue

The fixed value for the parameter

Properties

CoverageCursor

Gets the coverage cursor for the PDA.

Declaration
public override long CoverageCursor { get; }
Property Value
Type Description
System.Int64
Overrides
ParameterDataAccessBase.CoverageCursor

DataChangedCounter

Gets a count of changes made to the data of any channel used by the PDA.

Declaration
public override int DataChangedCounter { get; }
Property Value
Type Description
System.Int32
Overrides
ParameterDataAccessBase.DataChangedCounter

Methods

CancelSearch()

Cancel/Abort Any Searches

Declaration
public override void CancelSearch()
Overrides
ParameterDataAccessBase.CancelSearch()
Exceptions
Type Condition
System.NotSupportedException

Contains(Int64, Int64, MatchingRule, Double, Nullable<Double>, Nullable<Int32>)

Does this PDA's data contain a value

Declaration
public override bool Contains(long startAt, long endAt, MatchingRule rule, double value, Nullable<double> upperValue, Nullable<int> timespan)
Parameters
Type Name Description
System.Int64 startAt

Seach Start Position

System.Int64 endAt

Search End Position

MatchingRule rule

Comparison operator

System.Double value

Value to Search For

System.Nullable<System.Double> upperValue

Upper Value - used when using the Between Operator

System.Nullable<System.Int32> timespan

Period of time the condition must be met for

Returns
Type Description
System.Boolean

Was the ValueFound

Overrides
ParameterDataAccessBase.Contains(Int64, Int64, MatchingRule, Double, Nullable<Double>, Nullable<Int32>)
Exceptions
Type Condition
System.NotSupportedException

Contains(Int64, Int64, MatchingRule, String, Nullable<Int32>)

Does this PDA's data contain a value

Declaration
public override bool Contains(long startAt, long endAt, MatchingRule rule, string value, Nullable<int> timespan)
Parameters
Type Name Description
System.Int64 startAt

Seach Start Position

System.Int64 endAt

Search End Position

MatchingRule rule

Comparison operator

System.String value

Value to Search For

System.Nullable<System.Int32> timespan

Period of time the condition must be met for

Returns
Type Description
System.Boolean

Was the ValueFound

Overrides
ParameterDataAccessBase.Contains(Int64, Int64, MatchingRule, String, Nullable<Int32>)
Exceptions
Type Condition
System.NotSupportedException

GetData(Int64[], SampleModeType, Boolean, ParameterValuesTemplate)

Gets the sampled data values and MAT.OCS.Core.DataStatusType from the requested timestamps and sample types.

Declaration
public override ParameterValues GetData(long[] sampleTimestamps, SampleModeType withSampleMode, bool linearInterpolation = false, ParameterValuesTemplate template = null)
Parameters
Type Name Description
System.Int64[] sampleTimestamps

The timestamps requested

SampleModeType withSampleMode

The SampleModeType which can be used. These are Minimum, Maximum, Mean and First. This is defaulted to Mean. These can be specified as flags to get more than one type

System.Boolean linearInterpolation

This option only really matters when you are requesting data at a higher frequency than it was collected.
For example, if you have low rate data collection at 1hz and request a sample rate of 10hz. This setting is defaulted to be false which means it will extend previous samples to fill the gaps in samples. If this is set to true, returned data is linearly interpolated, so the data changes in the samples will be smoother.

MAT.OCS.Core.ParameterValuesTemplate template

Optional template to be populated with samples. This can be used if the client wants to manage the memory to perform it's own memory management/buffering. The use of this is discouraged as the SQL Race memory pooling means it is more efficient in the large object heap and reduces fragmentation. When specifing a template you should follow these rules:

  • You always need a DataStatus array
  • If using the mode type Mean you need a Data array
  • If using the mode type First you need a DataFirst array
  • If using the mode type Minimum you need a DataMin array
  • If using the mode type Maximum you need a DataMax array
  • The arrays must have the length equal or greater to number of samples.
    If it is greater than the array past the index of the number of samples will be left untouched by this call
  • If you want the timestamps in the result, you must specify a Timestamp array

Returns
Type Description
MAT.OCS.Core.ParameterValues

Returns a MAT.OCS.Core.ParameterValues object containing the resulting data

Overrides
ParameterDataAccessBase.GetData(Int64[], SampleModeType, Boolean, ParameterValuesTemplate)
Remarks

On completion of this call, the CurrentTime will be set to the end of the returned data

Examples

The most simple call to this method, provides just the timestamps. This call will return the mean samples for the given timestamps

pda.GetData(timestamps)

This call will return the first samples for the given timestamps

pda.GetData(timestamps, SampleModeType.First)

This call will return the linearly interpolated mean values for the given timestamps

pda.GetData(timestamps, linearInterpolation: true)

Get minimum and maximum values and populate the given template

pda.GetData(timestamps, SampleModeType.Minimum | SampleModeType.Maximum, interpolate, new ParameterValuesTemplate { DataMin = minimumValues, DataMax = maximumValues, DataStatus = status });
Exceptions
Type Condition
System.ArgumentException

This is thrown if the timestamps is an empty array or if the length of the arrays in the template are less than the number of timestamps requested

System.ArgumentNullException

This is thrown if timestamps is set to null or if a template is provided, but it does not contain the array definitions it need for the given SampleModeType(s). You need to follow the template definition rules documented.

GetDataStatistics(Int64, Int64, Boolean, StatisticOption, IParameterDataStatistics)

Returns the statistical values requested with statistic option flag(s) for a time range of data.

It takes a show you workings approach. For example when you specify StandardDeviation it will include the sum of values and mean in the result.

Any samples that have a NaN value are skipped.

Declaration
public override IParameterDataStatistics GetDataStatistics(long startTimeStamp, long duration, bool weightStatistics = false, StatisticOption statisticOption, IParameterDataStatistics statisticsResult = null)
Parameters
Type Name Description
System.Int64 startTimeStamp

Start time of data range in nanoseconds. This number is inclusive so will include the sample at this given timestamp

System.Int64 duration

Length of data range in nanoseconds. This duration is exclusive, it will ignore any sample at the end of the sample range (startTimeStamp + duration)

System.Boolean weightStatistics

Weight statistics flag, this is defaulted to false. If this is set to true then the mean, absolute mean and standard deviation calculations are weighted against the sample interval

StatisticOption statisticOption

The statistic to be retrieved. This is defaulted to None which will only return start/end values. This is a flag field so mutiple types of statistics can be requested in one call.

IParameterDataStatistics statisticsResult

Optional base statistics result

Returns
Type Description
IParameterDataStatistics

Returns a IParameterDataStatistics object containing the results for the requested statistic options. Depending on the statistic options depends which fields will be populated:

  • AbsoluteMeanValue is populated when AbsoluteMean option is used
  • DeltaValue is populated when the Delta option is used. This value is the delta between the first and last sample.
  • EndValue is always populated with the last value in the sample time range
  • GeometricMeanValue is populated when the GeometricMean sample option is used. Geometric mean cannot be calculated for negative values
  • Lap is always null for GetDataStatistics, it is only used in GetLapStatistics
  • MaximumStatus is populated with the maximum sample's status when Max option is used, otherwise it is defaulted to missing
  • MaximumTime is populated with the maximum sample's timestamp when Max option is used, otherwise it is set to 0
  • MaximumValue is populated with the maximum sample's value when Max option is used
  • MeanValue is populated when Mean and/or StandardDevation sample options are used
  • MinimumStatus is populated with the minimum sample's status when Min option is used, otherwise it is defaulted to missing
  • MinimumTime is populated with the minimum sample's timestamp when Min option is used, otherwise it is set to 0
  • MinimumValue is populated with the minimum sample's value when Min option is used
  • NumberOfSamples is always populated with the number of samples used to derive the statistics
  • RegressionInterceptValue is populated by specifing SlopeIntercept, SlopeRIntercept and/or SlopeRSquared statistic options. X is the sample number and Y is the sample value. For example the samples 10, 11, 12 would be mapped to (1, 10)(2, 11)(3, 12)
  • RegressionRSquaredValue is populated by specifing SlopeIntercept, SlopeRIntercept and/or SlopeRSquared statistic options. X is the sample number and Y is the sample value. For example the samples 10, 11, 12 would be mapped to (1, 10)(2, 11)(3, 12)
  • RegressionSlopeValue is populated by specifing SlopeIntercept, SlopeRIntercept and/or SlopeRSquared statistic options. X is the sample number and Y is the sample value. For example the samples 10, 11, 12 would be mapped to (1, 10)(2, 11)(3, 12)
  • SessionKey is always populated with the session key
  • StandardDeviation is populated by specifing the StandardDeviation statistic option. This is calculated using the Population Standard deviation.
  • StartValue is always populated with the first value in the sample time range
  • SumOfAbsoluteSampleValues is populated when AbsoluteMean option is used. If weighted is true this is the sum of values after weighting has been applied
  • SumOfSampleValues is populated when Mean and/or StandardDevation sample options are used. If weighted is true this is the sum of values after weighting has been applied
  • SumOfSquaredSampleValues is populated when StandardDevation sample option is used. If weighted is true this is the sum of values after weighting has been applied
  • TimeRange is always populated with the time range used to derive the statistics
  • NumberOfNansSkipped is always populated with the number of samples which had the value NaN and where therefore skipped.

Overrides
ParameterDataAccessBase.GetDataStatistics(Int64, Int64, Boolean, StatisticOption, IParameterDataStatistics)
Remarks

If data is requested data is either before or after samples are available then a zero numberOfSamples will be returned.

Examples

Get the minimum value for the given time range

var result = this.pda.GetDataStatistics(
                        startTime,
                        duration,
                        false,
                        StatisticOption.Min);

Get the Max, Min and Mean for a given time range

pda.GetDataStatistics(
              startTime,
              duration,
              false,
              StatisticOption.Max | StatisticOption.Min | StatisticOption.Mean,
              compositeStatistics);
Exceptions
Type Condition
System.ArgumentException

Thrown if the startTimeStampis less than zero or duration is less than, or equal to zero.

GetEndTime()

Returns the end time of the parameters data.

Declaration
public override Nullable<long> GetEndTime()
Returns
Type Description
System.Nullable<System.Int64>

The end time.

Overrides
ParameterDataAccessBase.GetEndTime()

GetLapStatistics(Lap, Boolean, StatisticOption, IParameterDataStatistics)

Returns the statistical values for the requested lap with statistic option flag(s) for lap time range of data. The calculated statistics will be cached for improved performance. It takes a show you workings approach. For example when you specify StandardDeviation it will include the sum of values and mean in the result.
Any samples that have a NaN value are skipped.

Declaration
public override IParameterDataStatistics GetLapStatistics(Lap lap, bool weightStatistics = false, StatisticOption statisticOption, IParameterDataStatistics statisticsResult = null)
Parameters
Type Name Description
Lap lap

The Lap to get statistics for.

System.Boolean weightStatistics

Weight statistics flag, this is defaulted to false. If this is set to true then the mean, absolute mean and standard deviation calculations are weighted

StatisticOption statisticOption

The statistic to be retrieved. This is defaulted to None which will only return start/end values. This is a flag field so mutiple types of statistics can be requested in one call.

IParameterDataStatistics statisticsResult

Optional base statistics result

Returns
Type Description
IParameterDataStatistics

Returns a IParameterDataStatistics object containing the results for the requested statistic options. Depending on the statistic options depends which fields will be populated:

  • AbsoluteMeanValue is populated when AbsoluteMean option is used
  • DeltaValue is populated when the Delta option is used. This value is the delta between the first and last sample.
  • EndValue is always populated with the last value in the sample time range
  • GeometricMeanValue is populated when the GeometricMean sample option is used. Geometric mean cannot be calculated for negative values
  • Lap is populated with the lap provided
  • MaximumStatus is populated with the maximum sample's status when Max option is used, otherwise it is defaulted to missing
  • MaximumTime is populated with the maximum sample's timestamp when Max option is used, otherwise it is set to 0
  • MaximumValue is populated with the maximum sample's value when Max option is used
  • MeanValue is populated when Mean and/or StandardDevation sample options are used
  • MinimumStatus is populated with the minimum sample's status when Min option is used, otherwise it is defaulted to missing
  • MinimumTime is populated with the minimum sample's timestamp when Min option is used, otherwise it is set to 0
  • MinimumValue is populated with the minimum sample's value when Min option is used
  • NumberOfSamples is always populated with the number of samples used to derive the statistics
  • RegressionInterceptValue is populated by specifing SlopeIntercept, SlopeRIntercept and/or SlopeRSquared statistic options. X is the sample number and Y is the sample value. For example the samples 10, 11, 12 would be mapped to (1, 10)(2, 11)(3, 12)
  • RegressionRSquaredValue is populated by specifing SlopeIntercept, SlopeRIntercept and/or SlopeRSquared statistic options. X is the sample number and Y is the sample value. For example the samples 10, 11, 12 would be mapped to (1, 10)(2, 11)(3, 12)
  • RegressionSlopeValue is populated by specifing SlopeIntercept, SlopeRIntercept and/or SlopeRSquared statistic options. X is the sample number and Y is the sample value. For example the samples 10, 11, 12 would be mapped to (1, 10)(2, 11)(3, 12)
  • SessionKey is always populated with the session key
  • StandardDeviation is populated by specifing the StandardDeviation statistic option. This is calculated using the Population Standard deviation.
  • StartValue is always populated with the first value in the sample time range
  • SumOfAbsoluteSampleValues is populated when AbsoluteMean option is used
  • SumOfSampleValues is populated when Mean and/or StandardDevation sample options are used
  • SumOfSquaredSampleValues is populated when StandardDevation sample option is used
  • TimeRange is always populated with the time range used to derive the statistics
  • NumberOfNansSkipped is always populated with the number of samples which had the value NaN and where therefore skipped.

Overrides
ParameterDataAccessBase.GetLapStatistics(Lap, Boolean, StatisticOption, IParameterDataStatistics)
Remarks

If data is requested data is either before or after samples are available then a zero numberOfSamples will be returned.

Examples

Get the minimum value for the given lap

var result = this.pda.GetLapStatistics(
                        lap,
                        false,
                        StatisticOption.Min);

Get the Max, Min and Mean for a given lap

pda.GetLapStatistics(
              lap
              false,
              StatisticOption.Max | StatisticOption.Min | StatisticOption.Mean,
              compositeStatistics);
Exceptions
Type Condition
System.ArgumentException

Thrown if the laps start is less than zero or if the start time is after the end time

System.ArgumentNullException

Thrown if the lap is null or if the lap does not have an end time

GetMaximumFrequency()

Returns the maximum frequency in Hz.

Declaration
public override double GetMaximumFrequency()
Returns
Type Description
System.Double

The maximum frequency.

Overrides
ParameterDataAccessBase.GetMaximumFrequency()
Remarks

If zero, then the frequency could not be determined.

GetMaximumSampleRate()

Returns the maximum sample rate available from the channels within the underlying Parameter associated with the PDA.

Declaration
public override Nullable<long> GetMaximumSampleRate()
Returns
Type Description
System.Nullable<System.Int64>

The maximum sample rate.

Overrides
ParameterDataAccessBase.GetMaximumSampleRate()
Remarks

This time returned is in nanoseconds.

GetMinimumFrequency()

Returns the minimum frequency in Hz.

Declaration
public override double GetMinimumFrequency()
Returns
Type Description
System.Double

The minimum frequency.

Overrides
ParameterDataAccessBase.GetMinimumFrequency()
Remarks

If zero, then the frequency could not be determined.

GetMinimumSampleInterval(Int64, Boolean)

Gets the minimum sample interval.

Declaration
public override long GetMinimumSampleInterval(long sampleTime, bool useSubSampledChannels)
Parameters
Type Name Description
System.Int64 sampleTime

The sample time.

System.Boolean useSubSampledChannels

if set to true [use sub sampled channels].

Returns
Type Description
System.Int64
Overrides
ParameterDataAccessBase.GetMinimumSampleInterval(Int64, Boolean)
Exceptions
Type Condition
System.NotSupportedException

GetNextData(Int32, SampleModeType, Boolean, ParameterValuesTemplate)

Gets the next sampled data values and MAT.OCS.Core.DataStatusType based on the number of samples requested and the PDA's current position.

Declaration
public override ParameterValues GetNextData(int numberOfSamples, SampleModeType withSampleMode, bool linearInterpolation = false, ParameterValuesTemplate template = null)
Parameters
Type Name Description
System.Int32 numberOfSamples

Number of samples to retrieve.

SampleModeType withSampleMode

The SampleModeType which can be used. These are Minimum, Maximum, Mean and First. This is defaulted to Mean. These can be specified as flags to get more than one type

System.Boolean linearInterpolation

This option only really matters when you are requesting data at a higher frequency than it was collected.
For example, if you have low rate data collection at 1hz and request a sample rate of 10hz. This setting is defaulted to be false which means it will extend previous samples to fill the gaps in samples. If this is set to true, returned data is linearly interpolated, so the data changes in the samples will be smoother.

MAT.OCS.Core.ParameterValuesTemplate template

Optional template to be populated with samples. This can be used if the client wants to manage the memory to perform it's own memory management/buffering. The use of this is discouraged as the SQL Race memory pooling means it is more efficient in the large object heap and reduces fragmentation. When specifing a template you should follow these rules:

  • You always need a DataStatus array
  • If using the mode type Mean you need a Data array
  • If using the mode type First you need a DataFirst array
  • If using the mode type Minimum you need a DataMin array
  • If using the mode type Maximum you need a DataMax array
  • The arrays must have the length equal or greater to number of samples.
    If it is greater than the array past the index of the number of samples will be left untouched by this call

Returns
Type Description
MAT.OCS.Core.ParameterValues

Returns a MAT.OCS.Core.ParameterValues object containing the resulting data

Overrides
ParameterDataAccessBase.GetNextData(Int32, SampleModeType, Boolean, ParameterValuesTemplate)
Remarks

On completion of this call, the CurrentTime will be set to the end of the returned data

Examples

This example is the most simple call to the method. It fetches the mean samples which are not linearly interpolated.

  var parameterValues = this.sourcePda.GetNextData(numberOfSamples);

This example gets the next mean, minimum and maximum samples which are linearly interpolated

  var parameterValues = this.sourcePda.GetNextData(numberOfSamples, SampleModeType.Minimum | SampleModeType.Maximum | SampleModeType.Mean, true);

Using the template to populate arrays in the client. This is particularly useful if you want to reuse the same array for multiple calls to perform buffering or object reuse.

 var data = new double[numberOfSamples];
 var status = new DataStatusType[numberOfSamples];
 parameterDataAccess.GetNextData(numberOfSamples, template: new ParameterValuesTemplate { Data = data, DataStatus = status});

If using the template and specifing different sample types, you need to ensure that you have defined the correct arrays in the template to be populated

 parameterDataAccess.GetNextData(numberOfSamples, SampleModeType.Minimum | SampleModeType.Maximum, 
   template: new ParameterValuesTemplate { DataMin = minimumValues, DataMax = maximumValues, DataStatus = dataStatusTypes});
Exceptions
Type Condition
System.ArgumentException

This is thrown if number of samples requested is less than 1 or if the length of the arrays in the template are less than the number of samples requested

System.ArgumentNullException

This is thrown if a template is provided, but it does not contain the array definitions it need for the given SampleModeType(s). You need to follow the template definition rules documented.

GetNextSamples(Int32, StepDirection, ParameterValuesTemplate)

Returns the next raw data samples, their MAT.OCS.Core.DataStatusType and time based on the number of samples requested.

Declaration
public override ParameterValues GetNextSamples(int numberOfSamples, StepDirection direction, ParameterValuesTemplate template = null)
Parameters
Type Name Description
System.Int32 numberOfSamples

Number of samples to retrieve. This has to be larger than 0.

StepDirection direction

Set this to Reverse if you want to read the previous samples (read backwards)

MAT.OCS.Core.ParameterValuesTemplate template

Optional template to be populated with samples. This can be used if the client wants to manage the memory to perform it's own memory management/buffering. The use of this is discouraged as the SQL Race memory pooling means it is more efficient in the large object heap and reduces fragmentation. When specifing a template you should follow these rules:

  • Provide a DataStatus array
  • Prove a Data array
  • Provide a Timestamp Array
  • Avoid providing a DataMin, DataFirst, DataMax or TimeStampValues arrays
  • The arrays must have the length equal or greater to number of samples.
    If it is greater than the array past the index of the number of samples will be left untouched by this call

Returns
Type Description
MAT.OCS.Core.ParameterValues

Returns a MAT.OCS.Core.ParameterValues object with the Data, Timestamp and DataStatus arrays populated with the results. Use the ParameterValues.SampleCount field to determine how much data to read out of the array. If there are no samples then SampleCount will be 0.
The if the template array size is larger than the requested number of samples the extra array space will be left untouched.

Overrides
ParameterDataAccessBase.GetNextSamples(Int32, StepDirection, ParameterValuesTemplate)
Remarks

On completion of this call, the CurrentTime will be set to the end of the returned data

Examples

Example of usage and then iterating over the results using the SampleCount field not the array size.

this.pda.GoTo(startTime);
var pdaSamples = this.pda.GetNextSamples(noOfSamples);
for (var i = 0; i < pdaSamples.SampleCount; i++)
{
    if(pdaSamples.DataStatus[i] != DataStatusType.Missing)
    {
        var data = pdaSamples.Data[i];
        var timestamp = pdaSamples.Timestamp[i]
        //Do something with data
    }
}

This is the same code example, but called using a template.

this.pda.GoTo(startTime);
var pdaSamples = this.pda.GetNextSamples(noOfSamples, template: new ParameterValuesTemplate
               {
                   Data = this.data,
                   DataStatus = this.dataStatus,
                   Timestamp = this.timeStamps
                });
for (var i = 0; i < pdaSamples.SampleCount; i++)
{
    if(this.dataStatus[i] != DataStatusType.Missing)
    {
        var data = this.data[i];
        var timestamp = this.timeStamps[i]
        //Do something with data
    }
}
Exceptions
Type Condition
System.ArgumentNullException

Thrown if a template is provided without Data, DataStatus or Timestamp arrays

System.ArgumentException

Thrown if; template arrays are too short, the smallest array is less than the number of samples in length or the number of samples is less than 1

GetSamplesBetween(Int64, Int64, Int32)

Gets a number of raw data samples, timestamps and MAT.OCS.Core.DataStatusType based on the time range between the current position to the end sample time and sample size cap requested.
If the start time is after the end time it will read the data backwards in reverse. The CurrentTime is not updated by this call.

Declaration
public override ParameterValues GetSamplesBetween(long startTimeStamp, long endTimeStamp, int sampleSizeCap = 10000)
Parameters
Type Name Description
System.Int64 startTimeStamp

The start time stamp for the range to be read. If this is larger than the end time then the data will be read in reverse.

System.Int64 endTimeStamp

The end time stamp for the range to be read. If this is smaller than the start time then the data will be read in reverse.

System.Int32 sampleSizeCap

The maximum number of samples to return, this is defaulted to 10000. If the cap is exceeded it will return the first X number of samples. This is a useful protection in case you query for high resolution data over an extended time.

Returns
Type Description
MAT.OCS.Core.ParameterValues

Returns a MAT.OCS.Core.ParameterValues object with the Data, Timestamp and DataStatus arrays populated with the results. Use the ParameterValues.SampleCount field to determine how much data to read out of the array. If there are no samples then SampleCount will be 0.
The array size is allocated by an estimate and then expanded if needed by a factor. Therefore the array size can be bigger than required and have empty data on the end.
Because of this nature, there is no feature to allow a ParameterValuesTemplate field.

Overrides
ParameterDataAccessBase.GetSamplesBetween(Int64, Int64, Int32)
Remarks

If start and end time are equal then the sample for that timestamp is returned

Examples

Example of usage and then iterating over the results using the SampleCount field not the array size.

var pdaSamples = this.pda.GetSamplesBetween(startTime, endTime, maxSampleCountForPdaCall);
for (var i = 0; i < pdaSamples.SampleCount; i++)
{
    if(pdaSamples.DataStatus[i] != DataStatusType.Missing)
    {
        var data = pdaSamples.Data[i];
        var timestamp = pdaSamples.Timestamp[i]
        //Do something with data
    }
}
Exceptions
Type Condition
System.ArgumentException

This is thrown if start or end time are minus numbers

System.ArgumentOutOfRangeException

This is thrown if the sampleSizeCap is less than 1

GetSamplesCount(Int64, Int64)

Returns the numbers of samples between a specified start and end time.

Declaration
public override long GetSamplesCount(long startTimeStamp, long endTimeStamp)
Parameters
Type Name Description
System.Int64 startTimeStamp

Start time stamp of the data.

System.Int64 endTimeStamp

End time stamp of the data.

Returns
Type Description
System.Int64

Number of samples between the start and end time, or zero if not samples found.

Overrides
ParameterDataAccessBase.GetSamplesCount(Int64, Int64)
Exceptions
Type Condition
System.NotSupportedException

GetSamplesCountEstimate(Int64, Int64)

Returns the theoretical sample count between a specified start and end time based on the highest frequency channel for this PDA's Parameter. If the return value is zero means that was impossible to calculate the sample count, or this PDA is created on a SlowRow parameter

Declaration
public override long GetSamplesCountEstimate(long startTimeStamp, long endTimeStamp)
Parameters
Type Name Description
System.Int64 startTimeStamp

Start time stamp of the data.

System.Int64 endTimeStamp

End time stamp of the data.

Returns
Type Description
System.Int64

Theoretical sample count between the start and end time, or zero if it was impossible to calculate, or this PDA is created on a SlowRow parameter.

Overrides
ParameterDataAccessBase.GetSamplesCountEstimate(Int64, Int64)
Exceptions
Type Condition
System.NotSupportedException

GetSamplesUntil(Int64, Int32)

Returns a number of raw data samples between the current position to the end sample time. If the endtime is after the CurrentTime then the position will be updated to be the last timestamp + 1.
If the endtime is before the CurrentTime then the position will be updated to be the last timestamp - 1 and the data will be read in reverse. If there are no samples then the PDA position is not updated.

Declaration
public override ParameterValues GetSamplesUntil(long endTimeStamp, int sampleSizeCap = 10000)
Parameters
Type Name Description
System.Int64 endTimeStamp

The end time stamp. If this is before the PDA current time then it will read backwards to that point.

System.Int32 sampleSizeCap

This is a cap on the amount of samples which will be returned. This is defaulted to 10,000. This is a useful protection in case you query for high resolution data over and extended time. If the cap is exceeded it will return the first X number of samples.. This can be overriden if required

Returns
Type Description
MAT.OCS.Core.ParameterValues

Returns a MAT.OCS.Core.ParameterValues object with the Data, Timestamp and DataStatus arrays populated with the results. Use the ParameterValues.SampleCount field to determine how much data to read out of the array. If there are no samples then SampleCount will be 0.
The array size is allocated by an estimate and then expanded if needed by a factor. Therefore the array size can be bigger than the required and have empty data on the end.
Because of this nature, there is no feature to allow a ParameterValuesTemplate field.

Overrides
ParameterDataAccessBase.GetSamplesUntil(Int64, Int32)
Remarks

If current time and end time are equal then the sample for that timestamp is returned

Examples

Example of usage and then iterating over the results using the SampleCount field not the array size.

this.pda.GoTo(startTime);
var pdaSamples = this.pda.GetSamplesUntil(endTime);
for (var i = 0; i < pdaSamples.SampleCount; i++)
{
    if(pdaSamples.DataStatus[i] != DataStatusType.Missing)
    {
        var data = pdaSamples.Data[i];
        var timestamp = pdaSamples.Timestamp[i]
        //Do something with data
    }
}
Exceptions
Type Condition
System.ArgumentOutOfRangeException

Thrown if sampleSizeCap is less than 1

System.ArgumentException

Is thrown if endtime equals the PDa current position or in less than 0

GetStartTime()

Returns the start time for the parameters data.

Declaration
public override Nullable<long> GetStartTime()
Returns
Type Description
System.Nullable<System.Int64>

The start time.

Overrides
ParameterDataAccessBase.GetStartTime()
Exceptions
Type Condition
System.NotSupportedException

GetTimeRange()

Gets the time range for the PDA.

Declaration
public override Nullable<TimeRange> GetTimeRange()
Returns
Type Description
System.Nullable<TimeRange>

Returns time range or null if there is no data.

Overrides
ParameterDataAccessBase.GetTimeRange()

Search(Int64, Int64, MatchingRule, Double, Nullable<Double>, Nullable<Int32>)

Search PDA for all occurances of a data value

Declaration
public override IList<QuerySample> Search(long startAt, long endAt, MatchingRule rule, double value, Nullable<double> upperValue, Nullable<int> timespan)
Parameters
Type Name Description
System.Int64 startAt

Seach Start Position

System.Int64 endAt

Search End Position

MatchingRule rule

Comparison operator

System.Double value

Value to Search For

System.Nullable<System.Double> upperValue

Upper Value - used when using the Between Operator

System.Nullable<System.Int32> timespan

Period of time the condition must be met for

Returns
Type Description
System.Collections.Generic.IList<QuerySample>

Matching samples

Overrides
ParameterDataAccessBase.Search(Int64, Int64, MatchingRule, Double, Nullable<Double>, Nullable<Int32>)
Exceptions
Type Condition
System.NotSupportedException

Search(Int64, Int64, MatchingRule, String, Nullable<Int32>)

Search PDA for all occurances of a data value

Declaration
public override IList<QuerySample> Search(long startAt, long endAt, MatchingRule rule, string value, Nullable<int> timespan)
Parameters
Type Name Description
System.Int64 startAt

Seach Start Position

System.Int64 endAt

Search End Position

MatchingRule rule

Comparison operator

System.String value

Value to Search For

System.Nullable<System.Int32> timespan

Period of time the condition must be met for

Returns
Type Description
System.Collections.Generic.IList<QuerySample>

Matching samples

Overrides
ParameterDataAccessBase.Search(Int64, Int64, MatchingRule, String, Nullable<Int32>)
Exceptions
Type Condition
System.NotSupportedException

SetMapper(String)

Sets the mapper for the PDA.

Declaration
public override void SetMapper(string mapper)
Parameters
Type Name Description
System.String mapper

The name of the mapper.

Overrides
ParameterDataAccessBase.SetMapper(String)
Exceptions
Type Condition
System.NotSupportedException

Events

Invalidated

Occurs when this PDA has been invalidated.

Declaration
public override event EventHandler Invalidated
Event Type
Type Description
System.EventHandler
Overrides
ParameterDataAccessBase.Invalidated

UnderlyingDataSourceChanged

Occurs when the underlying data source has been changed. This event will be raised if the source data context of this PDA changes - any previously-requested data is invalid.

Declaration
public override event EventHandler UnderlyingDataSourceChanged
Event Type
Type Description
System.EventHandler
Overrides
ParameterDataAccessBase.UnderlyingDataSourceChanged

Implements

IParameterDataAccess
System.IDisposable
Back to top Generated by DocFX