exercise_3_1 : THEORY BEGIN D : real = 5*1852 % [m] T : real = 5*60 % [s] IMPORTING CDR2D[D,T] Identifier : TYPE = string % % Exercise 1 % % Define a type of aircraft with an identifier, a 2D position, and a 2D velocity AircraftXY : TYPE % = ... % Define an example of an AircraftXYZ ac0 : AircraftXY % = ... IMPORTING NAS[Identifier,AircraftXY] % Define cdnas such that it returns true if there is a traffic aircraft % that is in conflict_ever with the ownship cdnas(ownid:Identifier,nas:(exists?(ownid))) : bool % = ... END exercise_3_1 exercise_3_2 : THEORY BEGIN % % Exercise 2 % D : real = 5*1852 % [m] T : real = 5*60 % [s] IMPORTING CDR2D[D,T] Identifier : TYPE = string AircraftGeo : TYPE = [# id : Identifier, lat : {x:real | -90 <= x AND x <= 90}, lon : {x:real | abs(x) < 360}, gs : posreal, % Ground speed [m/s] trk : {x:real | abs(x) < 360} % Track [True North] #] IMPORTING vectors@ECEF, vectors@vect3_basis, vectors@trackAngles_2D % Radius of the earth R : posreal = 6353000 % [m] geo2sxy(lat_ref,lon_ref:real)(lat,lon:real) : Position = LET midlat = (lat_ref+lat)/2, midlon = (lon_ref+lon)/2, refxyz = spherical2xyz(R,midlat,midlon), pxyz = spherical2xyz(R,lat,lon) IN sphere_to_2D_plane(refxyz)(pxyz) gstrk2vxy(gs:posreal,trk:real): AbsVelocity = v_from(trk,gs) IMPORTING NAS[Identifier,AircraftGeo] % Define cdnas such that it returns true if there is a traffic aircraft % that is in conflict_ever with the ownship cdnas(ownid:Identifier,nas:(exists?(ownid))) : bool % = ... END exercise_3_2