Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        private void Step(Double IntegrStep)
        {
            TimeInModeControl += IntegrStep;
            var lastForce   = ForceKGC;
            var lastCurrent = Ip;

            Current = ModeControl.GetCurrent(Velocity, this);
            if (Voltage > 750)
            {
                Current = Current * VoltageNominal / Voltage;
            }
            ForceKGC = ModeControl.GetForce(Velocity, this);
            if (Math.Abs(ForceKGC - lastForce) > IntegrStep * dF)
            {
                ForceKGC = lastForce + Math.Sign(ForceKGC - lastForce) * IntegrStep * dF;
            }
            if (Math.Abs(Math.Abs(Current) - Math.Abs(lastCurrent)) > (dIc * IntegrStep))
            {
                Current = lastCurrent + Math.Sign(Current - lastCurrent) * dIc * IntegrStep;
            }
            Ip = Current;

            var dA     = Voltage * Current;
            var dAeown = Converter.GetInKilo(OwnNeedsElectricPower) * IntegrStep;

            A       += dAeown;
            Current  = Current + dAeown / Voltage;
            Current *= NumberCars;
            Force    = Converter.GetForceInKNewton(ForceKGC) * motorCount / (UnladenWeight + Mass);

            ForceBaseResistance = ModeControl.GetBaseResistance(this);
            var acc = Force - ForceAdditionalResistance - ForceBaseResistance;
            var dV  = factor * IntegrStep * acc;

            if (ModeControl is IBreak)
            {
                Current *= -1 * 2.5 * kF;
                Force   *= -1;
                dV       = -BreakAverage * IntegrStep * 3.6;
            }
            if (ModeControl is IAverageBreak)
            {
                Acceleration = BreakAverage;
            }
            else
            {
                Acceleration = Converter.GetVelocityMeterPerSec(dV) / IntegrStep;
            }
            Velocity += dV;
            Space    += Converter.GetVelocityMeterPerSec(Velocity) * IntegrStep;
            Time     += IntegrStep;

            A += dA * IntegrStep;

            if (Velocity >= MaxVelocity && ModeControl is IInert && dV > 0)
            {
                ModeControl       = ModeControl.Low(ByMass);
                TimeInModeControl = 0;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        private void Step(Double IntegrStep)
        {
            var lastForce   = ForceKGC;
            var lastCurrent = Current;

            Current = ModeControl.GetCurrent(Converter.GetVelocityKmPerHour(Velocity), this) * NumberCars;
            if (Voltage > 750)
            {
                Current = Current * VoltageNominal / Voltage;
            }
            ForceKGC = ModeControl.GetForce(Converter.GetVelocityKmPerHour(Velocity), this);

            if (Math.Abs(ForceKGC - lastForce) > IntegrStep * dF)
            {
                ForceKGC = lastForce + Math.Sign(ForceKGC - lastForce) * IntegrStep * dF;
                var kpd = ModeControl.GetKPD(Velocity);
                if (kpd > 0)
                {
                    Current = Converter.GetVelocityMeterPerSec(Velocity) * Converter.GetForceInK(ForceKGC) / kpd / Voltage * motorCount;
                }
                else
                {
                    Current = 0.0;
                }
            }
            if (Math.Abs(Math.Abs(Current) - Math.Abs(lastCurrent)) > (dIc * IntegrStep))
            {
                Current = lastCurrent + Math.Sign(Current - lastCurrent) * dIc * IntegrStep;
            }
            Force = Converter.GetForceInKNewton(ForceKGC) * motorCount / (UnladenWeight + Mass);
            ForceBaseResistance = ModeControl.GetBaseResistance(this);
            var a  = Force - ForceAdditionalResistance - ForceBaseResistance;
            var dV = factor * a;

            if (ModeControl is IAverageBreak)
            {
                Acceleration = BreakAverage;
            }
            else
            {
                Acceleration = Converter.GetVelocityMeterPerSec(dV) / IntegrStep;
            }
            Velocity          += dV;
            Space             += Converter.GetVelocityMeterPerSec(Velocity) * IntegrStep;
            Time              += IntegrStep;
            TimeInModeControl += IntegrStep;
            if (Converter.GetVelocityKmPerHour(Velocity) >= MaxVelocity && ModeControl is IInert && dV > 0)
            {
                ModeControl       = ModeControl.Low(ByMass);
                TimeInModeControl = 0;
            }
        }