![]() |
ModelSpace
|
Simple implementation of the scheduler class. More...
#include <SimScheduler.h>
Classes | |
struct | Inputs |
struct | Outputs |
struct | Params |
Signal name Type Default. More... | |
Public Member Functions | |
SimScheduler (clockwerk::Executive &executive) | |
Constructor for the scheduler. | |
int | startup () |
Function to start and configure the scheduler prior to run. | |
int | step (const clockwerk::Time &step_size=clockwerk::Time(0, 999999999+1)) |
Function to step the scheduler by a single step. | |
int | run () |
Function to run the scheduler until pre-determined end conditions identified/calculated by the scheduler. | |
virtual int | registerTask (clockwerk::Task *task) override |
Function to register tasks with the scheduler. Depending on the scheduler implementation these may be unused. | |
void | terminate () |
Function to set the scheduler for termination. | |
virtual bool | isTerminated () |
Function to indicate whether the scheduler is terminated. | |
void | logLevel (clockwerk::log_level_e new_level) |
Function to set the local model log level. | |
void | create () |
Function to set up our scheduler. | |
GraphTreeObject * | parent () |
Functions to get object's parent/children. | |
int | parent (GraphTreeObject *new_parent) |
Function to assign the node's parent via pointer. | |
int | parent (GraphTreeObject &new_parent) |
Function to assign the node's parent via reference. | |
std::vector< GraphTreeObject * > & | children () |
unsigned int | nChildren () |
Getters for number of children and descendants. | |
unsigned int | nDescendants () |
std::string | name () const |
Getter and setter for object name. | |
int | name (const std::string &new_name) |
int | rank () |
Getter for the object rank. | |
virtual int | type () |
Function to indicate type – -1 by default unless implemented downstream. | |
bool | loggable () |
Getter for object logability flag – note no setter because should only be set by this or a derived class in its definition. | |
std::string | address () |
Getter for object's string address. | |
std::vector< std::string > | search (const std::string &address) |
Function to search through the graph tree by string address. | |
GraphTreeObject * | getByAddress (const std::string &address) |
Function to get an object from the graph tree by string address. | |
void | dump (bool recursive=false) |
Function to dump the graph node, optionally including descendents. | |
void | graphNodeInfo () |
Function to return all info associated with a given graph node. | |
void | recurseGraphNodeInfo (unsigned int counter) |
Function to recurse through graph tree and print all node info. | |
virtual int | header (void *logger) |
Function to pass headers for this object to the logger. | |
virtual std::vector< std::string > | header_info () const |
void | findLoggable (std::vector< GraphTreeObject * > &matches) |
Function to find all loggable parameters in this node and its children. | |
virtual int | log (void *logger) |
Function to log data to a logger. | |
void | lock (bool recursive=true) |
Function to lock the graph tree object and its children to changes. | |
void | unlock (bool recursive=true) |
Function to unlock the graph tree and its children for changes. | |
bool | locked () |
Function to return whether graph tree object is locked. | |
Public Attributes | |
Params | params = Params(this, "params") |
Inputs | inputs = Inputs(this, "inputs") |
Outputs | outputs = Outputs(this, "outputs") |
modelspace::SimTimeManager | time |
Time manager to handle all time in the scheduler. | |
Executive * | exc |
Event logger for debugging and key events. | |
Protected Member Functions | |
int | _executeTaskThread (std::vector< clockwerk::Task * > &task_thread) |
Function to execute a single task thread. | |
void | recalculateDescendants () |
Function to recursively re-calculate the number of descendants of a given node on the tree. | |
void | recalculateRank () |
Function to recursively re-calculate the rank of a given node on the tree. | |
std::vector< std::string > | decomposeAddress (std::string address) |
Function to decompose a string into a series of substrings via indexing. | |
void | findMatches (const std::vector< std::string > &subaddresses, const unsigned int &num_subaddresses, unsigned int index, bool match_found, std::vector< GraphTreeObject * > &matches) |
Function to find all addresses mathcing the set of substrings @parem subaddresses A vector of subaddresses to match. | |
std::vector< GraphTreeObject * > | searchNodes (const std::string &address) |
Function to search through the graph tree by string address. | |
int | addChild (GraphTreeObject *child) |
Function to add a child to the graph tree object. | |
int | removeChild (GraphTreeObject *child) |
Function to remove a child from the graph node's children. | |
Protected Attributes | |
std::vector< clockwerk::Task * > | _all_tasks |
Vectors to store the sequences for each element of the simulation scheduler. | |
std::vector< clockwerk::Task * > | _startup |
std::vector< std::vector< clockwerk::Task * > > | _start_step |
std::vector< std::vector< clockwerk::Task * > > | _derivative |
std::vector< std::vector< clockwerk::Task * > > | _end_step |
bool | _is_terminated |
Variable to terminate the simulation. The simulation run function terminates when this flag is set. | |
int | _error |
Variable to catch errors from stuff. | |
SixDOFDynamicsModel | _dynamics |
Our 6-DOF dynamics model. | |
bool | _is_first_step = true |
clockwerk::Time | _sim_time_step |
clockwerk::Time | _real_time_step |
clockwerk::Time | _next_time |
log_level_e | _local_log_level = NONE |
GraphTreeObject * | _parent = nullptr |
Pointer to the object's parent – should be null if the object is the root. Is set to null by default. | |
std::vector< GraphTreeObject * > | _children |
Pointers to the object's children – automatically set to an empty vector, and can be increased to any size. | |
std::string | _name = DEFAULT_NAME |
String name for object. | |
uint16_t | _num_descendants = 0 |
Total number of descendants (includes children of children) of the tree, again not including the tree itself. | |
uint8_t | _num_children = 0 |
Number of direct children of the tree (not including the tree itself) | |
uint8_t | _rank = 0 |
Rank for how far down on the graph tree the object is – starts at zero and maxes out at 256 via variable size. | |
uint8_t | _graph_tree_type = BASE_GRAPH_TREE |
Variable to store graph tree object type. | |
bool | _locked = false |
Variable to lock the graph tree object and prevent structural updates. | |
bool | _loggable = false |
Variable to indicate whether the selected object is loggable. Set to false by default. | |
Simple implementation of the scheduler class.
This class is a base implementation of scheduler. It is an empty base class and cannot be used without implementation in a derived child class. The scheduler is used to execute models, tasks, monitors, and events in a sequence and format as defined in the derived scheduler class. Note: This scheduler is intended for use explicitly in simulation with the 6-DOF dynamics model. It manually adds the 6-DOF dynamics and uses it internally for time and integrator calculations.
modelspace::SimScheduler::SimScheduler | ( | clockwerk::Executive & | executive | ) |
Constructor for the scheduler.
|
protected |
Function to execute a single task thread.
task_thread | The task thread to execute |
|
protectedinherited |
Function to add a child to the graph tree object.
child | A pointer to the graph tree object to add to the tree |
|
inherited |
Getter for object's string address.
|
protectedinherited |
Function to decompose a string into a series of substrings via indexing.
address | The address to be decomposed |
Function to dump the graph node, optionally including descendents.
recursive | Parameter indicating whether to dump only one node (default/false) or the entire tree (true) |
|
inherited |
Function to find all loggable parameters in this node and its children.
matches | Expandable vector to hold all matches in the tree |
|
protectedinherited |
Function to find all addresses mathcing the set of substrings @parem subaddresses A vector of subaddresses to match.
num_subaddresses | The number of subaddresses to match |
index | The index of subaddresses to search in |
match_found | Variable indicating whether a match was found higher in the tree |
matches | Implicit return of all matches to the specified address |
|
inherited |
Function to get an object from the graph tree by string address.
address | The exact string address to access the variable with |
|
inlinevirtualinherited |
Function to pass headers for this object to the logger.
logger | Pointer to logger |
Reimplemented in clockwerk::DataIO< T >, clockwerk::DataIO< bool >, clockwerk::DataIO< clockwerk::Body< double > * >, clockwerk::DataIO< clockwerk::Body< T > * >, clockwerk::DataIO< clockwerk::CartesianVector< double, 2 > >, clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > >, clockwerk::DataIO< clockwerk::CartesianVector< T, 3 > >, clockwerk::DataIO< clockwerk::Euler321< double > >, clockwerk::DataIO< clockwerk::Frame< double > * >, clockwerk::DataIO< clockwerk::Frame< T > * >, clockwerk::DataIO< clockwerk::Matrix< double, 2, 2 > >, clockwerk::DataIO< clockwerk::Matrix< double, 3, 3 > >, clockwerk::DataIO< clockwerk::Matrix< double, 6, 3 > >, clockwerk::DataIO< clockwerk::Matrix< double, 6, 6 > >, clockwerk::DataIO< clockwerk::Matrix< T, 3, 3 > >, clockwerk::DataIO< clockwerk::Node< double > * >, clockwerk::DataIO< clockwerk::Quaternion< double > >, clockwerk::DataIO< clockwerk::Quaternion< T > >, clockwerk::DataIO< clockwerk::Time >, clockwerk::DataIO< double >, clockwerk::DataIO< int >, clockwerk::DataIO< modelspace::integrator_type_e >, clockwerk::DataIO< std::string >, and clockwerk::DataIO< void * >.
|
inlinevirtualinherited |
Reimplemented in clockwerk::Time.
|
inlinevirtual |
Function to indicate whether the scheduler is terminated.
Reimplemented from clockwerk::Scheduler.
Function to lock the graph tree object and its children to changes.
recursive | Flag to indicate whether lock should be recursive |
|
inlinevirtualinherited |
Function to log data to a logger.
logger | Pointer to logger |
Reimplemented in clockwerk::Time, clockwerk::DataIO< T >, clockwerk::DataIO< bool >, clockwerk::DataIO< clockwerk::Body< double > * >, clockwerk::DataIO< clockwerk::Body< T > * >, clockwerk::DataIO< clockwerk::CartesianVector< double, 2 > >, clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > >, clockwerk::DataIO< clockwerk::CartesianVector< T, 3 > >, clockwerk::DataIO< clockwerk::Euler321< double > >, clockwerk::DataIO< clockwerk::Frame< double > * >, clockwerk::DataIO< clockwerk::Frame< T > * >, clockwerk::DataIO< clockwerk::Matrix< double, 2, 2 > >, clockwerk::DataIO< clockwerk::Matrix< double, 3, 3 > >, clockwerk::DataIO< clockwerk::Matrix< double, 6, 3 > >, clockwerk::DataIO< clockwerk::Matrix< double, 6, 6 > >, clockwerk::DataIO< clockwerk::Matrix< T, 3, 3 > >, clockwerk::DataIO< clockwerk::Node< double > * >, clockwerk::DataIO< clockwerk::Quaternion< double > >, clockwerk::DataIO< clockwerk::Quaternion< T > >, clockwerk::DataIO< clockwerk::Time >, clockwerk::DataIO< double >, clockwerk::DataIO< int >, clockwerk::DataIO< modelspace::integrator_type_e >, clockwerk::DataIO< std::string >, and clockwerk::DataIO< void * >.
|
inline |
Function to set the local model log level.
new_level | The new level to set logging to |
|
inherited |
Function to assign the node's parent via reference.
new_parent | The new parent to assign the node to |
|
inherited |
Function to assign the node's parent via pointer.
new_parent | The new parent to assign the node to |
Function to recurse through graph tree and print all node info.
|
overridevirtual |
Function to register tasks with the scheduler. Depending on the scheduler implementation these may be unused.
task | The task to register |
Reimplemented from clockwerk::Scheduler.
|
protectedinherited |
Function to remove a child from the graph node's children.
child | The child to remove |
|
virtual |
Function to run the scheduler until pre-determined end conditions identified/calculated by the scheduler.
Reimplemented from clockwerk::Scheduler.
|
inherited |
Function to search through the graph tree by string address.
address | `The address or address chunk to search for |
|
protectedinherited |
Function to search through the graph tree by string address.
address | `The address or address chunk to search for |
|
virtual |
Function to start and configure the scheduler prior to run.
Reimplemented from clockwerk::Scheduler.
|
virtual |
Function to step the scheduler by a single step.
step_size | The step size (as a time object) to step the sim by. Any nsec value greater than NSEC_MAX will cause step to take the input step size, which is the default behavior. Setting time to a valid time will step by that time rather than the input value. |
Reimplemented from clockwerk::Scheduler.
|
inlinevirtual |
Function to set the scheduler for termination.
Reimplemented from clockwerk::Scheduler.
|
inlinevirtualinherited |
Function to indicate type – -1 by default unless implemented downstream.
Function to unlock the graph tree and its children for changes.
recursive | Flag to indicate whether unlock should be recursive |