Skip to content

Radio: concurrent transmissions and receptions (off by default) - #1300

Open
torokati44 wants to merge 3 commits into
inet-framework:masterfrom
torokati44:topic/radio-concurrent-transmissions
Open

torokati44 wants to merge 3 commits into
inet-framework:masterfrom
torokati44:topic/radio-concurrent-transmissions

Conversation

@torokati44

Copy link
Copy Markdown
Member

Split out from #1281.

Radio can transmit only one signal and attempt only one reception at a time. A cellular base station needs several of each: it serves many users at once, each on its own part of the band. This PR lets Radio do that behind two new parameters, both default(false). With the defaults, behaviour is unchanged.

Each commit builds and makes sense on its own, so it's easiest to review them in order:

  1. IRadio: every transmission and reception in progress. Adds pure virtual getTransmissionsInProgress() and getReceptionsInProgress(). ReceiverBase and the canvas visualizers use them instead of the singular getters. With at most one signal in progress, every answer is the same as before. I made them pure virtual on purpose: a default built on the singular getters would silently report just one signal for a radio that has several.
  2. Radio: log the attempted receptions that are dropped. A reconfiguration such as a bitrate, bandwidth or channel change, or a newly attempted reception, silently drops the attempt in progress. The log showed "attempting" and then "ignoring" with nothing in between to explain why. The new abandonAttemptedReceptions() logs "Reception abandoned". It also gives the next commit one place where the attempt is dropped.
  3. Radio: concurrent transmissions and receptions. The single transmission and reception timers become vectors. allowConcurrentTransmissions and allowConcurrentReceptions turn the feature on. The singular getters keep working while at most one signal is in progress in their direction, and throw when there are several.

Compatibility, described in two WHATSNEW entries:

  • An IRadio implementation that doesn't derive from Radio must implement the two new methods. In INET, NoiseSource and ShortcutRadio are updated.
  • Radio subclasses lose receptionTimer and transmissionTimer. continueTransmission(), endTransmission() and abortTransmission() now take the timer as an argument.
  • Models that rely on the singular signal-part getters, such as StateBasedEpEnergyConsumer and StateBasedCcEnergyConsumer, can't be used with a radio that actually has several signals in progress.
  • Ieee802154UwbIrReceiver attempts every reception and relies on the newest one replacing the current one. That still happens with the default allowConcurrentReceptions = false.

Tests (in tests/module):

  • Radio_InProgressGetters and Radio_AbandonedReception cover commits 1 and 2.
  • ConcurrentRadio_1–_6 cover commit 3:
    • two overlapping transmissions from one radio, and two receptions at one receiver;
    • the default guard and replacement behaviour;
    • three senders on a dimensional medium, where the two sharing a band collide and the one on a separate band is decoded;
    • the getters with nothing in progress;
    • the received signal part with two overlapping receptions.

IRadio answers for one transmission and one attempted reception in
progress, getTransmissionInProgress() and getReceptionInProgress(). Code
that asks whether a given signal is the one in progress, such as
ReceiverBase deciding whether to attempt a reception and the canvas
visualizers linking a figure to a signal, cannot work with a radio that
has several in progress at once, which a later commit of this series
("Radio: concurrent transmissions and receptions") lets Radio have.

IRadio gains getTransmissionsInProgress() and getReceptionsInProgress(),
which return every one in progress. Radio, NoiseSource and ShortcutRadio,
which have at most one in each direction, implement them from their
singular getters. The callers switch to them: ReceiverBase attempts a
reception when nothing is being attempted or the reception is among the
attempted ones, and not when a preceding interferer is among them.
RadioCanvasVisualizer links the reception or transmission state figure to
a signal only when it is the only one in progress in that direction.
MediumCanvasVisualizer shows a signal in its spectrum figures only when
neither direction has several in progress; otherwise they show the
medium, as with none. With at most one in progress every answer is the
same as before.

The two methods are pure virtual rather than defaulted to the singular
getters: a radio that has several signals in progress and inherited such
a default would silently report one of them. C++ API change, stated in
WHATSNEW: an IRadio implementation must implement both.

Test: Radio_InProgressGetters (halfway through the only signal, the
plural getters hold exactly the transmission and the reception that the
singular ones answer; after it, nothing).
A reconfiguration of the radio (bitrate, bandwidth, and the IEEE 802.11
mode set, mode, band and channel) stops attempting the reception in
progress by resetting the receptionTimer member, and a newly attempted
reception replaces the one in progress the same way. Neither is logged:
the log shows a reception "attempting" and later "ignoring", with nothing
between to say why.

The new abandonAttemptedReceptions() does this for the seven setters and
startReception(), and logs "Reception abandoned" for the reception, in
the format of the other reception lines. The timer stays scheduled, owned
by allReceptionTimers, and the reception is ignored when it ends, as
before; the reception state and the received signal part are still
updated only by the next reception event. The call also gives the
subclasses one place that drops the attempt, which the next commit needs
when the single member becomes a vector.

Test: Radio_AbandonedReception (the receiving radio's bandwidth is set
halfway through the only signal: attempting, abandoned, ignoring, nothing
sent up).
Radio held one transmission timer and one attempted-reception timer, so it
could transmit one signal and attempt one reception at a time. Both become
vectors: transmissionTimers (a pool: idle timers are reused, so a radio that
never transmits concurrently still allocates exactly one) and
attemptedReceptionTimers.

Two new parameters, both default(false), keep today's behavior:
- allowConcurrentTransmissions: without it, a packet from above while
  transmitting is still an error;
- allowConcurrentReceptions: without it, a newly attempted reception replaces
  the one in progress, as the single member did. The receivers shipped with
  INET attempt one reception at a time, except Ieee802154UwbIrReceiver,
  which attempts every one and relies on that replacement.

Radio's getTransmissionsInProgress() and getReceptionsInProgress() return
every transmission and attempted reception in progress. Its
getTransmissionInProgress(), getReceptionInProgress(),
getTransmittedSignalPart() and getReceivedSignalPart() answer for the one
signal in progress in their direction, nullptr or SIGNAL_PART_NONE when
there is none, and throw an error when there are several: then there is no
one transmission, reception or signal part. The two signal parts, and the
signals emitted when they change, are only updated while at most one is in
progress; when one of two attempted receptions ends, the received part
becomes the other one's. A model that relies on the parts, such as the
StateBasedEpEnergyConsumer and StateBasedCcEnergyConsumer energy consumers,
therefore cannot be used with a radio that has several signals in progress
at once. The callers in INET that must see every signal already ask for
all of them, and abandonAttemptedReceptions() now drops every attempted
reception.

C++ API change for Radio subclasses: receptionTimer/transmissionTimer are
gone, continueTransmission(), endTransmission() and abortTransmission() take
the timer, and a subclass that dropped the attempted reception by resetting
receptionTimer calls abandonAttemptedReceptions().

Tests: ConcurrentRadio_1 (both enabled: two overlapping transmissions from
one radio, both attempted and sent up at the receiver; halfway through, 2
transmissions and 2 receptions in progress, and the singular and part
getters throw), _2 (the default transmission guard), _3 (the default
replacement), _4 (on a dimensional medium, three senders at once, two
sharing a band and one on another, all attempted by a receiver that takes
any signal within its listening band: the pair collides, the third is
decoded; 3 receptions in progress), _5 (with nothing in progress the
singular getters answer nullptr and the part getters NONE, with and without
concurrency) and _6 (separate reception parts: with two attempted receptions
the received part getter throws; when the earlier one ends, the part is the
header of the other one).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant