;;; -*- Mode:Lisp; Syntax: Common-lisp; Package:ONTOLINGUA-USER; Syntax:COMMON-LISP; Base:10 -*-

;;; Standard Units and Dimensions
;;; (c) 1993 Greg Olsen and Thomas Gruber

(in-package "ONTOLINGUA-USER")

(define-theory standard-units (standard-dimensions)

  "This theory defines a set of basic units of measure.  The associated physical
dimensions are defined in the standard-dimensions theory.  Each
unit-of-measure is defined with its relationship to SI units for the
fundamental dimensions.  It is intended that this theory represent enough
information to convert among any pair of units of the same dimension that are
either defined as basic units here or built up from the basic units using the
composition operators * and EXPT."
    :issues ("(c) 1993, 1994 Greg R. Olsen, Thomas R. Gruber, and Yves Peligry"
	   "This theory used to be combined with standard-units in a
theory called standard-units-and-dimensions.  We divided them because commitments
to one are often independent of commitments to the other."
	     (:see-also "The EngMath paper on line")))

(in-theory 'standard-units)

;;; SI (Systeme International) units

(define-class SI-unit (?unit)

  "The class of Systeme International units."

  :def (unit-of-measure ?unit)                         ;redundant but helpful

  :axiom-def (and (system-of-units SI-unit)
                  (= (base-units SI-unit)
                     (setof meter kilogram second-of-time ampere
                            degree-kelvin mole candela


;;; The IDENTITY-UNIT is defined in the PHYSICAL-QUANTITIES theory

(define-instance SECOND-OF-TIME (unit-of-measure)
  "The SI standard unit of time.  It is not called 'second' to distinguish
it from the function second (from the KIF-lists ontology) that denotes the
second element of a sequence."
  :axiom-def (and (= (quantity.dimension second-of-time) time-dimension)
                  (SI-unit second-of-time)))

(define-instance MINUTE (unit-of-measure)
  "Time unit."   
  := (* second-of-time 60)
  :axiom-def (= (quantity.dimension minute) time-dimension))
(define-instance HOUR (unit-of-measure)
  "Time unit."
  := (* minute 60)
  :axiom-def (= (quantity.dimension hour) time-dimension))

(define-instance METER (unit-of-measure)
  "SI length unit.  No conversion function is given
because this is a standard."
  :axiom-def (and (= (quantity.dimension meter) length-dimension)
                  (SI-unit meter)))

(define-instance KILOMETER (unit-of-measure)
  := (* meter 1000)
  :axiom-def (= (quantity.dimension kilometer) length-dimension))

(define-instance INCH (unit-of-measure)
  "English length unit."
  := (/ meter 39.37)
  :axiom-def (= (quantity.dimension inch) length-dimension))

(define-instance FOOT (unit-of-measure)
  "English length unit of feet."
  := (* inch 12)
  :axiom-def (= (quantity.dimension foot) length-dimension))

(define-instance MILE (unit-of-measure)
  "English length unit."
  := (* foot 5280)
  :axiom-def (= (quantity.dimension mile) length-dimension))

(define-instance ANGSTROM (unit-of-measure)
  "ang.strom \'a<nj>-str<e>m also '<o.><nj>-\ n (1897)
 [Anders J. <A^o>ngstr<o:>m]
    :a unit of length equal to one ten-billionth of a meters -- used esp. 
    for wavelengths of light."
  := (/ meter (expt 10 10))
  :axiom-def (= (quantity.dimension angstrom) length-dimension))

(define-instance KILOGRAM (unit-of-measure)
  "SI mass unit of kilogram."
  :axiom-def (and (= (quantity.dimension kilogram) mass-dimension)
                  (SI-unit kilogram)))

(define-instance POUND-MASS (unit-of-measure)
  "English pound of mass."
  :axiom-def (= (quantity.dimension pound-mass) mass-dimension)
  := (/ kilogram 2.2046))

(define-instance SLUG (unit-of-measure)
  "English mass unit."
  := (/ pound-mass 1000)
  :axiom-def (= (quantity.dimension slug) mass-dimension))

(define-instance NEWTON (unit-of-measure)
  "SI force unit."
  := (* (* kilogram meter) (expt second-of-time -2))
  :axiom-def (and (= (quantity.dimension newton) force-dimension)
                  (SI-unit newton)))
(define-instance AMPERE (unit-of-measure)
  "SI electrical current unit."
  :axiom-def (and (= (quantity.dimension ampere)
                  (SI-unit ampere)))

(define-instance POUND-FORCE (unit-of-measure)
  "English pound of force."
  :axiom-def (= (quantity.dimension pound-force) force-dimension)
  := (/ newton 4.448))

(define-instance JOULE (unit-of-measure)
  "SI energy unit."
  := (* newton meter)
  :axiom-def (and (SI-unit joule)
                  (= (quantity.dimension joule) energy-dimension)))

(define-instance BTU (unit-of-measure)
  "British thermal unit, a unit of energy."
  := (* 1055.0 joule)
  :axiom-def (= (quantity.dimension btu) energy-dimension))

(define-instance PASCAL (unit-of-measure)
  "SI pressure unit."
  := (* newton (expt meter -2))
  :axiom-def (and (SI-unit pascal)
                  (= (quantity.dimension pascal)
                               (* force-dimension
                                  (expt length-dimension -2)))))

(define-instance DEGREE-KELVIN (unit-of-measure)

  "A unit of thermodynamic temperature.  The degree-Kelvin 
differs from the Celcius scale ..."
  :axiom-def (and (= (quantity.dimension degree-kelvin) 
                  (SI-unit degree-kelvin)))

(define-instance DEGREE-RANKINE (unit-of-measure)

  "Being, according to, or relating to an absolute-temperature scale on
which the unit of measurement equals a Fahrenheit degree and on which
the freezing point of water is 491.67<^o> and the boiling point
671.67<^o>. [Webster]" 
  := (* degree-kelvin (/ 5 9))
  :axiom-def (= (quantity.dimension degree-rankine)

(define-instance RADIAN (unit-of-measure)
  "Angular measurement unit."
  := identity-unit
  :axiom-def (= (quantity.dimension radian) identity-dimension))

(define-instance THE-NUMBER-PI (real-number)
  "THE-NUMBER-PI is an approximation of the real number that is the ratio
of the perimeter of a circle to its diameter."
  := 3.1415926535897936
  :issues ("Should be defined as part of kif-numbers?"
	   (:formerly-called PI)
	   "Renamed from PI because PI is a common abbreviation.  In a general
            ontology (one that will be included and extended, it's probably
            a good idea to avoid short, ambiguous names."))

(define-instance ANGULAR-DEGREE (unit-of-measure)
  "Angular measurement unit."
  := (* radian (/ the-number-pi 180))
  :axiom-def (= (quantity.dimension angular-degree) identity-dimension)
  :issues ((:formerly-called degree)))

(define-instance US-DOLLAR (unit-of-measure)
  "An example currency unit."
  :axiom-def (= (quantity.dimension us-dollar) currency-dimension))

(define-instance US-CENT (unit-of-measure)
  "Currency measurement unit."
  := (/ US-DOLLAR 100)
  :axiom-def (= (quantity.dimension us-cent) currency-dimension))

(define-instance MOLE (unit-of-measure)
  "SI unit for amount of substance.  A mole of a substance is the
amount of that substance that contains 6.02252 x 10^23 elementary
entities.  Those entities may be atoms, molecules, ions, electrons,
other particles, or specified groups of such particles.  One mole
of carbon atoms (the C^12 isotope) is exactly 12 grams [Halliday
and Resnick].  In this ontology we say that the specified unit
is the molecule, so that the MOLE stands by itself as a unit."

  :axiom-def (and (= (quantity.dimension MOLE)
                  (SI-unit MOLE)))

(define-instance CANDELA (unit-of-measure)
  "The CANDELA is the SI unit for luminous intensity."

  :axiom-def (and (= (quantity.dimension CANDELA)
                  (SI-unit CANDELA)))

(define-instance megapascal (unit-of-measure)
  " 1 megapascal = 10^6 pascal "
  := (* pascal 1000000)
  :axiom-def (quantity.dimension megapascal pressure-dimension)

  :issues ("Provided by Bernd Bachmann, DFKI"))

(define-instance watt (unit-of-measure)
  "unit of measure for measuring physical work"
  := (* newton meter)
  :axiom-def (quantity.dimension watt work-dimension)

  :issues ("Provided by Bernd Bachmann, DFKI"))

This Lisp-to-HTML translation was brought to you by
François Gerbaux and Tom Gruber