2. Building an observation network#
import netsse
vessel1 = netsse.base.Platform('Containership1')
vessel2 = netsse.base.Platform('RoRo1')
vessel3 = netsse.base.Platform()
print(vessel3.name)
Platform9XE0N
network = netsse.base.Network(name='TestNetwork',nature='test',platforms=[vessel1,vessel2])
print([(platform.name,platform.owner) for platform in network.platforms])
[('Containership1', 'undefined'), ('RoRo1', 'undefined')]
network.add_platform(vessel3)
print([(platform.name,platform.owner) for platform in network.platforms])
Platform 'Platform9XE0N' was added to the network.
[('Containership1', 'undefined'), ('RoRo1', 'undefined'), ('Platform9XE0N', 'undefined')]
vessel2.owner = 'SomeCompany'
network.add_platform(vessel2)
print([(platform.name,platform.owner) for platform in network.platforms])
Platform 'RoRo1' in TestNetwork was updated with new information.
[('Containership1', 'undefined'), ('RoRo1', 'SomeCompany'), ('Platform9XE0N', 'undefined')]
network.remove_platform(vessel3,'Containership1','NonExistentShip')
print([(platform.name,platform.owner) for platform in network.platforms])
Platform 'Platform9XE0N' was removed from TestNetwork.
Platform 'Containership1' was removed from TestNetwork.
Platform 'NonExistentShip' not found.
[('RoRo1', 'SomeCompany')]