Gadget
Public Member Functions | Protected Attributes | List of all members
TimeClass Class Reference

This is the class used to store information about the timesteps used for the current model. More...

#include <areatime.h>

Collaboration diagram for TimeClass:
Collaboration graph

Public Member Functions

 TimeClass (CommentStream &infile, double maxratio)
 This is the TimeClass constructor. More...
 
 ~TimeClass ()
 This is the TimeClass destructor. More...
 
int getSubStep () const
 This will return the current substep of the model simulation. More...
 
int getStep () const
 This will return the current step of the model simulation. More...
 
int getYear () const
 This will return the current year of the model simulation. More...
 
int getTime () const
 This will return the total number of timesteps that have taken place in the simulation from the start of the model simulation until the current timestep. More...
 
int getFirstStep () const
 This will return the first step of the model simulation. More...
 
int getFirstYear () const
 This will return the first year of the model simulation. More...
 
int getLastStep () const
 This will return the last step of the model simulation. More...
 
int getLastYear () const
 This will return the last year of the model simulation. More...
 
double getTimeStepSize () const
 This will return the length of the current step of the model simulation as a proportion of the whole year. More...
 
double getTimeStepLength () const
 This will return the length of the current step of the model simulation. More...
 
int calcSteps (int year, int step) const
 This will return the total number of timesteps that have taken place in the simulation from the start of the model simulation until a specifed year and step. More...
 
int numTotalSteps () const
 This will return the total number of timesteps in the model simulation. More...
 
int numSteps () const
 This will return the number of steps in each year of the model simulation. More...
 
void IncrementTime ()
 This is the function that increases the timestep for the model simulation. More...
 
int isWithinPeriod (int year, int step) const
 This is the function that will check to see if specified year and step are within the time period covered by the model simulation. More...
 
void Reset ()
 This is the function that resets the timestep to the beginning of the model simulation. More...
 
int numSubSteps () const
 This will return the number of substeps in the current timestep of the model simulation. More...
 
void IncrementSubstep ()
 This is the function that increases the substep within the current timestep. More...
 
int didStepSizeChange () const
 This is the function that will check to see if the length of the current timestep has changed from the previous timestep. More...
 
double getMaxRatioConsumed () const
 This function will return the maximum ratio of any stock that can be consumed on the current substep. More...
 

Protected Attributes

int currentstep
 This is the current step of the model simulation. More...
 
int currentyear
 This is the current year of the model simulation. More...
 
int firstyear
 This is the first year in the model simulation. More...
 
int firststep
 This is the first step in the model simulation. More...
 
int lastyear
 This is the last year in the model simulation. More...
 
int laststep
 This is the last step in the model simulation. More...
 
int numtimesteps
 This is the number of steps in a year in the model simulation. More...
 
double lengthofyear
 This is the length of a year in the model simulation (should be 12) More...
 
double maxratioconsumed
 This is the maximum ratio of stock that can be consumed in any given timestep. More...
 
DoubleVector timesteps
 This is the DoubleVector of timesteps in each year. More...
 
IntVector numsubsteps
 This is the IntVector of substeps in each step. More...
 
int currentsubstep
 This is the current substep of the model simulation. More...
 

Detailed Description

This is the class used to store information about the timesteps used for the current model.

This class keeps an index of the timesteps in the model. A step is a subdivision of a year, and is usually defined in terms of months, and is the same in each year of the model. A check is made to ensure that the total length of all the steps adds up to 12.

Constructor & Destructor Documentation

◆ TimeClass()

TimeClass::TimeClass ( CommentStream infile,
double  maxratio 
)

This is the TimeClass constructor.

Parameters
infileis the CommentStream to read the time data from
maxratiois the maximum ratio of a stock that will be consumed on any given timestep

◆ ~TimeClass()

TimeClass::~TimeClass ( )
inline

This is the TimeClass destructor.

Member Function Documentation

◆ calcSteps()

int TimeClass::calcSteps ( int  year,
int  step 
) const
inline

This will return the total number of timesteps that have taken place in the simulation from the start of the model simulation until a specifed year and step.

Parameters
yearis the specified year
stepis the specified step
Returns
number of timesteps taken

◆ didStepSizeChange()

int TimeClass::didStepSizeChange ( ) const

This is the function that will check to see if the length of the current timestep has changed from the previous timestep.

Returns
1 if the length of the timestep has changed, 0 otherwise

◆ getFirstStep()

int TimeClass::getFirstStep ( ) const
inline

This will return the first step of the model simulation.

Returns
firststep

◆ getFirstYear()

int TimeClass::getFirstYear ( ) const
inline

This will return the first year of the model simulation.

Returns
firstyear

◆ getLastStep()

int TimeClass::getLastStep ( ) const
inline

This will return the last step of the model simulation.

Returns
laststep

◆ getLastYear()

int TimeClass::getLastYear ( ) const
inline

This will return the last year of the model simulation.

Returns
lastyear

◆ getMaxRatioConsumed()

double TimeClass::getMaxRatioConsumed ( ) const

This function will return the maximum ratio of any stock that can be consumed on the current substep.

Returns
maximum ratio of the stock that can be consumed on the current substep

◆ getStep()

int TimeClass::getStep ( ) const
inline

This will return the current step of the model simulation.

Returns
currentstep

◆ getSubStep()

int TimeClass::getSubStep ( ) const
inline

This will return the current substep of the model simulation.

Returns
currentsubstep

◆ getTime()

int TimeClass::getTime ( ) const
inline

This will return the total number of timesteps that have taken place in the simulation from the start of the model simulation until the current timestep.

Returns
number of timesteps taken from the start of the simulation

◆ getTimeStepLength()

double TimeClass::getTimeStepLength ( ) const
inline

This will return the length of the current step of the model simulation.

Returns
length of step

◆ getTimeStepSize()

double TimeClass::getTimeStepSize ( ) const
inline

This will return the length of the current step of the model simulation as a proportion of the whole year.

Returns
proportion of year

◆ getYear()

int TimeClass::getYear ( ) const
inline

This will return the current year of the model simulation.

Returns
currentyear

◆ IncrementSubstep()

void TimeClass::IncrementSubstep ( )
inline

This is the function that increases the substep within the current timestep.

◆ IncrementTime()

void TimeClass::IncrementTime ( )

This is the function that increases the timestep for the model simulation.

◆ isWithinPeriod()

int TimeClass::isWithinPeriod ( int  year,
int  step 
) const

This is the function that will check to see if specified year and step are within the time period covered by the model simulation.

Parameters
yearis the specified year
stepis the specified step
Returns
1 if the timestep is within the model period, 0 otherwise

◆ numSteps()

int TimeClass::numSteps ( ) const
inline

This will return the number of steps in each year of the model simulation.

Returns
numtimesteps

◆ numSubSteps()

int TimeClass::numSubSteps ( ) const
inline

This will return the number of substeps in the current timestep of the model simulation.

Returns
number of substeps

◆ numTotalSteps()

int TimeClass::numTotalSteps ( ) const
inline

This will return the total number of timesteps in the model simulation.

Returns
total number of timesteps

◆ Reset()

void TimeClass::Reset ( )

This is the function that resets the timestep to the beginning of the model simulation.

Member Data Documentation

◆ currentstep

int TimeClass::currentstep
protected

This is the current step of the model simulation.

◆ currentsubstep

int TimeClass::currentsubstep
protected

This is the current substep of the model simulation.

◆ currentyear

int TimeClass::currentyear
protected

This is the current year of the model simulation.

◆ firststep

int TimeClass::firststep
protected

This is the first step in the model simulation.

◆ firstyear

int TimeClass::firstyear
protected

This is the first year in the model simulation.

◆ laststep

int TimeClass::laststep
protected

This is the last step in the model simulation.

◆ lastyear

int TimeClass::lastyear
protected

This is the last year in the model simulation.

◆ lengthofyear

double TimeClass::lengthofyear
protected

This is the length of a year in the model simulation (should be 12)

Note
This is stored as 1/length of year to save processing time

◆ maxratioconsumed

double TimeClass::maxratioconsumed
protected

This is the maximum ratio of stock that can be consumed in any given timestep.

Note
This value will enforce a limit on the consumption of a stock which should prevent a stock from collapsing on any given timestep. If the calculated consumption is over this ratio, then the consumption is limited to this value and the rest is treated as "overconsumption", which will lead to understocking.

◆ numsubsteps

IntVector TimeClass::numsubsteps
protected

This is the IntVector of substeps in each step.

◆ numtimesteps

int TimeClass::numtimesteps
protected

This is the number of steps in a year in the model simulation.

◆ timesteps

DoubleVector TimeClass::timesteps
protected

This is the DoubleVector of timesteps in each year.


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