Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %This module will handle the exploration of additional monitoring
- % information that is necessary for error identification.
- :-ensure_loaded('RTXutil.pl').
- :-dynamic x_before/1.
- :-dynamic y_before/1.
- :-dynamic z_before/1.
- :-dynamic x_is_near/1.
- :-dynamic z_is_near/1.
- :-dynamic y_is_near/1.
- :-dynamic up/2.
- :-dynamic down/2.
- %define your new facts for monitoring operations here
- %pick aditional information as described in [SupInt-5-2019.pdf]
- monitoring:-
- x_is_at(X),
- \+ x_before(X),
- %retracts previous facts x_before(_) and assert to the newest x_before(X)
- assert_once(x_before(X)).
- %asserting betweeness for xx axis
- monitoring:-
- \+ x_is_at(_), % xx is not on a sensor position
- x_before(X),
- x_moving(1), %% moving to the right
- Xbetween is X +0.5,
- assert_once(x_is_near(Xbetween)).
- monitoring:-
- \+ x_is_at(_), % xx is not on a sensor position
- x_before(X),
- x_moving(-1), %% moving to the left
- Xbetween is X -0.5,
- assert_once(x_is_near(Xbetween)).
- %asserting betweeness for zz axis
- monitoring:-
- \+ z_is_at(_), % zz is not on a sensor position
- z_before(Z),
- z_moving(1), %% moving up
- Zbetween is Z +0.5,
- assert_once(z_is_near(Zbetween)).
- monitoring:-
- \+ z_is_at(_), % zz is not on a sensor position
- z_before(Z),
- z_moving(-1), %% moving down
- Zbetween is Z -0.5,
- assert_once(z_is_near(Zbetween)).
- monitoring:-
- z_is_at(Z),
- \+z_before(Z),
- assert_once(z_was_at(Z)).
- % monitor each situation HERE, with more monitoring rules, like the previous
- %asserting betweeness for yy axis
- monitoring:-
- \+ y_is_at(_), % yy is not on a sensor position
- y_before(Y),
- y_moving(1), %% moving inside
- Ybetween is Y +0.5,
- assert_once(y_is_near(Ybetween)).
- monitoring:-
- \+ y_is_at(_), % yy is not on a sensor position
- y_before(Y),
- y_moving(-1), %% moving outside
- Ybetween is Y -0.5,
- assert_once(y_is_near(Ybetween)).
- monitoring:-
- y_is_at(Y),
- \+ y_before(Y),
- %retracts previous facts y_before(_) and assert to the newest y_before(Y)
- assert_once(y_before(Y)).
- monitoring:- %time up events
- %List of states that we need to UP events
- List = [x_is_at(_), y_is_at(_), z_is_at(_) /*other states*/],
- findall(__IGNORE,
- (
- member(State, List),
- ( State,
- \+up(State, _),
- currTimeMili(T),
- assert( up(State, T))
- ; %OR
- \+State,
- retractall(up(state, _))
- )
- ),___IGNORE).
- monitoring:- %time up events
- %List of states that we need to UP events
- List = [x_is_at(_), y_is_at(_), z_is_at(_) /*other states*/],
- findall(__IGNORE,
- (
- member(State, List),
- ( State,
- \+down(State, _),
- currTimeMili(T),
- assert( down(State, T))
- ; %OR
- \+State,
- retractall(down(state, _))
- )
- ),____IGNORE).
- save_warehouse_states:-
- tell('kbase/warehouse_saved.pl'),
- listing(x_is_near),
- listing(x_before),
- listing(z_is_near),
- listing(z_before),
- listing(y_is_near),
- listing(y_before),
- %other facts like: listing(cell)
- told.
- currTimeMili(Time):-
- get_time(CurrTime),
- Time is CurrTime*1000.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement