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

Simple implementation of the scheduler class. More...

#include <SimScheduler.h>

Inheritance diagram for modelspace::SimScheduler:

Classes

struct  Inputs
 
struct  Outputs
 
struct  Params
 Signal name Type Default. More...
 

Public Member Functions

 SimScheduler (SimulationExecutive &executive)
 Constructor for the scheduler. More...
 
int16 startup () override
 Function to start and configure the scheduler prior to run. More...
 
int16 step (const clockwerk::Time &step_size=clockwerk::Time(0, 999999999+1)) override
 Function to step the scheduler by a single step. More...
 
int16 run () override
 Function to run the scheduler until pre-determined end conditions identified/calculated by the scheduler. More...
 
int16 registerApp (cfspp::App &app, int16 slot) override
 Function to register apps with the scheduler. Depending on the scheduler implementation these may be unused. More...
 
const std::vector< cfspp::App * > & allApps ()
 Handle to acquire access to all apps. More...
 
log_level_e logLevel ()
 Get the log level set for the executive. More...
 
void logLevel (log_level_e log_level)
 Set the executive log level. More...
 
- Public Member Functions inherited from cfspp::Scheduler
 Scheduler ()
 Constructor for the scheduler. More...
 
virtual int16 unregisterApp (int16 slot)
 Function to unregister a certain schedule slot. More...
 
void terminate ()
 Terminate the scheduler. More...
 
bool isTerminated ()
 Get whether scheduler is terminated. More...
 
void setExecutive (FlightExecutive *exc)
 Set the flight executive for the scheduler. 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

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. More...
 

Protected Member Functions

int _executeAppThread (std::vector< cfspp::App * > &app_thread)
 Function to execute a single app thread. More...
 
- 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...
 

Protected Attributes

std::vector< cfspp::App * > _all_apps
 Vectors to store the sequences for each element of the simulation scheduler. More...
 
std::vector< cfspp::App * > _startup
 
std::vector< std::vector< cfspp::App * > > _start_step
 
std::vector< std::vector< cfspp::App * > > _derivative
 
std::vector< std::vector< cfspp::App * > > _end_step
 
int16 _error
 Variable to catch errors from stuff. More...
 
SixDOFDynamicsModel _dynamics
 Our 6-DOF dynamics model. More...
 
bool _is_first_step = true
 
clockwerk::Time _sim_time_step
 
clockwerk::Time _real_time_step
 
clockwerk::Time _next_time
 
SimulationExecutiveexc
 
log_level_e _local_log_level = log_level_e::LOG_WARNING
 The log level for this particular app. More...
 
- Protected Attributes inherited from cfspp::Scheduler
bool _is_terminated = false
 Flag to indicate whether the scheduler is terminated. More...
 
FlightExecutive_exc_ptr
 Pointer to the executive which may optionally be registered with scheduler. More...
 
- 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...
 

Detailed Description

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 modelsand apps 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.

Constructor & Destructor Documentation

◆ SimScheduler()

modelspace::SimScheduler::SimScheduler ( SimulationExecutive executive)

Constructor for the scheduler.

Note
Does note resolve all dependencies - executive needs to be set

Member Function Documentation

◆ _executeAppThread()

int modelspace::SimScheduler::_executeAppThread ( std::vector< cfspp::App * > &  app_thread)
protected

Function to execute a single app thread.

Parameters
app_threadThe app thread to execute
Returns
Error code corresponding to success/failure

◆ allApps()

const std::vector<cfspp::App*>& modelspace::SimScheduler::allApps ( )
inline

Handle to acquire access to all apps.

Returns
Vector containing all apps

◆ logLevel() [1/2]

log_level_e modelspace::SimScheduler::logLevel ( )
inline

Get the log level set for the executive.

Returns
Log level for the executive

◆ logLevel() [2/2]

void modelspace::SimScheduler::logLevel ( log_level_e  log_level)
inline

Set the executive log level.

Parameters
log_levelThe level to set logging to

◆ registerApp()

int16 modelspace::SimScheduler::registerApp ( cfspp::App app,
int16  slot 
)
overridevirtual

Function to register apps with the scheduler. Depending on the scheduler implementation these may be unused.

Parameters
appThe app to register
Returns
Error code corresponding to success/failure

Reimplemented from cfspp::Scheduler.

◆ run()

int16 modelspace::SimScheduler::run ( )
overridevirtual

Function to run the scheduler until pre-determined end conditions identified/calculated by the scheduler.

Returns
Error code corresponding to success/failure
Note
The scheduler MUST define stopping conditions. Otherwise, will run indefinitely

Reimplemented from cfspp::Scheduler.

◆ startup()

int16 modelspace::SimScheduler::startup ( )
overridevirtual

Function to start and configure the scheduler prior to run.

Returns
Error code corresponding to success/failure

Reimplemented from cfspp::Scheduler.

◆ step()

int16 modelspace::SimScheduler::step ( const clockwerk::Time step_size = clockwerk::Time(0,  999999999  + 1))
overridevirtual

Function to step the scheduler by a single step.

Parameters
step_sizeThe 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.
Returns
Error code corresponding to success/failure
Note
Overrides input step size parameter

Reimplemented from cfspp::Scheduler.

Member Data Documentation

◆ _all_apps

std::vector<cfspp::App*> modelspace::SimScheduler::_all_apps
protected

Vectors to store the sequences for each element of the simulation scheduler.

◆ _derivative

std::vector<std::vector<cfspp::App*> > modelspace::SimScheduler::_derivative
protected

◆ _dynamics

SixDOFDynamicsModel modelspace::SimScheduler::_dynamics
protected

Our 6-DOF dynamics model.

◆ _end_step

std::vector<std::vector<cfspp::App*> > modelspace::SimScheduler::_end_step
protected

◆ _error

int16 modelspace::SimScheduler::_error
protected

Variable to catch errors from stuff.

◆ _is_first_step

bool modelspace::SimScheduler::_is_first_step = true
protected

◆ _local_log_level

log_level_e modelspace::SimScheduler::_local_log_level = log_level_e::LOG_WARNING
protected

The log level for this particular app.

◆ _next_time

clockwerk::Time modelspace::SimScheduler::_next_time
protected

◆ _real_time_step

clockwerk::Time modelspace::SimScheduler::_real_time_step
protected

◆ _sim_time_step

clockwerk::Time modelspace::SimScheduler::_sim_time_step
protected

◆ _start_step

std::vector<std::vector<cfspp::App*> > modelspace::SimScheduler::_start_step
protected

◆ _startup

std::vector<cfspp::App*> modelspace::SimScheduler::_startup
protected

◆ exc

SimulationExecutive& modelspace::SimScheduler::exc
protected

◆ inputs

Inputs modelspace::SimScheduler::inputs = Inputs(this, "inputs")

◆ outputs

Outputs modelspace::SimScheduler::outputs = Outputs(this, "outputs")

◆ params

Params modelspace::SimScheduler::params = Params(this, "params")

◆ time

modelspace::SimTimeManager modelspace::SimScheduler::time

Time manager to handle all time in the scheduler.


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