Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add remaining CGS units and some other US customary units #115

Merged
merged 2 commits into from
Jan 1, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 48 additions & 30 deletions src/pkgdefaults.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,26 @@
include("temperature.jl")

# Define derived dimensions.
@derived_dimension Area 𝐋^2
@derived_dimension Volume 𝐋^3
@derived_dimension Frequency inv(𝐓)
@derived_dimension Force 𝐌*𝐋/𝐓^2
@derived_dimension Pressure 𝐌*𝐋^-1*𝐓^-2
@derived_dimension Energy 𝐌*𝐋^2/𝐓^2
@derived_dimension Momentum 𝐌*𝐋/𝐓
@derived_dimension Power 𝐋^2*𝐌*𝐓^-3
@derived_dimension Charge 𝐈*𝐓
@derived_dimension Voltage 𝐈^-1*𝐋^2*𝐌*𝐓^-3
@derived_dimension Resistance 𝐈^-2*𝐋^2*𝐌*𝐓^-3
@derived_dimension Capacitance 𝐈^2*𝐋^-2*𝐌^-1*𝐓^4
@derived_dimension Inductance 𝐈^-2*𝐋^2*𝐌*𝐓^-2
@derived_dimension MagneticFlux 𝐈^-1*𝐋^2*𝐌*𝐓^-2
@derived_dimension HField 𝐈/𝐋
@derived_dimension BField 𝐈^-1*𝐌*𝐓^-2
@derived_dimension Action 𝐋^2*𝐌*𝐓^-1
@derived_dimension Area 𝐋^2
@derived_dimension Volume 𝐋^3
@derived_dimension Frequency inv(𝐓)
@derived_dimension Force 𝐌*𝐋/𝐓^2
@derived_dimension Pressure 𝐌*𝐋^-1*𝐓^-2
@derived_dimension Energy 𝐌*𝐋^2/𝐓^2
@derived_dimension Momentum 𝐌*𝐋/𝐓
@derived_dimension Power 𝐋^2*𝐌*𝐓^-3
@derived_dimension Charge 𝐈*𝐓
@derived_dimension Voltage 𝐈^-1*𝐋^2*𝐌*𝐓^-3
@derived_dimension Resistance 𝐈^-2*𝐋^2*𝐌*𝐓^-3
@derived_dimension Capacitance 𝐈^2*𝐋^-2*𝐌^-1*𝐓^4
@derived_dimension Inductance 𝐈^-2*𝐋^2*𝐌*𝐓^-2
@derived_dimension MagneticFlux 𝐈^-1*𝐋^2*𝐌*𝐓^-2
@derived_dimension HField 𝐈/𝐋
@derived_dimension BField 𝐈^-1*𝐌*𝐓^-2
@derived_dimension Action 𝐋^2*𝐌*𝐓^-1
@derived_dimension DynamicViscosity 𝐌*𝐋^-1*𝐓^-1
@derived_dimension KinematicViscosity 𝐋^2*𝐓^-1
@derived_dimension Wavenumber inv(𝐋)

# Define base units. This is not to imply g is the base SI unit instead of kg.
# See the documentation for further details.
Expand Down Expand Up @@ -136,32 +139,47 @@ const σ = π^2*k^4/(60*ħ^3*c^2) # Stefan-Boltzmann constant
@unit ge "ge" EarthGravity gn false


# CGS units
@unit dyn "dyn" Dyne 1g*cm/s^2 true
@unit P "P" Poise 1g/cm/s true
@unit St "St" Stokes 1cm^2/s true


#########
# Shared Imperial / US customary units

# Length
#key: Symbol Display Name Equivalent to 10^n prefixes?
@unit inch "inch" Inch (254//10000)*m false
@unit ft "ft" Foot 12inch false
@unit yd "yd" Yard 3ft false
@unit mi "mi" Mile 1760yd false
#key: Symbol Display Name Equivalent to 10^n prefixes?
@unit inch "inch" Inch (254//10000)*m false
@unit ft "ft" Foot 12inch false
@unit yd "yd" Yard 3ft false
@unit mi "mi" Mile 1760yd false

# Area
@unit ac "ac" Acre (316160658//78125)*m^2 false
@unit ac "ac" Acre (316160658//78125)*m^2 false

# Temperatures
@unit °Ra "°Ra" Rankine (5//9)*K false
@unit °F "°F" Fahrenheit (5//9)*K false
@unit °Ra "°Ra" Rankine (5//9)*K false
@unit °F "°F" Fahrenheit (5//9)*K false
Unitful.offsettemp(::Unitful.Unit{:Fahrenheit}) = 45967//100

# Masses
@unit lb "lb" Pound 0.45359237kg false # is exact
@unit oz "oz" Ounce lb//16 false
@unit dr "dr" Dram oz//16 false
@unit gr "gr" Grain (32//875)*dr false
@unit lb "lb" Pound 0.45359237kg false # is exact
@unit oz "oz" Ounce lb//16 false
@unit slug "slug" Slug 1lb*ge*s^2/ft false
@unit dr "dr" Dram oz//16 false
@unit gr "gr" Grain (32//875)*dr false

# Force
@unit lbf "lbf" PoundsForce 1lb*ge false
@unit lbf "lbf" PoundsForce 1lb*ge false

# Energy
# Use ISO 31-4 for BTU definition
@unit cal "cal" Calorie 4.184J true
@unit btu "btu" BritishThermalUnit 1055.06J false

# Pressure
@unit psi "psi" PoundsPerSquareInch 1lbf/inch^2 false

#########
# Logarithmic scales and units
Expand Down