#include <TimeSeries.hpp>
Public Member Functions | |
Constructors | |
TimeSeries () | |
Default constructor with no data. More... | |
TimeSeries (const Date &startDate, const Time &intervalLength, const Vector &values, const std::string &units) | |
Constructor from start date, interval length, values, and units. More... | |
TimeSeries (const DateTime &firstReportDateTime, const Time &intervalLength, const Vector &values, const std::string &units) | |
Constructor from first report date and time, interval length, values, and units. More... | |
TimeSeries (const DateTime &firstReportDateTime, const Vector &timeInDays, const Vector &values, const std::string &units) | |
Constructor from first report date and time, time in days, values, and units. More... | |
TimeSeries (const DateTime &firstReportDateTime, const std::vector< double > &timeInDays, const std::vector< double > &values, const std::string &units) | |
Constructor from first report date and time, time in days, values, and units. More... | |
TimeSeries (const DateTimeVector &dateTimes, const Vector &values, const std::string &units) | |
Constructor from date times, values, and units. More... | |
TimeSeries (const DateTime &firstReportDateTime, const std::vector< long > &timeInSeconds, const Vector &values, const std::string &units) | |
Constructor from first report date and time, time in seconds, values, and units. More... | |
~TimeSeries () | |
Virtual destructor. More... | |
Getters | |
openstudio::OptionalTime | intervalLength () const |
Returns the interval length if any. More... | |
openstudio::DateTimeVector | dateTimes () const |
Returns the date and times at which values are reported, these are the end of each reporting interval. More... | |
openstudio::DateTime | firstReportDateTime () const |
Returns the date and time of first report value. More... | |
openstudio::Vector | daysFromFirstReport () const |
Returns the vector of time in days from end of the first reporting interval. More... | |
double | daysFromFirstReport (unsigned int i) const |
Returns the time in days from end of the first reporting interval at index i to prevent implicit vector copy for single value. More... | |
std::vector< long > | secondsFromFirstReport () const |
Returns the time in seconds from end of the first reporting interval. More... | |
long | secondsFromFirstReport (unsigned int i) const |
Return the time in seconds from end of the first reporting interval at index i to prevent implicit vector copy for single value. More... | |
openstudio::Vector | values () const |
Returns the values vector. More... | |
double | values (unsigned int i) const |
Returns the value at index i to prevent implicit vector copy for single value. More... | |
const std::string | units () const |
Returns the series units as a standard string. More... | |
double | value (double daysFromFirstReport) const |
Get value at number of days from first report date and time. More... | |
double | value (const Time &timeFromFirstReport) const |
Get value at time from first report date and time. More... | |
double | value (const DateTime &dateTime) const |
Get value at date and time. More... | |
Vector | values (const DateTime &startDateTime, const DateTime &endDateTime) const |
Get values between start and end date times. More... | |
double | outOfRangeValue () const |
Get the value used for out of range data. More... | |
Setters | |
void | setOutOfRangeValue (double value) |
Set the value used for out of range data, defaults to 0. More... | |
Operators | |
TimeSeries | operator+ (const TimeSeries &other) const |
Add timeseries. More... | |
TimeSeries | operator- (const TimeSeries &other) const |
Subtract timeseries. More... | |
TimeSeries | operator* (double d) const |
TimeSeries * double. More... | |
TimeSeries | operator/ (double d) const |
TimeSeries / double. More... | |
Analysis Functions | |
double | integrate () const |
Integrate the time series. More... | |
double | averageValue () const |
Compute the time series average value. More... | |
TimeSeries is a series of values each reported at a single time.
We follow the EnergyPlus convention that the time reported for each value is at the end of the reporting interval. For example, if a value is measured over the interval from hour 1 (non-inclusive) to hour 2 (inclusive), that is 1 < t <= 2, and the reported value (either the average, median, min, max, etc) is determined to be 7, then the value 7 is reported at hour 2. One of the primary tasks of the TimeSeries class is to get the value of the series at an arbitrary time. For the example above, any time in the interval 1 < t <= 2 will return 7. We refer to the beginning of the first reporting interval as the startDateTime. The end of the first interval is referred to as the firstReportDateTime.
Todo: add method to mark TimeSeries that represent point in time measurements rather than interval measurements
Todo: add calendar to deal with Daylight Savings
openstudio::TimeSeries::TimeSeries | ( | ) |
Default constructor with no data.
openstudio::TimeSeries::TimeSeries | ( | const Date & | startDate, |
const Time & | intervalLength, | ||
const Vector & | values, | ||
const std::string & | units | ||
) |
Constructor from start date, interval length, values, and units.
First reporting interval starts at 0 hours on startDate and ends at startDate + intervalLength.
openstudio::TimeSeries::TimeSeries | ( | const DateTime & | firstReportDateTime, |
const Time & | intervalLength, | ||
const Vector & | values, | ||
const std::string & | units | ||
) |
Constructor from first report date and time, interval length, values, and units.
First reporting interval starts at firstReportDateTime - intervalLength and ends at firstReportDateTime.
openstudio::TimeSeries::TimeSeries | ( | const DateTime & | firstReportDateTime, |
const Vector & | timeInDays, | ||
const Vector & | values, | ||
const std::string & | units | ||
) |
Constructor from first report date and time, time in days, values, and units.
The treatment of the time vector depends upon the value of the first element:
An exception is thrown if:
openstudio::TimeSeries::TimeSeries | ( | const DateTime & | firstReportDateTime, |
const std::vector< double > & | timeInDays, | ||
const std::vector< double > & | values, | ||
const std::string & | units | ||
) |
Constructor from first report date and time, time in days, values, and units.
The treatment of the time vector depends upon the value of the first element:
An exception is thrown if:
openstudio::TimeSeries::TimeSeries | ( | const DateTimeVector & | dateTimes, |
const Vector & | values, | ||
const std::string & | units | ||
) |
Constructor from date times, values, and units.
The size of the dateTimes vector determines how it is handled:
An exception is thrown if:
openstudio::TimeSeries::TimeSeries | ( | const DateTime & | firstReportDateTime, |
const std::vector< long > & | timeInSeconds, | ||
const Vector & | values, | ||
const std::string & | units | ||
) |
Constructor from first report date and time, time in seconds, values, and units.
The treatment of the time vector depends upon the value of the first element:
An exception is thrown if:
|
inline |
Virtual destructor.
double openstudio::TimeSeries::averageValue | ( | ) | const |
Compute the time series average value.
openstudio::DateTimeVector openstudio::TimeSeries::dateTimes | ( | ) | const |
Returns the date and times at which values are reported, these are the end of each reporting interval.
openstudio::Vector openstudio::TimeSeries::daysFromFirstReport | ( | ) | const |
Returns the vector of time in days from end of the first reporting interval.
double openstudio::TimeSeries::daysFromFirstReport | ( | unsigned int | i | ) | const |
Returns the time in days from end of the first reporting interval at index i to prevent implicit vector copy for single value.
openstudio::DateTime openstudio::TimeSeries::firstReportDateTime | ( | ) | const |
Returns the date and time of first report value.
double openstudio::TimeSeries::integrate | ( | ) | const |
Integrate the time series.
openstudio::OptionalTime openstudio::TimeSeries::intervalLength | ( | ) | const |
Returns the interval length if any.
TimeSeries openstudio::TimeSeries::operator* | ( | double | d | ) | const |
TimeSeries * double.
TimeSeries openstudio::TimeSeries::operator+ | ( | const TimeSeries & | other | ) | const |
Add timeseries.
TimeSeries openstudio::TimeSeries::operator- | ( | const TimeSeries & | other | ) | const |
Subtract timeseries.
TimeSeries openstudio::TimeSeries::operator/ | ( | double | d | ) | const |
TimeSeries / double.
double openstudio::TimeSeries::outOfRangeValue | ( | ) | const |
Get the value used for out of range data.
std::vector<long> openstudio::TimeSeries::secondsFromFirstReport | ( | ) | const |
Returns the time in seconds from end of the first reporting interval.
long openstudio::TimeSeries::secondsFromFirstReport | ( | unsigned int | i | ) | const |
Return the time in seconds from end of the first reporting interval at index i to prevent implicit vector copy for single value.
void openstudio::TimeSeries::setOutOfRangeValue | ( | double | value | ) |
Set the value used for out of range data, defaults to 0.
const std::string openstudio::TimeSeries::units | ( | ) | const |
Returns the series units as a standard string.
double openstudio::TimeSeries::value | ( | double | daysFromFirstReport | ) | const |
Get value at number of days from first report date and time.
double openstudio::TimeSeries::value | ( | const Time & | timeFromFirstReport | ) | const |
Get value at time from first report date and time.
double openstudio::TimeSeries::value | ( | const DateTime & | dateTime | ) | const |
Get value at date and time.
openstudio::Vector openstudio::TimeSeries::values | ( | ) | const |
Returns the values vector.
double openstudio::TimeSeries::values | ( | unsigned int | i | ) | const |
Returns the value at index i to prevent implicit vector copy for single value.