Logical time, explained

Time management (clause 8 of IEEE 1516.1-2025) lets the federates of an HLA federation share one simulated clock, so that every federate sees events in the right order whatever the speed of the others and of the network. This page explains the ideas one at a time, then follows two federates through a real run on MicroRTI, the HLA 4 RTI.

Why logical time exists

Each federate simulates at its own pace: one runs faster than real time, another slower, a third waits for a human. Messages cross a network and can arrive late. If nothing coordinates them, a radar model can compute the situation at 10:00:06 before it has received the aircraft position for 10:00:05, and two runs of the same scenario give two different results.

Logical time is the simulated time of the federation: a value on an axis that all federates share, independent of the wall clock. Messages are stamped with it. To the federates that ask for it, the RTI gives two guarantees: a federate’s logical time moves only when the RTI grants it, and a federate never receives a timestamped message from its own past.

Not every federation needs this. The chat of the repository does not: a line arrives when it arrives. Use time management when the order and the simulated time of events matter, when federates must not run ahead of each other, or when you want the same results from the same inputs.

Regulating and constrained federates

Each federate has two independent settings.

A time-regulating federate sends timestamped messages, and the RTI holds the time-constrained federates back so that they do not pass a time at which it could still send something. It turns this on with Enable Time Regulation (8.2), confirmed by Time Regulation Enabled † (8.3), and off with Disable Time Regulation (8.4).

A time-constrained federate receives timestamped messages in timestamp order and cannot advance past the regulating federates. It turns this on with Enable Time Constrained (8.5), confirmed by Time Constrained Enabled † (8.6), and off with Disable Time Constrained (8.7).

Not constrainedConstrained
Not regulatingThe default. Receives everything as it arrives: the chat, the monitor of microrti-cli.Follows the others without holding them back: a recorder or a display that must see events in order.
RegulatingDrives the others and waits for nobody: a scenario player or a recorded data feed.Takes part fully, waits and is waited for: the usual case for a simulator.

A federate that is not time-constrained is granted every advance at once.

Lookahead

A regulating federate gives a lookahead when it enables regulation. It is a promise not to send anything stamped earlier than its current logical time plus the lookahead: at logical time 10 with a lookahead of 1, the federate may send messages stamped 11 or later. In exchange, the others can be granted any time before 11 without waiting for it.

The larger the lookahead, the more the federates can work in parallel. A good lookahead comes from the model itself: a sensor report takes at least one second to produce, an order takes at least two time steps to execute. Zero is allowed: the federate may then send at its own current time, and the “available” advance services below (8.9, 8.11) are made for that case. Modify Lookahead (8.20) and Query Lookahead (8.21) change and read it.

MicroRTI refuses a timestamp below the promise with InvalidLogicalTime, and the message says what the limit is:

InvalidLogicalTime: timestamp 1 is not allowed for federate 2: the lowest timestamp it may send is 2

Timestamp order and receive order

Every update, interaction and deletion travels in one of two orders. It is sent in timestamp order (TSO) when three conditions hold:

  • its attribute or interaction class has TimeStamp as preferred order type: the order column of the FOM, which a federate can change for itself with Change Attribute Order Type (8.24) and Change Interaction Order Type (8.26);
  • the sender is time-regulating;
  • the sender gave a timestamp.

Otherwise it travels in receive order (RO), even if it carries a timestamp. A TSO message reaches a time-constrained federate in timestamp order; a federate that is not constrained gets it in receive order, as soon as it arrives.

The RTI keeps the TSO messages of a constrained federate in a queue and delivers them, sorted by timestamp, when the federate asks to advance far enough. Receive-order messages are not sorted, but a constrained federate gets them only while it is asking to advance, unless it called Enable Asynchronous Delivery (8.15). A sender can withdraw a TSO message with Retract (8.22), using the retraction handle that its send returned.

The standard says nothing about the order of TSO messages that carry the same timestamp (8.1.4). MicroRTI delivers them in the order in which they reached it, with a Remove Object Instance after the other messages of its timestamp.

A timestamped callback says which order applied. In the Rust client, for example, Callback::ReceiveInteractionWithTime has the fields time, sent_order_type and received_order_type.

Asking to advance

A federate’s logical time moves only when it asks and the RTI grants. Between the request and the grant the federate is in the Time Advancing state; the grant arrives as Time Advance Grant † (8.14), or Flush Queue Grant † (8.13) for a flush.

ServiceUse it whenGranted
Time Advance Request (8.8)your federate steps through timeat the requested time t, once no TSO message stamped t or earlier can still arrive; all of them are delivered before the grant
Time Advance Request Available (8.9)the same, with zero lookaheadat t, once nothing stamped earlier than t can arrive; more messages stamped exactly t may follow the grant
Next Message Request (8.10)your federate jumps from event to eventat the timestamp of the next TSO message, with every message of that timestamp, if it comes before t; otherwise at t
Next Message Request Available (8.11)the same, with zero lookaheadas Next Message Request, with more messages at the granted time allowed to follow
Flush Queue Request (8.12)you want everything queued, nowat once, with every message of the queue whatever its timestamp; the advance goes to t or as far as GALT allows, whichever is earlier

GALT and LITS in plain words

GALT (greatest available logical time) is, for a time-constrained federate, the time up to which the RTI can promise that no more TSO messages will arrive. The RTI works it out from the other regulating federates. For each of them, its logical time (or the time it asked to advance to) plus its lookahead gives the earliest timestamp it could still send, and GALT is the smallest of those. A Time Advance Request to t is granted when t is below GALT. When no other federate is regulating, GALT is undefined and nothing holds the federate back. A federate waiting in Next Message Request makes the calculation a little more involved, as the example below shows. Query GALT (8.17) returns it.

LITS (least incoming timestamp) is the smallest timestamp of a TSO message that could still be delivered to the federate, either already queued or yet to be sent. Query LITS (8.19) returns it, and Query Logical Time (8.18) returns the federate’s own logical time.

A worked example: alice and bob

Two federates, alice and bob, share the chat FOM in a federation execution created with HLAinteger64Time. Both are time-regulating with a lookahead of 1, and both are time-constrained. The chat FOM sends Communication in receive order, so each federate switches it to timestamp order for itself with Change Interaction Order Type. The calls, with the Rust client:

// fom: the content of crates/microrti-examples/fom/Chat.xml
let chat_fom = FomModule::content("Chat.xml", fom);
rti.create_federation_execution_with_time("TimeDemo", &chat_fom, "HLAinteger64Time")?;

// each federate, once joined
rti.publish_interaction_class(communication)?;
rti.subscribe_interaction_class(communication)?;
rti.change_interaction_order_type(communication, OrderType::Timestamp)?;
rti.enable_time_regulation(LogicalTimeInterval::Integer64(1))?;
rti.enable_time_constrained()?;

// sending (values: the Sender and Message parameters), and asking to advance
rti.send_interaction_with_time(communication, &values, b"", LogicalTime::Integer64(1))?;
rti.time_advance_request(LogicalTime::Integer64(1))?;
rti.next_message_request(LogicalTime::Integer64(10))?;

This is what happened when the program ran against a microrti server. After each step the program asked both federates for their GALT (Query GALT).

StepCallalice receivesbob receivesGALT of alice, bob
1both enable time regulation (lookahead 1) and time constrainedTime Regulation Enabled at 0, Time Constrained Enabled at 0the same1, 1
2alice sends “hello” stamped 11, 1
3alice: Time Advance Request 11, 2
4bob: Time Advance Request 1Time Advance Grant at 1“hello” stamped 1, then Time Advance Grant at 12, 2
5bob sends “too early” stamped 1 (refused), then “see you at 5” stamped 52, 2
6alice: Next Message Request 102, 3
7bob: Time Advance Request 3Time Advance Grant at 34, 5
8bob: Time Advance Request 10“see you at 5” stamped 5, then Time Advance Grant at 511, 6
9alice: Time Advance Request 10Time Advance Grant at 10Time Advance Grant at 1011, 11

Step by step:

  1. Both start at logical time 0. Each sees the other at 0 with a lookahead of 1, so the earliest message that could come is stamped 1: GALT is 1 for both.
  2. alice is at 0 with lookahead 1, so a message stamped 1 is allowed. bob does not receive it yet: he is constrained at time 0 and the message is in his future.
  3. alice asks for time 1. She is not granted, because bob could still send something stamped 1 and her GALT (1) is not above 1. Her request is a promise not to send below 1 + 1 = 2, so bob’s GALT rises to 2.
  4. bob asks for time 1. His request raises alice’s GALT to 2, and both are granted. bob receives “hello” stamped 1 before his grant, as Time Advance Request requires; the callback says it was sent and received in timestamp order.
  5. bob is now at 1 with lookahead 1. “too early” stamped 1 is refused with InvalidLogicalTime (the lowest timestamp he may send is 2); “see you at 5” is accepted and waits in alice’s queue.
  6. alice asks for the next message, up to 10. There is one at 5, but bob, at 1, could still send something stamped 2, so nothing can be delivered yet. bob’s GALT moves to 3: alice could be granted at 2 if a message stamped 2 came, and could then send at 3.
  7. bob asks for time 3. That request promises nothing below 4, so alice cannot be granted before 4 nor send below 5, and bob is granted at once. alice still waits: her GALT is 4 and her next message is at 5.
  8. bob asks for time 10, which promises nothing below 11. alice receives “see you at 5” and is granted 5, not 10: Next Message Request stops at the next message. Now bob waits, because alice at 5 could answer with a message stamped 6.
  9. alice asks for time 10, and both are granted.

The engine’s own test suite plays scenarios of this kind, for instance two_federates_leapfrog_with_positive_lookahead in crates/microrti-engine/tests/time.rs.

The two time representations

A federation execution uses one representation for every logical time, timestamp and lookahead, chosen when it is created (Create Federation Execution, 4.5; see also 4.1.5). MicroRTI provides the two that the standard defines for every RTI (12.4):

  • HLAfloat64Time, a 64-bit floating-point number. It is the default when the creating federate names no representation.
  • HLAinteger64Time, a 64-bit signed integer, whose smallest step is 1.

A federation cannot bring a representation of its own to MicroRTI. A joining federate learns the representation from Join Federation Execution (in Rust, rti.time_kind()), and microrti-cli list shows it for every federation execution.

Choose HLAinteger64Time when your model advances in fixed steps (ticks, milliseconds): comparisons are exact. With HLAfloat64Time, remember that floating-point sums round: ten steps of 0.1 do not add up to exactly 1.0, so two federates that compute the same instant in different ways can end up with timestamps that differ.

Getting the same results every run

MicroRTI’s engine is deterministic: the same sequence of service calls gives the same callbacks. Between federates on separate connections, though, the order in which calls reach the RTI changes from one run to the next. The repository checks by experiment what a federation can still count on (crates/microrti/tests/reproducibility.rs: five federates on their own TCP sessions, played many times with different join orders and random pauses). The TSO messages each federate receives (timestamps, classes, values, senders by name) and the times it is granted are the same in every run when the federation keeps to four rules:

  1. Every federate is time-regulating and time-constrained before the first timestamped message is sent, and stays so. A synchronization point is the usual way to wait for that.
  2. Everything a result depends on is sent in timestamp order, and the federates advance with Time Advance Request.
  3. A federate acts only on TSO messages and on its grants: not on receive-order messages, not on the moment an instance is discovered, not on handle values, not on the wall clock.
  4. No two federates send with the same timestamp, or each federate sorts the messages of one timestamp by a key of its own (their content, for example) before it acts on them at the grant. MicroRTI delivers equal timestamps in order of arrival, and that order differed in every run of the experiment.

Some things are never reproducible: the order of receive-order messages, the handles of federates and object instances, and whatever the wall clock drives (MOM periodic reports, update rate reduction, timeouts). The removals caused by a federate that resigns or is lost belong here too, which is why rule 1 says “stays so”. The experiment does not cover the “available” and flush services, the final logical time, zero lookahead, save and restore, ownership transfer or DDM.

There is a cost in latency. A TSO message stamped exactly with the receiver’s GALT is delivered only when no other message with that timestamp can still arrive, and at the latest before the grant. A message stamped with its sender’s time plus lookahead therefore reaches the receiver at least one request of the sender later than it could have; it never delays a grant. In practice, a federate should not sit in the granted state waiting for another federate to react to such a message: it would wait forever. It should ask to advance first.

The full reasoning, with clause references, is section 10 of the architecture page.

Next steps