Presentation is loading. Please wait.

Presentation is loading. Please wait.

11/5 - 20071 VIP Elevator – first model A VDM++ Project Made By: Sune Wolff.

Similar presentations


Presentation on theme: "11/5 - 20071 VIP Elevator – first model A VDM++ Project Made By: Sune Wolff."— Presentation transcript:

1 11/5 - 20071 VIP Elevator – first model A VDM++ Project Made By: Sune Wolff

2 11/5 - 20072 System Summary VIP and neighbours share elevator. Elevator moves between 5 floors. Call buttons used to call elevator. VIP has door sensor installed Turnstiles can be used to restrict access to the neighbours. VIP do not like to share the elevator. VIP do not like to wait to long.

3 11/5 - 20073 Class Diagram

4 11/5 - 20074 World class World instance variables private environment: Environment; operations public World: () ==> World World() == (environment := new Environment(5); ); public Run: () ==> () Run() == is not yet specified; end World

5 11/5 - 20075 Environment class Environment instance variables private elevator: Elevator; operations public Environment: (nat) ==> Environment Environment(max) == (elevator := new Elevator(max); ); end Environment

6 11/5 - 20076 Elevator instance variables private currentFloor: Floor := ; private numNeighboursInside: nat := 0; private numVipInside: nat := 0; private maxUsersInside: nat; private innerQueue: Queue := new Queue(3); private outerQueue: Queue := new Queue(3); private tsController: Turnstile := new Turnstile(false); types public Floor = | | | | ; public VipFloor = | ; public User = | ;

7 11/5 - 20077 Queue instance variables private elevatorQueue: seq of Elevator`Floor := []; private maxInQueue: nat; private VipQueue: Elevator`Floor; public VipInQueue: bool := false; public PutInQueue: Elevator`Floor * Elevator`User ==> () PutInQueue(f, u) == (if (u = ) then (VipInQueue := true; VipQueue := f) else (elevatorQueue := elevatorQueue ^ [f]); ) pre (len elevatorQueue < maxInQueue) post (len elevatorQueue = len elevatorQueue~ + 1); Notice the use of sequence concatenation

8 11/5 - 20078 Queue public GetNextFromQueue: () ==> Elevator`Floor GetNextFromQueue() == (dcl tempQueue : Elevator`Floor; if (len elevatorQueue = 0 and VipInQueue = true) then return VipQueue; if (VipInQueue = false) then (tempQueue := elevatorQueue(1); elevatorQueue := tl elevatorQueue); return tempQueue; ) pre (len elevatorQueue > 0) or (VipInQueue = true) post (len elevatorQueue = len elevatorQueue~ - 1); Notice use of sequence tail operator

9 11/5 - 20079 Turnstile class Turnstile instance variables private locked: bool; operations public Turnstile: bool ==> Turnstile Turnstile(l) == (locked := l); public IsTurnstileLocked: () ==> bool IsTurnstileLocked() == (return locked); public LockTurnstile: () ==> () LockTurnstile () == (locked := true) pre locked = false post locked = true; public UnlockTurnstile: () ==> () UnlockTurnstile () == (locked := false) pre locked = true post locked = false; end Turnstile

10 11/5 - 200710 Class Diagram

11 11/5 - 200711 Future Improvements Introduce classes for buttons and sensors  Make use of mapping Make elevator more intelligent  Keep track of direction  Choose next floor based on direction and distance Introduce automatic test  Read test sequence from file Make sure the VIP receives special treatment  No neighbours in elevator when VIP wants to use it  Execute VIP order as soon as possible


Download ppt "11/5 - 20071 VIP Elevator – first model A VDM++ Project Made By: Sune Wolff."

Similar presentations


Ads by Google