# Traffic Models

**URL:** <https://vccsforum.nt.tuwien.ac.at/t/traffic-models/304>\
**Category:** Vienna 5G System Level Simulator\
**Created:** [November 29, 2023, 6:44pm UTC](https://vccsforum.nt.tuwien.ac.at/t/traffic-models/304 "2023-11-29T18:44:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gabriel.andrade](https://vccsforum.nt.tuwien.ac.at/letter_avatar_proxy/v4/letter/g/3be4f8/32.png) [@gabriel.andrade](https://vccsforum.nt.tuwien.ac.at/u/gabriel.andrade)\
**Post date:** [November 29, 2023, 6:44pm UTC](https://vccsforum.nt.tuwien.ac.at/t/traffic-models/304/1 "2023-11-29T18:44:47Z")

</div>

Hello,

I’m trying to implement traffic models to my HetNet scenario.

Originally we have as users: _clusteredUser_ (IoT users), _poissonPedestrians_, _poissonCars_ and _streetCars_ (as vehicular users).

In my scenario, I’ve changed to:  
_clusteredUser_  
_poissonPedestriansFullBuffer_ (NEW)  
_poissonPedestriansHTTP_ (NEW)  
_poissonPedestriansVideo_ (NEW)  
_poissonPedestriansVoIP_ (NEW)  
_poissonPedestriansGaming_ (NEW)  
_poissonCars_  
_streetCars_

I have some questions:

**1) Is Full Buffer the traffic type set as default?** This is what I undestood by reading _scenarios/example_ and _parameters/user/trafficModel/TrafficModel_

**2) What is the correct way to configure a traffic model?** I’m confused about what instruction to follow. In sequence I demonstrate the two ways that I found possible:

```auto
% First Way - as "scenarios/example"
poissonPedestriansGaming = parameters.user.Poisson2D;
poissonPedestriansGaming.nElements = 30; % number of users placed
poissonPedestriansGaming.nRX = 1;
poissonPedestriansGaming.speed = 0; % static user
poissonPedestriansGaming.movement = parameters.user.movement.Static;
poissonPedestriansGaming.schedulingWeight = 10; % assign 10 resource blocks when scheduled
poissonPedestriansGaming.indoorDecision = parameters.indoorDecision.Random(0.5);
poissonPedestriansGaming.losDecision = parameters.losDecision.UrbanMacro5G;
poissonPedestriansGaming.channelModel = parameters.setting.ChannelModel.PedA;
poissonPedestriansGaming.trafficModel.type = parameters.setting.TrafficModelType.Gaming;
poissonPedestriansGaming.trafficModel.delayConstraint = 60; 
params.userParameters('poissonUserPedestrianGaming') = poissonPedestriansGaming;

```

Or

```auto
% Second Way - as "trafficModels/example"
poissonPedestriansGaming = parameters.user.Poisson2D;
poissonPedestriansGaming.nElements = 30; % number of users placed
poissonPedestriansGaming.nRX = 1;
poissonPedestriansGaming.speed = 0; % static user
poissonPedestriansGaming.movement = parameters.user.movement.Static;
poissonPedestriansGaming.schedulingWeight = 10; % assign 10 resource blocks when scheduled
poissonPedestriansGaming.indoorDecision = parameters.indoorDecision.Random(0.5);
poissonPedestriansGaming.losDecision = parameters.losDecision.UrbanMacro5G;
poissonPedestriansGaming.channelModel = parameters.setting.ChannelModel.PedA;

params.setDependentParameters;
params.transmissionParameters.DL.bandwidthHz = 20e6;
UE = networkElements.ue.User;
poissonPedestriansGaming.trafficModel.type = parameters.setting.TrafficModelType.Gaming;
UE.setGenericParameters(poissonPedestriansGaming, params);
traffic = UE.trafficModel;
for iSlot = 1:10
    UE.trafficModel.checkNewPacket(iSlot);
end
[numberOfPackets,remaningBits,generationTimes] = UE.trafficModel.getBufferState;
userThroughput = 3000;
UE.trafficModel.updateAfterTransmit(userThroughput,iSlot);
Latency = UE.trafficModel.getTransmissionLatency;
if all(isinf(Latency)) || isempty(Latency)
    warning('Transmission latency plot will not be shown since insufficient number of packets has been transmitted, you may need to increase the simulation time or change the traffic model parameters.');
    return;
end

params.userParameters('poissonUserPedestrianGaming') = poissonPedestriansGaming;

```

**3) Is it possible to configure multiple users with different traffic models in the same scenario? If possible, what details should I pay attention to in the configuration?**

**4) Sometimes I get the warning about insufficient number of packets. How can I increase separately for each scenario user?**

**5) What is the correct way to plot the Latency ECDF of all users of my scenario including the ones with Traffic Models set?** In the MATLAB variable _result.transmissionLatency_ all I get is **Inf**

---

<div class="post-metadata">

**Author:** ![afastenb](https://vccsforum.nt.tuwien.ac.at/letter_avatar_proxy/v4/letter/a/6de8d8/32.png) [@afastenb](https://vccsforum.nt.tuwien.ac.at/u/afastenb)\
**Post date:** [December 1, 2023, 12:58pm UTC](https://vccsforum.nt.tuwien.ac.at/t/traffic-models/304/2 "2023-12-01T12:58:23Z")

</div>

Hello,

> [@gabriel.andrade](#):
>
> **Is Full Buffer the traffic type set as default?**

Yes. If you do not set another traffic model for a user group, a full buffer will be simulated.

> [@gabriel.andrade](#):
>
> **What is the correct way to configure a traffic model?**

The trafficModels.example is the example for stand-alone use for the traffic models. So the scenario example is the better template. You can also refer to the openStreetMap scenario. There, constant rate models are set up.

> [@gabriel.andrade](#):
>
> Is it possible to configure multiple users with different traffic models in the same scenario? If possible, what details should I pay attention to in the configuration?

You can set arbitrary traffic models for each user group that you add to a scenario. If you want latency results, it is not recommended to use the full buffer traffic model, since the latency cannot be determined for this traffic model.

> [@gabriel.andrade](#):
>
> Sometimes I get the warning about insufficient number of packets. How can I increase separately for each scenario user?

I suspect that you set up short simulations with traffic models that have long waiting times in between their periods for traffic generation, so you might end up with a simulation without any data to transmit. If you want to set the traffic generation manually, I recommend using the constant rate traffic model. You also get this warning if there are only full buffer users in the simulation.

> [@gabriel.andrade](#):
>
> What is the correct way to plot the Latency ECDF of all users of my scenario including the ones with Traffic Models set?

The Inf values can come from full buffer users, or from users that never successfully transmit data. The lack of successful transmission can stem from bad channel conditions for these users, or from an overloaded network that never schedules these users for transmission, or from the scheduling decision that prioritizes other users. If you do not set a traffic model and use only full buffer users, plotting the latency is not possible, since there are no latency values.

---

<div class="post-metadata">

**Author:** ![gabriel.andrade](https://vccsforum.nt.tuwien.ac.at/letter_avatar_proxy/v4/letter/g/3be4f8/32.png) [@gabriel.andrade](https://vccsforum.nt.tuwien.ac.at/u/gabriel.andrade)\
**Post date:** [December 6, 2023, 5:30pm UTC](https://vccsforum.nt.tuwien.ac.at/t/traffic-models/304/3 "2023-12-06T17:30:48Z")

</div>

Hello @afastenb,

Thank you for the answers.

I changed my scenario considering the information of configuration provided by the openStreetMap scenario. Also, I removed the FullBuffer traffic so I could get information about latency.

Now I’m having trouble in generating my plot for the throughput by user group. I get errors like this one:

```auto
*Index in position 1 exceeds array bounds. Index must not exceed 213.

Error in launcherFiles.launcherHetNet (line 113)
VideoThroughput = result.userThroughputMBitPerSec.DL(pedestrianUserVideo,:);*

```

Also, the ECDF graph for latency is only plotted up to 50% of users and the latency axis varies from 1 in 1 ms to just 9 ms. Is the default setting of “result.plotUserLatencyEcdf;” correct?

Do you mind if I send you my codes for “HetNet” and “launcherHetNet” so you can take a closer look at this array error? I’m a little confused on this part

---

<div class="post-metadata">

**Author:** ![afastenb](https://vccsforum.nt.tuwien.ac.at/letter_avatar_proxy/v4/letter/a/6de8d8/32.png) [@afastenb](https://vccsforum.nt.tuwien.ac.at/u/afastenb)\
**Post date:** [December 18, 2023, 4:14pm UTC](https://vccsforum.nt.tuwien.ac.at/t/traffic-models/304/4 "2023-12-18T16:14:34Z")

</div>

Hello,

the error message tells you that your indices `pedestrianUserVideo` do not match the throughput results. You probably did not set them correctly.

> Also, the ECDF graph for latency is only plotted up to 50% of users and the latency axis varies from 1 in 1 ms to just 9 ms. Is the default setting of “result.plotUserLatencyEcdf;” correct?

The latency ECDF only reaching 50% means that 50% of packets are not transmitted during the simulation time, and thus their latency is set to `Inf`. The example HetNet scenario simulates a duration of 10 ms, thus large latency values are not reached within a simulation. Keep in mind that the example scenarios are example that show how to set parameters and what features the simulator supports. They are kept very small in order to produce and show results quickly. They are not providing full simulation results with meaningful results, they at best provide a snapshot of the network.

> Do you mind if I send you my codes for “HetNet” and “launcherHetNet” so you can take a closer look at this array error?

We do not have the resources to debug your code for you. Please look at the results object and the implementation of the respective classes and use the debugging functionalities provided by MATLAB.
