From: ian Date: Sat, 19 Apr 2008 00:13:50 +0000 (+0000) Subject: wip new safety X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=5e2c972fc896f163f345d9f05569b4084e88dae7;p=trains.git wip new safety --- diff --git a/hostside/safety.c b/hostside/safety.c index 2ae6eda..d676e8a 100644 --- a/hostside/safety.c +++ b/hostside/safety.c @@ -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 ========== */ diff --git a/hostside/safety.h b/hostside/safety.h index f99f12b..66de2ac 100644 --- a/hostside/safety.h +++ b/hostside/safety.h @@ -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 */