コード例 #1
0
        public void ToStringTest()
        {
            var pressure = Pressure.FromPascal(123.456d);

            Assert.AreEqual("123.46 Pa", pressure.ToString());
            Assert.AreEqual("123.456 Pa", pressure.ToString(PressureUnit.Pascal, "{0:F3} {1}"));
            Assert.AreEqual("123,456 Pa", pressure.ToString(PressureUnit.Pascal, new CultureInfo("nl-NL"), "{0:F3} {1}"));
            Assert.AreEqual("123,456", pressure.ToString(PressureUnit.Pascal, new CultureInfo("nl-NL"), "{0:F3}"));
            pressure = Pressure.FromBar(123.456d);
            Assert.AreEqual("123.46 bar", pressure.ToString(PressureUnit.Bar));
            Assert.AreEqual("123.46 bar", pressure.ToString(PressureUnit.Bar, CultureInfo.InvariantCulture));
            Assert.AreEqual("123,46 bar", pressure.ToString(PressureUnit.Bar, new CultureInfo("nl-NL")));
            pressure = Pressure.FromAtmosphere(123.456d);
            Assert.AreEqual("123.46 atm", pressure.ToString(PressureUnit.Atmosphere));
            Assert.AreEqual("123.46 atm", pressure.ToString(PressureUnit.Atmosphere, CultureInfo.InvariantCulture));
            pressure = Pressure.FromPoundsPerSquareInch(123.456d);
            Assert.AreEqual("123.46 psi", pressure.ToString(PressureUnit.Psi));
            Assert.AreEqual("123.46 psi", pressure.ToString(PressureUnit.Psi, CultureInfo.InvariantCulture));
            pressure = Pressure.FromTorr(123.456d);
            Assert.AreEqual("123.46 Torr", pressure.ToString(PressureUnit.Torr));
            Assert.AreEqual("123.46 Torr", pressure.ToString(PressureUnit.Torr, CultureInfo.InvariantCulture));
        }
コード例 #2
0
        public void OperatorPlusTest()
        {
            var pressure = Pressure.FromBar(10d) + Pressure.FromPoundsPerSquareInch(145.03773773d);

            Assert.AreEqual(20d, pressure.Bar);
        }
コード例 #3
0
        private void AddPlayerCarInfo(R3ESharedData data, SimulatorDataSet simData)
        {
            CarInfo playerCar = simData.PlayerInfo.CarInfo;

            playerCar.CarDamageInformation.Bodywork.MediumDamageThreshold     = 0.01;
            playerCar.CarDamageInformation.Engine.MediumDamageThreshold       = 0.01;
            playerCar.CarDamageInformation.Transmission.MediumDamageThreshold = 0.01;
            playerCar.CarDamageInformation.Suspension.Damage   = data.CarDamage.Suspension >= 0 ? 1 - data.CarDamage.Suspension : 0;
            playerCar.CarDamageInformation.Bodywork.Damage     = data.CarDamage.Aerodynamics >= 0 ? 1 - data.CarDamage.Aerodynamics : 0;
            playerCar.CarDamageInformation.Engine.Damage       = data.CarDamage.Engine >= 0 ? 1 - data.CarDamage.Engine : 0;
            playerCar.CarDamageInformation.Transmission.Damage = data.CarDamage.Transmission >= 0 ? 1 - data.CarDamage.Transmission : 0;
            playerCar.TurboPressure    = Math.Abs(data.TurboPressure) < 0.1 ? Pressure.Zero : Pressure.FromBar(data.TurboPressure);
            playerCar.OverallDownForce = Force.GetFromNewtons(data.Player.CurrentDownforce);

            playerCar.FrontRollAngle = Angle.GetFromRadians(data.Player.FrontRollAngle);
            playerCar.RearRollAngle  = Angle.GetFromRadians(data.Player.RearRollAngle);

            playerCar.SpeedLimiterEngaged = data.PitLimiter == 1;

            playerCar.WorldOrientation = new Orientation()
            {
                Roll  = Angle.GetFromRadians(data.CarOrientation.Roll),
                Pitch = Angle.GetFromRadians(data.CarOrientation.Pitch),
                Yaw   = Angle.GetFromRadians(-data.CarOrientation.Yaw),
            };

            FillDrsData(data, playerCar);
            FillBoostData(data.PushToPass, playerCar);

            playerCar.EngineTorque = Torque.FromNm(data.Player.EngineTorque);
            playerCar.EnginePower  = Power.FromKw(data.Player.EngineTorque * playerCar.EngineRpm / 9549);
        }
コード例 #4
0
 public void TestPressureCalculation()
 {
     Assert.AreEqual(-499990d, (Pressure.FromPascal(10d) - Pressure.FromBar(5d)).Pascal, DoubleDelta);
     Assert.AreEqual(500010d, (Pressure.FromPascal(10d) + Pressure.FromBar(5d)).Pascal, DoubleDelta);
 }
コード例 #5
0
 public void TestPressureValue()
 {
     Assert.AreEqual(10d, Pressure.FromPascal(10d).Pascal, DoubleDelta);
     Assert.AreEqual(10d, Pressure.FromBar(10d).Bar, DoubleDelta);
 }
コード例 #6
0
        private void AddPlayerCarInfo(R3ESharedData data, SimulatorDataSet simData)
        {
            CarInfo playerCar = simData.PlayerInfo.CarInfo;

            playerCar.CarDamageInformation.Bodywork.MediumDamageThreshold     = 0.01;
            playerCar.CarDamageInformation.Engine.MediumDamageThreshold       = 0.01;
            playerCar.CarDamageInformation.Transmission.MediumDamageThreshold = 0.01;
            playerCar.CarDamageInformation.Suspension.Damage   = 1 - data.CarDamage.Suspension;
            playerCar.CarDamageInformation.Bodywork.Damage     = 1 - data.CarDamage.Aerodynamics;
            playerCar.CarDamageInformation.Engine.Damage       = 1 - data.CarDamage.Engine;
            playerCar.CarDamageInformation.Transmission.Damage = 1 - data.CarDamage.Transmission;
            playerCar.TurboPressure    = Math.Abs(data.TurboPressure) < 0.1 ? Pressure.Zero : Pressure.FromBar(data.TurboPressure);
            playerCar.OverallDownForce = Force.GetFromNewtons(data.Player.CurrentDownforce);

            playerCar.FrontRollAngle = Angle.GetFromRadians(data.Player.FrontRollAngle);
            playerCar.RearRollAngle  = Angle.GetFromRadians(data.Player.RearRollAngle);

            playerCar.SpeedLimiterEngaged = data.PitLimiter == 1;

            FillDrsData(data, playerCar);
            FillBoostData(data.PushToPass, playerCar);
        }