GCBM
Classes | Public Member Functions | Private Attributes | List of all members
TimeSeries Class Reference

Encapsulates a timeseries of data. Normal usage allows modules to retrieve the most relevant data for the current timestep of the simulation. More...

#include <timeseries.h>

Collaboration diagram for TimeSeries:
Collaboration graph

Classes

class  TimeSeriesPrep
 

Public Member Functions

 TimeSeries ()
 
 TimeSeries (int yr0, int dataPerYr, int nYrs, bool subSame, const std::vector< boost::optional< double >> raw, DateOrigin origin=DateOrigin::StartSim, int extraSteps=0)
 Constructs a TimeSeries with the specified parameters. More...
 
 ~TimeSeries ()=default
 
void setTiming (const flint::ITiming *timing)
 Sets the simulation timing for the TimeSeries. The value returned by the TimeSeries will be the most appropriate for the current timestep in the timing object and the configuration of the TimeSeries; for example, if the TimeSeries is set up for yearly data, and the timing object is also in yearly steps and is currently on timestep 5, value() will return the timestep 5 value. More...
 
void setTiming (DateTime start, DateTime end)
 Alternate way to set the timing for the TimeSeries. The most often used method is to use the setTiming(const ITiming*) version. More...
 
const std::vector< double > & series () const
 Gets the values for all timesteps in the entire TimeSeries. More...
 
double value () const
 Gets the most current value for this point in time in the simulation. More...
 
int yr0 () const
 The first year or timestep of data for the TimeSeries. More...
 
int nYrs () const
 The number of years in the TimeSeries. More...
 
int dataPerYr () const
 The number of data points per year in the TimeSeries. More...
 
bool subSame () const
 True means that sub-timesteps get the full year value; false means the yearly value will be divided evenly among sub-timesteps. More...
 
const std::vector< boost::optional< double > > raw () const
 The raw data for the TimeSeries. More...
 
DateOrigin origin () const
 The origin of the TimeSeries. More...
 
ExtrapType extrap () const
 

Private Attributes

std::shared_ptr< TimeSeriesPrep_impl
 

Detailed Description

Encapsulates a timeseries of data. Normal usage allows modules to retrieve the most relevant data for the current timestep of the simulation.

Constructor & Destructor Documentation

◆ TimeSeries() [1/2]

◆ TimeSeries() [2/2]

TimeSeries ( int  yr0,
int  dataPerYr,
int  nYrs,
bool  subSame,
const std::vector< boost::optional< double >>  raw,
DateOrigin  origin = DateOrigin::StartSim,
int  extraSteps = 0 
)

Constructs a TimeSeries with the specified parameters.

Parameters
yr0The first timestep of data in the TimeSeries. Must be a multiple of dataPerYr for origin=DateOrigin::StartSim; for example, data starting in the second year of a monthly simulation would have yr0=12.
dataPerYrThe number of data points per year in the TimeSeries.
nYrsThe number of years of data in the TimeSeries.
subSameIf true, values are divided between the sub-timesteps. False means that the value for sub-timesteps is the same as for the full timestep.
rawThe raw data making up the TimeSeries.
origin(Optional) The units of the TimeSeries origin (yr0), most commonly either StartSim (timestep - the default) or Calendar (year).
extraSteps(Optional) the extra steps.

◆ ~TimeSeries()

~TimeSeries ( )
default

Member Function Documentation

◆ dataPerYr()

int dataPerYr ( ) const

The number of data points per year in the TimeSeries.

◆ extrap()

ExtrapType extrap ( ) const

◆ nYrs()

int nYrs ( ) const

The number of years in the TimeSeries.

◆ origin()

DateOrigin origin ( ) const

The origin of the TimeSeries.

◆ raw()

const std::vector< boost::optional< double > > raw ( ) const

The raw data for the TimeSeries.

◆ series()

const std::vector< double > & series ( ) const

Gets the values for all timesteps in the entire TimeSeries.

◆ setTiming() [1/2]

void setTiming ( const flint::ITiming *  timing)

Sets the simulation timing for the TimeSeries. The value returned by the TimeSeries will be the most appropriate for the current timestep in the timing object and the configuration of the TimeSeries; for example, if the TimeSeries is set up for yearly data, and the timing object is also in yearly steps and is currently on timestep 5, value() will return the timestep 5 value.

Parameters
timingThe timing.

◆ setTiming() [2/2]

void setTiming ( DateTime  start,
DateTime  end 
)

Alternate way to set the timing for the TimeSeries. The most often used method is to use the setTiming(const ITiming*) version.

Parameters
startThe start Date/Time.
endThe end Date/Time.

◆ subSame()

bool subSame ( ) const

True means that sub-timesteps get the full year value; false means the yearly value will be divided evenly among sub-timesteps.

◆ value()

double value ( ) const

Gets the most current value for this point in time in the simulation.

◆ yr0()

int yr0 ( ) const

The first year or timestep of data for the TimeSeries.

Member Data Documentation

◆ _impl

std::shared_ptr<TimeSeriesPrep> _impl
private

The documentation for this class was generated from the following files: