def main(mode='straight'): the_world = world() initialize() tk = the_world.tk canvas, x_, y_, s_ = tk.canvas, tk.x_, tk.y_, tk.s_ ### ### PRT ### berths = 6 psm1 = PRTStationManager(berths) psm2 = PRTStationManager(berths) activate(psm1, psm1.check(), 0.0) activate(psm2, psm2.check(), 0.0) s1 = Straight((20., -30.), (20., -5.0)) s1.next, last_left, last_right, length \ = station((20.0, -5.0), PRT.max_speed, 'right', berths, psm1) last_left.next = last_right.next = s2 \ = Straight((20., -5. + length), (20., -5. + length + 5.)) psm1.mainline = last_left s2.next, last_left, last_right, length \ = station((20.0, -5.0 + length + 5), PRT.max_speed, 'right', berths, psm2) last_left.next = last_right.next \ = Straight((20.0, 500.), (20., 10000.)) psm2.mainline = last_left prt_draw(s1, 20.0, -31.0) pc = PRTChecker() activate(pc, pc.check(s2.members), 0.0) p1_ul, p1_lr = prt_platform = s1.next.platform prt_platform_center = (p1_ul.y + p1_lr.y) / 2 psm1.platform = prt_platform p2_ul, p2_lr = s2.next.platform canvas.create_polygon( ((x_(p1_lr.x), y_(p1_ul.y)), (x_(p1_lr.x + 15), y_(p1_ul.y + 4)), (x_(p1_lr.x + 15), y_(p1_lr.y - 4)), (x_(p1_lr.x), y_(p1_lr.y))), fill='#ccc', outline='#ccc') canvas.create_polygon( ((x_(p2_lr.x), y_(p2_ul.y)), (x_(p2_lr.x + 15), y_(p2_ul.y + 4)), (x_(p2_lr.x + 15), y_(p2_lr.y - 4)), (x_(p2_lr.x), y_(p2_lr.y))), fill='#ccc', outline='#ccc') tg = PRTGenerator() # 75% empty to simulate sending extras to the stadium activate(tg, tg.generate(s1, interval, percent_empty=0.75), 0.0) ### ### Rail ### rx, ry = 80., 0. rsm = RailStationManager() activate(rsm, rsm.check(), 0.0) rail_stop_center = 100 rail_draw(rx, ry, rail_stop_center) rg = RailcarGenerator(rx, rsm) rsm.mode = "stadium" activate(rg, rg.generate(), 20.0 + 30) rg.waypoint_high = vec3(rx - 4, p1_ul.y + 3) rg.waypoint_low = vec3(rx - 4, p1_lr.y - 3) canvas.create_polygon( ((x_(rx - 20), y_(rail_stop_center + 20)), (x_(rx - 5), y_(rail_stop_center + Railcar.length)), (x_(rx - 5), y_(rail_stop_center - Railcar.length)), (x_(rx - 20), y_(rail_stop_center - 20))), fill='#ccc', outline='#ccc') ### ### People ### pg = PersonGenerator(rsm, rx - 20, rail_stop_center - Railcar.length + 2, rail_stop_center + Railcar.length - 2, psm1, p1_lr.x + 15, p1_lr.y - 4, p1_ul.y + 4, psm2, p2_lr.x + 15, p2_lr.y - 4, p2_ul.y + 4) activate(pg, pg.generate(), 45.0) ### ### ### u = Updater(interval) activate(u, u.execute(), 0.0) simulate(until=2000)