Esempio n. 1
0
world = World()

node = Node(0)
node.add_sensor('chemical', ChemicalSensor(interval=1, use_event_channel=True))
node.set_position(39.883531, -75.193963, 0) #sw of navy yard
world.add_entity(node)

node1 = Node(1)
node1.add_sensor('chemical', ChemicalSensor(interval=1, use_event_channel=True))
node1.set_position(39.890776,-75.195594, 0) #w of navy yard
world.add_entity(node1)

node2 = Node(2)
node2.set_position(39.892223,-75.196788, 0) #immediately east of I-95 bridge, on water
node2.add_agent( ChemicalSpillAnnounceAgent(2, 1, 4, 0.1) )   #ID, interval, announce time, spill rate in km/s
world.add_entity(node2)

if __name__ == '__main__' :
    sim = Simulation(world)

    def quit(signal, frame) :
        print 'Stopping...'
        sim.stop()
        sys.exit(0)
    signal.signal(signal.SIGINT, quit)

    sim.start(2)

    while True :
        pass
Esempio n. 2
0
world.add_entity(uavnode)

#Small personal craft
for i in range(0,9):
    n = Node(len(world.get_entities()))
    ship = SmallShip(n.get_uid(), i, 0.03, path + str(i) + ".dat")
    n.add_agent(ship)
    world.add_entity(n)

#AIS Ships
for i in range(0, 16):
	n = Node(len(world.get_entities()))
	n.add_interface(Interface('aisn', aisnet, power=120))
	ship = AISShip(n.get_uid(), 0.03, 'localhost', 12348, 'aisn')
	n.add_agent(ship)
	world.add_entity(n)

if __name__ == '__main__' :
    sim = Simulation(world)

    def quit(signal, frame) :
        print 'Stopping...'
        sim.stop()
        sys.exit(0)
    signal.signal(signal.SIGINT, quit)

    sim.start(5)

    while True :
        pass