ModelSpace
Documentation for ModelSpace models and classes.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
modelspace::SimTimeManager Class Reference

Class to manage time for the simulation object. More...

#include <SimTimeManager.h>

Inheritance diagram for modelspace::SimTimeManager:

Public Member Functions

 SimTimeManager ()
 Base constructor – time manager should initialize to zeros and then be set. More...
 
virtual ~SimTimeManager ()
 
void stepTime (const clockwerk::Time &step)
 Function to increment all times. More...
 
void updateStep (const clockwerk::Time &step)
 Function to increment step start and end time. More...
 
clockwerk::Time wallClockTimer ()
 Function to return the wall clock time since run start. More...
 
double str2tdb (const std::string &time_input)
 
std::string tdbTime ()
 Function to return the TDB time as a string. More...
 
std::string utcTime ()
 Function to return the TDB time as a string. More...
 
std::string jdTime ()
 Function to return the Julian date as a string. More...
 
std::string gpsTime ()
 Function to return the GPS time as a string. More...
 
double decimalYear ()
 Function to return the decimal year as a double. More...
 
void setTime (const std::string &time_input=DEFAULT_SIMULATION_TIME)
 Function to set time by string input. More...
 
bool wallClockIsStarted ()
 Function to return whether the wall clock timer is started. More...
 
- Public Member Functions inherited from clockwerk::GraphTreeObject
 GraphTreeObject (const char *gt_nme="", GraphTreeObject **storage_array=nullptr, uint32 storage_size=0)
 Name-based constructor for GraphTreeObject which will have no children by default. More...
 
virtual ~GraphTreeObject ()
 Destructor. More...
 
GraphTreeObjectparent ()
 Functions to get object's parent/children. More...
 
GraphTreeObject ** children ()
 
GraphTreeObjectchildAtIndex (uint8 i) const
 
int16 parent (GraphTreeObject *new_parent)
 Function to assign the node's parent via pointer. More...
 
int16 parent (GraphTreeObject &new_parent)
 Function to assign the node's parent via reference. More...
 
uint8 nChildren () const
 Getters for number of children and descendants. More...
 
uint16 nDescendants () const
 
uint8 capacity () const
 
const char * name () const
 Getter and setter for object name. More...
 
int16 name (const char *new_name)
 
uint8 rank ()
 Getter for the object rank. More...
 
int8 type ()
 Function to indicate type – -1 by default unless implemented downstream. More...
 
bool loggable ()
 Getter for object logability flag – note no setter because should only be set by this or a derived class in its definition. More...
 
GraphTreeObjectgetRootDataPointer ()
 Get the pointer to the highest object in the graph tree. More...
 
virtual int16 str (char *output, size_t size) const
 Get object represented as string. More...
 
virtual int16 fromStr (const char *val)
 Set value of graphtreeobject from string. More...
 

Public Attributes

clockwerk::DataIO< clockwerk::Timestep_start_time = clockwerk::DataIO<clockwerk::Time>(this, "step_start_time")
 
clockwerk::DataIO< clockwerk::Timestep_end_time = clockwerk::DataIO<clockwerk::Time>(this, "step_end_time")
 This is the time at the end of a given scheduler step. More...
 
clockwerk::DataIO< clockwerk::Timebase_time = clockwerk::DataIO<clockwerk::Time>(this, "base_time")
 This is the exact current time as the scheduler steps forward. More...
 
clockwerk::DataIO< clockwerk::Timetdb_time = clockwerk::DataIO<clockwerk::Time>(this, "tdb_time")
 

Protected Attributes

clockwerk::Time_tdb_ptr
 Pointers to our time objects. More...
 
clockwerk::Time _diff
 
struct timespec _tmp
 
clockwerk::Time_start_step_ptr
 Pointers to our time objects. More...
 
clockwerk::Time_end_step_ptr
 
clockwerk::Time_base_time_ptr
 
bool _started = false
 
clockwerk::Time _start
 
clockwerk::Time _now
 
GraphTreeObject_children [MAXIMUM_APP_CHILDREN]
 
- Protected Attributes inherited from clockwerk::GraphTreeObject
GraphTreeObject_parent = nullptr
 
GraphTreeObject ** _children_ptr = nullptr
 
uint32 _max_num_children = 0
 
uint16 _num_descendants = 0
 
char _name [MAXIMUM_NAME_CHARS] = ""
 String name for object. More...
 
uint8 _num_children = 0
 Number of direct children of the tree (not including the tree itself) More...
 
uint8 _rank = 0
 
int8 _graph_tree_type = BASE_GRAPH_TREE
 Variable to store graph tree object type. More...
 
bool _loggable = false
 Variable to indicate whether the selected object is loggable. Set to false by default. More...
 
uint32 _index = 0
 Index pointing to the next write location for the graph tree children. More...
 

Additional Inherited Members

- Protected Member Functions inherited from clockwerk::GraphTreeObject
int16 _setStorage (GraphTreeObject **storage_array, uint8 storage_size)
 Getter for object's string address. More...
 
void _recalculateDescendants ()
 Function to recursively re-calculate the number of descendants of a given node on the tree. More...
 
void _recalculateRank ()
 Function to recursively re-calculate the rank of a given node on the tree. More...
 
int16 _addChild (GraphTreeObject *child)
 Function to decompose a string into a series of substrings via indexing. More...
 
int16 _removeChild (GraphTreeObject *child)
 Function to remove a child from the graph node's children. More...
 

Detailed Description

Class to manage time for the simulation object.

This class uses the SPICE module to manage time within the simulation. Internally it steps the sim time and the spice ephemeris time (TDB time), which is used to cast UTC and JD time scales. All are published on the time manager.

Time representations are based on the clockwerk Time class.

Constructor & Destructor Documentation

◆ SimTimeManager()

modelspace::SimTimeManager::SimTimeManager ( )

Base constructor – time manager should initialize to zeros and then be set.

◆ ~SimTimeManager()

virtual modelspace::SimTimeManager::~SimTimeManager ( )
inlinevirtual

Member Function Documentation

◆ decimalYear()

double modelspace::SimTimeManager::decimalYear ( )

Function to return the decimal year as a double.

Returns
Data in units of year with a decimal describing percent until next year

◆ gpsTime()

std::string modelspace::SimTimeManager::gpsTime ( )

Function to return the GPS time as a string.

Returns
GPS time in the format

◆ jdTime()

std::string modelspace::SimTimeManager::jdTime ( )

Function to return the Julian date as a string.

Returns
Julian date as a days since the JD epoch as JDUTC

◆ setTime()

void modelspace::SimTimeManager::setTime ( const std::string &  time_input = DEFAULT_SIMULATION_TIME)

Function to set time by string input.


Methods to set time The following functions allow users to set time based on string

input.

Parameters
time_inputThe string input by which time will be set. valid inputs are any input which is accepted by the SPICE function STR2ET. More info here: https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/FORTRAN/spicelib/str2et.html This value defaults to 2023 September 26, 12:00:00 MDT

◆ stepTime()

void modelspace::SimTimeManager::stepTime ( const clockwerk::Time step)

Function to increment all times.

Parameters
stepTime object to step by

◆ str2tdb()

double modelspace::SimTimeManager::str2tdb ( const std::string &  time_input)

Time converters

The following functions convert time between representations

◆ tdbTime()

std::string modelspace::SimTimeManager::tdbTime ( )
inline

Function to return the TDB time as a string.


Useful Time Representations The following functions return time as any one of a number of

useful representations such as UTC and GPS time

Returns
TDB time as seconds since J2000

◆ updateStep()

void modelspace::SimTimeManager::updateStep ( const clockwerk::Time step)

Function to increment step start and end time.

Parameters
stepTime object to step by

◆ utcTime()

std::string modelspace::SimTimeManager::utcTime ( )

Function to return the TDB time as a string.

Returns
UTC time in the format 'YYYY MMM DD HH:MM:SS'

◆ wallClockIsStarted()

bool modelspace::SimTimeManager::wallClockIsStarted ( )
inline

Function to return whether the wall clock timer is started.

Returns
Whether the wall clock timer is started

◆ wallClockTimer()

clockwerk::Time modelspace::SimTimeManager::wallClockTimer ( )

Function to return the wall clock time since run start.


Other time functions – These functions return other forms of time

Returns
A time object containing the time since run start

Member Data Documentation

◆ _base_time_ptr

clockwerk::Time* modelspace::SimTimeManager::_base_time_ptr
protected

◆ _children

GraphTreeObject* modelspace::SimTimeManager::_children[MAXIMUM_APP_CHILDREN]
protected

◆ _diff

clockwerk::Time modelspace::SimTimeManager::_diff
protected

◆ _end_step_ptr

clockwerk::Time* modelspace::SimTimeManager::_end_step_ptr
protected

◆ _now

clockwerk::Time modelspace::SimTimeManager::_now
protected

◆ _start

clockwerk::Time modelspace::SimTimeManager::_start
protected

◆ _start_step_ptr

clockwerk::Time* modelspace::SimTimeManager::_start_step_ptr
protected

Pointers to our time objects.

◆ _started

bool modelspace::SimTimeManager::_started = false
protected

◆ _tdb_ptr

clockwerk::Time* modelspace::SimTimeManager::_tdb_ptr
protected

Pointers to our time objects.

◆ _tmp

struct timespec modelspace::SimTimeManager::_tmp
protected

◆ base_time

clockwerk::DataIO<clockwerk::Time> modelspace::SimTimeManager::base_time = clockwerk::DataIO<clockwerk::Time>(this, "base_time")

This is the exact current time as the scheduler steps forward.

◆ step_end_time

clockwerk::DataIO<clockwerk::Time> modelspace::SimTimeManager::step_end_time = clockwerk::DataIO<clockwerk::Time>(this, "step_end_time")

This is the time at the end of a given scheduler step.

◆ step_start_time

clockwerk::DataIO<clockwerk::Time> modelspace::SimTimeManager::step_start_time = clockwerk::DataIO<clockwerk::Time>(this, "step_start_time")

Incrementing clocks – these are standard clocks that begin on start and continue incrementing as the scheduler steps forward

in time.

This is the time at the start of a given scheduler step

◆ tdb_time

clockwerk::DataIO<clockwerk::Time> modelspace::SimTimeManager::tdb_time = clockwerk::DataIO<clockwerk::Time>(this, "tdb_time")

TDB time is represented as seconds relative to the J2000 epoch, which is January 1, 2000, at 12:00 TT (Terrestrial Time). This is also known as "ephemeris time"


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