mirror of
https://github.com/nasa/trick.git
synced 2024-12-18 20:57:55 +00:00
Time tic precision fix and test (#1428)
This commit is contained in:
parent
97cf685b6a
commit
77fa8d78b0
@ -1,4 +1,4 @@
|
||||
|
||||
|
||||
trick.stop(1.0);
|
||||
trick.exec_set_time_tic_value(10000000)
|
||||
trick.exec_set_time_tic_value(100000000)
|
||||
|
@ -1,6 +1,8 @@
|
||||
/************************TRICK HEADER*************************
|
||||
PURPOSE:
|
||||
()
|
||||
(Test that the time tic value can be changed and that
|
||||
warnings about the resolution of the cycle are displayed
|
||||
properly. Scheduled2 should produce a warning.)
|
||||
LIBRARY DEPENDENCIES:
|
||||
*************************************************************/
|
||||
|
||||
@ -15,6 +17,9 @@ class TTVTestSimObject : public Trick::SimObject {
|
||||
|
||||
TTVTestSimObject() {
|
||||
(0.0078125, "scheduled") trick_ret = ttvtest.scheduled();
|
||||
(0.000078125, "scheduled") ttvtest.scheduled2();
|
||||
(50, "scheduled") ttvtest.scheduled3();
|
||||
(100, "scheduled") ttvtest.scheduled4();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -4,3 +4,18 @@ int TTVTest::scheduled() {
|
||||
//message_publish(MSG_NORMAL, "Hello World!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int TTVTest::scheduled2() {
|
||||
//message_publish(MSG_NORMAL, "Hello World!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int TTVTest::scheduled3() {
|
||||
//message_publish(MSG_NORMAL, "Hello World!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int TTVTest::scheduled4() {
|
||||
//message_publish(MSG_NORMAL, "Hello World!\n");
|
||||
return 0;
|
||||
}
|
@ -9,4 +9,7 @@ LIBRARY DEPENDENCY:
|
||||
class TTVTest {
|
||||
public:
|
||||
int scheduled();
|
||||
int scheduled2();
|
||||
int scheduled3();
|
||||
int scheduled4();
|
||||
};
|
@ -48,12 +48,12 @@ int Trick::Executive::check_all_job_cycle_times() {
|
||||
Trick::JobData * temp_job = all_jobs_vector[ii] ;
|
||||
double test_rem ;
|
||||
|
||||
/* calculate the floating point remainder when cycle is divided by 1/time_tic_value. Normalize result to 1.0 */
|
||||
test_rem = fmod(temp_job->cycle , 1.0 / time_tic_value ) * time_tic_value ;
|
||||
/* Calculate the if the cycle_tics would be a whole number */
|
||||
test_rem = fmod(temp_job->cycle * (double)time_tic_value , 1.0 ) ;
|
||||
|
||||
if ( test_rem > 0.001 ) {
|
||||
message_publish(MSG_WARNING,"Cycle for (%s) cannot be exactly scheduled with time tic value. "
|
||||
"cycle = %16.12f, cycle_tics = %d , time_tic = %16.12f\n",
|
||||
"cycle = %16.12f, cycle_tics = %lld , time_tic = %16.12f\n",
|
||||
temp_job->name.c_str() , temp_job->cycle, temp_job->cycle_tics , 1.0 / time_tic_value ) ;
|
||||
ret = -1 ;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user