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

Model to implement 6-DOF dynamics. More...

#include <SixDOFDynamicsModel.h>

Inheritance diagram for modelspace::SixDOFDynamicsModel:

Classes

struct  Inputs
 
struct  Outputs
 
struct  Params
 

Public Member Functions

 SixDOFDynamicsModel (cfspp::FlightExecutive &executive)
 
virtual ~SixDOFDynamicsModel ()
 
void reset ()
 Function to reset our integrator for next step. More...
 
- Public Member Functions inherited from cfspp::App
 App (FlightExecutive &executive, const char *name, uint16 apid, uint8 instance=0)
 Executive-based constructor for the task. More...
 
virtual ~App ()
 Destructor. Doesn't really do anything. More...
 
int16 startup ()
 Initialize the app. Should be called once before step. More...
 
int16 step ()
 Step the app by a single step. Maps params, inputs, etc. to outputs. More...
 
virtual int16 activate ()
 Activate the app. The app will step when active. More...
 
virtual int16 deactivate ()
 Deactivate the app. The app will not step when deactivated. More...
 
virtual int16 command (uint16 apid, uint8 *buffer, uint16 size)
 Process commands issued to the app. 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...
 
bool isStarted ()
 Return whether task startup has been run. More...
 
uint16 apid ()
 Get the apid for this app. More...
 
uint8 & instance ()
 Get the instance of this app (used to differentiate between multiple instances of the same app) 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")
 
- Public Attributes inherited from cfspp::App
clockwerk::DataIO< bool > active = clockwerk::DataIO<bool>(this, "active", true)
 The active flag for the task – set to true by default. More...
 

Protected Member Functions

int16 start () override
 
int16 execute () override
 
int _integrateRecursiveForwardEuler (Frame *frame_ptr)
 Function to recursively integrate the frame tree via forward euler. More...
 
int _integrateRecursiveRk4 (Frame *frame_ptr)
 Function to recursively integrate the frame tree via RK4. More...
 
int _recurseRefreshFrameIntegratorSet (Frame *frame_ptr)
 Function to recursively loop through frames and set their integrators. 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

unsigned int _integrator_step_num = 0
 Variables to track integrator type and steps. More...
 
unsigned int _integrator_steps_per_step = 0
 
std::list< cfspp::ForwardEulerIntegrator< NUM_INTEGRATED_STATES > > _fe_integrators
 Vectors of integrators – allows for dynamic integrator numbers. More...
 
std::list< cfspp::RK4Integrator< NUM_INTEGRATED_STATES > > _rk4_integrators
 
cfspp::RK4Integrator< NUM_INTEGRATED_STATES > * _rk4_ptr
 
cfspp::ForwardEulerIntegrator< NUM_INTEGRATED_STATES > * _fe_ptr
 
FrameDynamics _frame_dynamics
 Our dynamics model for frames. More...
 
std::array< double, NUM_INTEGRATED_STATES_tmp_state
 
std::vector< GraphTreeObject * > _frame_children
 
clockwerk::Time _half_step_size
 Temporary variable for time calculation in RK4. More...
 
- Protected Attributes inherited from cfspp::App
FlightExecutiveexc
 Override our executive to include the FlightExecutive instead. More...
 
int16 _error = 0
 Internal variable to track and return error on app step through. More...
 
uint16 _apid = 0
 Internal variable to hold the APID for this app. More...
 
bool _is_started = false
 Flag indicating whether app has been started or not. More...
 
log_level_e _local_log_level = log_level_e::LOG_WARNING
 The log level for this particular app. More...
 
GraphTreeObject_app_children [MAXIMUM_APP_CHILDREN]
 Local storage for App children so it can live on the graph tree. More...
 
uint8 _instance
 Instance number of this app. Used to differentiate between multiple instances of the same app. 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

Model to implement 6-DOF dynamics.

This file defines the dynamics used for 6-DOF simulation.

It inherits from the classical model architecture, but is designed to execute in a manner that propagates dynamics forward in time.

Tasks executed and order of operations: Start step: Nothing Derivative:

  • Ensures frames are up to date by evaluating current state
  • Articulates forces and moments applied at nodes through the kinematics chain to the appropriate bodies
  • Determines frame motion on the basis of applied forces/moments
  • Integrates/updates frame states on the basis of kinematics – note the critical difference in model scheme here – this model updates frame states in derivative, and therefore must run at the end of the model order after forces and moments have been calculated. It cannot be used as a standard model End step: Nothing

Key restrictions

  • Must run at the end of model chain
  • Must be one, and only one, instance of this model for every simulation instance that uses 6-DOF frame dynamics

Constructor & Destructor Documentation

◆ SixDOFDynamicsModel()

modelspace::SixDOFDynamicsModel::SixDOFDynamicsModel ( cfspp::FlightExecutive executive)

Model-specific implementations of startup and derivative Must be scheduled manually to derivative

◆ ~SixDOFDynamicsModel()

virtual modelspace::SixDOFDynamicsModel::~SixDOFDynamicsModel ( )
inlinevirtual

Member Function Documentation

◆ _integrateRecursiveForwardEuler()

int modelspace::SixDOFDynamicsModel::_integrateRecursiveForwardEuler ( Frame frame_ptr)
protected

Function to recursively integrate the frame tree via forward euler.

Parameters
frame_ptrPointer to the root frame
Returns
Error code corresponding to success/failure

◆ _integrateRecursiveRk4()

int modelspace::SixDOFDynamicsModel::_integrateRecursiveRk4 ( Frame frame_ptr)
protected

Function to recursively integrate the frame tree via RK4.

Parameters
frame_ptrPointer to the root frame
Returns
Error code corresponding to success/failure

◆ _recurseRefreshFrameIntegratorSet()

int modelspace::SixDOFDynamicsModel::_recurseRefreshFrameIntegratorSet ( Frame frame_ptr)
protected

Function to recursively loop through frames and set their integrators.

Returns
Error code corresponding to success/failure

◆ execute()

int16 modelspace::SixDOFDynamicsModel::execute ( )
overrideprotectedvirtual

Reimplemented from cfspp::App.

◆ reset()

void modelspace::SixDOFDynamicsModel::reset ( )
inline

Function to reset our integrator for next step.

◆ start()

int16 modelspace::SixDOFDynamicsModel::start ( )
overrideprotectedvirtual

Reimplemented from cfspp::App.

Member Data Documentation

◆ _fe_integrators

std::list<cfspp::ForwardEulerIntegrator<NUM_INTEGRATED_STATES> > modelspace::SixDOFDynamicsModel::_fe_integrators
protected

Vectors of integrators – allows for dynamic integrator numbers.

◆ _fe_ptr

cfspp::ForwardEulerIntegrator<NUM_INTEGRATED_STATES>* modelspace::SixDOFDynamicsModel::_fe_ptr
protected

◆ _frame_children

std::vector<GraphTreeObject*> modelspace::SixDOFDynamicsModel::_frame_children
protected

◆ _frame_dynamics

FrameDynamics modelspace::SixDOFDynamicsModel::_frame_dynamics
protected

Our dynamics model for frames.

◆ _half_step_size

clockwerk::Time modelspace::SixDOFDynamicsModel::_half_step_size
protected

Temporary variable for time calculation in RK4.

◆ _integrator_step_num

unsigned int modelspace::SixDOFDynamicsModel::_integrator_step_num = 0
protected

Variables to track integrator type and steps.

◆ _integrator_steps_per_step

unsigned int modelspace::SixDOFDynamicsModel::_integrator_steps_per_step = 0
protected

◆ _rk4_integrators

std::list<cfspp::RK4Integrator<NUM_INTEGRATED_STATES> > modelspace::SixDOFDynamicsModel::_rk4_integrators
protected

◆ _rk4_ptr

cfspp::RK4Integrator<NUM_INTEGRATED_STATES>* modelspace::SixDOFDynamicsModel::_rk4_ptr
protected

◆ _tmp_state

std::array<double, NUM_INTEGRATED_STATES> modelspace::SixDOFDynamicsModel::_tmp_state
protected

Temporary variables to hold state output from integrator and frame children for recursion

◆ inputs

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

◆ outputs

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

◆ params

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

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