class SimulatorEnvironment issubclassof Environment
instancevariables
simtime : [nat]; time : nat;
operations
public SimulatorEnvironment: Network * map World`TMSId to TMS * [nat] ==> SimulatorEnvironment
SimulatorEnvironment(net, tms, t) == ( let - = Environment(net, tms) inskip;
simtime := t; time := 0;
);
public Run: bool * seqofchar * seq1ofchar ==> ()
Run(colab,network_file,tms_file) == ( dcl path: seqofchar := tempo_vdm_SimulatorIO`initialize(network_file,tms_file);
tempo_vdm_SimulatorIO`fastForwardSimulator(20 * 60); whilenot isFinished() do ( dcl trafsit: TrafficSituation; dcl control: TMS`Control := {|->};
tempo_vdm_SimulatorIO`runSimulator(10);
trafsit := UpdateSit(); forall id insetdom tms_m do tms_m(id).Step(trafsit); if colab thenforall id insetdom tms_m do tms_m(id).MakeOffers(); forall id insetdom tms_m do tms_m(id).EvaluateOffers(); forall id insetdom tms_m do let c = tms_m(id).FinaliseOffers() in
(control := control ++ c;
network.ResetNotproblematic(id));
IO`printf("%s\nEdge situation: %s\nControl measures: %s\n", [time, trafsit, control]); forall e insetdom control do forall m inset control(e) do if is_TMS`HardShoulder(m) then
tempo_vdm_SimulatorIO`applyHardShoulder(e, m.open) elseif is_TMS`MaxSpeed(m) then if m.speed <> nil then tempo_vdm_SimulatorIO`applyMaxSpeed(e, m.speed) else tempo_vdm_SimulatorIO`applyMaxSpeed(e, 0) elseif is_TMS`TrafficLight(m) then
tempo_vdm_SimulatorIO`applyTrafficLight(e, m.greentime) elseif is_TMS`RampMeter(m) then
tempo_vdm_SimulatorIO`applyRampMeter(e, m.redtime) elseif is_TMS`Diversion(m) then if m.route <> nil then tempo_vdm_SimulatorIO`applyDiversion(e, m.route) else tempo_vdm_SimulatorIO`applyDiversion(e, "") elseif is_TMS`LaneClosure(m) then
tempo_vdm_SimulatorIO`applyLaneClosure(e, m.closed);
network.ResetOffers(); time := time+1;
);
);
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.