SlottedRandomAccess.jl

Documentation for SlottedRandomAccess.jl

Public API

SlottedRandomAccess.CollisionModelType
CollisionModel()

Type to be used as plr_func when instantiating PLR_SimulationParameters or PLR_Simulation, which will mimic a collision model for the PHY abstraction.

Note

An instance of CollisionModel is not callable like all other plr_func values, the collision model is just implemented directly inside the inner code performing the simulation.

source
SlottedRandomAccess.GeneralizedLogisticType
struct GeneralizedLogistic

Type representing a generalized logistic function with specific parameters a, b and c, used to approximate a PLR curve as a function of the (linear) EbN0. The approximating function takes the following form:

\[f(E_bN_0) = (1 + exp(a ⋅ (E_bN_0 - b)))^{-c}\]

Any instance of this type can be called with a single number ebno as input and returns the resulting approximated PLR value following the formula above.

Fields

  • a::Float64

  • b::Float64

  • c::Float64

Constructors

The sole constructor takes 3 input numbers representing the a, b and c parameters in this order.

Examples

julia> using TelecomUtils

julia> g = GeneralizedLogistic(3, 1.1, 1.2)
GeneralizedLogistic(3.0, 1.1, 1.2)

julia> g(1.3) # This is not ebno in db, but linear
0.287945071618515

See the plr_fit_notebook.jl notebook in the package root folder for example of fitting to real simulated data.

source
SlottedRandomAccess.MF_CRDSAType
struct MF_CRDSA{N, F} <: SlottedRandomAccess.FixedRepSlottedRAScheme{N}

Type representing the Multi-Frequency Contention Resolution Diversity Slotted ALOHA (MF-CRDSA) scheme, with a number of replicas N.

This RA scheme was introduced in this 2017 IEEE paper.

The scheme can support a number of time slots that is different than the number of replicas, though the originating paper only implements a scheme where one replica (and only one) is sent in each time slot.

Note

When specifying the number of frame slots in the PLR_SimulationParameters, the total number of slots in the frame (nslots) is assumed to be the product of time slots and frequency slots.

So for example when putting nslots = 100 in the PLR_SimulationParameters and using a MF-CRDSA scheme with time_slots = 2, the number of frequency slots is assumed to be 50.

The assumed number of time slots and the function used to generate them randomly can be modified through the structure fields listed below.

Fields

  • n_time_slots::Int64: The number of time slots in each RA frame for this MF-CRDSA scheme, must be a number equal or greater than the number of replicas N

  • time_slots_function::Any: This function is used to generate the time slots (between 1 and time_slots). It should be a function (or callable) that takes no argument and return an NTuple{N, Int} with the time slots of each replica (without repetitions).

Note

The current implementation still assumes that there is only a single replica per time slot, so while the time_slots_function is arbitrary, potentially wrong results will be returned if this is not the case.

Constructors

MF_CRDSA{N}()

Default construct, which assumes N time slots (so one per replica) and that one replica is sent in each time slot (randomizing over the frequency slots).

MF_CRDSA{N}(n_time_slots::Int, time_slots_function)

More advanced constructor for the MF-CRDSA scheme, which allows specifying a number of time slots different than the number of replicas and the function to be used to generate randomly the time slots to use for each user in each frame.

Example

The code below will generate a MF-CRDSA scheme with 2 replicas and 3 time slots, where the first time slot is always used for the first replica, while the second replica is sent randomly either in the 2nd or 3rd slot.

julia> scheme = MF_CRDSA{2}(3, () -> (1, rand(2:3)))

See also: CRDSA

source
SlottedRandomAccess.PLR_SimulationType
struct PLR_Simulation

Type containing the parameters and results of a PLR simulation.

Fields

  • params::PLR_SimulationParameters: Parameters used for the simulation

  • results::StructArrays.StructArray{SlottedRandomAccess.PLR_Simulation_Point}: Results of the simulation

  • scatter_kwargs::Dict{Symbol, Any}: The list of keyword arguments passed to the scatter call for plotting

Constructors

PLR_Simulation(load::AbstractVector; kwargs...)

Create a PLR_Simulation object by simply providing the load vector. This forwards all the kwargs to the PLR_SimulationParameters constructor.

PLR_Simulation(load::AbstractVector, params::PLR_SimulationParameters; scatter_kwargs = Dict{Symbol, Any}())

This constructor permits to provide both the load and the params field directly as positional arguments. The custom keyword arguments to pass to the scatter call from PlotlyBase can be provided using the scatter_kwargs keyword argument, which defaults to an empty Dict.

See also: PLR_SimulationParameters

source
SlottedRandomAccess.PLR_SimulationParametersType
struct PLR_SimulationParameters{RA, F}

Type storing the parameters to be used for a PLR simulation.

Fields

  • scheme::Any: The specific RA scheme

  • poisson::Bool: Flag specifying whether the simulation should assume poisson or constant traffic

  • coderate::Float64: The coderate of the packets sent by the users

  • M::Int64: The modulation cardinality of the packets sent by the users

  • power_dist::Any: Distribution used to generate the random power values

  • power_strategy::ReplicaPowerStrategy: The strategy to assign power to the replicas of a given packet. Must be a valid value of ReplicaPowerStrategy enum type.

  • max_simulated_frames::Int64: The number of RA frames to simulate for each Load point

  • nslots::Int64: The number of slots in each RA frame

  • plr_func::Any: The function used to compute the PLR for a given packet as a function of its equivalent Eb/N0

  • noise_variance::Float64: The variance of the noise, assumed as N0 in the simulation

  • SIC_iterations::Int64: The maximum number of SIC iterations to perform during the decoding steps

  • max_errored_frames::Int64: The maximum number of frames with errors to simulate. Once a simulation reaches this number of frames with errors, the simulation will stop.

  • overhead::Float64: Overhead assumed for the framing and or guard bands/times in the simulation. It must be a positive number representing the overhead compared to an ideal case where all resources are fully used for sending data (e.g. no pilots, no roll-off, no guard bands, no guard times). An overhead value of 1.0 implies that the spectral efficiency is half of the ideal case.

source
SlottedRandomAccess.RA4StepType
struct RA4Step <: SlottedRandomAccess.FixedRepSlottedRAScheme{1}

Type representing the 4-step RA procedure, where Slotted ALOHA is used during the RA contention period (msg1) and succesfully decoded msg1 packets are used to allocate orthogonal resources for the msg3 transmission of the actual data.

Note

This type of RA scheme will only simulate the packet decoding process for the msg1 and optionally limit the maximum number of succesfull packets per frame to be the number of slots available for msg3 transmission.

Fields

  • msg1_occasions::Int64: Number of time occasions (slots) in each RA frame allocated to the msg1 random access.

  • msg3_occasions::Int64: Number of time occasions (slots) in each RA frame allocated to the msg3 transmission.

  • freq_slots::Int64: Number of frequency slots (i.e. sub-carriers) available in each time slot, it is assumed that the number of subcarriers is the same for both msg1 and msg3 transmissions.

  • limit_packets::Bool: Flag to specify whether to limit the number of maximum decoded packet to the number of slots associated to msg3 transmission (which is equivalent to msg3_occasions * freq_slots).

Constructors

RA4Step(msg1_occasions, msg3_occasions; freq_slots = 48, limit_packets = true)

Example

The code below will generate a 4-step RA scheme with 5 time occasions for msg1 every 2 time occasions for msg3, while assuming 20 frequency slots (i.e. subcarriers) for each time slots and while limiting the maximum number of decoded packets in each frame to the actual number of msg3 slots (which is 2 * 20).

julia> scheme = RA4Step(5, 2; freq_slots = 20, limit_packets = true)

See also: CRDSA, MF-CRDSA

source
SlottedRandomAccess.ReplicaPowerStrategyType
@enum ReplicaPowerStrategy SamePower IndependentPower

Enum used to specify how the power for replicas of a given user in a specific RA frame is determined.

Values

  • SamePower: All replicas have the same power for a given user in a specific RA frame.
  • IndependentPower: Each replica has an independent power in each slot.
source
SlottedRandomAccess.SlottedALOHAType
const SlottedALOHA = CRDSA{1}

This is just an alias to represent SlottedALOHA with the CRDSA type, you create a slotted aloha scheme with the following code:

julia> scheme = SlottedALOHA()
source
SlottedRandomAccess.add_scatter_kwargs!Method
add_scatter_kwargs!(sim::PLR_Simulation; kwargs...)

Add arguments to the scatter_kwargs field in the simulation object by merging all the passed keyword arguments with the existing dictionary.

source
SlottedRandomAccess.extract_plrFunction
plrs = extract_plr(sim::PLR_Simulation)
plr = extract_plr(p::Union{PLR_Simulation_Point,PLR_Result})

Extract the PLR value (as a number between 0 and 1) from either a PLR_Simulation or a single PLR_Simulation_Point or PLR_Result.

In the first case, the function will return a vector with an element for each load point in the PLR_Simulation object.

source
SlottedRandomAccess.simulate!Method
simulate!(sim::PLR_Simulation; kwargs...)

Perform the simulation to compute the PLR for each load point in the PLR_Simulation object, using all available threads by default. The function sends a warning if julia is started with a single thread

Note

Points that already contain valid simulation results are skipped and a new simulation object must be explicitly created to recompute them.

Keyword Arguments

  • logger: The logger to use for displaying the progress of the simulation. Defaults to the default julia logger and also prints to the terminal via TerminalLogger.jl when executed from an interactive julia session (i.e. the REPL).
  • ntasks: The number of tasks to use for the parallel computation of each PLR point. Uses all available threads if not provided.
source