InterpacketGapInserter

Package: inet.protocolelement.common

simple module InterpacketGapInserter

Enforces a minimum time gap between consecutive packets, which is important for protocols like Ethernet that require an interpacket gap (IPG) or interframe spacing. This module delays packet transmission to ensure the configured minimum gap duration is maintained between packets. It can optionally use an external clock module for timing, and supports packet streaming.

inet.protocolelement.common.InterpacketGapInserterInterpacketGapInsertersimple

Usage diagram

Inheritance diagram

Used in compound modules

Name

Type

Description

EthernetPhyLayer

compound module

(no description)

EthernetPreemptingPhyLayer

compound module

(no description)

Extends

Name

Type

Description

PacketProcessorBase

simple module

Base module for various packet processing modules which maintains a few statistics.

Parameters

Name

Type

Default value

Description

displayStringTextFormat

string

“delayed %p pk (%l)\nifg: %g”

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

clockModule

string

“”

Relative path of a module that implements IClock(1,:ref:2 <neddoc-msg-inet-iclock>); optional

initialChannelBusy

bool

false

Assume that the channel was busy before the simulation started

duration

double

Properties

Name

Value

Description

class

InterpacketGapInserter

display

i=block/timer

Gates

Name

Direction

Size

Description

in

input

out

output

Signals

Name

Type

Unit

Description

interpacketGapEnded

double

interpacketGapStarted

double

Statistics

Name

Title

Source

Record

Unit

Interpolation Mode

Description

interpacketGap

interpacket gap state

count(interpacketGapStarted) - count(interpacketGapEnded)

vector

sample-hold

Source code

//
// Enforces a minimum time gap between consecutive packets, which is important
// for protocols like Ethernet that require an interpacket gap (IPG) or
// interframe spacing. This module delays packet transmission to ensure the
// configured minimum gap duration is maintained between packets. It can
// optionally use an external clock module for timing, and supports packet
// streaming.
//
simple InterpacketGapInserter extends PacketProcessorBase
{
    parameters:
        string clockModule = default(""); // Relative path of a module that implements IClock; optional
        bool initialChannelBusy = default(false); // Assume that the channel was busy before the simulation started
        volatile double duration @unit(s);
        displayStringTextFormat = default("delayed %p pk (%l)\nifg: %g");
        @display("i=block/timer");
        @class(InterpacketGapInserter);
        @signal[interpacketGapStarted](type=double);
        @signal[interpacketGapEnded](type=double);
        @statistic[interpacketGap](title="interpacket gap state"; type=int; source=count(interpacketGapStarted) - count(interpacketGapEnded); record=vector; interpolationmode=sample-hold);
    gates:
        input in;
        output out;
}

File: src/inet/protocolelement/common/InterpacketGapInserter.ned