AIM
|
#include <SleepTimeEstimate.h>
Public Member Functions | |
SleepTimeEstimate (std::string name=MODULE_NAME) | |
void | doTick () |
Public Member Functions inherited from AIM | |
AIM (std::string name="") | |
AIM (const AIM &other) | |
AIM & | operator= (const AIM &rhs) |
virtual void | addDataSubscriber (const std::string &key, AIM *subscriber) |
virtual void | removeDataSubscriber (const std::string &key) |
virtual AIMValue | setProperty (const std::string &key, AIMValue value) |
virtual AIMValue | getProperty (std::string key) const |
virtual void | sendData () |
virtual void | addData (const AIMData &data) |
virtual std::string | exportProperties () |
virtual std::vector< std::pair < std::string, AIMValue > > | getOutputData (bool clear_output=false) |
virtual std::vector< std::pair < std::string, AIMValue > > | getInputData (bool clear_input=false) |
virtual AIM * | getDataSubscriber (std::string subscriber) |
virtual const std::map < std::string, AIMValue > & | getProperties () |
virtual std::string | getName () const |
virtual std::vector< AIMValue > | getRequirements () const |
virtual bool | requirementsAreUpdated (bool reset=true) const |
virtual void | setProperties (const std::map< std::string, AIMValue > &properties) |
Static Public Attributes | |
static const std::string | VERSION = "1.0" |
static const std::string | MODULE_NAME = "sleep_time_estimate" |
static const std::string | FIELD_SLEEP_TIME = "sleepTime" |
static const std::string | FIELD_START_DATE = "start_date" |
static const std::string | FIELD_END_DATE = "end_date" |
static const std::string | FIELD_HISTORY_BASED = "history_based" |
static const std::string | PROP_SLEEP_TIME_AVERAGE = "sleep_time_average" |
static const std::string | PROP_SLEEP_TIME_COUNT = "sleep_time_count" |
static const std::string | PROP_SLEEP_TIME_HISTORY = "sleep_time_history" |
static const std::string | PROP_POPULATION_SLEEP_TIME = "population_sleep_time" |
static const std::string | PROP_POPULATION_START_TIME = "population_start_time" |
static const std::string | PROP_POPULATION_END_TIME = "population_end_time" |
static const std::string | PROP_SLEEP_END_TIME = "sleep_end_time" |
static const std::string | PROP_MAX_SLEEP_DURATION = "max_sleep_duration" |
static const std::string | PROP_MIN_SLEEP_DURATION = "min_sleep_duration" |
static const std::string | PROP_GOAL_SLEEP_TIME_COUNT = "goal_sleep_time_count" |
static const std::string | PROP_ESTIMATE_RETURN_TIME = "estimate_return_time" |
static const std::string | PROP_ESTIMATE_RETURN_MIN_CNT = "estimate_return_min_cnt" |
static const std::string | PROP_ESTIMATE_NOISE = "estimate_noise" |
static const std::string | PROP_SLEEP_TIME_WEIGHTED_AVERAGE = "sleep_time_weighted_average" |
Static Public Attributes inherited from AIM | |
static const std::string | VERSION = AIM_VERSION |
Additional Inherited Members | |
Public Types inherited from AIM | |
typedef std::pair< std::string, AIMValue > | AIMData |
typedef std::queue< AIMData > | AIMDataQueue |
typedef std::queue< AIMValue > | AIMValueQueue |
typedef std::map< std::string, AIMValueQueue > | InputDataQueue |
Protected Member Functions inherited from AIM | |
void | setDataSubscribers (const std::map< std::string, AIM * > &subscribers) |
void | setInputDataQueue (const InputDataQueue &inputDataQueue) |
void | setOutputDataQueue (const AIMDataQueue &outputDataQueue) |
Protected Attributes inherited from AIM | |
std::string | name |
std::vector< AIMValue > | requirements |
bool | requirementsUpdated |
std::map< std::string, AIM * > | dataSubscribers |
std::map< std::string, AIMValue > | properties |
InputDataQueue | inputDataQueue |
AIMDataQueue | outputDataQueue |
Created on: Dec 17, 2014 Author: Ted Schmidt
This module gives a sleep estimate based on the observed values of the sleep_time module.
When the sleep_time module continuously returns 0 minutes of sleep during sleep period, this module will return an estimate based on the population and the sleep history of the user.
An estimate will only be calculated when:
SleepTimeEstimate::SleepTimeEstimate | ( | std::string | name = MODULE_NAME | ) |
SleepTimeEstimate constructor
The SleepTimeEstimate module will be initialized with the following properties, these can be altered via setProperty:
PROP_POPULATION_SLEEP_TIME = 8 hours
PROP_POPULATION_START_TIME = 23.5 o'clock
PROP_POPULATION_END_TIME = 7 o'clock
PROP_MIN_SLEEP_DURATION = 4 hours
PROP_GOAL_SLEEP_TIME_COUNT = 14 nights
PROP_ESTIMATE_RETURN_TIME = 6 o'clock
PROP_ESTIMATE_RETURN_MIN_CNT = 48 samples (4 hours every 5 minutes a sample)
PROP_SLEEP_END_TIME = 12 o'clock
PROP_MAX_SLEEP_DURATION = 14 hours
PROP_ESTIMATE_NOISE = 0.5 hours
|
virtual |
Do an AIM tick
This method is called to tick the AI-module to do its processing. During this tick the AI module grabs it's input data, does its processing, and sends the data to its data receivers. This method can be used in combination with AIM priorities, to streamline the data flow and timers for timed AI modules.
Reimplemented from AIM.
|
static |
sleep_time module field name end_date
|
static |
sleep_time_estimate module field names
|
static |
sleep_time module field name sleepTime
|
static |
sleep_time module field name start_date
|
static |
Name of the this module
|
static |
The property name for the maximum amount of noise in hours added/subtracted from the sleepTime estimate
|
static |
The property name for the min amount of data points after which it starts returning an estimate
|
static |
The property name for the hour at which it starts returning an estimate
|
static |
The property name for the goal value for the amount of values needed to have the sleep time estimation totally based on the users average
|
static |
The property name for maximum sleep duration, start time - end time of the sleep period of the sleep_time module
|
static |
The property name for the minimum sleep time duration needed before the value is used for the average sleep calculation
|
static |
The property name for the sleep population value for the end time in hours
|
static |
The property name for the sleep population value for the amount of sleep in hours
|
static |
The property name for the sleep population value for the start time in hours
|
static |
The property name for the end time for calculating the sleep period as set in the sleep_time module
|
static |
user specific sleep_time structured average value
|
static |
user specific average sample count
|
static |
The property name for the sleep time value cache for the last night
|
static |
The property name for the weighted sleep time average based on the population and user average with added noise
|
static |
Module version