diff --git a/packages/dimensional/src/attribute.ts b/packages/dimensional/src/attribute.ts index 81d5d49..cac3623 100644 --- a/packages/dimensional/src/attribute.ts +++ b/packages/dimensional/src/attribute.ts @@ -10,7 +10,8 @@ export namespace Attribute { export type Name = Dimension.Name | 'area' | 'volume' | 'velocity' | 'acceleration' - | 'force' | 'energy' | 'power'; + | 'force' | 'energy' | 'power' + | 'pressure' | 'flow' | 'viscosity'; /** * Is an object containing keys of attributes and values of nonzero exponents. */ @@ -98,6 +99,9 @@ export namespace Attribute { force: () => new Attribute({ mass: 1, acceleration: 1 }, 'F'), energy: () => new Attribute({ force: 1, length: 1 }, 'E'), // Same as mv^2, mgh, ... power: () => new Attribute({ energy: 1, time: -1 }, 'P'), + pressure: () => new Attribute({ force: 1, area: -1 }, 'P'), + flow: () => new Attribute({ volume: 1, time: -1 }, 'Q'), + viscosity: () => new Attribute({ pressure: 1, time: -1 }, '\\mu'), }; /** * Represents a dimensionless attribute. diff --git a/packages/dimensional/src/conversion.ts b/packages/dimensional/src/conversion.ts index 40adc96..6190b6f 100644 --- a/packages/dimensional/src/conversion.ts +++ b/packages/dimensional/src/conversion.ts @@ -82,6 +82,7 @@ export namespace Conversion { micron: () => Conversion.scaled('micro', 'meter'), millimeter: () => Conversion.scaled('milli', 'meter'), centimeter: () => Conversion.scaled('centi', 'meter'), + decimeter: () => Conversion.scaled('deci', 'meter'), meter: () => Conversion.simple('\\text{m}', 'length'), kilometer: () => Conversion.scaled('kilo', 'meter'), inch: () => Conversion.relative('\\text{in}', 1 / 12, 'foot'), @@ -106,10 +107,29 @@ export namespace Conversion { mole: () => Conversion.simple('\\text{mol}', 'substance'), candela: () => Conversion.simple('\\text{cd}', 'intensity'), lumen: () => Conversion.relative('\\text{lm}', 4 * Math.PI, 'candela'), + milliliter: () => Conversion.scaled('milli', 'liter'), + liter: () => Conversion.complex('\\text{L}', { decimeter: 3 }), + gallon: () => Conversion.relative('\\text{gal}', 3.7854, 'liter'), Newton: () => Conversion.complex('\\text{N}', { kilogram: 1, meter: 1, second: -2 }), kiloNewton: () => Conversion.scaled('kilo', 'Newton'), pound_force: () => Conversion.complex('\\text{lb}_{f}', { slug: 1, foot: 1, second: -2 }), Joule: () => Conversion.complex('\\text{J}', { Newton: 1, meter: 1 }), + calorie: () => Conversion.relative('\\text{cal}', 1, 'Joule'), + Calorie: () => Conversion.relative('\\text{Cal}', 1000, 'calorie'), + WattHour: () => Conversion.complex('\\text{Wh}', { Watt: 1, hour: -1 }), + kiloWattHour: () => Conversion.scaled('kilo', 'WattHour'), + BritishThermalUnit: () => Conversion.relative('\\text{BTU}', 1055.056, 'Joule'), Watt: () => Conversion.complex('\\text{W}', { Joule: 1, second: -1 }), + Pascal: () => Conversion.complex('\\text{Pa}', { Newton: 1, meter: -2 }), + kiloPascal: () => Conversion.scaled('kilo', 'Pascal'), + atmosphere: () => Conversion.relative('\\text{atm}', 101.325, 'kiloPascal'), + millibar: () => Conversion.scaled('milli', 'bar'), + bar: () => Conversion.relative('\\text{bar}', 100, 'kiloPascal'), + mmHg: () => Conversion.relative('\\text{mmHg}', 7.5, 'kiloPascal'), + pounds_per_square_inch: () => Conversion.complex('\\text{psi}', { pound_force: 1, inch: -2 }), + poise: () => Conversion.complex('\\text{P}', { gram: 1, centimeter: -1, second: -1 }), + centipoise: () => Conversion.scaled('centi', 'poise'), + stoke: () => Conversion.complex('\\text{St}', { centimeter: 2, second: -1 }), + centistoke: () => Conversion.scaled('centi', 'stoke'), }; } \ No newline at end of file diff --git a/packages/dimensional/src/unit.ts b/packages/dimensional/src/unit.ts index 9215dc8..45c6157 100644 --- a/packages/dimensional/src/unit.ts +++ b/packages/dimensional/src/unit.ts @@ -12,7 +12,7 @@ export namespace Unit { // Time span/duration | 'nanosecond' | 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year' // Length/distance - | 'nanometer' | 'micrometer' | 'micron' | 'millimeter' | 'centimeter' | 'meter' | 'kilometer' | 'inch' | 'foot' | 'yard' | 'mile' + | 'nanometer' | 'micrometer' | 'micron' | 'millimeter' | 'centimeter' | 'decimeter' | 'meter' | 'kilometer' | 'inch' | 'foot' | 'yard' | 'mile' // Mass | 'milligram' | 'gram' | 'kilogram' | 'tonne' | 'ounce' | 'pound_mass' | 'slug' | 'stone' | 'shortton' // Current @@ -23,12 +23,18 @@ export namespace Unit { | 'mole' // Luminous Intensity | 'candela' | 'lumen' + // Volume + | 'milliliter' | 'liter' | 'gallon' // Force | 'Newton' | 'kiloNewton' | 'pound_force' // Energy - | 'Joule' + | 'Joule' | 'calorie' | 'Calorie' | 'WattHour' | 'kiloWattHour' | 'BritishThermalUnit' // Power | 'Watt' + // Pressure + | 'Pascal' | 'kiloPascal' | 'atmosphere' | 'millibar' | 'bar' | 'mmHg' | 'pounds_per_square_inch' + // Viscosity + | 'poise' | 'centipoise' | 'stoke' | 'centistoke' // Trailing semicolon ; /**