Beispiel #1
0
            /// <inheritdoc/>
            public virtual void Prepare()
            {
                var delta = Math.Min(Delta, Parameters.MaxStep);

                // Breakpoints
                if (Time.Equals(Breakpoints.First) || Breakpoints.First - Time <= Parameters.MinStep)
                {
                    // Cut integration order
                    Order = 1;

                    // Limit the next timestep
                    var mt = Math.Min(_saveDelta, Breakpoints.Delta);
                    delta = Math.Min(delta, 0.1 * mt);

                    // Spice will divide the first timestep by 10
                    if (BaseTime.Equals(0.0))
                    {
                        delta /= 10.0;
                    }

                    // Don't go below MinStep without reason
                    delta = Math.Max(delta, 2.0 * Parameters.MinStep);
                }
                else if (Time + delta >= Breakpoints.First)
                {
                    Break      = true;
                    _saveDelta = delta;
                    delta      = Breakpoints.First - Time;
                }

                // Start
                States.Accept();
                BaseTime           = Time;
                States.Value.Delta = delta;
                Delta = delta;
            }