/// <summary> /// Creates a realtime viewing function /// </summary> /// <param name="t">the time simulation model to target</param> /// <param name="fallBehindThreshold">The time model will be determined to have fallen behind if the simulation falls /// behind the system wall clock by more than this amound (defaults to 100 ms)</param> /// <param name="fallBehindCooldownPeriod">When in the behind state the time simulation must surpass the FallBehindThreshold /// by this amount before moving out of the behind state. This is a debouncing mechanism.</param> public RealTimeViewingFunction(Time t, TimeSpan?fallBehindThreshold = null, TimeSpan?fallBehindCooldownPeriod = null) { behindSignal = new DebounceableSignal() { Threshold = fallBehindThreshold.HasValue ? fallBehindThreshold.Value.TotalMilliseconds : 100, // we've fallen behind if we're 100ms off of wall clock time CoolDownAmount = fallBehindCooldownPeriod.HasValue ? fallBehindCooldownPeriod.Value.TotalMilliseconds : 30, // we're not back on track until we are within 70 ms of wall clock time }; this.t = t; }