diff --git a/test/SIM_exec_set_time_tic_value/RUN_test/unit_test.py b/test/SIM_exec_set_time_tic_value/RUN_test/unit_test.py index 5b5b48ba..04f1b809 100644 --- a/test/SIM_exec_set_time_tic_value/RUN_test/unit_test.py +++ b/test/SIM_exec_set_time_tic_value/RUN_test/unit_test.py @@ -1,4 +1,4 @@ trick.stop(1.0); -trick.exec_set_time_tic_value(10000000) +trick.exec_set_time_tic_value(100000000) diff --git a/test/SIM_exec_set_time_tic_value/S_define b/test/SIM_exec_set_time_tic_value/S_define index 261f24a4..b0e10be0 100644 --- a/test/SIM_exec_set_time_tic_value/S_define +++ b/test/SIM_exec_set_time_tic_value/S_define @@ -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(); } }; diff --git a/test/SIM_exec_set_time_tic_value/models/ttvtest.cpp b/test/SIM_exec_set_time_tic_value/models/ttvtest.cpp index 4b343eb5..cf516ba2 100644 --- a/test/SIM_exec_set_time_tic_value/models/ttvtest.cpp +++ b/test/SIM_exec_set_time_tic_value/models/ttvtest.cpp @@ -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; +} \ No newline at end of file diff --git a/test/SIM_exec_set_time_tic_value/models/ttvtest.h b/test/SIM_exec_set_time_tic_value/models/ttvtest.h index e5ab5fed..92a10bdf 100644 --- a/test/SIM_exec_set_time_tic_value/models/ttvtest.h +++ b/test/SIM_exec_set_time_tic_value/models/ttvtest.h @@ -9,4 +9,7 @@ LIBRARY DEPENDENCY: class TTVTest { public: int scheduled(); + int scheduled2(); + int scheduled3(); + int scheduled4(); }; \ No newline at end of file diff --git a/trick_source/sim_services/Executive/Executive_check_all_job_cycle_times.cpp b/trick_source/sim_services/Executive/Executive_check_all_job_cycle_times.cpp index 6f3b2384..9a67410a 100644 --- a/trick_source/sim_services/Executive/Executive_check_all_job_cycle_times.cpp +++ b/trick_source/sim_services/Executive/Executive_check_all_job_cycle_times.cpp @@ -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 ; }