(defModelFragment heat-flow :subclass-of (physical-process) :participants ((the-src :type thermal-physob) (the-dst :type thermal-physob) (the-path :type heat-path :constraints ((heat-connection the-path the-src the-dst)))) :conditions ((heat-aligned the-path) (> (temperature the-src) (temperature the-dst))) :quantities ((heat-flow-rate :type heat-flow-rate)) :consequences ((Q= heat-flow-rate (- (temperature the-src) (temperature the-dst))) (I- (heat the-src) heat-flow-rate) (I+ (heat the-dst) heat-flow-rate)))
(defModelFragment Contained-Stuff :subclass-of (physical-object) :participants (;; (the-csp :type contained-stuff-possibility) (the-can :type container ;;; :constraints ((the-can-of the-csp the-can)) ) (the-phase :type phase ;;; :constraints ((the-phase-of the-csp the-phase)) ) (the-sub :type substance ;;; :constraints ((the-sub-of the-csp the-sub)) )) :conditions (;; (active csp) (> (amount-of the-sub the-phase the-can) 0)) :quantities ((mass :type mass)) ;; ***** Are the biconditionals below really necessary? :consequences ((:biconditional (volumetric-physob :self)) (Q= mass (amount-of the-sub the-phase the-can)) (:biconditional (finite-thermal-physob :self))))
(defModelFragment liquid-engine-burning :participants ((fuel :type rocket-fuel) (oxidizer :type rocket-oxidizer) (the-fuel-flow :type rocket-fluid-flow :constraints ((stuff-of the-fuel-flow fuel))) (the-oxidizer-flow :type rocket-fluid-flow :constraints ((stuff-of the-oxidizer-flow oxidizer))) (the-engine :type rocket-engine :constraints ;; Equivalent: ;; ((dest-of the-fuel-flow the-engine) ;; (dest-of the-oxidizer-flow the-engine)) ((has-participant-role the-engine dest the-fuel-flow) (has-participant-role the-engine dest the-oxidizer-flow))) (the-igniter :type switch :constraints ((controls the-igniter the-engine)))) :quantities ((thrust)) :conditions ((active the-fuel-flow) (active the-oxidizer-flow) (is-on the-igniter)) ; (> (flow-rate-of the-fuel-flow) 0) ; (> (flow-rate-of the-oxidizer-flow) 0)) :consequences ((qprop thrust (flow-rate-of the-fuel-flow)) (qprop (thrust :self) (flow-rate-of the-oxidizer-flow))))
Active is a predicate which is true if the model fragment being referred to is not only instantiated but also has all conditions forfilled. A model fragment can be instantiated but not active. The active predicate returns true if the model fragment is active. In this example, the model fragment the-cstuff needs to be active before the model fragment Contained-Gas-Properties will become active.
(defModelFragment Contained-Gas-Properties :participants ((the-cstuff :type Contained-Stuff :constraints ((the-phase-of the-cstuff gas))) (the-sub :type substance :constraints ((the-sub-of the-cstuff the-sub))) (the-can :type container :constraints ((the-can-of the-cstuff the-can)))) :conditions ((active the-cstuff)) :consequences ((>= (temperature the-cstuff) (TBoil the-sub the-can)) (qprop (pressure the-cstuff) (mass the-cstuff)) (qprop (pressure the-cstuff) (volume the-cstuff)) (qprop (pressure the-cstuff) (heat the-cstuff))))