public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit()
        {
            var quantity00 = ElectricPotential.From(1, ElectricPotentialUnit.Kilovolt);

            AssertEx.EqualTolerance(1, quantity00.Kilovolts, KilovoltsTolerance);
            Assert.Equal(ElectricPotentialUnit.Kilovolt, quantity00.Unit);

            var quantity01 = ElectricPotential.From(1, ElectricPotentialUnit.Megavolt);

            AssertEx.EqualTolerance(1, quantity01.Megavolts, MegavoltsTolerance);
            Assert.Equal(ElectricPotentialUnit.Megavolt, quantity01.Unit);

            var quantity02 = ElectricPotential.From(1, ElectricPotentialUnit.Microvolt);

            AssertEx.EqualTolerance(1, quantity02.Microvolts, MicrovoltsTolerance);
            Assert.Equal(ElectricPotentialUnit.Microvolt, quantity02.Unit);

            var quantity03 = ElectricPotential.From(1, ElectricPotentialUnit.Millivolt);

            AssertEx.EqualTolerance(1, quantity03.Millivolts, MillivoltsTolerance);
            Assert.Equal(ElectricPotentialUnit.Millivolt, quantity03.Unit);

            var quantity04 = ElectricPotential.From(1, ElectricPotentialUnit.Volt);

            AssertEx.EqualTolerance(1, quantity04.Volts, VoltsTolerance);
            Assert.Equal(ElectricPotentialUnit.Volt, quantity04.Unit);
        }
Exemplo n.º 2
0
 public void FromValueAndUnit()
 {
     AssertEx.EqualTolerance(1, ElectricPotential.From(1, ElectricPotentialUnit.Kilovolt).Kilovolts, KilovoltsTolerance);
     AssertEx.EqualTolerance(1, ElectricPotential.From(1, ElectricPotentialUnit.Megavolt).Megavolts, MegavoltsTolerance);
     AssertEx.EqualTolerance(1, ElectricPotential.From(1, ElectricPotentialUnit.Microvolt).Microvolts, MicrovoltsTolerance);
     AssertEx.EqualTolerance(1, ElectricPotential.From(1, ElectricPotentialUnit.Millivolt).Millivolts, MillivoltsTolerance);
     AssertEx.EqualTolerance(1, ElectricPotential.From(1, ElectricPotentialUnit.Volt).Volts, VoltsTolerance);
 }
Exemplo n.º 3
0
        public static ElectricPotential ToElectricPotenital(this XGain xGain)
        {
            switch (xGain)
            {
            case XGain.Volt5:
                return(ElectricPotential.From(5, ElectricPotentialUnit.Volt));

            case XGain.Volt33:
                return(ElectricPotential.From(3.3, ElectricPotentialUnit.Volt));

            default:
                throw new NotImplementedException($"No ElectricPotential mapping for {xGain}");
            }
        }
Exemplo n.º 4
0
 public void FromValueAndUnit()
 {
     Assert.AreEqual(1, ElectricPotential.From(1, ElectricPotentialUnit.Volt).Volts, VoltsTolerance);
 }
Exemplo n.º 5
0
        public SensorLight(ADS1015 adc, int SampleRateMilliseconds, string name) : base("light", "p", SensorMakerDen.ValuesPerSample.One, SampleRateMilliseconds, name)
        {
            ldr = new LDR(adc, ADS1015.Channel.A3, ADS1015.Gain.Volt5, ElectricPotential.From(5, ElectricPotentialUnit.Volt));

            StartMeasuring();
        }
        public SensorSound(ADS1015 adc, int SampleRateMilliseconds, string name) : base("sound", "p", SensorMakerDen.ValuesPerSample.One, SampleRateMilliseconds, name)
        {
            sound = new Sound(adc, ADS1015.Channel.A2, ADS1015.Gain.Volt5, ElectricPotential.From(5, ElectricPotentialUnit.Volt));

            StartMeasuring();
        }