21#ifndef SCHEDULES_TABLE_SCHEDULER_H
22#define SCHEDULES_TABLE_SCHEDULER_H
64 virtual int16
startup()
override;
75 virtual int16
run()
override;
148 static_assert(N <= 1000,
"Table scheduler cannot be broken into more than 1,000 slots");
153 for(uint16 i = 0; i < N; i++) {
201 for(uint16 i = 0; i < N; i++) {
305 while(current_time < next_slot_start) {
306 current_time =
_os.systemTime();
314 next_slot_start.
setTime(next_slot_start.
sec(),
320 _os.delayUntil(next_slot_start);
328 int16 next = current_slot + 1;
#define LOG_SCHEDULER(LEVEL, MESSAGE)
Definition appmacros.h:76
const char * name() const
Getter and setter for object name.
Definition GraphTreeObject.h:135
Wrapper to manage and convert time as timespce.
Definition Time.h:53
void setTime(const struct timespec &t)
Function to set the time in the time object.
Definition Time.h:67
int64 nsec() const
Get time nanoseconds.
Definition Time.h:63
int64 sec() const
Get time seconds.
Definition Time.h:61
Base app class for derived implementation.
Definition App.h:55
Holds all os-specific interfaces.
Definition OS.h:51
Scheduler()
Constructor for the scheduler.
Definition Scheduler.cpp:21
FlightExecutive * _exc_ptr
Pointer to the executive which may optionally be registered with scheduler.
Definition Scheduler.h:87
bool _is_terminated
Flag to indicate whether the scheduler is terminated.
Definition Scheduler.h:84
virtual int16 startup() override
Start the table scheduler.
Definition TableScheduler.hpp:200
uint8 scheduleExceedances()
Get the number of schedule exceedances.
Definition TableScheduler.hpp:98
uint8 taskFailures()
Get number of task failures.
Definition TableScheduler.hpp:90
char _print_buf[200]
Definition TableScheduler.hpp:139
TableScheduler(OS &os)
Constructor for the scheduler.
Definition TableScheduler.hpp:145
uint16 currentSlot()
Get the current schedule slot (executed previous step).
Definition TableScheduler.hpp:94
uint32 _nsec_per_slot
The number of nsec allocated per slot.
Definition TableScheduler.hpp:132
const App * lastAppRun()
Get handle to the last app run.
Definition TableScheduler.hpp:114
tlm_executive_schedule_overrun _tlm_overrun
Definition TableScheduler.hpp:141
virtual int16 registerApp(App &app, int16 slot) override
Register an app with the table scheduler.
Definition TableScheduler.hpp:163
int16 _end_slot
The slot where schedule run ended.
Definition TableScheduler.hpp:131
App * _schedule_array[N]
Array to hold the actual schedule slot.
Definition TableScheduler.hpp:125
uint16 _getNextSlot(uint16 current_slot)
Return schedule slot after current one.
Definition TableScheduler.hpp:327
int16 _current_slot
The current schedule slot to execute.
Definition TableScheduler.hpp:130
~TableScheduler()
Definition TableScheduler.hpp:60
clockwerk::Time _step_size
The step size as a clockwerk time.
Definition TableScheduler.hpp:133
OS & _os
Handle to the os from which we pull system time.
Definition TableScheduler.hpp:122
virtual int16 step(const clockwerk::Time &step_val) override
Function to execute a single table schedule slot.
Definition TableScheduler.hpp:227
const tlm_executive_schedule_overrun & lastExceedance()
Return the last task to exceed its slot.
Definition TableScheduler.hpp:102
const clockwerk::Time & timePerSlot()
Get the time per slot.
Definition TableScheduler.hpp:110
virtual int16 run() override
Function to run the scheduler until pre-determined end conditions identified/calculated by the schedu...
Definition TableScheduler.hpp:296
int16 _error
Variable to catch errors out of runs.
Definition TableScheduler.hpp:136
virtual int16 unregisterApp(int16 slot) override
Function to unregister a certain schedule slot.
Definition TableScheduler.hpp:187
bool _scheduler_initialized
Flag indicating whether time has been initialized.
Definition TableScheduler.hpp:128
const tlm_executive_app_error & lastTaskFailure()
Get handle to record of last failure.
Definition TableScheduler.hpp:106
tlm_executive_app_error _tlm_error
Definition TableScheduler.hpp:140
#define NO_ERROR
Error code in the case where matrix math executed successfully.
Definition clockwerkerrors.h:34
#define ERROR_TREE_NAME_EXISTS
Definition clockwerkerrors.h:74
#define ERROR_INVALID_RANGE
Definition clockwerkerrors.h:53
#define WARN_SCH_WAIT_FOR_INIT
Warning in case where sim scheduler is waiting for initialization time.
Definition flighterrors.h:150
@ LOG_ERROR
No output at all.
Definition flighterrors.h:161
@ LOG_DEBUG
Definition flighterrors.h:164
const uint32 NSEC_PER_SEC_I
Definition Time.h:41
Definition DeadReckon.cpp:20
Packet for app errors.
Definition tlm_Executive.h:49
Packet for schedule overrun.
Definition tlm_Executive.h:64