Parameters


?variable

Variables are prefixed with the symbol "?". Variables names are not representative of any underlying process or domain knowledge.

(defQuantityFunction thrust (?rocket-burn-process) 
  :=> (liquid-engine-burning ?rocket-burn-process))

Note that this defQuantityFunction would mean the same thing even if it were written as:

(defQuantityFunction thrust (?random-variable-1) 
  :=> (liquid-engine-burning ?random-variable-1))

The use of "?" variables are just placeholders.


:conditions

The conditions parameter are used in defModelFragments. It is...


:constraints

The :constraints parameter is used within the :participants parameter which itself resides within the defModelFragment.


:participants

Args: (&rest (variable-name :type variable-type &key :constraints))

:Participants are used as arguments in defModelFragments. It takes a list of variable names, the types of those variables, and an optional constraints. If the types of the variables exist and the constraints are satisified, then the model fragment is instantiated.

(defModelFragment liquid-flow
 :subclass-of (physical-process)
 :participants ((the-src :type container)
                (the-sub :type substance)
                (the-dst :type container)
                (the-path :type fluid-path
                  :constraints ((fluid-connection the-path the-src the-dst)))
                (the-src-stuff :type contained-stuff
                 :constraints ((the-phase-of the-src-stuff liquid)
                               (the-can-of the-src-stuff the-src)
                               (the-sub-of the-src-stuff the-sub)))
                (the-dst-stuff :type contained-stuff
                 :constraints ((the-phase-of the-dst-stuff liquid)
                               (the-can-of the-dst-stuff the-dst)
                               (the-sub-of the-dst-stuff the-sub))))
. . .)

In the above example, the following must exist for the model fragment to be instantiated: the types created by a defEntity and the constraints which need to be satisified. The defEntity needs to create the following types: two containers, a substance, a fluid-path, and two contained-stuffs. And constraints such as the the following:

 :constraints ((fluid-connection the-path the-src the-dst)))

require that all the forms in the list within the constraint be active. Even if all the constraints forms are active and all the types exist; this does not mean that the model fragment is active. The :participants only affect the instantiation of the model fragment, it does not determine the activeness! To make a model fragment active is a two step process: (1) the model fragment must exist (be instantiated) and (2) the :conditions need to be satisified.


:quantities

:Quantities are used in top level forms...


:self

The colon-self reference is used to refer to the instantiation of the model fragment itself. This is sometimes used in a model fragment where you need to refer the current object itself after instantiation. The following example taken from Jeff Usher's flow model shows how to reference to the model fragment

(defModelFragment flow
  :subclass-of (process translation--single-trajectory)
  :participants ((the-stuff :type flowable-stuff)     ; what substance is flowing
                 (the-src :type spatial-thing         ; source of flow
                  :constraints ((flow-source the-src the-stuff)))
                 (the-dst :type spatial-thing         ; destination of flow
                  :constraints ((flow-destination the-dst the-stuff)))
                 (the-route :type trajectory))        ; actual route follwed by flow
  :conditions ((> (amount-of the-stuff the-src) 0)
               (aligned-for-flow the-route the-stuff))
  :quantities ((flow-rate-of))
  :consequences ((from-location :self the-src)
                 (to-location :self the-dst)
                 (trajectory--complete :self the-route)
                 (object-moving :self the-stuff)
                 (> flow-rate-of 0)
                 (<= flow-rate-of (max-flow-source-output-rate the-src the-stuff))
                 (<= flow-rate-of (max-flow-dest-input-rate the-dst the-stuff))))

In this example the :self refers to the flow model fragment. This code if instantiated states several things. The code fragment states that the from-location of the this flow is stored in the this flow's the-src slot and that the to-location is stored in this flow's the-dst slot.

Note that sometimes the :self can be omitted, since one can assume that if the model fragment reference is left off then it usually refers to current model fragment which is also the one just instantianted.

:consequences ((qprop thrust (flow-rate-of the-fuel-flow))
:consequences ((qprop (thrust :self) (flow-rate-of the-fuel-flow))

The two code fragments above are equivalent.


:subclass-of

Args: (&rest base-types)

The :subclass-of parameter states that the current defEntity is a derived class of a base type(s).