Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

THS S A PYHTON CLASS QUESTON. (((((((Background Information---> In an uncertain future, humankind wants to control the surface of the planet Omicron Persei 8, located

THS S A PYHTON CLASS QUESTON.

(((((((Background Information---> In an uncertain future, humankind wants to control the surface of the planet Omicron Persei 8, located out of the alpha centauri star system. For this purpose, transceivers and certain type of robots are designed. Transceivers located to fixed locations, and robots are mobile and should be stay connected to the transceiver towers, otherwise, if robots cannot build a duplex connection (both transmitting and receiving signals) more than 60 seconds, it is assumed that the robot unit can be (or worse it is) captured by the aliens, and the units destroy themselves due to prevent any possible information leakage. Your task is to create a simulator to test the possible algorithms for this mission. In the planet Omicron Persei 8, the power of the electromagnetic waves used for communication decay linearly and inversely proportional to the distance from transceivers or robot units. A battlefield is composed of transceivers and the mobile units (robots).))))))

Transceiver: Transceivers (transmitter and receiver) (can also be think as base stations) are stationary and have fixed location. Every transceiver has a different transmitting power and minimum receiving power according to used components in them. Once a transceiver set up in the battlefield, then a local/internal time counter starts to run and count every second. Every transceiver should have a unique ID to build up separate communication channels.

Transceiver class:

This is a base class that will hold the basic information about a unit, and basic methods for printing setting and getting information, and comparison.

Methods Explanation
__init__(x, y, tpower, rpower)

__init__ method should take x and y coordinates of the unit and transmitting and minimum receiving powers. The default value for minimum receiving power is 1 mW.

>>> t1 = Transceiver(0,0,100)

>>> t2 = Transceiver(750,500,100,0.1)

get_coordinate_x()

This method will return the x component of the location of the transceiver in meters as float or integer

. >>> t1.get_coordinate_x()

0

>>> t2.get_coordinate_x()

750

get_coordinate_y()

This method will return the y component of the location of the transceiver in meters as float or integer.

>>> t1.get_coordinate_y()

0

>>> t2.get_coordinate_y()

500

get_coordinates()

This method will return the x, y coordinates of the location of the transceiver in meters as tuple.

>>> t1.get_coordinates()

(0, 0)

>>> t2.get_coordinates()

(750, 500)

get_tpower()

This method will return the transmitting power of the transceiver in Watts as integer or float. >>> t1.get_tpower()

100

>>> t2.get_tpower()

100

get_rpower()

This method will return the minimum receiving power of the transceiver in Watts as integer or float.

>>> t1.get_rpower()

0.001

>>> t2.get_rpower()

0.1

get_id()

This method will return the ID number of the transceiver as integer.

>>> t1.get_id()

0

>>> t2.get_id()

1

get_localtime()

This method will return the local time of the transceiver in seconds as integer.

>>> t1.get_localtime()

0

>>> t2.get_localtime()

0

set_coordinates(x, y)

This method will set the x, y coordinates of the transceiver in meters. The coordinates are float or integer.

>>> t1.set_coordinates(-250, 0)

>>> t1.get_coordinates() (-250, 0)

set_transmitting_power(tpower)

This method will set the transmitting power of the transceiver in Watts. Transmitting power can be float or integer.

>>> t1.set_transmitting_power(1000)

>>> t1.get_tpower()

1000

set_receiving_power(rpower)

This method will set the minimum receiving power of the transceiver in Watts. Minimum Receiving power can be float or integer.

>>> t1.set_receiving_power(1.5)

>>> t1.get_rpower()

1.5

update_local_time()

This method will set the local time of the transceiver. The local time should be integer in seconds.

>>> t1.update_local_time(50)

>>> t1.get_localtime()

50

distance(m)

This method will return the distance of the transceiver to another unit in meters as float. >>> t1.distance(t2)

1118.033988749895

transmitted_power((x,y))

This method will calculate and return the transmitted power from the transceiver to given coordinates. Method will take the coordinates as tuple and return the transmitted power in Watts as float or integer.

>>> t1.transmitted_power((-250,0))

1000

>>> t1.transmitted_power((50,25)) 3.3218191941495983

>>> t1.transmitted_power(t2.get_coordinates() )

0.8944271909999159

>>> t1.transmitted_power(t1.get_coordinates() )

1000

__eq__()

This method will implement equal operation between two units. If the transmitted signals can be received from both sides it returns True, otherwise False.

>>> t1==t2 False

__lt__()

This method will implement less than operation between two units. If the transmitted signal from the first unit can be received from the other unit it returns True, otherwise False.

>>>t1

False

__gt__()

This method will implement greater than operation between two units. If the transmitted signal from the second unit can be received from the first unit it returns True, otherwise False.

>>> t1>t2

False

__str__()

This method will return the following information in the following format as string. Note the difference of kW, W, and mW.

>>> print(t1)

Class: Tower T

ower number: 0

Coordinates:<-250,0>

Transmitting Power: 1.0kW

Min. Receiving Power: 1.5W

>>> print(t2)

Class: Tower T

ower number: 1

Coordinates:<750,500>

Transmitting Power: 100W

Min. Receiving Power: 100.0mW

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems For Advanced Applications 18th International Conference Dasfaa 2013 Wuhan China April 22 25 2013 Proceedings Part 2 Lncs 7826

Authors: Weiyi Meng ,Ling Feng ,Stephane Bressan ,Werner Winiwarter ,Wei Song

2013th Edition

3642374492, 978-3642374494

More Books

Students also viewed these Databases questions

Question

Show that

Answered: 1 week ago