chiark / gitweb /
wip new safety
authorian <ian>
Sat, 19 Apr 2008 00:13:50 +0000 (00:13 +0000)
committerian <ian>
Sat, 19 Apr 2008 00:13:50 +0000 (00:13 +0000)
hostside/safety.c
hostside/safety.h

index 2ae6eda8491479e76a3cd79152a9e47e42275028..d676e8ad9dc080f668ceb9a480bc07c60399ce64 100644 (file)
@@ -89,49 +89,56 @@ Segment *segments;
  * the new ownership.
  *
  * If not then we issue an signal stop command (we'd better not be
- * doing that already!) or countermand the speed increase or whatever */
-
- * Having advanced the head, we 
-
- owner         train which owns this for signalling purposes
-               no other train may interfere
-
- physical      in an unowned segment, this has no particular
- feature               relationship to anything
-  &
- movposcomb    in an owned segment, if moving, means that
-  &                    we have a promise that the feature
- moving                        will be OK by the time we get there
-                       at our current speed
-
- move_reservation
-               0 for unowned segments (although during prediction
-                       may be non-0 for a bit, in which case
-                       we garbage collect it in a bit)
-
-               for an owned segment is our reservation which
-                       allows us to know that we are going to
-                       be able to change this segment between
-                       the tail leaving it and the head arriving
-
- det_ignore    we expect interference detection here due to a crossing
-                       (unowned segment)
-               or this is part of the body of a train which we've
-                       already detected here (owned segment)
-
- det_expected  this is the next place we expect owner train to arrive
-               (it is not valid to have both det_ignore and _expected)
-
-VALID DURING PREDICTION ETC. ONLY
-
- pred_present  in our prediction, the train physically occupies this
-               until_here tells us when will be
-
- pred_vacated   in our prediction, the train does not occupy this
-                       although it did in previous predictions
-               until_here tells us when it will have been vacated
-               if set together with pred_present, means was vacated
-                       and then reentered; do not record vacation again
+ * doing that already!) or countermand the speed increase or whatever
+ */
+/*
+ * Here is how we use the stuff in the Segment:
+ *
+ *  owner              train which owns this for signalling purposes
+ *                             no other train may interfere
+ * 
+ *  physical           in an unowned segment, this has no particular
+ *  feature                    relationship to anything
+ *   &
+ *  movposcomb         in an owned segment, if moving, means that
+ *   &                         we have a promise that the feature
+ *  moving                     will be OK by the time we get there
+ *                             at our current speed
+ * 
+ *  move_reservation   0 for unowned segments (although during prediction
+ *                             may be non-0 for a bit, in which case
+ *                             we garbage collect it in a bit)
+ * 
+ *                     for an owned segment is our reservation which
+ *                             allows us to know that we are going to
+ *                             be able to change this segment between
+ *                             the tail leaving it and the head arriving
+ * 
+ *  det_ignore         we expect interference detection here due to a
+ *                             crossing (unowned segment), or
+ *                     this is part of the body of a train which we've
+ *                             already detected here (owned segment)
+ * 
+ *  det_expected       this is the next place we expect owner train
+ *                             to arrive
+ *                     (it is not valid to have both det_ignore
+ *                      and _expected)
+ * 
+ * VALID DURING PREDICTION ETC. ONLY
+ * 
+ *  pred_present       in our prediction, the train physically occupies this
+ *                             until_here tells us when will be
+ * 
+ *  pred_vacated       in our prediction, the train does not occupy this
+ *                             although it did in previous predictions
+ *                     until_here tells us when it will have been vacated
+ *                     if set together with pred_present, means was vacated
+ *                             and then reentered; do not record vacation
+ *                             again
+ *
+ *                     iff either of these is set, this train is going
+ *                             to own the segment when we're finished
+ */
 
 /* ============ OLD CODE ========== */
 
index f99f12b7ae83d6e6726caeff10d6e5dcc48e18fd..66de2ac0622df7183e1cdd360fe201b315474ff2 100644 (file)
@@ -69,10 +69,7 @@ struct Segment {
     ho_backwards:1, /* home train has its front and rear backwards wrt track */
     cm_autostop:1, /* train should stop on detection */
     seg_inverted:1, /* polarity is inverted */
-    det_ignore:1,
-    det_expected:1,
-    pred_enter:1, /* for use by safety.c:lay_train etc.; otherwise 0 */
-    pred_vacate:1, /* for use by safety.c:lay_train etc.; otherwise 0 */
+    det_ignore:1, det_expected:1, pred_enter:1, pred_vacate:1, /* safety.c */
     res_detect:1; /* detection noticed here during resolution */
   TimeInterval until_here; /* ) nonnegative; */  /* ) always valid but      */
                            /* ) 0 if already */  /* )  meaningful iff owner */