Beispiel #1
0
 public void Interpolation(int dataSize)
 {
     foreach (var kv in this.Signals)
     {
         var ss = kv.Value;
         if (dataSize == ss.Count)
         {
             continue;
         }
         var list = CtkNumUtil.InterpolationCanOneOrZero(ss, dataSize);
         kv.Value.Clear();
         kv.Value.AddRange(list);
     }
 }
Beispiel #2
0
        public void Input(object sender, SNetTdSignalEventArg e)
        {
            if (!this.IsEnalbed)
            {
                return;
            }
            var tsSetSecondEa = e as SNetTdSignalSecSetF8EventArg;

            if (tsSetSecondEa == null)
            {
                throw new SNetException("尚未無法處理此類資料: " + e.GetType().FullName);
            }


            if (!tsSetSecondEa.PrevTime.HasValue)
            {
                return;
            }
            if (tsSetSecondEa.Time == tsSetSecondEa.PrevTime.Value)
            {
                return;
            }
            var t = tsSetSecondEa.PrevTime.Value;

            //取得時間變更前的時間資料
            IList <double> signalData = tsSetSecondEa.TSignalSource.GetOrCreate(t);


            if (this.FilterArgs.Mode != CtkEnumPassFilterMode.None)
            {
                this.PassFilter.SetFilter(this.FilterArgs);
                signalData = CtkNumUtil.InterpolationCanOneOrZero(signalData, (int)this.FilterArgs.SampleRate);
                signalData = this.PassFilter.ProcessSamples(signalData);
            }

            this.ProcAndPushData(this.TSignal, new SNetTSignalSecF8(t, signalData));
            e.InvokeResult = this.disposed ? SNetTdEnumInvokeResult.IsDisposed : SNetTdEnumInvokeResult.None;
        }