using System.Globalization; using Aitex.Core.RT.DataCollection.HighPerformance; using Aitex.Core.Util; using MECF.Framework.Common.MECF.Framework.Common.Utilities; using MECF.Framework.RT.Core.IoProviders; namespace Aitex.Core.RT.IOCore { public class AOAccessor : IOAccessor { public AOAccessor(string name, int index, string address, bool isSimulator = false, bool disImmCache = false) : base(name, index, address, IOType.AO, isSimulator, disImmCache) { } /// protected override void SetValue(int index, float value) { #if EN_AO_IMM_CACHE var oldValue = Buffer[Index]; #endif Buffer[index] = value; Singleton.Instance.GetProvider(base.Provider)?.SetValue(this, value); #if EN_AO_IMM_CACHE //! NOTE THIS MAY CAUSE OVERRUN-DATA-TRACE ISSUE // Check if immediate cache needed var needImmCache = DoubleUtil.NotEqual(oldValue, value) & !IsSimulator & !DisableImmediatelyCache; if (needImmCache) DataTraceManager.Instance.ImmediateCache(this, new CacheDiagnosisInfo("", Name, Type, index, value.ToString(CultureInfo.CurrentCulture))); #endif } } }