elevator-rules.lisp | |
File Size: | 4 kb |
File Type: | lisp |
Rules for controlling the elevator - example of one to let people off the elevator.
(defrule let-off-people :forward
:context elevator-control
:priority 100
(idealm ?idealm current-simulation ?sim)
(elevator-car ?elevator next-floor ?next-floor direction ?direction moving t current-floor
?current-floor stop-count 0)
(floor-button ?button elevator ?elevator onp t floor-number ?current-floor)
(building-floor ?floor floor-number ?current-floor)
(test (can-stop ?elevator))
-->
((send-message ?sim "Firing rule: let off people"))
((create-stopping-event ?elevator))
(assert (elevator-car ?elevator openp nil stop-count 1)) ;; flag to open door
(assert (floor-button ?button onp nil)) ;; turn button off.
((print "Firing rule: letting off people")))