示例#1
0
        public static void Signal(ILoop loop, double time, double dt, ISignalGenerator signalGenerator, SimulateCallback callback = null)
        {
            loop.Initialize(dt);
            callback?.Invoke(0, 0d);

            int iterations = (int)Math.Floor(time / dt) + 1;

            for (int i = 1; i < iterations; i++)
            {
                double currentTime  = i * dt;
                var    signalSample = signalGenerator.GetSample(currentTime);
                loop.NextIteration(signalSample.value, currentTime, dt);

                callback?.Invoke(i, currentTime);
            }
        }
 public SignalSample GetSample(double time)
 {
     return(generator.GetSample(time));
 }