Using Simulink time in timeAdvanceRequest

Home » Blog » Tips » Using Simulink time in timeAdvanceRequest

Using Simulink time with timeAdvanceRequest

The HLA Blockset manage the federate simulation time through the “Initialize” block whenever you have a time managed federate. It is important to specify that there will be no time management for your federate unless you make it Time Regulating and/or Time Constrained.

The user interface for the “Initialize” block provides a way to specify the federate Time Step in the Time Management section. Regardless of the Simulink time, your federate will use this value by default (in this case 10) for the advancement of its time through the timeAdvanceRequest call handled by the block. In this case, the internal Simulink time and the federate time exposed to the federation won’t be related.

If the execution of your Simulink federate depends on some interaction with other federate in the federation or if they need to be synchronised, you may want to use the Simulink time as the time use by timeAdvanceRequest to synchronise your federate with the rest of the federation. In order to do so, use the “Initialize” block GUI menu “Options -> Advanced …” and specify that you want to do “Manual Time Management”. As you can see, you can also choose to update your federate time on minor time step by selecting the associated option.

Advanced settings

Once properly configured, the “Initialize” block will show an input port providing a way to connect it to the Simulink internal clock using the Clock block. You can then verify that the federate time received by the RTI from your federate match the Simulink internal clock.

Simulink Time

NOTE: Using Simulink time as the federate time with an update on all minor time step may cause your federate to update its HLA objects more often than necessary. Be careful with the design of your Simulink model when using this feature with the updateAttributesValues or sendInteractions blocks.

Leave a Comment