Table of Contents

Class ResultSet

Namespace
EpNet.Results
Assembly
EpNet.dll

Stores an eso result and provides methods to operate with different result sets.

public class ResultSet
Inheritance
ResultSet
Extension Methods

Constructors

ResultSet()

Creates an empty result set.

public ResultSet()

ResultSet(ResultDescriptor)

Creates an empty result set and assign a Result Descriptor.

public ResultSet(ResultDescriptor resultDescriptor)

Parameters

resultDescriptor ResultDescriptor

Result Descriptor to assign.

ResultSet(ResultSet, double)

Creates a new result set from an existing, optionally scaling the values.

public ResultSet(ResultSet resultset, double multiplier = 1)

Parameters

resultset ResultSet

Existing result set.

multiplier double

Quantity to multiply each value.

Properties

Component

Gets/Sets the component name of current ResultSet Result Descriptor.

public string Component { get; set; }

Property Value

string

Compponent Name.

Count

Returns the number of result values in the result set.

public int Count { get; }

Property Value

int

Number of values.

DataSet

Sequencial numeric result values.

public List<double> DataSet { get; set; }

Property Value

List<double>

Numeric Result List.

Frequency

Gets/Sets the frequency of current ResultSet Result Descriptor.

public Frequencies Frequency { get; set; }

Property Value

Frequencies

Frequency.

this[DateTime]

Gets the value at a specified datetime.

public double this[DateTime time] { get; set; }

Parameters

time DateTime

DateTime to look for.

Property Value

double

Value at the datetime.

this[int]

Returns the value at a specified index.

public double this[int index] { get; set; }

Parameters

index int

zero-based index.

Property Value

double

Result value.

ReportType

Gets/Sets the report type of current ResultSet Result Descriptor.

public string ReportType { get; set; }

Property Value

string

Report Type.

ResultDescriptor

Gets/Sets the Result Descriptor associated to this result.

public ResultDescriptor ResultDescriptor { get; set; }

Property Value

ResultDescriptor

Result Descriptor.

Units

Gets/Sets the units of current ResultSet Result Descriptor.

public string Units { get; set; }

Property Value

string

Units.

Methods

Add(double)

Add a new data point (numeric result) to the result list.

public void Add(double value)

Parameters

value double

Numeric value to add.

CVRMSE(IEnumerable<double>)

Calculates the Coefficient of Variation of the Root Mean Square Error (CVRMSE) between this ResultSet (predicted values) and observed values.

public double CVRMSE(IEnumerable<double> observed)

Parameters

observed IEnumerable<double>

An IEnumerable of double representing the observed values.

Returns

double

The CVRMSE as a percentage, which provides a normalized measure of the RMSE relative to the mean of the observed data.

Exceptions

ArgumentNullException

Thrown if either the predicted or observed sequence is null.

ArgumentException

Thrown if the number of elements in predicted and observed sequences are not the same, or if the observed values contain all zeros which would result in a division by zero in mean calculation.

Clone()

Returns a Clone of the resultset

public ResultSet Clone()

Returns

ResultSet

Cloned instance

ContainsComponent(IEnumerable<string>)

public bool ContainsComponent(IEnumerable<string> values)

Parameters

values IEnumerable<string>

Returns

bool

ContainsReport(IEnumerable<string>)

public bool ContainsReport(IEnumerable<string> values)

Parameters

values IEnumerable<string>

Returns

bool

EqualsComponentReport(ResultSet)

Returns true if component and reporttype are equal in both resultsets.

public bool EqualsComponentReport(ResultSet other)

Parameters

other ResultSet

Returns

bool

EqualsDescriptor(ResultSet)

Returns true if component, reporttype, units and frequency are equal in both resultsets.

public bool EqualsDescriptor(ResultSet other)

Parameters

other ResultSet

Returns

bool

FillData(Func<double, bool>)

Zeroes all the values in the dataset except those which satisfy the supplied filter function

public ResultSet FillData(Func<double, bool> filter)

Parameters

filter Func<double, bool>

Filter function

Returns

ResultSet

New resultset

FilterData(Func<double, bool>, double)

Sets all the values in the dataset to supplied value except those which satisfy the filter function

public ResultSet FilterData(Func<double, bool> filter, double valueFalse = 0)

Parameters

filter Func<double, bool>

Filter function

valueFalse double

Value to be assigned to the elements that do not satisfy the filter criteria

Returns

ResultSet

New resultset

FilterData(Func<double, bool>, double, double)

Values in the dataset that satisfy the filter are set to trueValue, the rest to falseValue

public ResultSet FilterData(Func<double, bool> filter, double trueValue, double falseValue)

Parameters

filter Func<double, bool>

Filter function

trueValue double

Value to assign to the values that satisfy the filter function

falseValue double

Value to assign to the values that do not satisfy the filter function

Returns

ResultSet

New resultset

GetDate(int)

Gets the datetime from a specified index.

public DateTime GetDate(int index)

Parameters

index int

Index position.

Returns

DateTime

Datetime

GetIndex(DateTime)

Gets the index from a specified datetime.

public int GetIndex(DateTime dateTime)

Parameters

dateTime DateTime

date time to search

Returns

int

Index position.

GetMaxDate()

Gets the datetime for the maximum value.

public DateTime GetMaxDate()

Returns

DateTime

Max value Datetime.

GetMaxIndex()

Gets the index for the maximum value.

public int GetMaxIndex()

Returns

int

Max value index.

GetMaxValue()

Gets maximum value in the result set.

public double GetMaxValue()

Returns

double

Max value.

GetMinDate()

Gets the datetime for the minimum value.

public DateTime GetMinDate()

Returns

DateTime

Min Value Datetime.

GetMinIndex()

Gets the index for the minimum value.

public int GetMinIndex()

Returns

int

Min Value Index.

GetMinValue()

Gets minimum value in the result set.

public double GetMinValue()

Returns

double

Min value

GreaterOrEqual(double)

Zeroes all the values in the resultset values greater or equal than an input value

public ResultSet GreaterOrEqual(double value)

Parameters

value double

Returns

ResultSet

New resultset

IsNotNull()

True if the Resultset is not null

public bool IsNotNull()

Returns

bool

IsNull()

True if the Resultset is null

public bool IsNull()

Returns

bool

LowerOrEqual(double)

Zeroes all the values in the resultset values lower or equal than an input value

public ResultSet LowerOrEqual(double value)

Parameters

value double

Returns

ResultSet

New resultset

MAE(IEnumerable<double>)

Calculates the Mean Absolute Error (MAE) between this ResultSet (predicted values) and an enumerable of observed values.

public double MAE(IEnumerable<double> observed)

Parameters

observed IEnumerable<double>

An enumerable of observed double values.

Returns

double

The Mean Absolute Error as a double value.

Exceptions

ArgumentNullException

Thrown if either the predicted list or the observed enumerable is null.

ArgumentException

Thrown if the predicted list and the observed enumerable do not have the same number of elements.

MBE(IEnumerable<double>)

Calculates the Mean Bias Error (MBE) between this ResultSet (predicted values) and observed values.

public double MBE(IEnumerable<double> observed)

Parameters

observed IEnumerable<double>

An IEnumerable of double representing the observed values.

Returns

double

The MBE value, representing the average bias in the predicted values relative to the observed values.

Exceptions

ArgumentNullException

Thrown if either the predicted or observed sequence is null.

ArgumentException

Thrown if the number of elements in predicted and observed sequences are not the same.

Match(string, string)

Returns true if component and report match the provided values.

public bool Match(string component, string reportType)

Parameters

component string
reportType string

Returns

bool

Match(string, string, Frequencies)

Returns true if component and report match the provided values.

public bool Match(string component, string reportType, Frequencies frequency)

Parameters

component string
reportType string
frequency Frequencies

Returns

bool

MatchComponent(string)

Returns true if component matches the provided value.

public bool MatchComponent(string component)

Parameters

component string

Returns

bool

MatchReport(string)

Returns true if report matches the provided value.

public bool MatchReport(string reportType)

Parameters

reportType string

Returns

bool

NMAE(IEnumerable<double>)

Calculates the Normalized Mean Absolute Error (NMAE) expressed as a percentage between this ResultSet (predicted values) and observed values.

public double NMAE(IEnumerable<double> observed)

Parameters

observed IEnumerable<double>

An enumerable collection of doubles representing the actual observed values.

Returns

double

A double value representing the NMAE as a percentage. This percentage indicates the average error relative to the mean observed value, providing a clear measure of prediction accuracy across different scales of data.

Exceptions

ArgumentNullException

Thrown if either the predicted or observed sequence is null.

ArgumentException

Thrown if the predicted and observed sequences do not have the same number of elements.

NMBE(IEnumerable<double>)

Calculates the Normalized Mean Bias Error (NMBE) between this ResultSet (predicted values) and observed values.

public double NMBE(IEnumerable<double> observed)

Parameters

observed IEnumerable<double>

An IEnumerable of double representing the observed values.

Returns

double

The NMBE as a percentage, indicating the average bias as a fraction of the mean observed values.

Exceptions

ArgumentNullException

Thrown if either the predicted or observed sequence is null.

ArgumentException

Thrown if the number of elements in predicted and observed sequences are not the same, or if the observed values are all zeros which would result in division by zero.

Negative()

Returns a new resultset with only the negative values

public ResultSet Negative()

Returns

ResultSet

Positive()

Returns a new resultset with only the positive values

public ResultSet Positive()

Returns

ResultSet

R2(IEnumerable<double>)

Calculates the Coefficient of Determination (R-squared) between this ResultSet (predicted values) and observed values.

public double R2(IEnumerable<double> observed)

Parameters

observed IEnumerable<double>

An IEnumerable of double representing the observed values.

Returns

double

The R-squared value, representing the proportion of variance in the observed data that is predictable from the predicted data.

Exceptions

ArgumentNullException

Thrown if either the predicted or observed sequence is null.

ArgumentException

Thrown if the number of elements in predicted and observed sequences are not the same, or if observed data has no variance.

SetComponent(string)

public ResultSet SetComponent(string component)

Parameters

component string

Returns

ResultSet

SetReportType(string)

public ResultSet SetReportType(string reportType)

Parameters

reportType string

Returns

ResultSet

SetUnits(string)

public ResultSet SetUnits(string units)

Parameters

units string

Returns

ResultSet

SetValue(double)

Sets a single value for all the data values in the ResultSet

public void SetValue(double value)

Parameters

value double

Sum(params ResultSet[])

Sums an array of result sets.

public ResultSet Sum(params ResultSet[] results)

Parameters

results ResultSet[]

array of result sets.

Returns

ResultSet

Summed Result Set.

TimeSeries()

Gets the Result Set as a Time Series.

public IEnumerable<ResultSet.TimeSeriesData> TimeSeries()

Returns

IEnumerable<ResultSet.TimeSeriesData>

Time Series.

ToFrequency(Frequencies, bool)

Transforms a result set from a specified frequency to another. Results can be summed or averaged during the transformation.

public ResultSet ToFrequency(Frequencies finalFrequency, bool average = false)

Parameters

finalFrequency Frequencies

Final Frequency.

average bool

If true, results are averaged.

Returns

ResultSet

ToFrequencyAuto(Frequencies)

Transforms a result set from a specified frequency to another. Averages if units are different from J, kg, m3 or hr.

public ResultSet ToFrequencyAuto(Frequencies finalFrequency)

Parameters

finalFrequency Frequencies

Final Frequency.

Returns

ResultSet

ToKWh()

Converts from J to kWh (divides between 3600000)

public ResultSet ToKWh()

Returns

ResultSet

ResultSet with values in kWh

Total()

Sums the values from the Result dataset

public double Total()

Returns

double

Operators

operator +(ResultSet, ResultSet)

Adds two result sets

public static ResultSet operator +(ResultSet r1, ResultSet r2)

Parameters

r1 ResultSet

First result set.

r2 ResultSet

Second result set.

Returns

ResultSet

Resulting Result Set.

operator +(ResultSet, double)

Adds a quantity to every value in a result set.

public static ResultSet operator +(ResultSet r1, double value)

Parameters

r1 ResultSet

Result Set

value double

Value to add.

Returns

ResultSet

Resulting Result Set.

operator /(ResultSet, ResultSet)

Divides one result set by another. If division by cero inserts 0 value.

public static ResultSet operator /(ResultSet r1, ResultSet r2)

Parameters

r1 ResultSet

First Result Set.

r2 ResultSet

Second Result Set.

Returns

ResultSet

Resulting Result Set.

operator /(ResultSet, double)

Divides by a quantity every value in a result set.

public static ResultSet operator /(ResultSet r1, double value)

Parameters

r1 ResultSet

Result Set

value double

Value to divide by.

Returns

ResultSet

Resulting Result Set.

operator ==(ResultSet, ResultSet)

Get if all the results in the first resultset are equal in the second result set

public static bool operator ==(ResultSet r1, ResultSet r2)

Parameters

r1 ResultSet

First result set.

r2 ResultSet

Second result set.

Returns

bool

True if equal

operator >(ResultSet, ResultSet)

Get if firstResultset is greater than second result sets

public static bool operator >(ResultSet r1, ResultSet r2)

Parameters

r1 ResultSet

First result set.

r2 ResultSet

Second result set.

Returns

bool

True if greater

operator !=(ResultSet, ResultSet)

Get if any of the results in the first resultset is different in the second result set

public static bool operator !=(ResultSet r1, ResultSet r2)

Parameters

r1 ResultSet

First result set.

r2 ResultSet

Second result set.

Returns

bool

True if different

operator <(ResultSet, ResultSet)

Get if firstResultset is lower than second result sets

public static bool operator <(ResultSet r1, ResultSet r2)

Parameters

r1 ResultSet

First result set.

r2 ResultSet

Second result set.

Returns

bool

True if lower

operator *(ResultSet, ResultSet)

Multiplies two result sets.

public static ResultSet operator *(ResultSet r1, ResultSet r2)

Parameters

r1 ResultSet

First Result Set.

r2 ResultSet

Second Result Set.

Returns

ResultSet

Resulting Result Set.

operator *(ResultSet, double)

Multiplies by a quantity every value in a result set.

public static ResultSet operator *(ResultSet r1, double value)

Parameters

r1 ResultSet

Result Set

value double

Value to multiply.

Returns

ResultSet

Resulting Result Set.

operator -(ResultSet, ResultSet)

Substract one resultset from another.

public static ResultSet operator -(ResultSet r1, ResultSet r2)

Parameters

r1 ResultSet

First result set.

r2 ResultSet

Result set to substract.

Returns

ResultSet

Resulting Result Set.

operator -(ResultSet, double)

Substracts a quantity to every value in a result set.

public static ResultSet operator -(ResultSet r1, double value)

Parameters

r1 ResultSet

Result Set

value double

Value to substract.

Returns

ResultSet

Resulting Result Set.

operator -(ResultSet)

Negate a result set (multiply by -1 every value).

public static ResultSet operator -(ResultSet r1)

Parameters

r1 ResultSet

Result Set.

Returns

ResultSet

Negated Result Set.