WarpTwin
Documentation for WarpTwin models and classes.
Loading...
Searching...
No Matches
SimTableScheduleModel.h
Go to the documentation of this file.
1/******************************************************************************
2* Copyright (c) ATTX INC 2025. All Rights Reserved.
3*
4* This software and associated documentation (the "Software") are the
5* proprietary and confidential information of ATTX INC. The Software is
6* furnished under a license agreement between ATTX and the user organization
7* and may be used or copied only in accordance with the terms of the agreement.
8* Refer to 'license/attx_license.adoc' for standard license terms.
9*
10* EXPORT CONTROL NOTICE: THIS SOFTWARE MAY INCLUDE CONTENT CONTROLLED UNDER THE
11* INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) OR THE EXPORT ADMINISTRATION
12* REGULATIONS (EAR99). No part of the Software may be used, reproduced, or
13* transmitted in any form or by any means, for any purpose, without the express
14* written permission of ATTX INC.
15******************************************************************************/
16/*
17Simulated table schedule model header file
18
19Author: Alex Reynolds
20*/
21/*
22Metadata for MS GUI:
23imdata = {"exclude" : True}
24*/
25
26#ifndef MODELS_SUPPORT_SIM_TABLE_SCHEDULE_MODEL_H
27#define MODELS_SUPPORT_SIM_TABLE_SCHEDULE_MODEL_H
28
29#include <chrono>
30
31#include "simulation/Model.h"
34
35namespace warptwin {
36
50 MODEL(SimTableScheduleModel)
51 public:
52 // Model params
53 // NAME TYPE DEFAULT VALUE
60 SIGNAL(table_schedule_rate, int, 1000)
61
62
65 SIGNAL(measure_timing, int, false)
67
68 // Model inputs
69 // NAME TYPE DEFAULT VALUE
71
73
74 // Model outputs
75 // NAME TYPE DEFAULT VALUE
77
79
84 virtual int16 registerApp(warpos::App& app, int16 slot);
85
86 int16 activate() override;
87 int16 deactivate() override;
88 protected:
89 int16 start() override;
90 int16 execute() override;
91
95 int16 _executeScheduleStep(const clockwerk::Time& step_time);
96
97 // Vector of app registries to store until startup
98 std::vector<std::pair<warpos::App*, int16>> _registries;
99
102 warpos::TableScheduler<10>* _ts_10 = nullptr;
103 warpos::TableScheduler<50>* _ts_50 = nullptr;
104 warpos::TableScheduler<100>* _ts_100 = nullptr;
105 warpos::TableScheduler<200>* _ts_200 = nullptr;
106 warpos::TableScheduler<1000>* _ts_1000 = nullptr;
107
108 // Internal variables to track window start/stop
112
113 // Variables to track timing
115 std::vector<std::vector<double>> _timing_values_micros;
116 std::vector<int> _schedule_mapping;
117 std::vector<warpos::App*> _app_record;
118 std::vector<std::string> _names;
119 int16 _last_sch_step = 0;
120 bool _first_run = true;
121 std::chrono::time_point<std::chrono::high_resolution_clock> _start_time;
122 std::chrono::time_point<std::chrono::high_resolution_clock> _end_time;
123 };
124}
125
126#endif
#define SIGNAL(NAME, TYPE, INITIAL_VALUE)
Definition appmacros.h:27
#define START_PARAMS
Definition appmacros.h:42
#define END_OUTPUTS
Definition appmacros.h:33
#define END_PARAMS
Definition appmacros.h:47
#define START_OUTPUTS
Definition appmacros.h:28
#define END_INPUTS
Definition appmacros.h:40
#define START_INPUTS
Definition appmacros.h:35
Definition CircularBuffer.hpp:28
Extensions to the C++ standard library.
Definition half.hpp:2325
Definition DeadReckon.cpp:20
Class to propagate CR3BP dynamics in characteristic units.
Definition statistics.hpp:22
virtual int16 registerApp(warpos::App &app, int16 slot)
Function to register apps with the table scheduler.
std::vector< std::string > _names
Definition SimTableScheduleModel.h:118
int16 start() override
Class to execute logging.
bool _first_run
Definition SimTableScheduleModel.h:120
std::vector< int > _schedule_mapping
Map schedule indices to timing vector.
Definition SimTableScheduleModel.h:116
SIGNAL(_mu, double, warpos::earth_wgs84.mu)
clockwerk::Time _step_end_sys_time
Definition SimTableScheduleModel.h:110
int16 _last_sch_step
Definition SimTableScheduleModel.h:119
std::vector< std::pair< warpos::App *, int16 > > _registries
Definition SimTableScheduleModel.h:98
int16 _executeScheduleStep(const clockwerk::Time &step_time)
Execute schedule step given current step time.
Definition SimTableScheduleModel.cpp:257
clockwerk::Time _next_step_start
Definition SimTableScheduleModel.h:111
warpos::TableScheduler< 200 > * _ts_200
Definition SimTableScheduleModel.h:105
std::vector< std::vector< double > > _timing_values_micros
The number of microseconds per app to run.
Definition SimTableScheduleModel.h:115
warpos::TableScheduler< 1000 > * _ts_1000
Definition SimTableScheduleModel.h:106
int16 activate() override
std::chrono::time_point< std::chrono::high_resolution_clock > _start_time
Definition SimTableScheduleModel.h:121
MODEL(Servo) public int16 deactivate() override
Model to simulate a servo's motion.
std::chrono::time_point< std::chrono::high_resolution_clock > _end_time
Definition SimTableScheduleModel.h:122
@ MODEL
Simplified dynamics model representing motion in the circular restricted 3 body problem.
Definition ImNode.h:31
warpos::TableScheduler< 100 > * _ts_100
Definition SimTableScheduleModel.h:104
warpos::TableScheduler< 50 > * _ts_50
Definition SimTableScheduleModel.h:103
std::vector< warpos::App * > _app_record
Record of mapped apps.
Definition SimTableScheduleModel.h:117
warpos::TableScheduler< 10 > * _ts_10
Definition SimTableScheduleModel.h:102
int16 execute() override
Function to check monitor input conditions and set trigger flag accordingly. Should be implemented in...
clockwerk::Time _time_per_slot
Definition SimTableScheduleModel.h:109
int _total_slots
Definition SimTableScheduleModel.h:114