HolgerL Skrevet 30. september 2007 Del Skrevet 30. september 2007 facts current_floor(1) and door(open) and floor_button_pushed(3, 0) and floor_button_pushed(5, 5) and elevator_button_pushed(2, 3) and elevator_button_pushed(2, 12) and time(0). rule open_door_at(H, T) %% should be placed first if time(T) and door(closed) and (floor_button_pushed(F, S) or elevator_button_pushed(F, S)) and call(S=<T) and current_floor(H) and call(F==H) then call(Q is T+1) and time(Q) and not time(T) and door(open) and not door(closed) and not floor_button_pushed(H, S) and not elevator_button_pushed(H, S). rule close_door_at(H, T) if time(T) and door(open) and current_floor(H) and (floor_button_pushed(F, S) or elevator_button_pushed(F, S)) and call(S=<T) and call(F\=H) then call(Q is T+1) and time(Q) and not time(T) and door(closed) and not door(open). %% Move because of button in elevator pushed (priority number 1) rule move_up_to(H, T) if time(T) and current_floor(F) and elevator_button_pushed(G, S) and call(S=<T) and door(closed) and call(F<G) then not current_floor(F) and call(H is F+1) and current_floor(H) and call(Q is T+1) and time(Q) and not time(T). rule move_down_to(H, T) if time(T) and current_floor(F) and elevator_button_pushed(G, S) and call(S=<T) and door(closed) and call(F>G) then not current_floor(F) and call(H is F-1) and current_floor(H) and call(Q is T+1) and time(Q) and not time(T). %% Move because of button on floor pushed (priority number 2) rule move_up_to(H, T) if time(T) and current_floor(F) and floor_button_pushed(G, S) and call(S=<T) and door(closed) and call(F<G) then not current_floor(F) and call(H is F+1) and current_floor(H) and call(Q is T+1) and time(Q) and not time(T). rule move_down_to(H, T) if time(T) and current_floor(F) and floor_button_pushed(G, S) and call(S=<T) and door(closed) and call(F>G) then not current_floor(F) and call(H is F-1) and current_floor(H) and call(Q is T+1) and time(Q) and not time(T). rule time_goes(T) if time(T) then call(Q is T+1) and time(Q) and not time(T). Lenke til kommentar
Anbefalte innlegg