def previousLocation(self): locationsLength = len(self.locations) self._setLocation((locationsLength + (self.currentLocationNum - 1)) % locationsLength) def _setLocation(self, locationNum): self.currentLocationNum = locationNum self.currentLocation = self.locations[self.currentLocationNum] self.updateLocationTable(self.simulationLog) def run(simulation): master = tk.Tk() image = tk.PhotoImage(file = "resources/europe.gif") gui = SimulationGUI(simulation, image, master) gui.master.title('Mokum Airlines') gui.after(100, gui.run) gui.start() if __name__ == "__main__": start = dt.datetime.now() simulation = Simulation() end = dt.datetime.now() print "Time taken over simulation initialization ", end - start start = dt.datetime.now() simulation.preSimulation() end = dt.datetime.now() print "Time taken over pre simulation", end - start run(simulation)
from __future__ import division from mokum import Simulation import mokumplotter as plotter if __name__ == "__main__": # initialize the simulation, all data is loaded from files simulation = Simulation() planes = simulation.getPlanes() # all the planes in the simulation connections = simulation.getConnections() # all the connections in the simulation locations = simulation.getLocations() # all the locations in the simulation # ================================================================== # # # # YOUR CODE GOES HERE! # # # # ================================================================== #
self._setLocation((locationsLength + (self.currentLocationNum - 1)) % locationsLength) def _setLocation(self, locationNum): self.currentLocationNum = locationNum self.currentLocation = self.locations[self.currentLocationNum] self.updateLocationTable(self.simulationLog) def run(simulation): master = tk.Tk() image = tk.PhotoImage(file="resources/europe.gif") gui = SimulationGUI(simulation, image, master) gui.master.title('Mokum Airlines') gui.after(100, gui.run) gui.start() if __name__ == "__main__": start = dt.datetime.now() simulation = Simulation() end = dt.datetime.now() print "Time taken over simulation initialization ", end - start start = dt.datetime.now() simulation.preSimulation() end = dt.datetime.now() print "Time taken over pre simulation", end - start run(simulation)
from __future__ import division from mokum import Simulation import mokumplotter as plotter if __name__ == "__main__": # initialize the simulation, all data is loaded from files simulation = Simulation() planes = simulation.getPlanes() # all the planes in the simulation connections = simulation.getConnections( ) # all the connections in the simulation locations = simulation.getLocations( ) # all the locations in the simulation # ================================================================== # # # # YOUR CODE GOES HERE! # # # # ================================================================== #
from __future__ import division from mokum import Simulation, Trip import mokumplotter as plotter import random import mokumgui as gui if __name__ == "__main__": # initialize the simulation, all data is loaded from files simulation = Simulation() planes = simulation.getPlanes() # all the planes in the simulation connections = simulation.getConnections( ) # all the connections in the simulation locations = simulation.getLocations( ) # all the locations in the simulation # ================================================================== # # # # EXAMPLES! # # # # ================================================================== # # Get the state of simulation after 100 minutes and 15 seconds: simLog = simulation.getSimulationLogAt(100.25) # Lets check which planes are flying at time 100.25. for planeLog in simLog.getPlaneLogs(): trip = planeLog.getTrip() plane = planeLog.getPlane()
from __future__ import division from mokum import Simulation, Trip import mokumplotter as plotter import random import mokumgui as gui if __name__ == "__main__": # initialize the simulation, all data is loaded from files simulation = Simulation() planes = simulation.getPlanes() # all the planes in the simulation connections = simulation.getConnections() # all the connections in the simulation locations = simulation.getLocations() # all the locations in the simulation # ================================================================== # # # # EXAMPLES! # # # # ================================================================== # # Get the state of simulation after 100 minutes and 15 seconds: simLog = simulation.getSimulationLogAt(100.25) # Lets check which planes are flying at time 100.25. for planeLog in simLog.getPlaneLogs(): trip = planeLog.getTrip() plane = planeLog.getPlane() # To see whether a plane is flying we just need to check