![]() |
VR-Link API Documentation for HLA 4
|
Helper that adjusts DIS/HLA timestamps using per-simulation-address latency statistics. More...
Collaboration diagram for DtTimestampAdjuster:Classes | |
| struct | PerSimAddressStats |
Per-simulation-address latency and clock-offset statistics used internally by DtTimestampAdjuster to adjust timestamps. More... | |
Public Member Functions | |
| DtTimestampAdjuster () | |
| virtual | ~DtTimestampAdjuster ()=default |
| virtual void | clear () |
| Reset all internal state. More... | |
| virtual void | setEnabled (bool enabled) |
| Enable or disable timestamp adjustment while preserving any accumulated latency and clock-offset statistics. More... | |
| virtual bool | enabled () const |
| Query whether timestamp adjustment is currently enabled. More... | |
| virtual void | setInitialLatency (const DtSimulationAddress &simAddress, double latency) |
| Provide an initial latency value L(SN,AN) for a specific simulation address before simulation begins. More... | |
| virtual DtTime | adjust (const DtSimulationAddress &simAddress, DtTime originalTime, DtTime receiveTime, DtTime now) |
| Compute an adjusted timestamp for the given simulation address. More... | |
| virtual void | printStats () const |
| Print a simple table of per-address latency and clock-offset statistics. More... | |
| virtual bool | accumulateLatencySample (const DtSimulationAddress &simAddress, DtTime originalTime, DtTime receiveTime) |
| Accumulate an initial latency sample for the given simulation address. More... | |
| virtual void | setInitialLatencySampleThreshold (int updateThreshold) |
| Set the number of initial latency samples required before the adjuster reports that its latency estimate is ready. More... | |
| virtual int | initialLatencySampleThreshold () const |
| Get the configured number of initial latency samples required before the latency estimate is considered ready. More... | |
Private Types | |
| typedef std::map < DtSimulationAddress, PerSimAddressStats > | StatsMap |
Map of per-simulation-address statistics, keyed by DtSimulationAddress. More... | |
Private Member Functions | |
| PerSimAddressStats & | statsFor (const DtSimulationAddress &simAddress) |
Private Attributes | |
| StatsMap | myStats |
| bool | myEnabled |
| bool | myExerciseStarted |
| int | myLatencySampleThreshold |
Helper that adjusts DIS/HLA timestamps using per-simulation-address latency statistics.
Decoders pass network timestamp and local receive/clock times in epoch seconds along with the simulation address (site, application). The adjuster maintains lightweight running statistics in an internal map keyed by simulation address and returns an adjusted epoch timestamp suitable to hand to the state repository.
|
private |
Map of per-simulation-address statistics, keyed by DtSimulationAddress.
| DtTimestampAdjuster::DtTimestampAdjuster | ( | ) |
|
virtualdefault |
|
virtual |
Accumulate an initial latency sample for the given simulation address.
Then continues to accumulate and track latency for the duration of the simulation, but only returns true (ready) once the initial sample threshold is reached.
This is typically called by decoders when entity state data is received with a relative timestamp. The function uses the incoming message timestamp and the local receive time to estimate one sample of link latency for the specified simulation address. Samples are accumulated until initialLatencySampleThreshold() is reached, at which point the internal latency estimate is considered ready for use by adjust().
| simAddress | Simulation address for per-source tracking. |
| originalTime | Incoming message timestamp in epoch time (seconds). |
| receiveTime | Local receive time in epoch time (seconds). |
|
virtual |
Compute an adjusted timestamp for the given simulation address.
| simAddress | Simulation address for per-source tracking. |
| originalTime | Incoming message timestamp in epoch time (seconds). |
| receiveTime | Local receive time in epoch time (seconds). |
| now | Current local clock time in epoch time (seconds). |
|
virtual |
Reset all internal state.
|
virtual |
Query whether timestamp adjustment is currently enabled.
adjust() applies latency/offset corrections, false if it simply returns the original timestamp.
|
virtual |
Get the configured number of initial latency samples required before the latency estimate is considered ready.
|
virtual |
Print a simple table of per-address latency and clock-offset statistics.
|
virtual |
Enable or disable timestamp adjustment while preserving any accumulated latency and clock-offset statistics.
When disabled, adjust() returns the original (unmodified) timestamp values.
| enabled | Set to true to apply adjustments, false to bypass them. |
|
virtual |
Provide an initial latency value L(SN,AN) for a specific simulation address before simulation begins.
This seeds the internal statistics so that adjust() can immediately compensate for known link latency without waiting for samples to be accumulated.
| simAddress | Simulation address (site, application) for which the latency value applies. |
| latency | One-way link latency in the same time units as DtTime (typically seconds). |
|
virtual |
Set the number of initial latency samples required before the adjuster reports that its latency estimate is ready.
This threshold controls when accumulateLatencySample() begins returning a ready state.
|
private |
|
private |
|
private |
|
private |
|
private |