gymwipe.networking.devices module¶
Device
implementations for network devices
-
class
NetworkDevice
(name, xPos, yPos, frequencyBand)[source]¶ Bases:
gymwipe.devices.core.Device
A subclass of
Device
that extends the constructor’s parameter list by a frequencyBand argument. The providedFrequencyBand
object will be stored in thefrequencyBand
attribute.Parameters: - name (
str
) – The device name - xPos (
float
) – The device’s physical x position - yPos (
float
) – The device’s physical y position - band (frequency) – The
FrequencyBand
instance that will be used for transmissions
-
frequencyBand
= None[source]¶ The
FrequencyBand
instance that is used for transmissionsType: FrequencyBand
- name (
-
class
SimpleNetworkDevice
(name, xPos, yPos, frequencyBand)[source]¶ Bases:
gymwipe.networking.devices.NetworkDevice
A
NetworkDevice
implementation running a network stack that consists of a SimplePHY and a SimpleMAC. It offers a method for sending a packet using the MAC layer, as well as a callback method that will be invoked when a packet is received. Also, receiving can be turned on or of by settingreceiving
either toTrue
or toFalse
.Parameters: - name (
str
) – The device name - xPos (
float
) – The device’s physical x position - yPos (
float
) – The device’s physical y position - band (frequency) – The
FrequencyBand
instance that will be used for transmissions
-
macAddr
= None[source]¶ The address that is used by the MAC layer to identify this device
Type: bytes
- name (
-
class
SimpleRrmDevice
(name, xPos, yPos, frequencyBand, deviceIndexToMacDict, interpreter)[source]¶ Bases:
gymwipe.networking.devices.NetworkDevice
A Radio Resource Management
NetworkDevice
implementation. It runs a network stack consisting of a SimplePHY and a SimpleRrmMAC. It offers a method for frequency band assignment and operates anInterpreter
instance that provides observations and rewards for a learning agent.Parameters: - name (
str
) – The device name - xPos (
float
) – The device’s physical x position - yPos (
float
) – The device’s physical y position - band (frequency) – The
FrequencyBand
instance that will be used for transmissions - deviceIndexToMacDict (
Dict
[int
,bytes
]) – A dictionary mapping integer indexes to device MAC addresses. This allows to pass the device index used by a learning agent instead of a MAC address toassignFrequencyBand()
. - interpreter (
Interpreter
) – TheInterpreter
instance to be used for observation and reward calculations
-
interpreter
= None[source]¶ The
Interpreter
instance that provides domain-specific feedback on the consequences ofassignFrequencyBand()
callsType: Interpreter
-
deviceIndexToMacDict
= None[source]¶ A dictionary mapping integer indexes to device MAC addresses. This allows to pass the device index used by a learning agent instead of a MAC address to
assignFrequencyBand()
.
-
macToDeviceIndexDict
= None[source]¶ The counterpart to
deviceIndexToMacDict
-
assignFrequencyBand
(deviceIndex, duration)[source]¶ Makes the RRM assign the frequency band to a certain device for a certain time.
Parameters: - deviceIndex (
bytes
) – The integer id that maps to the MAC address of the device to assign the frequency band to (seedeviceIndexToMacDict
) - duration (
int
) – The number of time units for the frequency band to be assigned to the device
Return type: Returns: The
Signal
object that was used to make the RRM MAC layer assign the frequency band. When the frequency band assignment is over, the signal’seProcessed
event will succeed.- deviceIndex (
- name (