VICUS Library
Documentation of Vicus library
Loading...
Searching...
No Matches
VICUS::Schedule Class Reference

#include <VICUS_Schedule.h>

Inheritance diagram for VICUS::Schedule:
[legend]

Public Member Functions

VICUS_READWRITE_OVERRIDE VICUS_COMPARE_WITH_ID bool isValid (std::string &err, bool checkAnnualScheds=false, const std::map< std::string, IBK::Path > &placeholder=std::map< std::string, IBK::Path >()) const
 
bool isValid () const
 
bool isSimilar (const Schedule &other) const
 
Schedule multiply (const Schedule &other) const
 
Schedule multiply (double val) const
 
Schedule add (const Schedule &other) const
 
Schedule add (double val) const
 
void createConstSchedule (double val=0)
 
void createYearDataVector (std::vector< double > &timepoints, std::vector< double > &data) const
 
Schedule createAnnualScheduleFromPeriodSchedule (std::string &name, const IBK::Unit &unit, unsigned int startDayOfYear=0)
 
ComparisonResult equal (const AbstractDBElement *other) const override
 
void insertIntoNandradSchedulegroup (const std::string &varName, std::vector< NANDRAD::Schedule > &scheduleGroup) const
 
void insertIntoNandradSchedulegroup (const std::string &varName, std::vector< NANDRAD::Schedule > &scheduleGroup, std::vector< NANDRAD::LinearSplineParameter > &splines, const std::map< std::string, IBK::Path > &placeholders=std::map< std::string, IBK::Path >()) const
 
- Public Member Functions inherited from VICUS::AbstractDBElement
 AbstractDBElement ()=default
 
 AbstractDBElement (unsigned int id, const IBK::MultiLanguageString &name)
 
virtual ~AbstractDBElement ()
 
virtual void readXML (const TiXmlElement *element)=0
 
virtual TiXmlElement * writeXML (TiXmlElement *parent) const =0
 
void collectChildren (std::set< const AbstractDBElement * > &allChildrenRefs) const
 
void collectLocalChildren (std::set< AbstractDBElement * > &localChildrenRefs) const
 
const QString sourceName () const
 

Static Public Member Functions

static std::vector< NANDRAD::Schedule::ScheduledDayType > mergeDayType (const std::vector< int > &dts)
 

Public Attributes

IBK::MultiLanguageString m_notes
 
IBK::MultiLanguageString m_dataSource
 
bool m_useLinearInterpolation = false
 
bool m_haveAnnualSchedule = false
 
NANDRAD::LinearSplineParameter m_annualSchedule
 
std::vector< ScheduleIntervalm_periods
 
- Public Attributes inherited from VICUS::AbstractDBElement
unsigned int m_id = INVALID_ID
 
IBK::MultiLanguageString m_displayName
 
QColor m_color
 
bool m_builtIn = false
 
bool m_local = true
 
std::set< AbstractDBElement * > m_childrenRefs
 
bool m_isReferenced = false
 
std::string m_errorMsg
 

Additional Inherited Members

- Public Types inherited from VICUS::AbstractDBElement
enum  ComparisonResult { Equal , OnlyMetaDataDiffers , Different }
 

Detailed Description

Describes the course of a single scheduled quantity (basically a value over time data set). This schedule does not have a unit.

Member Function Documentation

◆ add() [1/2]

Schedule VICUS::Schedule::add ( const Schedule other) const

Multiply a schedule with another schedule. Returns the result schedule.

◆ add() [2/2]

Schedule VICUS::Schedule::add ( double  val) const

Add a constant value to a schedule. Returns the result schedule.

◆ createAnnualScheduleFromPeriodSchedule()

Schedule VICUS::Schedule::createAnnualScheduleFromPeriodSchedule ( std::string &  name,
const IBK::Unit &  unit,
unsigned int  startDayOfYear = 0 
)

Creates an annual schedule from a period schedule.

Parameters
name-> name of quantity

◆ createConstSchedule()

void VICUS::Schedule::createConstSchedule ( double  val = 0)

Create a constant schedule with value val.

◆ createYearDataVector()

void VICUS::Schedule::createYearDataVector ( std::vector< double > &  timepoints,
std::vector< double > &  data 
) const

Create a data and a timepoint vector for the hole schedule. Only period based schedules.

◆ equal()

AbstractDBElement::ComparisonResult VICUS::Schedule::equal ( const AbstractDBElement other) const
overridevirtual

Comparison operator

Implements VICUS::AbstractDBElement.

◆ insertIntoNandradSchedulegroup() [1/2]

void VICUS::Schedule::insertIntoNandradSchedulegroup ( const std::string &  varName,
std::vector< NANDRAD::Schedule > &  scheduleGroup 
) const

Generates NANDRAD schedules from data stored in this object and inserts these into the given schedule group. The variable to be inserted into the schedule group is given in parameter 'varName' (formatted including unit). Only period schedule are valid.

◆ insertIntoNandradSchedulegroup() [2/2]

void VICUS::Schedule::insertIntoNandradSchedulegroup ( const std::string &  varName,
std::vector< NANDRAD::Schedule > &  scheduleGroup,
std::vector< NANDRAD::LinearSplineParameter > &  splines,
const std::map< std::string, IBK::Path > &  placeholders = std::map<std::string, IBK::Path>() 
) const

Generates NANDRAD schedules from data stored in this object and inserts these into the given schedule group. The variable to be inserted into the schedule group is given in parameter 'varName' (formatted including unit).

◆ isSimilar()

bool VICUS::Schedule::isSimilar ( const Schedule other) const

Checks if two schedules encode the same physical behaviour, allowing for small rounding errors.

◆ isValid() [1/2]

bool VICUS::Schedule::isValid ( ) const

Checks if all referenced schedule is valid. Only for period schedules.

◆ isValid() [2/2]

bool VICUS::Schedule::isValid ( std::string &  err,
bool  checkAnnualScheds = false,
const std::map< std::string, IBK::Path > &  placeholder = std::map<std::string, IBK::Path>() 
) const

Checks if all referenced schedule is valid.

◆ mergeDayType()

std::vector< NANDRAD::Schedule::ScheduledDayType > VICUS::Schedule::mergeDayType ( const std::vector< int > &  dts)
static

Converts vector of VICUS day types into a NANDRAD schedule day types (also merges weekdays to NANDRAD::Schedule::ST_WEEKDAY, etc.).

◆ multiply() [1/2]

Schedule VICUS::Schedule::multiply ( const Schedule other) const

Multiply a schedule with another schedule. Returns the result schedule.

◆ multiply() [2/2]

Schedule VICUS::Schedule::multiply ( double  val) const

Multiply a schedule with constant value. Returns the result schedule.

Member Data Documentation

◆ m_annualSchedule

NANDRAD::LinearSplineParameter VICUS::Schedule::m_annualSchedule

Annual schedule data.

◆ m_dataSource

IBK::MultiLanguageString VICUS::Schedule::m_dataSource

Data source.

◆ m_haveAnnualSchedule

bool VICUS::Schedule::m_haveAnnualSchedule = false

If true, we have an annual schedule (though it might still be empty).

◆ m_notes

IBK::MultiLanguageString VICUS::Schedule::m_notes

Notes.

◆ m_periods

std::vector<ScheduleInterval> VICUS::Schedule::m_periods

Data is organized in periods of data. Periods in vector must be consecutive in time.

◆ m_useLinearInterpolation

bool VICUS::Schedule::m_useLinearInterpolation = false

If true, values are linearly interpolated between given time points. Applies to both daily cycle and annual schedules. Defaults to true.


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