Added "target_integ_time" to Integrator class. It can be useful to know the integration time. (#1760)

Co-authored-by: Thomas Brain <thomas.a.brain@nasa.gov>
This commit is contained in:
Thomas Brain 2024-08-13 10:51:24 -05:00 committed by GitHub
parent 446f1fa757
commit 26f6a02e44
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 20 additions and 3 deletions

View File

@ -128,6 +128,8 @@ namespace Trick {
bool use_deriv2; // -- set by integration technique
double dt; // -- set by IntegLoopSimObject.cpp
double target_integ_time; // -- set by IntegLoopScheduler.cpp. Final integration time regardless of
// intermediate step.
#ifndef USE_ER7_UTILS_INTEGRATORS
double **state_origin;
#endif

View File

@ -11,6 +11,8 @@ int integrate(void);
int integrate_1st_order_ode(const double* deriv, double* state);
int integrate_2nd_order_ode(const double* acc, double* vel, double * pos);
double get_integ_time(void);
double get_integ_dt(void);
double get_integ_target_time(void);
void set_integ_time(double time_value);
void reset_state();
#ifndef USE_ER7_UTILS_INTEGRATORS

View File

@ -444,6 +444,8 @@ int Trick::IntegLoopScheduler::integrate_dt ( double t_start, double dt) {
int ex_pass = 0;
bool need_derivs = get_first_step_deriv_from_integrator();
double target_time = t_start + dt;
do {
ex_pass ++;
// Call all of the jobs in the derivative job queue if needed.
@ -482,11 +484,12 @@ int Trick::IntegLoopScheduler::integrate_dt ( double t_start, double dt) {
if (ex_pass == 1) {
trick_curr_integ->time = t_start;
trick_curr_integ->dt = dt;
trick_curr_integ->target_integ_time = target_time;
}
if (verbosity || trick_curr_integ->verbosity) {
message_publish (MSG_DEBUG, "Job: %s, time: %f, dt: %f\n",
curr_job->name.c_str(), t_start, dt);
message_publish (MSG_DEBUG, "Job: %s, target_integ_time: %f, integ_time: %f, dt: %f, ipass = %d\n",
curr_job->name.c_str(), target_time, t_start, dt, ipass);
}
ipass = curr_job->call();

View File

@ -15,6 +15,7 @@ Trick::Integrator::Integrator() {
is_2nd_order_ODE_technique = 0;
use_deriv2 = 0;
dt = 0.01;
target_integ_time = dt;
state = NULL;
deriv = NULL;
deriv2 = NULL;

View File

@ -22,11 +22,20 @@ extern "C" int integrate_2nd_order_ode(const double* acc, double* vel, double *
}
extern "C" double get_integ_time() {
return (trick_curr_integ->time);
return (trick_curr_integ->time);
}
extern "C" double get_integ_dt(void) {
return (trick_curr_integ->dt);
}
extern "C" double get_integ_target_time(void) {
return (trick_curr_integ->target_integ_time);
}
extern "C" void set_integ_time(double time_value) {
trick_curr_integ->time = time_value;
trick_curr_integ->target_integ_time = time_value;
}
extern "C" void reset_state() {