public Run: seqofchar * seq1ofchar * [nat] ==> () --Performance
Run(network_file, tms_file, simtime) == (
network := ReadRoadNetwork(network_file); forall tid insetdom tms_m do
tms_m(tid).ResetNetwork(network,self);
ReadTMSs(tms_file, network);
env := new SimulatorEnvironment(network, tms_m, simtime); forall tid insetdom tms_m do
tms_m(tid).UpdateInternalEdges();
env.Run(collaboration,network_file,tms_file)
);
public ReadRoadNetwork: seq1ofchar ==> Network
ReadRoadNetwork(file_n) == let mk_(ok,lines) = CSV`flinecount(file_n) in if ok then (dcl net : map Network`EdgeId to Edge := {|->}; for i = 1 to lines do -- each line in the network configuration file contains -- - The identifier of the edge -- - the starting node for the edge -- - the ending node for the edge -- - the length of the edge -- - the number of lanes for the edge -- - the maximum speed for the edge -- - flow of cars into the edge let mk_(ok,[edgeid,startid,endid,l,lane,max,inflow]) =
CSV`freadval[seqof (nat | seqofchar)](file_n,i) in net(edgeid) := new Edge(max,lane,l,mk_token(startid),mk_token(endid)); returnnew Network(net)
) elseerror;
public ReadTMSs: seqofchar * Network ==> ()
ReadTMSs(file_n, n) == let mk_(ok,lines) = CSV`flinecount(file_n) in if ok then (for i = 1 to lines do -- each line in the TMS configuration file contains: -- - the identification of the TMS -- - an identification of the edge included -- - a traffic control measure if available (alternatively nil is included) -- - a priority if available (alternatively nil is included) -- - possible suggested routes to make diversions avoiding the edge let mk_(ok,[tmsid,edgeid,tcm,prio,diversions]) =
CSV`freadval[seqof ([nat] | seqofchar |setofseqofseqofchar)](file_n,i),
tid = tmsid in ( --{["A202","S109","S102","A153"],["A42","A43","A152","A153"],["A42","S114","S102","A153"]} ifnot tid insetdom tms_m then tms_m(tid) := new TMS("Invalid TMS", n);-- this should never happen
tms_m(tid).AddEdge({edgeid}); if tcm <> niland tcm <> "Bridge"then tms_m(tid).AddTCM(edgeid,TMS`ConvertTCM(tcm)); if tcm <> niland tcm = "Bridge"then tms_m(tid).AddBridge(edgeid,TMS`ConvertBridge(tcm)); if prio <> nilthen tms_m(tid).AddPriority(edgeid,prio); -- if diversions <> nil -- then network.AddDiversionRoutes(edgeid, -- {[r(j) | j in set inds r] -- | r in set diversions})
); forall tid insetdom tms_m do tms_m(tid).CalculateInterest(n);-- sort out interested edges
) elseerror;
public SetCollaboration: bool ==> ()
SetCollaboration(b) ==
collaboration := b;
end World
¤ 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.0.25Bemerkung:
(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.