SpaceFOM: Some Freeze points get ignored
simtheverse opened this issue · comments
Hello,
I think this line is "disarming" planned pauses in my Other federate because of a suspected double/float math error:
TrickHLA/source/SpaceFOM/ExecutionControl.cpp
Line 2311 in 0580604
This happens often but not all the time and I can Freeze okay often as well.
When I initiate a freeze by pressing "Freeze" on the Trick Panel for the MPR federate, here is the console output from my Other federate:
=============================================================
SpaceFOM::ExecutionConfiguration::unpack():331
Current Scenario Time: 1597341675.89400005
Current Simulation Time: 6.70999999999999996
Current HLA grant time: 6.70999999999999996
Current HLA request time:6.70999999999999996
.............................................................
Object-Name: 'ExCO'
root_frame_name: 'RootFrame'
scenario_time_epoch: 1597341669.18400002
next_mode_scenario_time:1597341677.89400005
next_mode_cte_time: -1.79769313486231571e+308
current_execution_mode: EXEC_MODE_RUNNING
next_execution_mode: EXECUTION_MODE_FREEZE
least_common_time_step: 5000 microseconds
=============================================================
SpaceFOM::ExecutionControl::process_execution_control_updates()
current_scenario_time: 1597341675.89400005
scenario_time_epoch: 1597341669.18400002
scenario_time_epoch(ExCO): 1597341669.18400002
scenario_time_sim_offset: 0
current_sim_time: 6.70999999999999996
simulation_time_epoch: 0
next_mode_scenario_time: 1597341677.89400005
next_mode_cte_time: -1.79769313486231571e+308
scenario_freeze_time: 1597341677.89400005
simulation_freeze_time: 8.71000003814697266
=============================================================
Then when it gets around to:
TrickHLA/source/SpaceFOM/ExecutionControl.cpp
Line 2311 in 0580604
Using print statements the Trick-sim-time and the simulation_freeze_time during that boolean condition is:
Trick-sim-time:8.71 get_simulation_freeze_time:8.71000003814697
This is the print statement inserted above the line in question:
#include <iomanip> // for std::setprecision()
ostringstream msg;
msg << std::setprecision(15); // Set the precision to 15 decimal digits
msg << "SpaceFOM::ExecutionControl::enter_freeze():" << __LINE__ << THLA_NEWLINE
<< " If value: " << ( ( exec_get_exec_command() == FreezeCmd )
&& ( exec_get_sim_time() < this->get_simulation_freeze_time() ) ? "True" : "False" )
<< THLA_NEWLINE
<< " Trick-sim-time:" << exec_get_sim_time()
<< " get_simulation_freeze_time:" << this->get_simulation_freeze_time()
<< THLA_NEWLINE;
send_hs( stdout, (char *)msg.str().c_str() );
Is this a result of float/double comparison issues?
I am using trick at 06a1d2bf and trickhla at 0580604, which I believe is master/latest at time of writing.
For some background, when the Product Development Group (PDG) designed the Execution Control part of the SpaceFOM standard, the scenario timeline was selected for freeze times since this timeline is common to both HLA time managed and non HLA time-managed federates.
The issue here is that the calculation of the simulation time from the scenario time did not take into account the time resolution used by Trick.
I configured the SpaceFOM example SIM_Roles_Test simulation to use 5 milliseconds for dynamics, lookahead & LCTS and I was able to reproduce the issue.
Please let me know if the updates I have checked in has fixed the issue for you and I will close the issue.
Hi @dandexter,
The updates work very well and no issues observed!
Thank you!