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

Class to generate input dispersions for the simulation. More...

#include <DispersionEngine.h>

Inheritance diagram for modelspace::DispersionEngine:

Public Member Functions

 DispersionEngine (cfspp::FlightExecutive &e)
 
 ~DispersionEngine ()
 
void initialize (int seed, int run, int nruns=1000)
 Function to initialize the dispersion engine. More...
 
void setUniformValue (UniformDispersion *dispersion_ptr)
 Function to set the value of a dispersion. More...
 
void setNormalValue (NormalDispersion *dispersion_ptr)
 Function to set the value of a dispersion. More...
 
UniformDispersioncreateUniformInputDispersion (const std::string &name, double default_val, double min, double max)
 Function to generate a uniform input dispersion. More...
 
NormalDispersioncreateNormalInputDispersion (const std::string &name, double default_val, double mean, double stdev)
 Function to generate a normal input dispersion. More...
 
Dispersionoperator() (const std::string &query)
 Call operator to get pointer to dispersion matching string. 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

cfspp::FlightExecutiveexc
 
int hash_seed = 0
 

Protected Member Functions

int _hash (int run_number, int seed)
 Function to generate a hashed seed from run number and seed. 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

int _hash_value
 
int _run_number
 
int _nruns
 
std::vector< UniformDispersion * > _uniform_dispersions
 
std::vector< NormalDispersion * > _normal_dispersions
 
UniformRandom< double > * _uniform_dist = nullptr
 
NormalRandom< double > * _normal_dist = nullptr
 
- 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

Class to generate input dispersions for the simulation.

The dispersion engine class is used to generate input dispersions for use in Monte Carlo and similar simulations. It generates dispersion values which parameters and inputs on models can map to, allowing for full dispersion-->model traceability.

The dispersion engine registers dispersions

Constructor & Destructor Documentation

◆ DispersionEngine()

modelspace::DispersionEngine::DispersionEngine ( cfspp::FlightExecutive e)
inline

◆ ~DispersionEngine()

modelspace::DispersionEngine::~DispersionEngine ( )

Member Function Documentation

◆ _hash()

int modelspace::DispersionEngine::_hash ( int  run_number,
int  seed 
)
protected

Function to generate a hashed seed from run number and seed.

Parameters
run_numberThe monte carlo run number
seedThe seed to affect hash generation
Returns
Seed generated by hash function

◆ createNormalInputDispersion()

NormalDispersion & modelspace::DispersionEngine::createNormalInputDispersion ( const std::string &  name,
double  default_val,
double  mean,
double  stdev 
)

Function to generate a normal input dispersion.

Parameters
nameThe name of the dispersion
default_valueThe "run zero" value for the undispersed case
meanThe mean for the normal distribution
stdevThe standard deviation of the normal distribution
Returns
The normal dispersion struct created in the generation process

◆ createUniformInputDispersion()

UniformDispersion & modelspace::DispersionEngine::createUniformInputDispersion ( const std::string &  name,
double  default_val,
double  min,
double  max 
)

Function to generate a uniform input dispersion.

Parameters
nameThe name of the dispersion
default_valueThe "run zero" value for the undispersed case
minThe minimum for the uniform distribution
maxThe maximum for the uniform distribution
Returns
The uniform dispersion struct created in the generation process

◆ initialize()

void modelspace::DispersionEngine::initialize ( int  seed,
int  run,
int  nruns = 1000 
)

Function to initialize the dispersion engine.

Parameters
seedThe seed to be used in hashing the rng
runThe run number
nrunsThe number of runs to generate dispersions for

◆ operator()()

Dispersion * modelspace::DispersionEngine::operator() ( const std::string &  query)

Call operator to get pointer to dispersion matching string.

Parameters
Thename of the knob to search for
Returns
Pointer to the base dispersion object. nullptr if match not found

◆ setNormalValue()

void modelspace::DispersionEngine::setNormalValue ( NormalDispersion dispersion_ptr)

Function to set the value of a dispersion.

Parameters
dispersionThe dispersion to set the value for

◆ setUniformValue()

void modelspace::DispersionEngine::setUniformValue ( UniformDispersion dispersion_ptr)

Function to set the value of a dispersion.

Parameters
dispersionThe dispersion to set the value for

Member Data Documentation

◆ _hash_value

int modelspace::DispersionEngine::_hash_value
protected

◆ _normal_dispersions

std::vector<NormalDispersion*> modelspace::DispersionEngine::_normal_dispersions
protected

◆ _normal_dist

NormalRandom<double>* modelspace::DispersionEngine::_normal_dist = nullptr
protected

◆ _nruns

int modelspace::DispersionEngine::_nruns
protected

◆ _run_number

int modelspace::DispersionEngine::_run_number
protected

◆ _uniform_dispersions

std::vector<UniformDispersion*> modelspace::DispersionEngine::_uniform_dispersions
protected

◆ _uniform_dist

UniformRandom<double>* modelspace::DispersionEngine::_uniform_dist = nullptr
protected

◆ exc

cfspp::FlightExecutive& modelspace::DispersionEngine::exc

◆ hash_seed

int modelspace::DispersionEngine::hash_seed = 0

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