javasimulationfederationhigh-level-architecture

HLA - usage of timeAdvanceRequest()


I have HLA simulation in Java using pRTI with two federates. I want to advance time of my simulation. As far I know, following method is used for this purpose:

_ambassador.timeAdvanceRequest(time);

, where ambassador is an RTI ambassador.

My question is what to pass into time parameter? I assume it should be the time I want my simulation advance to, but how to get this one?


Solution

  • Ok, I figured it out.

    It is neccessary to use one of LogicalTime interface implementations, for example using TimeFactory:

    LogicalTime time =  _ambassador.getTimeFactory().makeFinal();
    

    calling timeAdvanceRequest() will send request to RTI. The, if time was advanced, the timeAdvanceGrant() will be called on federate.

    Further info here.