public bool DoTest()
        {
            // Load
            Load TestLoad = new Load(1.01, 2.01);
            if (TestLoad.Mass != 1.01) return false;
            if (TestLoad.MomentOfInertia != 2.01) return false;

            // Motor
            //Motor TestMotor = new Motor(1.01, 2.01, 3.01, 4.01, 5.01, 6.01, 7.01);
            //if (TestMotor.Mass != 1.01) return false;
            //if (TestMotor.MaxTemp != 2.01) return false;
            //if (TestMotor.MomentOfInertia != 3.01) return false;
            //if (TestMotor.Resistance != 4.01) return false;
            //if (TestMotor.Inductance != 5.01) return false;
            //if (TestMotor.ThermalResistance != 6.01) return false;
            //if (TestMotor.KT != 7.01) return false;

            // SimulationEnv
            SimulationEnv TestEnvironment = new SimulationEnv(0.01, 1.01, 2.01, 3.01, 4.01, 5.01, "6.01");
            if (TestEnvironment.StaticFriction != 0.01) return false;
            if (TestEnvironment.DynamicFriction != 1.01) return false;
            if (TestEnvironment.PreLoadForce != 2.01) return false;
            if (TestEnvironment.ThrustForce != 3.01) return false;
            if (TestEnvironment.AmbientTemp != 4.01) return false;
            if (TestEnvironment.MechEfficiency != 5.01) return false;
            if (!TestEnvironment.Cooling.Equals("6.01")) return false;

            return true;
        }
        /// <summary>
        /// Start a simulation
        /// </summary>
        /// <param name="initial">The initial state</param>
        /// <param name="motor">The motor object</param>
        /// <param name="load">The load</param>
        /// <param name="path">The path</param>
        public bool Start(IRecord initial, IMotor motor, ILoad load, IPath path, SimulationEnv env)
        {
            _record = initial;
            _motor = motor;
            _load = load;
            _path = path;

            double mass = _load.Mass + _motor.CoilMass;

            int count = _record.Time.Length;

            if (_record.Time == null || (_record.Position == null && _record.Velocity == null && _record.Acceleration == null))
                return false;

            if (_record.Acceleration == null)
                _record.Acceleration = new double[count];

            if (_record.Velocity == null)
                _record.Velocity = new double[count];

            if (_record.Position == null)
                _record.Position = new double[count];

            _record.RMSforce = Math.Pow(mass * _record.Acceleration[0], 2);

            if (_record.Acceleration != null && !isZero(_record.Acceleration))
            {
                if (isZero(_record.Velocity))
                {
                    for (int i = 1; i < count; i++)
                    {
                        _record.Velocity[i] = (_record.Time[i] - _record.Time[i - 1]) * _record.Acceleration[i] + _record.Velocity[i - 1];
                        _record.Position[i] = (_record.Time[i] - _record.Time[i - 1]) * _record.Velocity[i] + _record.Position[i - 1];
                        _record.RMSforce += Math.Pow(mass * _record.Acceleration[i] + env.StaticFriction + env.DynamicFriction * _record.Velocity[i] + env.ThrustForce, 2);
                    }
                }
                else if (!isZero(_record.Velocity) && isZero(_record.Position))
                {
                    for (int i = 1; i < count; i++)
                    {
                        _record.Position[i] = (_record.Time[i] - _record.Time[i - 1]) * _record.Velocity[i] + _record.Position[i - 1];
                        _record.RMSforce += Math.Pow(mass * _record.Acceleration[i] + env.StaticFriction + env.DynamicFriction * _record.Velocity[i] + env.ThrustForce, 2);
                    }
                }
                else
                {
                    for (int i = 1; i < count; i++)
                    {
                        _record.RMSforce += Math.Pow(mass * _record.Acceleration[i] + env.StaticFriction + env.DynamicFriction * _record.Velocity[i] + env.ThrustForce, 2);
                    }
                }
            }
            else if (_record.Velocity != null && !isZero(_record.Velocity))
            {
                if (isZero(_record.Position))
                {
                    for (int i = 1; i < count; i++)
                    {
                        _record.Position[i] = (_record.Time[i] - _record.Time[i - 1]) * _record.Velocity[i] + _record.Position[i - 1];
                        _record.Acceleration[i] = (_record.Velocity[i] - _record.Velocity[i - 1]) / (_record.Time[i] - _record.Time[i - 1]);
                        _record.RMSforce += Math.Pow(mass * _record.Acceleration[i] + env.StaticFriction + env.DynamicFriction * _record.Velocity[i] + env.ThrustForce, 2);
                    }
                }
                else
                {
                    for (int i = 1; i < count; i++)
                    {
                        _record.Acceleration[i] = (_record.Velocity[i] - _record.Velocity[i - 1]) / (_record.Time[i] - _record.Time[i - 1]);
                        _record.RMSforce += Math.Pow(mass * _record.Acceleration[i] + env.StaticFriction + env.DynamicFriction * _record.Velocity[i] + env.ThrustForce, 2);
                    }
                }
            }
            else
            {
                for (int i = 1; i < count; i++)
                {
                    _record.Velocity[i] = (_record.Position[i] - _record.Position[i - 1]) / (_record.Time[i] - _record.Time[i - 1]);
                    _record.Acceleration[i] = (_record.Velocity[i] - _record.Velocity[i - 1]) / (_record.Time[i] - _record.Time[i - 1]);
                    _record.RMSforce += Math.Pow(mass * _record.Acceleration[i] + env.StaticFriction + env.DynamicFriction * _record.Velocity[i] + env.ThrustForce, 2);
                }
            }

            double efficiency = env.MechEfficiency * 0.01;

            _record.RMSforce = Math.Sqrt(_record.RMSforce / count) / efficiency;
            _record.MAXforce = (mass * _record.Acceleration.Max() + env.StaticFriction + env.DynamicFriction * _record.Velocity.Max() + env.ThrustForce) / efficiency;
            _record.RMScurrent = _record.RMSforce / _motor.ForceConstant;
            _record.MAXcurrent = _record.MAXforce / _motor.ForceConstant;
            _record.TemperatureRise = (Math.Pow(_record.RMSforce / _motor.MotorConstant, 2) * _motor.ThermalResistance);

            Write();

            return true;
        }