Traffic generation for machine type communication ?
2 次查看(过去 30 天)
显示 更早的评论
Hello everyone, i am currently doing my thesis on some traffic models and here there is the flow diagrams of these 3 traffic models. I have already found the 3rd one which is CMMPP. I just need to to modify a part of the code to get 3GPP1-2 models which is shown in the first and second part. And for the first one 3GPP1 is not synchronous and the distribution of arrivals are uniform and the period T=60 second. For the second flow diagram 3GPP-2 is synchronous and distribution is beta(3,4) and the period is T=10 s. Can anyone help me to modify this part of the code for any one these 3GPP1 or 3GPP2 please? Here is the code for the 3rd one.
for cntt=2:length(time)
% do the state transition
Theta=weightt(cntt)*weightm;
Sprob=cumsum(Theta*ones(1,NUMSTATES).*P_COORD(:,state)'+...
(1-Theta)*ones(1,NUMSTATES).*P_INDEP(:,state)',2);
statechangerand=rand(NUMMACHINES,1);
for cnts=NUMSTATES:-1:1
state_idx=statechangerand<=Sprob(:,cnts);
state(state_idx)=cnts;
end
% generate a random number of pkts -> poisson distr.
numpkts=poissrnd(LAMBDA(state));
prioritypkts=PRIORITY(state); % type of packets
for cntpkt=1:max(numpkts)
% update data
data_idx=numpkts>=cntpkt & prioritypkts==0; % machine index
if(sum(data_idx)>0) % for each packet:
data=[data; [machines(data_idx,:),... % store location
rand(sum(data_idx),1)*HEARTBEAT+time(cntt-1),... % store time
truncrandom(DATADISSIZE, SUPPS, sum(data_idx), 1)]];
end
% update alarm
alrm_idx=numpkts>=cntpkt & prioritypkts==1; % machine index
if(sum(alrm_idx)>0) % for each packet:
alarm=[alarm; [machines(alrm_idx,:),... % store location
rand(sum(alrm_idx),1)*HEARTBEAT+time(cntt-1),... % store time
truncrandom(ALRMDISSIZE, SUPPS, sum(alrm_idx), 1)]];
end
end
end
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/147212/image.png)
1 个评论
Le Duc Long
2020-6-25
Hi everybody,
I'm also interested in this issue. I want to simulate the flow of vehicles to the poisson distribution over time at an intersection.
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!