from ahoy.agents.smallship import SmallShip from ahoy.agents.divertagent import DivertAgent from ahoy.agents.sensorforwardagent import SensorForwardAgent from ahoy.sensors.radarsensor import RadarSensor from ahoy.sensors.sonarsensor import SonarSensor from ahoy.agents.correlationagent import CorrelationAgent from ahoy.util.units import * world = World() aisnet = Network('aisn', LogLossComms()) world.add_network(aisnet) for i in range(0, 6): n = Node(len(world.get_entities())) n.add_interface(Interface('ais1', aisnet, power=120)) ship = AISShip(n.get_uid(), 0.0203, 'localhost', 12346, 'ais1') n.add_agent(ship) world.add_entity(n) path = "agents/paths/path" for i in range(8,12): 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) """ # Make sensor interfaces s1net = Network('sonar1n', LogLossComms()) world.add_network(s1net) s2net = Network('sonar2n', LogLossComms())
from ahoy.agents.smallship import SmallShip from ahoy.agents.sensorforwardagent import SensorForwardAgent from ahoy.sensors.radarsensor import RadarSensor from ahoy.sensors.sonarsensor import SonarSensor from ahoy.agents.correlationagent import CorrelationAgent #from ahoy.agents.histcorragent import HistoryCorrelationAgent from ahoy.util.units import * world = World() aisnet = Network('aisn', LogLossComms()) world.add_network(aisnet) for i in range(0, 2): n = Node(len(world.get_entities())) n.add_interface(Interface('ais1', aisnet, power=120)) ship = AISShip(n.get_uid(), 0.0203, 'localhost', 12347, 'ais1') n.add_agent(ship) world.add_entity(n) path = "agents/paths/path" for i in range(9,11): 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) # Make sensor interfaces s1net = Network('sonar1n', LogLossComms()) world.add_network(s1net) s2net = Network('sonar2n', LogLossComms())
from ahoy.agents.correlationagent import CorrelationAgent world = World() wlan = Network('wlan0', LogLossComms()) tnet = Network('tnet',LogLossComms()) world.add_network(wlan) world.add_network(tnet) path = "agents/paths/path" pathfile = "agents/paths/tpaths.dat" tanknode = Node(len(world.get_entities())) #uavnode.set_position(39.8656978,-75.21841399, 0.0001) tanknode.add_interface(Interface('tnet',tnet,power=120)) tanknode.add_agent(Tanker(tanknode.get_uid(),0.08,'tnet',pathfile)) world.add_entity(tanknode) threatnode = Node(len(world.get_entities())) tagent = ThreatShip(threatnode.get_uid(),0.10,pathfile) tagent.follow(tanknode.get_uid()) threatnode.add_agent(tagent) world.add_entity(threatnode) #for i in range(0,4): # n = Node(i+100) # ship = SmallShip(i+200, i, 0.03, path + str(i) + ".dat") # n.add_agent(ship) # world.add_entity(n)
sonar2n.add_interface(Interface('sonar2', s2net, power=120)) world.add_entity(sonar2n) # Red Bank Battlefield (nw part of land sticking out south of navy yard) sonar3n = Node(902) sonar3n.set_position(39.872596,-75.190008, 0) sonar3n.add_sensor('sonar', SonarSensor(source_level=220, source_bw=10, array_size=360, interval=5, min_snr=120, use_event_channel=True)) sonar3n.add_interface(Interface('sonar3', s3net, power=120)) world.add_entity(sonar3n) # On pier of naval yard radarn = Node(903) radarn.set_position(39.886597, -75.166043, 0) radarn.add_sensor('radar', RadarSensor(trans_power=watts(6000), trans_freq=25, gain=1, aperature=5, prop_fact=1, dwell_time=3/360.0, angle=1, use_event_channel=True)) radarn.add_interface(Interface('radar1', r1net, power=12000)) radarn.add_agent(SensorForwardAgent(radarn.get_uid(), 'radar', 'radar1')) world.add_entity(radarn) # Ground station groundst = Node(len(world.get_entities())) groundst.set_position(39.887911, -75.187533, 0) groundst.add_interface(Interface('sonar1', s1net, power=12000)) groundst.add_interface(Interface('sonar2', s2net, power=12000)) groundst.add_interface(Interface('radar1', r1net, power=12000)) groundst.add_interface(Interface('aisn', aisnet, power=12000)) groundst.add_interface(Interface('uavnet', uavnet, power=12000)) groundst.add_agent(CorrelationAgent(groundst.get_uid(), 0.5, 0.45, 'aisn')) #groundst.add_agent(DivertAgent(len(world.get_entities()),'aisn')) world.add_entity(groundst) #create tanker
world = World() wlan = Network('wlan0', LogLossComms()) uavnet = Network('uavnet',LogLossComms()) world.add_network(wlan) world.add_network(uavnet) path = "agents/paths/path" pathfile = "agents/paths/tpaths.dat" uavnode = Node(1) uavnode.set_position(39.8661,-75.2549, 0.0001) #uavnode.set_position(39.8656978,-75.21841399, 0.0001) uavnode.add_interface(Interface('uavnet',uavnet,power=120)) uavnode.add_sensor('camera', CameraSensor(1.75,0.25,use_event_channel=True)) uavnode.add_agent(SensorForwardAgent(uavnode.get_uid(),'camera','uavnet')) uavnode.add_agent(UAV(8,1.0,0.045,0.015)) world.add_entity(uavnode) for i in range(0,9): n = Node(i+100) ship = SmallShip(i+200, i, 0.02, path + str(i) + ".dat") n.add_agent(ship) world.add_entity(n) if __name__ == '__main__' : sim = Simulation(world)
for loc in inactive : chem = Node(len(world.get_entities())) chem.add_sensor('chemical', ChemicalSensor(interval=9000)) chem.set_position(loc[0], loc[1], 0) world.add_entity(chem) chemspill = Node(len(world.get_entities())) chemspill.set_position(39.892223,-75.196788, 0) #immediately east of I-95 bridge, on water chemspill.add_agent( ChemicalSpillAnnounceAgent(2, 1, 20, 0.05) ) #ID, interval, announce time, spill rate in km/s world.add_entity(chemspill) #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.0203, '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(2) while True :