Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow different values for the Trick software frame and least common time step for SpaceFOM #146

Open
dandexter opened this issue Jul 26, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@dandexter
Copy link
Contributor

dandexter commented Jul 26, 2024

Currently, the Trick software frame and Least Common Time Step (LCTS) for SpaceFOM are locked together. This constrains the simulation to only have a Trick realtime software frame that matches the LCTS. If we apply some constraints we can allow more leeway in setting the Trick software frame, LCTS and lookahead values.

The following relationships between the Trick real-time software-frame, Least Common Time Step (LCTS), and lookahead times must hold True:

( software_frame > 0 ) && ( LCTS > 0 ) && ( lookahead >= 0 )
( LCTS >= software_frame) && ( LCTS % software_frame == 0 )
( LCTS >= lookahead ) && ( LCTS % lookahead == 0 )

As an example, to run a Trick simulation at 20 Hz (i.e. 50 milliseconds) realtime, with HLA data exchanges at 80 Hz (i.e. 12.5 milliseconds) and an LCTS of 100 milliseconds for the time boundary for ExCO commands (i.e. freeze commands), we would use the following settings in the input.py file:

trick.exec_set_software_frame( 0.050 )
federate.set_lookahead_time( 0.0125 )
federate.set_least_common_time_step( 0.100 )
@dandexter dandexter added the enhancement New feature or request label Jul 26, 2024
@dandexter dandexter self-assigned this Jul 26, 2024
@simtheverse
Copy link
Contributor

We were just trying to figure some of these relationships out so this is very timely! In addition, how does THLA_DATA_CYCLE_TIME and THLA_INTERACTION_CYCLE_TIME relate to software_frame and the other timing parameters?

@dandexter
Copy link
Contributor Author

dandexter commented Jul 27, 2024

Because the S_define file including the job cycle rates are compile time and not set at runtime we are left with the user needing to set the THLA_DATA_CYCLE_TIME to the same time as the lookahead time. I made the cycle time for interactions (THLA_INTERACTION_CYCLE_TIME) independent of the cyclic data time to give users a better control over processing receive order (i.e. synchronous) interactions but still in a Trick job and thread safe way.

The HLA Lookahead time sets the fastest rate you can send cyclic data updates and the THLA_DATA_CYCLE_TIME and THLA_INTERACTION_CYCLE_TIME values give you the opportunity to set the cyclic rate your federation needs to exchange data given the lookahead time as a constraint. Typically the THLA_DATA_CYCLE_TIME matches the lookahead time and THLA_INTERACTION_CYCLE_TIME matches or is an integer multiple faster than the lookahead time to better capture the async interactions.

The relationship for these cycle times is the same as that for the lookahead time and the LCTS and Trick software frame.

@dandexter
Copy link
Contributor Author

dandexter commented Jul 27, 2024

Because we will no longer automatically set a value for the Trick software frame for a simulation using SpaceFOM, you will now need to set a value for all your simulations even if they are not running realtime. Make sure you add this directive to your simulation input.py file trick.exec_set_software_frame( t ) and use an appropriate time. If your federates Trick software frame will not meet the constraints for the Least Common Time Step and Lookahead times and error message will be displayed and the simulation will terminate.

@dandexter
Copy link
Contributor Author

dandexter commented Jul 27, 2024

Hopefully this will better show how everything is related given these constraints. We need the Trick Software Frame, LCTS and lookahead all land on the same frame boundary.

( software_frame > 0 ) && ( LCTS > 0 ) && ( lookahead >= 0 )
( LCTS >= software_frame) && ( LCTS % software_frame == 0 )
( LCTS >= lookahead ) && ( LCTS % lookahead == 0 )

For this example, we can get frame boundary alignment with the following:

  • Lookahead = 1
  • Cyclic Data = 1 (i.e. 1 * lookahead)
  • Trick software frame = 2 (i.e. 2 * lookahead) Trick holds realtime to this time.
  • Least Common Time Step (LCTS) = 4 (i.e. 4 * lookahead) the time boundary the Execution Control Object data gets reflected to the other federates and is the major frame boundary that works for all federates in the federation execution as required by the SpaceFOM standard.
          LCTS |-------------------|-------------------|
Trick SW frame |---------|---------|---------|---------|
   Cyclic Data |----|----|----|----|----|----|----|----|
     Lookahead |----|----|----|----|----|----|----|----|
          Time 0    1    2    3    4    5    6    7    8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants