products/Sources/formale Sprachen/VDM/VDMPP/BuslinesWithDBPP image not shown  

Quellcode-Bibliothek

© Kompilation durch diese Firma

[Weder Korrektheit noch Funktionsfähigkeit der Software werden zugesichert.]

Datei: World.vdmpp   Sprache: VDM

Original von: VDM©

-----------------------------------------------
-- Class: World
-- Description:  World class
-----------------------------------------------

-- Rules of this world
-- In the model the city map is loaded form a database so is the buses and their routes. 
-- There are multiple maps which can be loaded and validated in the model. 
-- A simulation can be started on specific maps. 
-- Buses and routes can also be defined in the inputvalues.txt
--
-- Example of a map
--  _ _ _ _ WP2_ _ _ _ _ C _ _ _ _ _ _ F _ _ _ _ _R8
-- |   |  R5   | R7  R15|    |
-- |   | R6|_ D _ _ _ _ _|WP4    | 
-- |R4   |R3  |   R11 |    |
-- |   |   R14| |R10    |
--    A|_ _ _ _ B|_ _ _ _ _ _ _ WP1_ _R16_WP3_ _ _ _ _| Central 
-- | R1  R2   | |    R9  |
-- |   R13 |_ _ E _ _|R12    |
-- |    |
-- |    |
-- |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | 
--  HW1
--
-- Rules of the model --
-- ¤ Passengers arrive at a certain inflow rate on central station, their destination is randomly picked
-- ¤ Buses always drives at full speed according to the roads speed limit
-- ¤ Passengers will not get on buses that do not pass their stop
-- ¤ Passenger will not change between multiple buses to get to a stop
-- ¤ Buses always drives in cicles. i.e. the start and the stop of a route must be the same
-- ¤ A bus route is defined by roads, and the bus will stop at all stops it passes on these roads
-- ¤ The roads in the bus route must be connected end to end, as the bus can not jump passed pieces of road
-- ¤ Roads are connected by waypoints, some of these waypoints function as bus stops where passengers get off. 

class World

instance variables
public static graphics : gui_Graphics:= new gui_Graphics();

public static env : [Environment] := new Environment("inputvalues.txt");
public static timerRef : TimeStamp := new TimeStamp();  

operations

 public World: () ==> World
 World() ==
 (
   Printer`Out("World created: ");
  Printer`Out("------------------------------------------\n");
 );

 public Run: () ==> ()
 Run() == 
 (
  graphics.init();
 );

 public StartSimulation: () ==> ()
 StartSimulation() ==
 (
  env.run();
 );

 public addWaypoint : Waypoint`WaypointsEnum ==> Waypoint 
 addWaypoint(wp) == env.city.addWaypoint(wp);

 public addRoad :  Waypoint`WaypointsEnum * Waypoint`WaypointsEnum * Road`RoadNumber * nat  * bool==> ()
 addRoad(wp1, wp2, roadNmbr, length, highspeed) ==
  env.city.addRoad(wp1,wp2,roadNmbr,length, highspeed);

 public addBus : nat * seq of Road`RoadNumber ==> Bus
 addBus(lineNumber, route) ==
  env.city.addBus(lineNumber, route);

end World

¤ Dauer der Verarbeitung: 0.16 Sekunden  (vorverarbeitet)  ¤





Download des
Quellennavigators
Download des
sprechenden Kalenders

in der Quellcodebibliothek suchen




Haftungshinweis

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.


Bot Zugriff