-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAircraftPair.pd
More file actions
48 lines (32 loc) · 1.48 KB
/
AircraftPair.pd
File metadata and controls
48 lines (32 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//*******************************************************
//* File: C:/Users/User/Desktop/Third Year Project/CollisionAvoidanceSystem/AircraftPair.pd
//* Author: Varuna
//* Created: 15:53:34 on Sunday January 25th 2015 UTC
//*******************************************************
class AircraftPair ^=
abstract
var craft1 : Aircraft;
var craft2 : Aircraft;
invariant craft1 ~= craft2;
interface
function craft1;
function craft2;
function getConflictStatus : ConflictStatus
^= craft1.getConflictStatus(craft2)
assert result = craft2.getConflictStatus(craft1);
function timeToConflict : real
^= craft1.timeToConflict(craft2);
function getMovementToPreventConflict : string
pre getConflictStatus = ConflictStatus PotentialFutureConflict
^= "Alter altitude of " ++ craft1.identification ++ " to " ++
([craft1.position.z > craft2.position.z] : (craft1.position.z + (craft1.getMinimumVerticalSeparation(craft2) - craft1.getHeightDifference(craft2))).toString,
[] : (craft1.position.z - (craft1.getMinimumVerticalSeparation(craft2) - craft1.getHeightDifference(craft2))).toString) ++ " meters";
function breaksMinimumVerticalSeparation : bool
^= craft1.breaksMinimumVerticalSeparation(craft2);
redefine function toString : string
^= "Craft 1 <br>" ++ craft1.toString ++ "<br> Craft 2 <br>" ++ craft2.toString;
operator ~~ (other)
^= timeToConflict ~~ other.timeToConflict;
build{!craft1 : Aircraft, !craft2 : Aircraft}
pre craft1 ~= craft2;
end;