VR-Link API Documentation for HLA 1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
timestampAdjuster.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 1992-2026 MAK Technologies, Inc.
3  * All rights reserved.
4  ****************************************************************************/
5 
6 #pragma once
7 
8 #include <map>
9 
10 #include <vlutil/vlTime.h>
11 #include <vlutil/vlString.h>
12 #include <vlpi/simulationAddress.h>
13 
14 
15 //class DtExerciseConn;
16 
24 {
25 public:
27  virtual ~DtTimestampAdjuster() = default;
28 
30  virtual void clear();
31 
37  virtual void setEnabled(bool enabled);
38 
42  virtual bool enabled() const;
43 
53  virtual void setInitialLatency(const DtSimulationAddress& simAddress, double latency);
54 
62  virtual DtTime adjust(const DtSimulationAddress& simAddress,
63  DtTime originalTime,
64  DtTime receiveTime,
65  DtTime now);
66 
67 
69  virtual void printStats() const;
70 
86  virtual bool accumulateLatencySample(const DtSimulationAddress& simAddress,
87  DtTime originalTime,
88  DtTime receiveTime);
89 
90 
95  virtual void setInitialLatencySampleThreshold(int updateThreshold);
96 
99  virtual int initialLatencySampleThreshold() const;
100 
101 private:
109  {
110  double latencyL; // configured/learned average link latency L(SN,AN)
111  double clockOffsetC; // accumulated clock offset C(SN,AN)
112  double emaAlpha; // smoothing factor for running average / EMA (exponential moving average)
113  bool hasLatency; // true if latencyL has been initialized/learned
114  bool hasOffset; // true if clockOffsetC has been initialized/learned
115 
117  : latencyL(0.0)
118  , clockOffsetC(0.0)
119  , emaAlpha(0.1)
120  , hasLatency(false)
121  , hasOffset(false)
122  {
123  }
124  };
125 
127  typedef std::map<DtSimulationAddress, PerSimAddressStats> StatsMap;
128 
130  bool myEnabled;
132  int myLatencySampleThreshold; // this value is the user-configurable relativeTimeAdjusterUpdateThreshold
133 
134  PerSimAddressStats& statsFor(const DtSimulationAddress& simAddress);
135 };
A DtSimulationAddress is used in DIS to identify a particular simulator.
Definition: simulationAddress.h:29
bool hasLatency
Definition: timestampAdjuster.h:113
Contains the DtString class declaration.
This file contains the declaration of DtClock and DtTime.
declares DtSimulationAddress.
double emaAlpha
Definition: timestampAdjuster.h:112
double clockOffsetC
Definition: timestampAdjuster.h:111
bool hasOffset
Definition: timestampAdjuster.h:114
double latencyL
Definition: timestampAdjuster.h:110
Per-simulation-address latency and clock-offset statistics used internally by DtTimestampAdjuster to ...
Definition: timestampAdjuster.h:108
bool myEnabled
Definition: timestampAdjuster.h:130
std::map< DtSimulationAddress, PerSimAddressStats > StatsMap
Map of per-simulation-address statistics, keyed by DtSimulationAddress.
Definition: timestampAdjuster.h:127
#define DT_DLL_VLPROTIND
Definition: vlMachineTypes.h:122
PerSimAddressStats()
Definition: timestampAdjuster.h:116
int myLatencySampleThreshold
Definition: timestampAdjuster.h:132
bool myExerciseStarted
Definition: timestampAdjuster.h:131
Helper that adjusts DIS/HLA timestamps using per-simulation-address latency statistics.
Definition: timestampAdjuster.h:23
StatsMap myStats
Definition: timestampAdjuster.h:129

Document ID: Generated on Mon Sep 28 00:09:32 EDT 2026 from SVN revision 295353
Copyright © 1992-2025 MAK Technologies. All Rights Reserved (www.mak.com)