Public Member Functions

cd_control_deck Class Reference
[ControlDeck framework]

ControlDeck manager class. More...

#include <cd_control_deck.h>

List of all members.

Public Member Functions

 cd_control_deck (const char *control_setup_file=NULL)
 Create a new control deck, with an optional setup file.
 ~cd_control_deck ()
 Destructor.
bool include_simulation (const char *setup_file)
 Load a simulation setup file, and map any variables that are marked with cd_mapped_variable.
bool map_simulation_variable (const char *dsim_path, const char *cd_group, const char *cd_path)
 Map a single simulation variable from the dsim simulation to a ControlDeck data point.
bool add_control_system (cd_control_system *system)
 Add a control system to the deck. Adding will fail if the new system has the same name as an existing system.
void set_time_scale (double scale)
 Set the timescale used by the deck. The number provided is a multiple of real-time; a 2.0 means the deck runs twice as fast as real time.
double time_scale ()
 Get the timescale used by the deck.
void initialize ()
 Initialize the control deck. This function must be called before run();.
void note_marked_variables (void(*note_callback)(void *ctx, const char *path, cd_data_point *pt, bool is_telemetry, bool is_command), void *ctx)
 Cause the ControlDeck to call the provided callback for all variables that have been marked as telemetry or commands.
void start ()
 Set up the ControlDeck to start the run loop.
void resume_from_pause ()
 Reset the ControlDeck's next loop timers to deal with time slippage (as from a pause)
ds_date run_step ()
 Run a single step of the run loop.
ds_date delay_step (const ds_time_interval &delay)
 Delay a run loop by a period of time.
void run ()
 Run the control deck. This function generally will never return (control deck errors call exit(1)).
ds_date current_time ()
 Get the current time for the ControlDeck.
dsim_simulation * simulation ()
 Get access to the simulation used by the ControlDeck (if one is active)
cd_control_moduleload_control_module (const char *path, const char *type, const char *name, const char *ident=NULL)
 Load a module.

Detailed Description

ControlDeck manager class.

The cd_control_deck class provides high-level management functions for controlling a set of control systems and their integration with a DSim simulation. Functions are provided for controlling the time scale (the dsim simulation timescale is completely ignored) as well as for mapping simulation variables into ControlDeck variables. The VisualCommander data source will instantiate this class automatically and then call functions as appropriate according to the ControlDeck setup file provided.


Constructor & Destructor Documentation

cd_control_deck::cd_control_deck ( const char *  control_setup_file = NULL )

Create a new control deck, with an optional setup file.

Constructor for a new ControlDeck. If the path to a ControlDeck setup file is provided, the setup file is opened and used to load the specified simulation, systems and modules.

Parameters:
control_setup_fileAn optional parameter providing a setup file to load. See the Setup file page.

Member Function Documentation

ds_date cd_control_deck::current_time (  )

Get the current time for the ControlDeck.

Return either the current time or, if a simulation is loaded, the simulation Julian date.

Referenced by run_step().

ds_date cd_control_deck::delay_step ( const ds_time_interval &  delay )

Delay a run loop by a period of time.

Update the timers for delay. Enables the ControlDeck data source to be paused and resumed in VisualCommander.

void cd_control_deck::initialize (  )

Initialize the control deck. This function must be called before run();.

Initializes all the loaded control systems. First initialize the created data in each system using cd_control_system::initialize_data(). Set all the variable paths, mark the telemetry and commands, and finally complete the initialization be calling each system's cd_control_system::initialize() function.

cd_control_module * cd_control_deck::load_control_module ( const char *  path,
const char *  type,
const char *  name,
const char *  ident = NULL 
)

Load a module.

Run the _builder function to create the control module.

void cd_control_deck::note_marked_variables ( void(*)(void *ctx, const char *path, cd_data_point *pt, bool is_telemetry, bool is_command)  note_callback,
void *  ctx 
)

Cause the ControlDeck to call the provided callback for all variables that have been marked as telemetry or commands.

Provide the telemetry and command paths as part of the interface to VisualCommander.

void cd_control_deck::start (  )

Set up the ControlDeck to start the run loop.

Starts the simulation, if one is loaded, and sets up the run loop using the current date.


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