Contact Graph Routing for time-varying satellite networks
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

cgr: Fix arrival time calculation for query time

The arrival_time function was using departure_time (contact start) as the
initial time, but should use start_time (query time when we were at the
source). This caused incorrect arrival times when the query time was after
a contact's start time.

Found by fuzz testing.

+20 -4
+17 -4
lib/cgr.ml
··· 103 103 (* Routes *) 104 104 105 105 module Route = struct 106 - type t = { hops : Contact.t list; src : Node.t; dst : Node.t } 106 + type t = { 107 + hops : Contact.t list; 108 + src : Node.t; 109 + dst : Node.t; 110 + start_time : float; 111 + } 107 112 108 113 let hops t = t.hops 109 114 let src t = t.src 110 115 let dst t = t.dst 116 + let start_time t = t.start_time 111 117 112 118 let departure_time t = 113 - match t.hops with [] -> 0. | c :: _ -> Contact.start c 119 + match t.hops with [] -> t.start_time | c :: _ -> Contact.start c 114 120 115 121 let arrival_time t = 116 122 let rec last_arrival time = function ··· 122 128 let arrival = tx_start +. Contact.owlt c in 123 129 last_arrival arrival rest 124 130 in 125 - last_arrival (departure_time t) t.hops 131 + (* Start with the time we arrive at source (the query time) *) 132 + last_arrival t.start_time t.hops 126 133 127 134 let capacity t = 128 135 match t.hops with ··· 272 279 | Some contact -> build_path (Contact.from contact) (contact :: acc) 273 280 in 274 281 let path = build_path dst [] in 275 - Some { Route.hops = path; src = state.src; dst } 282 + Some 283 + { 284 + Route.hops = path; 285 + src = state.src; 286 + dst; 287 + start_time = state.start_time; 288 + } 276 289 end 277 290 278 291 (* High-level routing *)
+3
lib/cgr.mli
··· 185 185 val dst : t -> Node.t 186 186 (** [dst route] is the destination node. *) 187 187 188 + val start_time : t -> float 189 + (** [start_time route] is the query time (when we were at the source). *) 190 + 188 191 val departure_time : t -> float 189 192 (** [departure_time route] is when transmission should begin. *) 190 193