-- -- Model of Digital ATC Database(1 & 2 /3) -- Track Circuits and Routes -- -- ver 1. 2000.4.11 by n. terada -- ver 2. 2000.6.14 by n. terada -- ver 2.3 2000.6.26 by n. terada -- ver 3 2000.8.16 by n. terada -- ver 4 2000.9.13 by n. terada -- ver 4.5 2000.9.15 by n. terada -- ver 4.6 2000.10.11 by n. terada -- ver 4.61 2001.2.5 by n.terada -- track circuits -- basic unit -- types
TrackC:: joints : map Joint_id to Joint
atc : map Direction to ATC
td : TD
atbt : ATBT inv tc == carddom tc.joints > 1 and dom tc.atc = {<ADIR>, <BDIR>} and
TD_Used_for_NonInsulated_TrackC(tc.td, tc.atbt, rng tc.joints) and
(tc.atc(<ADIR>).used and tc.atc(<BDIR>).used =>
tc.atc(<ADIR>).carrier <> tc.atc(<BDIR>).carrier);
-- -- joint -- connection between two track circuits --
Joint_id = token;
Joint:: position : nat
insulated : Insulation
remark : Remark;
Insulation = bool; -- true if joint is insulated
Remark :: atc_terminal : map Direction tobool-- true if atc is terminated
line_terminal : bool-- true if line terminated inv rm == dom rm.atc_terminal = {<ADIR>, <BDIR>};
Direction = <ADIR> | <BDIR>; -- -- carrier of track circuits -- atc signal , td(train detection signal) --
ATC :: used : bool-- true if Digital ATC is used
carrier : token;
TD :: used : bool-- true if TD is used
carrier : token;
Adjacent_TD_Carrier_Differ : TD * ATBT * TD * ATBT * Insulation -> bool
Adjacent_TD_Carrier_Differ(td1, atbt1, td2, atbt2, insulated) ==
(insulated or
td1.carrier <> td2.carrier and
(atbt1 <> atbt2 or atbt1 = <AT> and atbt2 = <AT>)); -- -- end of track circuit --
-- -- paths in track circuits -- types
Path:: tc : TrackC_id start : Joint_id
endp : Joint_id
length : nat
used : map Direction tobool
condition : setof Condition inv p == p.start <> p.endp and dom p.used = {<ADIR>, <BDIR>} and
(exists dr insetdom p.used & p.used(dr)) and
(forall c1, c2 inset p.condition & Condition_not_Conflict(c1, c2)); -- start.position < endp.position is added at inv_Area
Condition :: kind : Cond_Kind start : nat
endp : nat
speed : nat-- only used for <LIMIT>
permill : nat-- should be integer or real inv con == con.start < con.endp;
Cond_Kind = <LIMIT> | <GRADIENT> | <SECTION>;
functions
Condition_not_Conflict : Condition * Condition -> bool
Condition_not_Conflict(c1, c2) ==
(c1 <> c2 and c1.kind = c2.kind and c1.kind <> <LIMIT>) => not Overlap(c1, c2);
functions
Not_Same_Path : Path * Path -> bool
Not_Same_Path(p1, p2) == not (p1.start = p2.startand p1.endp = p2.endp) and not (p1.start = p2.endp and p1.endp = p2.start); -- It is possible to allow the case p1.tc <> p2.tc -- but that is not practical, so it is not allowed here.
-- next function is related with signal
Exists_ATC_for_Route : TrackC_map * Path_map * Route -> bool
Exists_ATC_for_Route(trackcs, paths, r) == forall pid inseq r.paths &
paths(pid).tc insetdom trackcs and
trackcs(paths(pid).tc).atc(r.dr).used pre Path_Exists(paths, r.paths, r.dr);
Route_not_Circular : Path_map * Route-> bool
Route_not_Circular(paths, r) == forall i, j insetinds r.paths &
i <> j => paths(r.paths(i)).tc <> paths(r.paths(j)).tc pre Path_Exists(paths, r.paths, r.dr);
-- -- Operation of Data Base (Area Level) --
Add_TrackC : Area * TrackC_id * TrackC -> Area
Add_TrackC(ar, tcid, tc) == mu(ar, trackcs |-> ar.trackcs ++ {tcid |-> tc}) pre tcid notinsetdom ar.trackcs and forall jid insetdom tc.joints &
Only_One_Next_TrackC(ar.trackcs, tcid, jid) and forall tcid1 insetdom ar.trackcs &
Joint_and_Next_TrackC(tc, ar.trackcs(tcid1), jid) post tcid insetdomRESULT.trackcs and RESULT.trackcs = ar.trackcs ++ {tcid |-> tc} and RESULT.trackcs(tcid) = tc and RESULT.paths = ar.paths and RESULT.routes = ar.routes;
Del_TrackC : Area * TrackC_id -> Area
Del_TrackC(ar, tcid) == mu(ar, trackcs |-> {tcid} <-: ar.trackcs) pre tcid insetdom ar.trackcs and forall p insetrng ar.paths & p.tc <> tcid post tcid notinsetdomRESULT.trackcs and RESULT.trackcs = {tcid} <-: ar.trackcs and RESULT.paths = ar.paths and RESULT.routes = ar.routes;
Add_Joint : Area * TrackC_id * Joint_id * Joint -> Area
Add_Joint(ar, tid, jid, joint) == let tc = ar.trackcs(tid) in mu(ar, trackcs |-> ar.trackcs ++ {tid |-> mu(tc, joints |-> tc.joints ++ {jid |-> joint})}) pre tid insetdom ar.trackcs and let tc = ar.trackcs(tid) in
jid notinsetdom tc.joints and
TD_Used_for_NonInsulated_TrackC(tc.td, tc.atbt, rng tc.joints union {joint}) and
Only_One_Next_TrackC(ar.trackcs, tid, jid) and forall tid1 insetdom ar.trackcs & tid1 <> tid =>
Joint_and_Next_TrackC(ar.trackcs(tid1), mu(tc,joints |-> tc.joints ++ {jid |-> joint}), jid) post tid insetdomRESULT.trackcs and
jid insetdomRESULT.trackcs(tid).joints and domRESULT.trackcs = dom ar.trackcs and
{tid} <-: RESULT.trackcs = {tid} <-: ar.trackcs and RESULT.trackcs(tid) = mu(ar.trackcs(tid),
joints |-> ar.trackcs(tid).joints ++ {jid |-> joint}) and RESULT.trackcs(tid).joints(jid) = joint and RESULT.trackcs(tid).atc = ar.trackcs(tid).atc and RESULT.trackcs(tid).td = ar.trackcs(tid).td and RESULT.trackcs(tid).atbt = ar.trackcs(tid).atbt and RESULT.paths = ar.paths and RESULT.routes = ar.routes
;
Del_Joint : Area * TrackC_id * Joint_id -> Area
Del_Joint(ar, tcid, jid) == let tc = ar.trackcs(tcid) in mu(ar, trackcs |-> ar.trackcs ++
{tcid |-> mu(tc, joints |-> {jid} <-: tc.joints)}) pre tcid insetdom ar.trackcs and
jid insetdom ar.trackcs(tcid).joints and carddom ar.trackcs(tcid).joints > 2 and
(forall path insetrng ar.paths &
path.tc <> tcid or
jid <> path.startand jid <> path.endp) post tcid insetdomRESULT.trackcs and domRESULT.trackcs = dom ar.trackcs and
{tcid} <-: RESULT.trackcs = {tcid} <-: ar.trackcs and
jid notinsetdomRESULT.trackcs(tcid).joints and RESULT.trackcs(tcid) = mu(ar.trackcs(tcid),
joints |-> {jid} <-: ar.trackcs(tcid).joints) and RESULT.trackcs(tcid).atc = ar.trackcs(tcid).atc and RESULT.trackcs(tcid).td = ar.trackcs(tcid).td and RESULT.trackcs(tcid).atbt = ar.trackcs(tcid).atbt and RESULT.trackcs(tcid).joints = {jid} <-: ar.trackcs(tcid).joints and RESULT.paths = ar.paths and RESULT.routes = ar.routes
;
Add_Path : Area * Path_id * Path -> Area
Add_Path(ar, pid, path) == mu(ar, paths |-> ar.paths ++ {pid |-> path}) pre pid notinsetdom ar.paths and
Path_within_TrackC(ar.trackcs, path) and
Direction_Correct(ar.trackcs, path) and forall p insetrng ar.paths &
Not_Same_Path(p, path) and Not_Start_and_End(p, path) post pid insetdomRESULT.paths and RESULT.paths = ar.paths ++ {pid |-> path} and RESULT.paths(pid) = path and RESULT.trackcs = ar.trackcs and RESULT.routes = ar.routes;
Del_Path : Area * Path_id -> Area
Del_Path(ar, pid) == mu(ar, paths |-> {pid} <-: ar.paths) pre pid insetdom ar.paths and forall r insetrng ar.routes & pid notinsetelems r.paths post pid notinsetdomRESULT.paths and RESULT.paths = {pid} <-: ar.paths and RESULT.trackcs = ar.trackcs and RESULT.routes = ar.routes;
Add_Route : Area * Route_id * Route -> Area
Add_Route (ar, rid, r) == mu(ar, routes |-> ar.routes ++ {rid |-> r}) pre rid notinsetdom ar.routes and
Path_Exists(ar.paths, r.paths, r.dr) and
Exists_ATC_for_Route(ar.trackcs, ar.paths, r) and
Route_not_Circular(ar.paths, r) and
Path_Connected(ar.paths, r.paths, r.dr) post rid insetdomRESULT.routes and RESULT.routes = ar.routes ++ {rid |-> r} and RESULT.routes(rid) = r and RESULT.trackcs = ar.trackcs and RESULT.paths = ar.paths;
Del_Route : Area * Route_id -> Area
Del_Route(ar, rid) == mu(ar, routes |-> {rid} <-: ar.routes) pre rid insetdom ar.routes post rid notinsetdomRESULT.routes and RESULT.routes = {rid} <-: ar.routes and RESULT.trackcs = ar.trackcs and RESULT.paths = ar.paths;
Add_Condition : Area * Path_id * Condition -> Area
Add_Condition(ar, pid, con) == let p = mu(ar.paths(pid),
condition |-> ar.paths(pid).condition union {con}) in mu(ar, paths |-> ar.paths ++ {pid |-> p}) pre pid insetdom ar.paths and let p = ar.paths(pid) in
ar.trackcs(p.tc).joints(p.start).position <= con.startand
con.endp <= ar.trackcs(p.tc).joints(p.endp).position and
(forall c inset p.condition & Condition_not_Conflict(c, con))
post pid insetdomRESULT.paths and domRESULT.paths = dom ar.paths and
{pid} <-: RESULT.paths = {pid} <-: ar.paths and RESULT.paths(pid) = mu(ar.paths(pid),
condition |-> ar.paths(pid).condition union {con}) and RESULT.paths(pid).start = ar.paths(pid).startand RESULT.paths(pid).endp = ar.paths(pid).endp and RESULT.paths(pid).tc = ar.paths(pid).tc and RESULT.paths(pid).length = ar.paths(pid).length and RESULT.paths(pid).condition = ar.paths(pid).condition union {con} and RESULT.trackcs = ar.trackcs and RESULT.routes = ar.routes
;
Del_Condition : Area * Path_id * Cond_Kind * nat * nat -> Area
Del_Condition(ar, pid, kind, start, endp) == let p = mu(ar.paths(pid), condition |->
{l | l inset ar.paths(pid).condition & not (l.kind = kind and l.start = startand l.endp = endp)}) in mu(ar, paths |-> ar.paths ++ {pid |-> p}) pre pid insetdom ar.paths and
(exists c inset ar.paths(pid).condition &
c.kind = kind and c.start = startand c.endp = endp) post pid insetdomRESULT.paths and domRESULT.paths = dom ar.paths and
{pid} <-: RESULT.paths = {pid} <-: ar.paths and RESULT.paths(pid) = mu(ar.paths(pid), condition |->
{l | l inset ar.paths(pid).condition & not (l.kind = kind and l.start = startand l.endp = endp)}) and RESULT.paths(pid).start = ar.paths(pid).startand RESULT.paths(pid).endp = ar.paths(pid).endp and RESULT.paths(pid).tc = ar.paths(pid).tc and RESULT.paths(pid).length = ar.paths(pid).length and RESULT.trackcs = ar.trackcs and RESULT.routes = ar.routes
;
-- -- end of Operation (Area level) --
types -- -- Line -- collection of Areas -- --
Line :: areas : Area_map
connect : Connect_map -- ver : Version -- -- edit_date : Date -- These 4 fields are -- valid_date : Date -- to be used version control system. -- locked : bool -- inv mk_Line(areas, connect) == forall c insetdom connect &
(forall n inset c & Area_Joint_Exists(areas, n)) and
(forall n1, n2 inset c & n1 <> n2 =>
Direction_for_Area_Joint(areas(n1.aid).paths, n1.no,
areas(n2.aid).paths, n2.no, connect(c).chng_direction) and let tc1 = areas(n1.aid).trackcs(n1.tcid),
tc2 = areas(n2.aid).trackcs(n2.tcid) in
Joint_Compatible(tc1.joints(n1.no), tc2.joints(n2.no),
connect(c)) and
Is_wf_adjacent_signal(tc1, n1.no, tc2, n2.no,
connect(c).chng_direction));
Area_map = map Area_id to Area;
Area_id = token;
-- (Plan) -- Area_id :: lid : nat -- aid : nat
-- -- connection between two areas --
Area_Joint :: aid : Area_id
tcid : TrackC_id
no : Joint_id;
Connect = setof Area_Joint inv con == card con = 2 and forall a1, a2 inset con & a1 <> a2 => a1.aid <> a2.aid;
Connect_map = map Connect to Remark_Connect inv con == forall a1, a2 insetdom con & a1 <> a2 => a1 inter a2 = {};
Add_Area : Line * Area_id * Area_Kind * MaxSpeed -> Line
Add_Area(ln, aid, kind, max) == mu(ln, areas |-> ln.areas ++ {aid |-> mk_Area({|->}, {|->}, {|->}, kind, max)}) pre aid notinsetdom ln.areas post aid insetdomRESULT.areas and RESULT.connect = ln.connect;
Change_Area : Line * Area_id * Area -> Line
Change_Area(ln, aid, area) == mu(ln, areas |-> ln.areas ++ {aid |-> area}) pre aid insetdom ln.areas and
inv_Line(mk_Line(ln.areas ++ {aid |-> area}, ln.connect)) postRESULT.areas(aid) = area and RESULT.connect = ln.connect;
Del_Area : Line * Area_id -> Line
Del_Area(ln, aid) == mu(ln, areas |-> {aid} <-: ln.areas) pre aid insetdom ln.areas and
(forall c insetdom ln.connect & forall aj inset c & aj.aid <> aid) post aid notinsetdomRESULT.areas and RESULT.connect = ln.connect;
Add_Connect : Line * Connect * Remark_Connect -> Line
Add_Connect(ln, con, r) == mu(ln, connect |-> ln.connect ++ {con |-> r}) pre (forall c insetdom ln.connect & c inter con = {}) and
(forall n inset con & Area_Joint_Exists(ln.areas, n)) and
(forall n1, n2 inset con & n1 <> n2 =>
Direction_for_Area_Joint(ln.areas(n1.aid).paths, n1.no,
ln.areas(n2.aid).paths, n2.no, r.chng_direction) and let tc1 = ln.areas(n1.aid).trackcs(n1.tcid),
tc2 = ln.areas(n2.aid).trackcs(n2.tcid) in
Joint_Compatible(tc1.joints(n1.no), tc2.joints(n2.no), r) and
Is_wf_adjacent_signal(tc1,n1.no, tc2, n2.no, r.chng_direction))
post con insetdomRESULT.connect and RESULT.connect = ln.connect ++ {con |-> r} and RESULT.connect(con) = r and RESULT.areas = ln.areas
;
Del_Connect : Line * Area_Joint -> Line
Del_Connect(ln, n) == mu(ln, connect |->
{c |-> ln.connect(c) | c insetdom ln.connect & n notinset c}) preexists c insetdom ln.connect & n inset c postforall c insetdomRESULT.connect & n notinset c and RESULT.areas = ln.areas; functions
Line_Add_TrackC : Line * Area_id * TrackC_id * TrackC -> Line
Line_Add_TrackC(ln, aid, tcid, tc) == mu(ln, areas |-> ln.areas ++
{aid |-> Add_TrackC(ln.areas(aid), tcid, tc)}) pre aid insetdom ln.areas and
pre_Add_TrackC(ln.areas(aid), tcid, tc) and
(forall jid insetdom tc.joints & forall c insetdom ln.connect & forall n inset c &
n.aid = aid => n.no <> jid) post aid insetdomRESULT.areas and dom ln.areas = domRESULT.areas and
{aid} <-: RESULT.areas = {aid} <-: ln.areas and
tcid insetdomRESULT.areas(aid).trackcs and RESULT.areas(aid).trackcs =
ln.areas(aid).trackcs ++ {tcid |-> tc} and RESULT.areas(aid).trackcs(tcid) = tc and RESULT.connect = ln.connect;
Line_Del_TrackC : Line * Area_id * TrackC_id -> Line
Line_Del_TrackC(ln, aid, tcid) == mu(ln, areas |-> ln.areas ++
{aid |-> Del_TrackC(ln.areas(aid), tcid)}) pre aid insetdom ln.areas and
pre_Del_TrackC(ln.areas(aid), tcid) and forall c insetdom ln.connect & forall aj inset c &
aj.aid = aid => aj.tcid <> tcid post aid insetdomRESULT.areas and dom ln.areas = domRESULT.areas and
{aid} <-: RESULT.areas = {aid} <-: ln.areas and RESULT.areas(aid).trackcs = {tcid} <-: ln.areas(aid).trackcs and
tcid notinsetdomRESULT.areas(aid).trackcs and RESULT.connect = ln.connect;
Line_Add_Joint : Line * Area_id * TrackC_id * Joint_id * Joint -> Line
Line_Add_Joint(ln, aid, tcid, jid, j) == mu(ln, areas |-> ln.areas ++
{aid |-> Add_Joint(ln.areas(aid), tcid, jid, j)}) pre aid insetdom ln.areas and
pre_Add_Joint(ln.areas(aid), tcid, jid, j) and
(forall c insetdom ln.connect & forall n inset c &
n.aid = aid => n.no <> jid) post aid insetdomRESULT.areas and
tcid insetdomRESULT.areas(aid).trackcs and
jid insetdomRESULT.areas(aid).trackcs(tcid).joints and domRESULT.areas = dom ln.areas and
{aid} <-: RESULT.areas = {aid} <-: ln.areas and domRESULT.areas(aid).trackcs = dom ln.areas(aid).trackcs and
{tcid} <-: RESULT.areas(aid).trackcs =
{tcid} <-: ln.areas(aid).trackcs and RESULT.areas(aid).trackcs(tcid).joints =
ln.areas(aid).trackcs(tcid).joints ++ {jid |-> j} and RESULT.areas(aid).trackcs(tcid).joints(jid) = j and RESULT.connect = ln.connect;
Line_Del_Joint : Line * Area_id * TrackC_id * Joint_id -> Line
Line_Del_Joint(ln, aid, tcid, jid) == mu(ln, areas |-> ln.areas ++
{aid |-> Del_Joint(ln.areas(aid), tcid, jid)}) pre aid insetdom ln.areas and
pre_Del_Joint(ln.areas(aid), tcid, jid) and forall c insetdom ln.connect & forall aj inset c &
(aj.aid = aid and aj.tcid = tcid) => aj.no <> jid post aid insetdomRESULT.areas and
tcid insetdomRESULT.areas(aid).trackcs and
jid notinsetdomRESULT.areas(aid).trackcs(tcid).joints and domRESULT.areas = dom ln.areas and
{aid} <-: RESULT.areas = {aid} <-: ln.areas and domRESULT.areas(aid).trackcs = dom ln.areas(aid).trackcs and
{tcid} <-: RESULT.areas(aid).trackcs =
{tcid} <-: ln.areas(aid).trackcs and RESULT.areas(aid).trackcs(tcid).joints =
{jid} <-: ln.areas(aid).trackcs(tcid).joints and RESULT.connect = ln.connect;
Line_Add_Path : Line * Area_id * Path_id * Path -> Line
Line_Add_Path(ln, aid, pid, p) == mu(ln, areas |-> ln.areas ++
{aid |-> Add_Path(ln.areas(aid), pid, p)}) pre aid insetdom ln.areas and
pre_Add_Path(ln.areas(aid), pid, p) and forall c insetdom ln.connect & forall n1, n2 inset c &
(n1 <> n2 and n1.aid = aid) =>
Direction_for_Area_Joint({pid |-> p}, n1.no,
ln.areas(n2.aid).paths , n2.no, ln.connect(c).chng_direction) post aid insetdomRESULT.areas and
pid insetdomRESULT.areas(aid).paths and domRESULT.areas = dom ln.areas and
{aid} <-: RESULT.areas = {aid} <-: ln.areas and RESULT.areas(aid).paths = ln.areas(aid).paths ++ {pid |-> p} and RESULT.areas(aid).paths(pid) = p and RESULT.connect = ln.connect;
Line_Del_Path : Line * Area_id * Path_id -> Line
Line_Del_Path(ln, aid, pid) == mu(ln, areas |-> ln.areas ++ {aid |-> Del_Path(ln.areas(aid), pid)}) pre aid insetdom ln.areas and
pre_Del_Path(ln.areas(aid), pid) post aid insetdomRESULT.areas and
pid notinsetdomRESULT.areas(aid).paths and domRESULT.areas = dom ln.areas and
{aid} <-: RESULT.areas = {aid} <-: ln.areas and RESULT.areas(aid).paths = {pid} <-: ln.areas(aid).paths and RESULT.connect = ln.connect;
Line_Add_Route : Line * Area_id * Route_id * Route -> Line
Line_Add_Route(ln, aid, rid, r) == mu(ln, areas |-> ln.areas ++ {aid |-> Add_Route(ln.areas(aid), rid,r)}) pre aid insetdom ln.areas and
pre_Add_Route(ln.areas(aid), rid, r) post aid insetdomRESULT.areas and
rid insetdomRESULT.areas(aid).routes and domRESULT.areas = dom ln.areas and
{aid} <-: RESULT.areas = {aid} <-: ln.areas and RESULT.areas(aid).routes = ln.areas(aid).routes ++ {rid |-> r} and RESULT.areas(aid).routes(rid) = r and RESULT.connect = ln.connect;
Line_Del_Route : Line * Area_id * Route_id -> Line
Line_Del_Route(ln, aid, rid) == mu(ln, areas |-> ln.areas ++ {aid |-> Del_Route(ln.areas(aid), rid)}) pre aid insetdom ln.areas and
pre_Del_Route(ln.areas(aid), rid) post aid insetdomRESULT.areas and domRESULT.areas = dom ln.areas and
{aid} <-: RESULT.areas = {aid} <-: ln.areas and
rid notinsetdomRESULT.areas(aid).routes and RESULT.areas(aid).routes = {rid} <-: ln.areas(aid).routes and RESULT.connect = ln.connect;
Line_Add_Condition : Line * Area_id * Path_id * Condition-> Line
Line_Add_Condition(ln, aid, pid, con) == mu(ln, areas |-> ln.areas ++
{aid |-> Add_Condition(ln.areas(aid), pid, con)}) pre aid insetdom ln.areas and
pre_Add_Condition(ln.areas(aid), pid, con);
Line_Del_Condition : Line * Area_id * Path_id * Cond_Kind * nat * nat-> Line
Line_Del_Condition(ln, aid, pid, kind, start, endp) == mu(ln, areas |-> ln.areas ++
{aid |-> Del_Condition(ln.areas(aid), pid, kind, start, endp)}) pre aid insetdom ln.areas and
pre_Del_Condition(ln.areas(aid), pid, kind, start, endp)
;
-- -- Digital ATC Database -- Condition for "Completed" Database --
functions
Is_wf_Line_DB : Line -> bool
Is_wf_Line_DB(ln) ==
(forall aid insetdom ln.areas & let ar = ln.areas(aid) in
Joint_Completed(ar.trackcs, aid, ln.connect) and
Path_Exists_for_Joint(ar.trackcs, ar.paths) and
Path_Exists_for_TrackC(ar.trackcs, ar.paths) and
Route_Exists_for_Path(ar) and
Path_Exists_before_Start(ar, aid, ln.connect) and
Path_Exists_after_End(ar, aid, ln.connect) and
Route_Exists_to_Terminal(ar, aid, ln.connect) and
(ar.kind = <PLAIN> => Is_Plain_Area(ar, aid, ln.connect))) and
Following_Path_Exists_at_Connect(ln) and
Preceding_Path_Exists_at_Connect(ln) and
One_Side_Unique_Path_at_Connection(ln);
Joint_Completed : TrackC_map * Area_id * Connect_map -> bool
Joint_Completed(trackcs, aid, connect) == forall tid insetdom trackcs & let tc = trackcs(tid) in forall jid insetdom tc.joints &
(notexists tcid insetdom trackcs & tcid <> tid and
jid insetdom trackcs(tcid).joints) =>
(mk_Area_Joint(aid, tid, jid) insetduniondom connect or
tc.joints(jid).remark.line_terminal)
;
Path_Exists_for_Joint : TrackC_map * Path_map -> bool
Path_Exists_for_Joint(trackcs, paths) == forall tid insetdom trackcs & forall jid insetdom trackcs(tid).joints &
(exists p insetrng paths &
p.tc = tid and
(p.start = jid or p.endp = jid))
;
Path_Exists_for_TrackC : TrackC_map * Path_map -> bool
Path_Exists_for_TrackC(trackcs, paths) == forall tid insetdom trackcs & forall dr insetdom trackcs(tid).atc &
trackcs(tid).atc(dr).used => exists p insetrng paths &
p.tc = tid and p.used(dr)
;
Route_Exists_for_Path : Area -> bool
Route_Exists_for_Path(ar) == forall pid insetdom ar.paths & forall dr insetdom ar.paths(pid).used &
ar.paths(pid).used(dr) =>
ar.trackcs(ar.paths(pid).tc).atc(dr).used => exists r insetrng ar.routes &
r.dr = dr and pid insetelems r.paths;
Path_Exists_before_Start : Area * Area_id * Connect_map -> bool
Path_Exists_before_Start(ar, aid, connect) == forall pid insetdom ar.paths & let p = ar.paths(pid) in forall dr insetdom p.used &
p.used(dr) =>
(mk_Area_Joint(aid, p.tc, p.start) insetduniondom connect or
ar.trackcs(p.tc).joints(p.start).remark.line_terminal or
ar.trackcs(p.tc).joints(p.start).remark.atc_terminal(dr) or exists pid1 insetdom ar.paths & let p1 = ar.paths(pid1) in
p1.tc <> p.tc and
p1.used(dr) and
p1.endp = p.start)
;
Path_Exists_after_End : Area * Area_id * Connect_map -> bool
Path_Exists_after_End(ar, aid, connect) == forall pid insetdom ar.paths & let p = ar.paths(pid) in forall dr insetdom p.used &
p.used(dr) =>
(mk_Area_Joint(aid, p.tc, p.endp) insetduniondom connect or
ar.trackcs(p.tc).joints(p.endp).remark.line_terminal or
ar.trackcs(p.tc).joints(p.endp).remark.atc_terminal(dr) or exists pid1 insetdom ar.paths & let p1 = ar.paths(pid1) in
p1.tc <> p.tc and
p1.used(dr) and
p1.start = p.endp)
;
StartJoint : Path * Direction -> Joint_id
StartJoint(path, dr) == if dr = <ADIR> then path.startelse path.endp post (dr = <ADIR> => RESULT = path.start) and
(dr = <BDIR> => RESULT = path.endp);
EndJoint : Path * Direction -> Joint_id
EndJoint(path, dr) == if dr = <ADIR> then path.endp else path.start post (dr = <ADIR> => RESULT = path.endp) and
(dr = <BDIR> => RESULT = path.start);
-- -- Route_Exists_to_Terminal means that Train can reach an Area_Joint or -- an end of track.
Route_Exists_to_Terminal : Area * Area_id * Connect_map -> bool
Route_Exists_to_Terminal(ar, aid, connect) == forall rid insetdom ar.routes & let r = ar.routes(rid) in let pid = r.paths(len r.paths) in let jid = EndJoint(ar.paths(pid), r.dr),
tcid = ar.paths(pid).tc in
mk_Area_Joint(aid, tcid, jid) insetduniondom connect or
ar.trackcs(tcid).joints(jid).remark.line_terminal or
ar.trackcs(tcid).joints(jid).remark.atc_terminal(r.dr) or
Following_Route_Exists(ar.routes, rid) or
Following_Path_Unique(ar.paths, pid, r.dr);
-- -- Following_Route_Exists1 : -- On the last path, if a next route which includes following paths can -- be indicated, train can proceed with next route ID. --
Following_Route_Exists : Route_map * Route_id -> bool
Following_Route_Exists(routes, rid) == exists rid1 insetdom routes & let r = routes(rid), r1 = routes(rid1) in
r1.dr = r.dr and exists i insetinds r1.paths &
r1.paths(i) = r.paths(len r.paths) and
i < len r1.paths pre rid insetdom routes;
-- -- Unique_Next_Path : -- On the last path, if there is only one next path possible, -- trains can proceed to the next path. --
Following_Path_Unique : Path_map * Path_id * Direction-> bool
Following_Path_Unique(paths, pid, dr) == exists1 pid1 insetdom paths &
paths(pid1).tc <> paths(pid).tc and
paths(pid1).used(dr) and
EndJoint(paths(pid), dr) = StartJoint(paths(pid1), dr) pre pid insetdom paths;
-- -- Plain Area, where from TrackC_id and direction, Route can be determined. --
Is_Plain_Area : Area * Area_id * Connect_map-> bool
Is_Plain_Area(ar, aid, connect) ==
(forall tcid insetdom ar.trackcs & forall dr insetdom ar.trackcs(tcid).atc &
ar.trackcs(tcid).atc(dr).used => exists1 rid insetdom ar.routes &
ar.routes(rid).dr = dr and exists pid inseq ar.routes(rid).paths &
ar.paths(pid).tc = tcid) and
(forall r insetrng ar.routes & let p = ar.paths(r.paths(len r.paths)) in let jid = EndJoint(p, r.dr) in
mk_Area_Joint(aid, p.tc, jid) insetduniondom connect or
ar.trackcs(p.tc).joints(jid).remark.line_terminal or
ar.trackcs(p.tc).joints(jid).remark.atc_terminal(r.dr));
-- -- One_Side_Unique_Path_at_Connection -- At the connection it is not favorable that -- in both area paths are not unique. -- Because it makes imposibble to indicate next path -- in the former track circuit.
One_Side_Unique_Path_at_Connection : Line -> bool
One_Side_Unique_Path_at_Connection(ln) == forall con insetdom ln.connect & forall n1, n2 inset con & n1 <> n2 => forall dr inset {<ADIR>, <BDIR>} & card {p | p insetrng ln.areas(n1.aid).paths &
p.used(dr) and
EndJoint(p, dr) = n1.no} > 1 =>
(ln.areas(n1.aid).trackcs(n1.tcid).joints(n1.no).
remark.atc_terminal(dr) or
let dr2 = ifnot ln.connect(con).chng_direction then dr elseif dr = <ADIR> then <BDIR> else <ADIR> in card {p | p insetrng ln.areas(n2.aid).paths &
p.used(dr2) and
StartJoint(p, dr2) = n2.no} = 1);
Following_Path_Exists_at_Connect : Line -> bool
Following_Path_Exists_at_Connect(ln) == forall con insetdom ln.connect & forall n1, n2 inset con & n1 <> n2 => forall dr inset {<ADIR>, <BDIR>} &
(exists p insetrng ln.areas(n1.aid).paths &
p.used(dr) and
EndJoint(p, dr) = n1.no) =>
(ln.areas(n1.aid).trackcs(n1.tcid).joints(n1.no).
remark.atc_terminal(dr) or
(exists p2 insetrng ln.areas(n2.aid).paths & let dr2 = ifnot ln.connect(con).chng_direction then dr elseif dr = <ADIR> then <BDIR> else <ADIR> in
p2.used(dr2) and
StartJoint(p2, dr2) = n2.no));
Preceding_Path_Exists_at_Connect : Line -> bool
Preceding_Path_Exists_at_Connect(ln) == forall con insetdom ln.connect & forall n1, n2 inset con & n1 <> n2 => forall dr inset {<ADIR>, <BDIR>} &
(exists p insetrng ln.areas(n1.aid).paths &
p.used(dr) and
StartJoint(p, dr) = n1.no) =>
(ln.areas(n1.aid).trackcs(n1.tcid).joints(n1.no).
remark.atc_terminal(dr) or
(exists p2 insetrng ln.areas(n2.aid).paths & let dr2 = ifnot ln.connect(con).chng_direction then dr elseif dr = <ADIR> then <BDIR> else <ADIR> in
p2.used(dr2) and
EndJoint(p2, dr2) = n2.no));
¤ Dauer der Verarbeitung: 0.25 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.