public void ComparisonOperators()
        {
            ElectricPotential oneVolt  = ElectricPotential.FromVolts(1);
            ElectricPotential twoVolts = ElectricPotential.FromVolts(2);

            Assert.True(oneVolt < twoVolts);
            Assert.True(oneVolt <= twoVolts);
            Assert.True(twoVolts > oneVolt);
            Assert.True(twoVolts >= oneVolt);

            Assert.False(oneVolt > twoVolts);
            Assert.False(oneVolt >= twoVolts);
            Assert.False(twoVolts < oneVolt);
            Assert.False(twoVolts <= oneVolt);
        }
Beispiel #2
0
 public void ToString_WithRussianCulture()
 {
     Assert.Equal("1 °", Angle.FromDegrees(1).ToUnit(AngleUnit.Degree).ToString(RussianCulture));
     Assert.Equal("1 м²", Area.FromSquareMeters(1).ToUnit(AreaUnit.SquareMeter).ToString(RussianCulture));
     Assert.Equal("1 В", ElectricPotential.FromVolts(1).ToUnit(ElectricPotentialUnit.Volt).ToString(RussianCulture));
     Assert.Equal("1 м³/с", VolumeFlow.FromCubicMetersPerSecond(1).ToUnit(VolumeFlowUnit.CubicMeterPerSecond).ToString(RussianCulture));
     Assert.Equal("1 Н", Force.FromNewtons(1).ToUnit(ForceUnit.Newton).ToString(RussianCulture));
     Assert.Equal("1 м", Length.FromMeters(1).ToUnit(LengthUnit.Meter).ToString(RussianCulture));
     Assert.Equal("1 кг", Mass.FromKilograms(1).ToUnit(MassUnit.Kilogram).ToString(RussianCulture));
     Assert.Equal("1 Па", Pressure.FromPascals(1).ToUnit(PressureUnit.Pascal).ToString(RussianCulture));
     Assert.Equal("1 рад/с", RotationalSpeed.FromRadiansPerSecond(1).ToUnit(RotationalSpeedUnit.RadianPerSecond).ToString(RussianCulture));
     Assert.Equal("1 K", Temperature.FromKelvins(1).ToUnit(TemperatureUnit.Kelvin).ToString(RussianCulture));
     Assert.Equal("1 Н·м", Torque.FromNewtonMeters(1).ToUnit(TorqueUnit.NewtonMeter).ToString(RussianCulture));
     Assert.Equal("1 м³", Volume.FromCubicMeters(1).ToUnit(VolumeUnit.CubicMeter).ToString(RussianCulture));
 }
Beispiel #3
0
 public void ToString_WithNorwegianCulture()
 {
     Assert.Equal("1 °", Angle.FromDegrees(1).ToString(AngleUnit.Degree, NorwegianCulture));
     Assert.Equal("1 m²", Area.FromSquareMeters(1).ToString(AreaUnit.SquareMeter, NorwegianCulture));
     Assert.Equal("1 V", ElectricPotential.FromVolts(1).ToString(ElectricPotentialUnit.Volt, NorwegianCulture));
     Assert.Equal("1 m³/s", VolumeFlow.FromCubicMetersPerSecond(1).ToString(VolumeFlowUnit.CubicMeterPerSecond, NorwegianCulture));
     Assert.Equal("1 N", Force.FromNewtons(1).ToString(ForceUnit.Newton, NorwegianCulture));
     Assert.Equal("1 m", Length.FromMeters(1).ToString(LengthUnit.Meter, NorwegianCulture));
     Assert.Equal("1 kg", Mass.FromKilograms(1).ToString(MassUnit.Kilogram, NorwegianCulture));
     Assert.Equal("1 Pa", Pressure.FromPascals(1).ToString(PressureUnit.Pascal, NorwegianCulture));
     Assert.Equal("1 rad/s", RotationalSpeed.FromRadiansPerSecond(1).ToString(RotationalSpeedUnit.RadianPerSecond, NorwegianCulture));
     Assert.Equal("1 K", Temperature.FromKelvins(1).ToString(TemperatureUnit.Kelvin, NorwegianCulture));
     Assert.Equal("1 N·m", Torque.FromNewtonMeters(1).ToString(TorqueUnit.NewtonMeter, NorwegianCulture));
     Assert.Equal("1 m³", Volume.FromCubicMeters(1).ToString(VolumeUnit.CubicMeter, NorwegianCulture));
 }
Beispiel #4
0
        public void AllUnitsImplementToStringForNorwegian()
        {
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("nb-NO");

            Assert.AreEqual("1 °", Angle.FromDegrees(1).ToString());
            Assert.AreEqual("1 m²", Area.FromSquareMeters(1).ToString());
            Assert.AreEqual("1 V", ElectricPotential.FromVolts(1).ToString());
            Assert.AreEqual("1 m³/s", Flow.FromCubicMetersPerSecond(1).ToString());
            Assert.AreEqual("1 N", Force.FromNewtons(1).ToString());
            Assert.AreEqual("1 m", Length.FromMeters(1).ToString());
            Assert.AreEqual("1 kg", Mass.FromKilograms(1).ToString());
            Assert.AreEqual("1 Pa", Pressure.FromPascals(1).ToString());
            Assert.AreEqual("1 rad/s", RotationalSpeed.FromRadiansPerSecond(1).ToString());
            Assert.AreEqual("1 K", Temperature.FromKelvins(1).ToString());
            Assert.AreEqual("1 N·m", Torque.FromNewtonMeters(1).ToString());
            Assert.AreEqual("1 m³", Volume.FromCubicMeters(1).ToString());
        }
Beispiel #5
0
        public void AllUnitsImplementToStringForRussian()
        {
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("ru-RU");

            Assert.AreEqual("1 °", Angle.FromDegrees(1).ToString());
            Assert.AreEqual("1 м²", Area.FromSquareMeters(1).ToString());
            Assert.AreEqual("1 В", ElectricPotential.FromVolts(1).ToString());
            Assert.AreEqual("1 м³/с", Flow.FromCubicMetersPerSecond(1).ToString());
            Assert.AreEqual("1 Н", Force.FromNewtons(1).ToString());
            Assert.AreEqual("1 м", Length.FromMeters(1).ToString());
            Assert.AreEqual("1 кг", Mass.FromKilograms(1).ToString());
            Assert.AreEqual("1 Па", Pressure.FromPascals(1).ToString());
            Assert.AreEqual("1 рад/с", RotationalSpeed.FromRadiansPerSecond(1).ToString());
            Assert.AreEqual("1 K", Temperature.FromKelvins(1).ToString());
            Assert.AreEqual("1 Н·м", Torque.FromNewtonMeters(1).ToString());
            Assert.AreEqual("1 м³", Volume.FromCubicMeters(1).ToString());
        }
        public void EqualityOperators()
        {
            var a = ElectricPotential.FromVolts(1);
            var b = ElectricPotential.FromVolts(2);

            // ReSharper disable EqualExpressionComparison

            Assert.True(a == a);
            Assert.False(a != a);

            Assert.True(a != b);
            Assert.False(a == b);

            Assert.False(a == null);
            Assert.False(null == a);

// ReSharper restore EqualExpressionComparison
        }
        public void AllUnitsImplementToStringForInvariantCulture()
        {
            Assert.Equal("1 °", Angle.FromDegrees(1).ToString());
            Assert.Equal("1 m²", Area.FromSquareMeters(1).ToString());
            Assert.Equal("1 V", ElectricPotential.FromVolts(1).ToString());
            Assert.Equal("1 m³/s", Flow.FromCubicMetersPerSecond(1).ToString());
            Assert.Equal("1 N", Force.FromNewtons(1).ToString());
            Assert.Equal("1 m", Length.FromMeters(1).ToString());
            Assert.Equal("1 kg", Mass.FromKilograms(1).ToString());
            Assert.Equal("1 Pa", Pressure.FromPascals(1).ToString());
            Assert.Equal("1 rad/s", RotationalSpeed.FromRadiansPerSecond(1).ToString());
            Assert.Equal("1 K", Temperature.FromKelvins(1).ToString());
            Assert.Equal("1 N·m", Torque.FromNewtonMeters(1).ToString());
            Assert.Equal("1 m³", Volume.FromCubicMeters(1).ToString());

            Assert.Equal("2 ft 3 in", Length.FromFeetInches(2, 3).FeetInches.ToString());
            Assert.Equal("3 st 7 lb", Mass.FromStonePounds(3, 7).StonePounds.ToString());
        }
Beispiel #8
0
        public void ToString_WithRussianCulture()
        {
#if WINDOWS_UWP
            Culture russian = "ru-RU";
#else
            Culture russian = new CultureInfo("ru-RU");
#endif
            Assert.Equal("1 °", Angle.FromDegrees(1).ToString(AngleUnit.Degree, russian));
            Assert.Equal("1 м²", Area.FromSquareMeters(1).ToString(AreaUnit.SquareMeter, russian));
            Assert.Equal("1 В", ElectricPotential.FromVolts(1).ToString(ElectricPotentialUnit.Volt, russian));
            Assert.Equal("1 м³/с", Flow.FromCubicMetersPerSecond(1).ToString(FlowUnit.CubicMeterPerSecond, russian));
            Assert.Equal("1 Н", Force.FromNewtons(1).ToString(ForceUnit.Newton, russian));
            Assert.Equal("1 м", Length.FromMeters(1).ToString(LengthUnit.Meter, russian));
            Assert.Equal("1 кг", Mass.FromKilograms(1).ToString(MassUnit.Kilogram, russian));
            Assert.Equal("1 Па", Pressure.FromPascals(1).ToString(PressureUnit.Pascal, russian));
            Assert.Equal("1 рад/с", RotationalSpeed.FromRadiansPerSecond(1).ToString(RotationalSpeedUnit.RadianPerSecond, russian));
            Assert.Equal("1 K", Temperature.FromKelvins(1).ToString(TemperatureUnit.Kelvin, russian));
            Assert.Equal("1 Н·м", Torque.FromNewtonMeters(1).ToString(TorqueUnit.NewtonMeter, russian));
            Assert.Equal("1 м³", Volume.FromCubicMeters(1).ToString(VolumeUnit.CubicMeter, russian));
        }
Beispiel #9
0
        public void ElectricPotentialDividedByElectricCurrentEqualsElectricResistance(float potential, float current, float expected)
        {
            ElectricResistance resistance = ElectricPotential.FromVolts(potential) / ElectricCurrent.FromAmperes(current);

            Assert.Equal(expected, resistance.Ohms);
        }
Beispiel #10
0
 public void NumberToVoltsTest() =>
 Assert.Equal(ElectricPotential.FromVolts(2), 2.Volts());
Beispiel #11
0
        public void EqualsReturnsFalseOnNull()
        {
            ElectricPotential volt = ElectricPotential.FromVolts(1);

            Assert.False(volt.Equals(null));
        }
Beispiel #12
0
        public void EqualsReturnsFalseOnTypeMismatch()
        {
            ElectricPotential volt = ElectricPotential.FromVolts(1);

            Assert.False(volt.Equals(new object()));
        }
Beispiel #13
0
        public void CompareToThrowsOnNull()
        {
            ElectricPotential volt = ElectricPotential.FromVolts(1);

            Assert.Throws <ArgumentNullException>(() => volt.CompareTo(null));
        }
Beispiel #14
0
        public void VoltToElectricPotentialUnits()
        {
            ElectricPotential volt = ElectricPotential.FromVolts(1);

            Assert.AreEqual(VoltsInOneVolt, volt.Volts, VoltsTolerance);
        }
        public void GetHashCode_Equals()
        {
            var quantity = ElectricPotential.FromVolts(1.0);

            Assert.Equal(new { ElectricPotential.QuantityType, quantity.Value, quantity.Unit }.GetHashCode(), quantity.GetHashCode());
        }
Beispiel #16
0
 /// <inheritdoc cref="ElectricPotential.FromVolts(double)"/>
 public static ElectricPotential Volts(this decimal value) => ElectricPotential.FromVolts(Convert.ToDouble(value));
Beispiel #17
0
 /// <inheritdoc cref="ElectricPotential.FromVolts(double)"/>
 public static ElectricPotential Volts(this double value) => ElectricPotential.FromVolts(value);
Beispiel #18
0
 /// <summary>Get <see cref="ElectricPotential"/> from <see cref="ElectricResistance"/> multiplied by <see cref="ElectricCurrent"/>.</summary>
 /// <remarks>Ohm's law implementation</remarks>
 public static ElectricPotential operator *(ElectricCurrent current, ElectricResistance resistance)
 {
     return(ElectricPotential.FromVolts(resistance.Ohms * current.Amperes));
 }
Beispiel #19
0
        public void ElectricPotentialMultipliedByElectricCurrentEqualsPower()
        {
            Power p = ElectricPotential.FromVolts(10) * ElectricCurrent.FromAmperes(2);

            Assert.Equal(20, p.Watts);
        }
Beispiel #20
0
        public void ConversionRoundTrip()
        {
            ElectricPotential volt = ElectricPotential.FromVolts(1);

            Assert.AreEqual(1, ElectricPotential.FromVolts(volt.Volts).Volts, VoltsTolerance);
        }
Beispiel #21
0
        public void As()
        {
            var volt = ElectricPotential.FromVolts(1);

            Assert.AreEqual(VoltsInOneVolt, volt.As(ElectricPotentialUnit.Volt), VoltsTolerance);
        }
Beispiel #22
0
        public void ElectricPotentialDividedByElectricResistanceEqualsElectricCurrent(float potential, float resistance, float expected)
        {
            ElectricCurrent current = ElectricPotential.FromVolts(potential) / ElectricResistance.FromOhms(resistance);

            Assert.Equal(expected, current.Amperes);
        }
        public void NegationOperator_ReturnsQuantity_WithNegatedValue(double value)
        {
            var quantity = ElectricPotential.FromVolts(value);

            Assert.Equal(ElectricPotential.FromVolts(-value), -quantity);
        }
Beispiel #24
0
        public void CompareToThrowsOnTypeMismatch()
        {
            ElectricPotential volt = ElectricPotential.FromVolts(1);

            Assert.Throws <ArgumentException>(() => volt.CompareTo(new object()));
        }
Beispiel #25
0
        public static void Main(string[] args)
        {
            // set I2C bus ID: 1
            // ADS1115 Addr Pin connect to GND
            I2cConnectionSettings settings = new I2cConnectionSettings(1, (int)I2cAddress.GND);
            // get I2cDevice (in Linux)
            I2cDevice device = I2cDevice.Create(settings);

            Console.WriteLine("Press any key to continue");
            // pass in I2cDevice
            // repeatedly measure the voltage AIN0
            // set the maximum range to 4.096V
            using (Iot.Device.Ads1115.Ads1115 adc = new Iot.Device.Ads1115.Ads1115(device, InputMultiplexer.AIN0, MeasuringRange.FS4096))
            {
                // loop
                while (Console.KeyAvailable == false)
                {
                    // read raw data form the sensor
                    short raw = adc.ReadRaw();
                    // raw data convert to voltage
                    ElectricPotential voltage = adc.RawToVoltage(raw);

                    Console.WriteLine($"ADS1115 Raw Data: {raw}");
                    Console.WriteLine($"Voltage: {voltage}");
                    Console.WriteLine();

                    // wait for 2s
                    Thread.Sleep(2000);
                }

                Console.ReadKey(true);
            }

            // Read all channels in a loop.
            // We set the device mode to power-down, because we have to wait for a sample after each channel swap anyway.
            using (var adc = new Iot.Device.Ads1115.Ads1115(device, InputMultiplexer.AIN0, MeasuringRange.FS4096, DataRate.SPS250, DeviceMode.PowerDown))
            {
                // loop
                while (Console.KeyAvailable == false)
                {
                    Console.Clear();

                    ElectricPotential voltage0 = adc.ReadVoltage(InputMultiplexer.AIN0);
                    ElectricPotential voltage1 = adc.ReadVoltage(InputMultiplexer.AIN1);
                    ElectricPotential voltage2 = adc.ReadVoltage(InputMultiplexer.AIN2);
                    ElectricPotential voltage3 = adc.ReadVoltage(InputMultiplexer.AIN3);

                    Console.WriteLine($"ADS1115 Voltages: (Any key to continue)");
                    Console.WriteLine($"Channel0: {voltage0:s3}");
                    Console.WriteLine($"Channel1: {voltage1:s3}");
                    Console.WriteLine($"Channel2: {voltage2:s3}");
                    Console.WriteLine($"Channel3: {voltage3:s3}");
                    Console.WriteLine();

                    // wait for 100ms
                    Thread.Sleep(100);
                }

                while (Console.KeyAvailable)
                {
                    Console.ReadKey(true);
                }
            }

            // Provide a callback that triggers each time the ADC has a new value available. The DataRate parameter will define the sample rate.
            // We are using pin 23 as interrupt input from the ADC, but note that the trigger signal from the ADC may be to short to be properly recognized by the Raspberry Pi and
            // some extra electronics is required to make this reliably work (see readme).
            using (var controller = new GpioController(PinNumberingScheme.Logical))
            {
                Console.Clear();
                Console.WriteLine("This triggers an interrupt each time a new value is available on AIN0");
                using (Iot.Device.Ads1115.Ads1115 adc = new Iot.Device.Ads1115.Ads1115(device, controller, 23, false, InputMultiplexer.AIN0, MeasuringRange.FS2048, DataRate.SPS250))
                {
                    Stopwatch         w = Stopwatch.StartNew();
                    int               totalInterruptsSeen        = 0;
                    int               previousNumberOfInterrupts = 0;
                    ElectricPotential lastVoltage = default;
                    adc.AlertReadyAsserted += () =>
                    {
                        ElectricPotential voltage = adc.ReadVoltage();
                        lastVoltage = voltage;
                        totalInterruptsSeen++;
                    };

                    adc.EnableConversionReady();
                    // (Do something else, here we print the output (as the console operations use to much time in the interrupt callback)
                    while (Console.KeyAvailable == false)
                    {
                        int    interruptsThisPeriod = totalInterruptsSeen - previousNumberOfInterrupts;
                        double intsSecond           = interruptsThisPeriod / w.Elapsed.TotalSeconds;

                        Console.WriteLine($"ADS1115 Voltage: {lastVoltage}");
                        Console.WriteLine($"Interrups total: {totalInterruptsSeen}, last: {interruptsThisPeriod} Average: {intsSecond}/s (should be ~ {adc.FrequencyFromDataRate(adc.DataRate)})");
                        w.Restart();
                        previousNumberOfInterrupts = totalInterruptsSeen;
                        // wait for 2s
                        Thread.Sleep(2000);
                    }

                    Console.ReadKey(true);
                }
            }

            // Use an interrupt handler, but this time when the value on AIN1 exceeds a threshold
            using (var controller = new GpioController(PinNumberingScheme.Logical))
            {
                Console.Clear();
                Console.WriteLine("This triggers an interrupt as long as the value is above 2.0V (and then stays above 1.8V)");
                using (Iot.Device.Ads1115.Ads1115 adc = new Iot.Device.Ads1115.Ads1115(device, controller, 23, false, InputMultiplexer.AIN1, MeasuringRange.FS4096, DataRate.SPS860))
                {
                    Stopwatch         w = Stopwatch.StartNew();
                    int               totalInterruptsSeen        = 0;
                    int               previousNumberOfInterrupts = 0;
                    ElectricPotential lastVoltage = default;
                    adc.AlertReadyAsserted += () =>
                    {
                        ElectricPotential voltage = adc.ReadVoltage();
                        lastVoltage = voltage;
                        totalInterruptsSeen++;
                    };

                    adc.EnableComparator(adc.VoltageToRaw(ElectricPotential.FromVolts(1.8)), adc.VoltageToRaw(ElectricPotential.FromVolts(2.0)), ComparatorMode.Traditional, ComparatorQueue.AssertAfterTwo);
                    // Do something else, here we print the output (as the console operations use to much time in the interrupt callback)
                    while (Console.KeyAvailable == false)
                    {
                        int    interruptsThisPeriod = totalInterruptsSeen - previousNumberOfInterrupts;
                        double intsSecond           = interruptsThisPeriod / w.Elapsed.TotalSeconds;

                        if (interruptsThisPeriod > 0)
                        {
                            Console.WriteLine($"Interrupt voltage: {lastVoltage}");
                            Console.WriteLine($"Interrups total: {totalInterruptsSeen}, last: {interruptsThisPeriod} Average: {intsSecond}/s");
                        }
                        else
                        {
                            Console.WriteLine($"Current Voltage (no interrupts seen): {adc.ReadVoltage()}");
                        }

                        lastVoltage = default;
                        w.Restart();
                        previousNumberOfInterrupts = totalInterruptsSeen;
                        // wait for 2s
                        Thread.Sleep(2000);
                    }

                    Console.ReadKey(true);
                }
            }
        }
Beispiel #26
0
        public static void InitiM5Stick()
        {
            Debug.WriteLine("This is the sequence to power on the Axp192 for M5 Stick");

            Configuration.SetPinFunction(22, DeviceFunction.I2C1_CLOCK);
            Configuration.SetPinFunction(21, DeviceFunction.I2C1_DATA);

            I2cDevice i2cAxp192 = new(new I2cConnectionSettings(1, Axp192.I2cDefaultAddress));

            power = new Axp192(i2cAxp192);

            // NOTE: the comments include code which was originally used
            // to setup the AXP192 and can be found in the M5Stick repository
            // This allows to understand the selection dome.
            // Set LDO2 & LDO3(TFT_LED & TFT) 3.0V
            // I2cWrite(Register.VoltageSettingLdo2_3, 0xcc);
            power.LDO2OutputVoltage = ElectricPotential.FromVolts(3);
            power.LDO3OutputVoltage = ElectricPotential.FromVolts(3);
            // Set ADC sample rate to 200hz
            // I2cWrite(Register.AdcFrequency, 0xF2);
            power.AdcFrequency  = AdcFrequency.Frequency200Hz;
            power.AdcPinCurrent = AdcPinCurrent.MicroAmperes80;
            power.BatteryTemperatureMonitoring = true;
            power.AdcPinCurrentSetting         = AdcPinCurrentSetting.AlwaysOn;
            // Set ADC to All Enable
            // I2cWrite(Register.AdcPin1, 0xff);
            power.AdcPinEnabled = AdcPinEnabled.All;
            // Bat charge voltage to 4.2, Current 100MA
            // I2cWrite(Register.ChargeControl1, 0xc0);
            power.SetChargingFunctions(true, ChargingVoltage.V4_2, ChargingCurrent.Current100mA, ChargingStopThreshold.Percent10);
            // Depending on configuration enable LDO2, LDO3, DCDC1, DCDC3.
            // byte data = I2cRead(Register.SwitchControleDcDC1_3LDO2_3);
            // data = (byte)((data & 0xEF) | 0x4D);
            // I2cWrite(Register.SwitchControleDcDC1_3LDO2_3, data);
            power.LdoDcPinsEnabled = LdoDcPinsEnabled.All;
            // 128ms power on, 4s power off
            // I2cWrite(Register.ParameterSetting, 0x0C);
            power.SetButtonBehavior(LongPressTiming.S1, ShortPressTiming.Ms128, true, SignalDelayAfterPowerUp.Ms64, ShutdownTiming.S10);
            // Set RTC voltage to 3.3V
            // I2cWrite(Register.VoltageOutputSettingGpio0Ldo, 0xF0);
            power.PinOutputVoltage = PinOutputVoltage.V3_3;
            // Set GPIO0 to LDO
            // I2cWrite(Register.ControlGpio0, 0x02);
            power.Gpio0Behavior = Gpio0Behavior.LowNoiseLDO;
            // Disable vbus hold limit
            // I2cWrite(Register.PathSettingVbus, 0x80);
            power.SetVbusSettings(true, false, VholdVoltage.V4_0, false, VbusCurrentLimit.MilliAmper500);
            // Set temperature protection
            // I2cWrite(Register.HigTemperatureAlarm, 0xfc);
            power.SetBatteryHighTemperatureThreshold(ElectricPotential.FromVolts(3.2256));
            // Enable RTC BAT charge
            // I2cWrite(Register.BackupBatteryChargingControl, 0xa2);
            power.SetBackupBatteryChargingControl(true, BackupBatteryCharingVoltage.V3_0, BackupBatteryChargingCurrent.MicroAmperes200);
            // Enable bat detection
            // I2cWrite(Register.ShutdownBatteryDetectionControl, 0x46);
            // Note 0x46 is not a possible value, most likely 0x4A
            power.SetShutdownBatteryDetectionControl(false, true, ShutdownBatteryPinFunction.HighResistance, true, ShutdownBatteryTiming.S2);
            // Set Power off voltage 3.0v
            // data = I2cRead(Register.VoltageSettingOff);
            // data = (byte)((data & 0xF8) | (1 << 2));
            // I2cWrite(Register.VoltageSettingOff, data);
            power.VoffVoltage = VoffVoltage.V3_0;
        }
Beispiel #27
0
 /// <inheritdoc cref="ElectricPotential.FromVolts(double?)"/>
 public static ElectricPotential?Volts(this float?value) => ElectricPotential.FromVolts(value);
Beispiel #28
0
 /// <inheritdoc cref="ElectricPotential.FromVolts(UnitsNet.QuantityValue)" />
 public static ElectricPotential Volts <T>(this T value) => ElectricPotential.FromVolts(Convert.ToDouble(value));
Beispiel #29
0
 /// <inheritdoc cref="ElectricPotential.FromVolts(double?)"/>
 public static ElectricPotential?Volts(this decimal?value) => ElectricPotential.FromVolts(value == null ? (double?)null : Convert.ToDouble(value.Value));
Beispiel #30
0
 public static ElectricPotential?Volts <T>(this T?value) where T : struct => ElectricPotential.FromVolts(value == null ? (double?)null : Convert.ToDouble(value.Value));