Main Content

addChannelModel

Add custom channel or path loss model

    Description

    addChannelModel(networkSimulator,customMdl) adds a custom channel model or path loss model to the wireless network simulation. The addChannelModel function sets the ChannelFunction property of the wirelessNetworkSimulator object to the custom model specified at input.

    Input Arguments

    collapse all

    Wireless network simulator, specified as a wirelessNetworkSimulator object.

    Function for computing the custom channel or path loss model, specified as a MATLAB® function handle. The syntax for the custom function must be of the format:

    rxData = customFcnName(rxInfo,txData)

    The rxInfo input is the receiver node information, and the txData input specifies the transmitted packets. The simulator automatically passes information about the receiver node and the packets transmitted by a transmitter node as inputs to the custom function.

    The receiver node information is a structure with these fields.

    FieldDescription
    IDUnique receiver node identifier.
    PositionPosition of the receiver node in 3-D Cartesian coordinates (x, y, z). Units are in meters.
    VelocityVelocity of the receiver node (Vrx, Vry, Vrz) in the x-, y-, and z-directions. Units are in meters per second.

    The packets from the transmitter node is a structure with these fields.

    FieldDescription
    Type

    Type of input signal packet, specified as one of these values: 0, 1, 2, 3, and 4.

    • 0 — Invalid packet

    • 1 — WLAN packet

    • 2 — 5G packet

    • 3 — Bluetooth LE packet

    • 4 — Bluetooth BR/EDR packet

    TransmitterIDUnique transmitter node identifier, specified as a positive scalar integer.
    TransmitterPositionPosition of the transmitter node in 3-D Cartesian coordinates (x, y, z). Units are in meters.
    TransmitterVelocityVelocity of the transmitter node (Vtx, Vty, Vtz) in the x-, y-, and z-directions. Units are in meters per second.
    StartTimeTime at which the transmitter starts transmitting the packets, specified as a non-negative scalar. Units are in seconds.
    DurationDuration of the transmitter packet, specified as a positive scalar. Units are in seconds.
    PowerAverage power consumption during transmission. Units are in dBm.
    CenterFrequencyCenter frequency of the carrier signal. Units are in Hz.
    BandwidthCarrier signal bandwidth. Units are in Hz.
    Abstraction

    Type of abstraction, specified as a logical scalar.

    • 1 — Abstracted physical layer

    • 0 — Full physical layer

    The default value is 0.

    SampleRateSample rate of the packet, specified as a numeric scalar in samples per second. This field is applicable only if the value of the Abstraction field is set to 0. The default value is [ ].
    DirectToDestination

    Information about the transmitted packet, specified as a numeric scalar integer.

    • The value is 0 if a normal packet is transmitted over the channel.

    • The value is a non-zero scalar integer if the packet bypasses the channel model and is transmitted directly to the destination node. In this case, this field value specifies the destination node identifier.

    Data

    Time-domain samples or frame information.

    • The field contains time-domain samples of the transmitted packet for full physical layer. In this case, the value of the Abstraction field is 0.

    • The field contains frame information for the abstracted physical layer. In this case, the value of the Abstraction field is 1.

    MetadataA structure representing the technology-specific and abstraction-specific information of the packet.

    The custom channel model function applies channel effects to the packets transmitted by the simulator. The modified packets are then sent back to the must simulator. The packets returned at the output must be a structure with same fields as those of the transmitted packets.

    Data Types: function_handle

    Version History

    Introduced in R2022b