Пример #1
0
        public void Extend(UnitConfiguration c)
        {
            c.Unit(Celsius)
               .IsPhysicalUnit(_TEMPERATURE)
               .ConvertValueBased(Kelvin, v => v + 273.15m, v => v - 273.15m);

            c.Unit(Fahrenheit)
                .IsPhysicalUnit(_TEMPERATURE)
                .ConvertValueBased(Celsius, v => (v - 32) * (5m / 9m), v => v * (9m / 5m) + 32);
        }
Пример #2
0
        public void Extend(UnitConfiguration c)
        {
            c.Unit(Celsius)
            .IsPhysicalUnit(_TEMPERATURE)
            .ConvertValueBased(Kelvin, v => v + 273.15m, v => v - 273.15m);

            c.Unit(Fahrenheit)
            .IsPhysicalUnit(_TEMPERATURE)
            .ConvertValueBased(Celsius, v => (v - 32) * (5m / 9m), v => v * (9m / 5m) + 32);
        }
Пример #3
0
 public void Extend(UnitConfiguration c)
 {
     c.Unit(Pascal)
     .IsPhysicalUnit(_MASS / (_TIME.Squared() * _LENGTH))
     .EquivalentTo(Newton / Meter.Squared())
     .ConvertValueBased(Bar, v => v * 1E-5m, v => v * 100000)
     .ConvertValueBased(Psi, v => 6.894E+3m, v => v * 145.04E-6m);
 }
Пример #4
0
 public void Extend(UnitConfiguration c)
 {
     c.Unit(Pascal)
         .IsPhysicalUnit(_MASS / (_TIME.Squared() * _LENGTH))
         .EquivalentTo(Newton / Meter.Squared())
         .ConvertValueBased(Bar, v => v * 1E-5m, v => v * 100000)
         .ConvertValueBased(Psi, v => 6.894E+3m, v => v * 145.04E-6m);
 }
Пример #5
0
        public void Extend(UnitConfiguration c)
        {
            c.Unit(Milligram)
            .IsPhysicalUnit(_MASS)
            .StartScale()
            .To(Carat, 200)
            .To(Gram, 5)
            .To(Kilogram, 1000)
            .To(Ton, 1000);

            c.Unit(Ounce)
            .IsPhysicalUnit((_MASS))
            .StartScale()
            .To(Pound, 16);

            c.Unit(Gram).ConvertValueBased(Ounce, v => v * 0.0352739619m, v => v * 28.3495231m);
            c.Unit(Pound).ConvertValueBased(Kilogram, v => v * 0.45359237m, v => v * 2.20462262m);
        }
Пример #6
0
        public void Extend(UnitConfiguration c)
        {
            c.Unit(Joule)
                .IsPhysicalUnit((_MASS * _LENGTH.Squared()) / _TIME.Squared())
                .EquivalentTo(Kilogram * Meter.Squared() / Second.Squared())
                .ConvertibleTo(Kilogram,
                  m => m / PhysicalConstants.EnergyMassFactor,
                  m => m * PhysicalConstants.EnergyMassFactor)
                .ConvertibleTo(ElectronVolt, j => 6.242e+18m * j, e => 1.6022e-19m * e)
                .StartScale()
                .To(KiloJoule, 1000)
                .To(MegaJoule, 1000)
                .To(GigaJoule, 1000)
                .To(TeraJoule, 1000);

            c.Unit(Newton)
                .IsPhysicalUnit(_MASS * _LENGTH / _TIME.Squared())
                .EquivalentTo(Kilogram * Meter / Second.Squared());
        }
Пример #7
0
        public void Extend(UnitConfiguration c)
        {
            c.Unit(Joule)
            .IsPhysicalUnit((_MASS * _LENGTH.Squared()) / _TIME.Squared())
            .EquivalentTo(Kilogram * Meter.Squared() / Second.Squared())
            .ConvertibleTo(Kilogram,
                           m => m / PhysicalConstants.EnergyMassFactor,
                           m => m * PhysicalConstants.EnergyMassFactor)
            .ConvertibleTo(ElectronVolt, j => 6.242e+18m * j, e => 1.6022e-19m * e)
            .StartScale()
            .To(KiloJoule, 1000)
            .To(MegaJoule, 1000)
            .To(GigaJoule, 1000)
            .To(TeraJoule, 1000);

            c.Unit(Newton)
            .IsPhysicalUnit(_MASS * _LENGTH / _TIME.Squared())
            .EquivalentTo(Kilogram * Meter / Second.Squared());
        }
Пример #8
0
        public void Extend(UnitConfiguration c)
        {
            c.Unit(Milligram)
                .IsPhysicalUnit(_MASS)
                .StartScale()
                .To(Carat, 200)
                .To(Gram, 5)
                .To(Kilogram, 1000)
                .To(Ton, 1000);

            c.Unit(Ounce)
                .IsPhysicalUnit((_MASS))
                .StartScale()
                .To(Pound, 16);

            c.Unit(Gram).ConvertValueBased(Ounce, v => v * 0.0352739619m, v => v * 28.3495231m);
            c.Unit(Pound).ConvertValueBased(Kilogram, v => v * 0.45359237m, v => v * 2.20462262m);

        }
Пример #9
0
 public void Extend(UnitConfiguration c)
 {
     c.Unit(Nanosecond)
         .IsPhysicalUnit(_TIME)
         .StartScale()
         .To(Microsecond, 1000)
         .To(Millisecond, 1000)
         .To(Second, 1000)
         .To(Minute, 60)
         .To(Hour, 60)
         .To(Day, 24);
 }
Пример #10
0
            public void Extend(UnitConfiguration c)
            {
                c.Unit(MicroShipLength)
                    .IsPhysicalUnit(_LENGTH)
                    .StartScale()
                    .To(ShipLength, 1000);
                c.Unit(Heartbeat)
                    .IsPhysicalUnit(_TIME)
                    .StartScale()
                    .To(Michron, 50)
                    .To(QMichron, 50)
                    .To(GreatMichron, 50)
                    .To(Period, 250);
                c.Unit(ShipMass)
                    .IsPhysicalUnit(_MASS)
                    .ConvertibleTo(SunMass, m => m / 10E+25m, m => m * 10E+25m);

                c[ShipLength].ConvertValueBased(Kilometer, v => v * 2.4640476m, v => v / 2.4640476m);
                c[Heartbeat].ConvertValueBased(Second, v => v * 0.821917808219178m, v => v / 0.821917808219178m);
                c[ShipMass].ConvertValueBased(Kilogram, v => v * 55402.15m, v => v / 55402.15m);
            }
Пример #11
0
 public void Extend(UnitConfiguration c)
 {
     c.Unit(Nanosecond)
     .IsPhysicalUnit(_TIME)
     .StartScale()
     .To(Microsecond, 1000)
     .To(Millisecond, 1000)
     .To(Second, 1000)
     .To(Minute, 60)
     .To(Hour, 60)
     .To(Day, 24);
 }
Пример #12
0
            public void Extend(UnitConfiguration c)
            {
                c.Unit(MicroShipLength)
                .IsPhysicalUnit(_LENGTH)
                .StartScale()
                .To(ShipLength, 1000);
                c.Unit(Heartbeat)
                .IsPhysicalUnit(_TIME)
                .StartScale()
                .To(Michron, 50)
                .To(QMichron, 50)
                .To(GreatMichron, 50)
                .To(Period, 250);
                c.Unit(ShipMass)
                .IsPhysicalUnit(_MASS)
                .ConvertibleTo(SunMass, m => m / 10E+25m, m => m * 10E+25m);

                c[ShipLength].ConvertValueBased(Kilometer, v => v * 2.4640476m, v => v / 2.4640476m);
                c[Heartbeat].ConvertValueBased(Second, v => v * 0.821917808219178m, v => v / 0.821917808219178m);
                c[ShipMass].ConvertValueBased(Kilogram, v => v * 55402.15m, v => v / 55402.15m);
            }
Пример #13
0
        public void Extend(UnitConfiguration c)
        {
            c.Unit(Nanometer)
            .IsPhysicalUnit(_LENGTH)
            .StartScale()
            .To(Micrometer, 1000)
            .To(Millimeter, 1000)
            .To(Centimeter, 10)
            .To(Meter, 100)
            .To(Kilometer, 1000);

            c.Unit(Microinch)
            .IsPhysicalUnit(_LENGTH)
            .StartScale()
            .To(Inch, 1000000)
            .To(Foot, 12)
            .To(Yard, 3)
            .To(Mile, 1760);

            c.Unit(Inch).ConvertValueBased(Centimeter, v => v * 2.54m, v => 0.393700787m * v);
            c.Unit(Mile).ConvertValueBased(Kilometer, v => v * 1.609344m, v => 0.621371192m * v);
        }
Пример #14
0
        public void Extend(UnitConfiguration c)
        {
            c.Unit(Nanometer)
                .IsPhysicalUnit(_LENGTH)
                .StartScale()
                .To(Micrometer, 1000)
                .To(Millimeter, 1000)
                .To(Centimeter, 10)
                .To(Meter, 100)
                .To(Kilometer, 1000);

            c.Unit(Microinch)
                .IsPhysicalUnit(_LENGTH)
                .StartScale()
                .To(Inch, 1000000)
                .To(Foot, 12)
                .To(Yard, 3)
                .To(Mile, 1760);

            c.Unit(Inch).ConvertValueBased(Centimeter, v => v * 2.54m, v => 0.393700787m * v);
            c.Unit(Mile).ConvertValueBased(Kilometer, v => v * 1.609344m, v => 0.621371192m * v);
        }
Пример #15
0
 public void Extend(UnitConfiguration c)
 {
     c.Unit(Meter ^ 2)
         .ConvertValueBased(Hectare, v => v * 0.0001m, v => v * 10000);
 }
Пример #16
0
 public void Extend(UnitConfiguration c)
 {
     c.Unit(Unit.Parse("Foo")).IsPhysicalUnit(U._TIME);
 }
Пример #17
0
 public void Extend(UnitConfiguration c)
 {
     c.Unit(Meter ^ 2)
     .ConvertValueBased(Hectare, v => v * 0.0001m, v => v * 10000);
 }
Пример #18
0
 public void Extend(UnitConfiguration c)
 {
     c.Unit(Unit.Parse("Foo")).IsPhysicalUnit(U._TIME);
 }