Class UnitDataSet
- Namespace
- TimeSeriesAnalysis.Dynamic
- Assembly
- TimeSeriesAnalysis.dll
The data for a porition of a process, containg only one output and one or multiple inputs that influence it
public class UnitDataSet
- Inheritance
-
UnitDataSet
- Inherited Members
Constructors
UnitDataSet(string)
Constructor for data set without inputs - for "autonomous" processes such as sinusoids, rand walks or other disturbancs.
public UnitDataSet(string name = null)
Parameters
namestringoptional internal name of dataset
UnitDataSet((double[], DateTime[]), (double[], DateTime[]), string)
Create a dataset for single-input system from two signals that have separate but overlapping time-series(each given as value-date tuples)
public UnitDataSet((double[], DateTime[]) u, (double[], DateTime[]) y_meas, string name = null)
Parameters
u(double[], DateTime[])tuple of values and dates describing u
y_meas(double[], DateTime[])tuple of values and dates describing y
namestringname of dataset
UnitDataSet(UnitDataSet)
Create a copy of an existing data set
public UnitDataSet(UnitDataSet otherDataSet)
Parameters
otherDataSetUnitDataSet
UnitDataSet(UnitDataSet, int, int)
Create a downsampled copy of an existing data set
public UnitDataSet(UnitDataSet originalDataSet, int downsampleFactor, int keyIndex = 0)
Parameters
originalDataSetUnitDataSetdownsampleFactorintfactor by which to downsample the original dataset
keyIndexintindex around which to center the downsampling
Fields
IndicesToIgnore
Indices that are ignored in Y during fitting.
public List<int> IndicesToIgnore
Field Value
Properties
BadDataID
Some systems for storing data do not support "NaN", but instead some other magic value is reserved for indicating that a value is bad or missing.
public double BadDataID { get; set; }
Property Value
D
Additve output disturbance D (Y = X+ D)
public double[] D { get; set; }
Property Value
- double[]
ProcessName
Name
public string ProcessName { get; }
Property Value
Times
Timestamps
public DateTime[] Times { get; set; }
Property Value
- DateTime[]
U
Input U (given)
public double[,] U { get; set; }
Property Value
- double[,]
U_sim
Input U(simulated) - in the case of PID-control
public double[,] U_sim { get; set; }
Property Value
- double[,]
Y_meas
Output Y (measured)
public double[] Y_meas { get; set; }
Property Value
- double[]
Y_proc
The simulated output of the process, this is a non-measured variable that excludes the disturbance
public double[] Y_proc { get; set; }
Property Value
- double[]
Y_setpoint
Setpoint - (if sub-process includes a PID-controller)
public double[] Y_setpoint { get; set; }
Property Value
- double[]
Y_sim
Output Y(simulated)
public double[] Y_sim { get; set; }
Property Value
- double[]
Methods
Concat(UnitDataSet)
Appends/concatenate another dataset to the end of this one
public bool Concat(UnitDataSet otherDataSet)
Parameters
otherDataSetUnitDataSet
Returns
CreateTimeStamps(double, DateTime?)
If data is already given to object, this method will fill out the timstamps member
public void CreateTimeStamps(double timeBase_s, DateTime? t0 = null)
Parameters
timeBase_sdoublethe time in seconds bewteen time samples
t0DateTime?the date of the first datapoint in the dataset
DetermineIndicesToIgnore(FittingSpecs)
Tags indices to be removed if either of the output is outside the range defined by [Y_min,Y_max], an input is outside [u_min, umax] or if any data matches badDataId
Results are stored in "IndicesToIgnore", not outputted.
public void DetermineIndicesToIgnore(FittingSpecs fittingSpecs)
Parameters
fittingSpecsFittingSpecs
GetAverageU()
Get the average value of each input in the dataset. This is useful when defining model local around a working point.
public double[] GetAverageU()
Returns
- double[]
an array of averages, each corrsponding to one column of U. Returns null if it was not possible to calculate averages
GetNumDataPoints()
Returns the number of datapoints in the dataset
public int GetNumDataPoints()
Returns
GetOversampledFactor(out int)
Identify the oversampled factor of the dataset. The oversamples need to be evenly spread in the dataset. Subsets of oversamples in an otherwise non-oversampled dataset will not be taken into account here.
public double GetOversampledFactor(out int keyIndex)
Parameters
keyIndexint
Returns
- double
the average distance between two unique values in the dataset arrays and a key index where the first new value occurs
GetTimeBase()
Gets the time between samples in seconds, returns zero if times are not set
public double GetTimeBase()
Returns
GetTimeSpan()
Get the time spanned by the dataset
public TimeSpan GetTimeSpan()
Returns
- TimeSpan
The time spanned by the dataset, or null if times are not set
SetU(double[], double[], double[], double[], double[], double[])
Helper to set column of U to uValues.
public bool SetU(double[] uValues1, double[] uValues2 = null, double[] uValues3 = null, double[] uValues4 = null, double[] uValues5 = null, double[] uValues6 = null)
Parameters
uValues1double[]first input array
uValues2double[]second input array(can be null)
uValues3double[]third input array(can be null)
uValues4double[]third input array(can be null)
uValues5double[]third input array(can be null)
uValues6double[]third input array(can be null)
Returns
- bool
true if succesful, otherwise false
SubsetInd(int, int)
Create a copy of the data set that is a subset with given start/end indices
public UnitDataSet SubsetInd(int startInd, int endInd)
Parameters
Returns
SubsetPrc(double, double)
Create a subset of the dataset that is defined in terms of percentages
public UnitDataSet SubsetPrc(double startPrc, double endPrc)
Parameters
startPrcdoubleA value 0-100%. Should be a value smaller than endPrc
endPrcdoubleA value 0-100%. Should be a value bigger than startPrc