ClearAll["Global`*"]

Written By Dr. Victor S. Frost
Dan F. Servey Distinguished Professor
Electrical Engineering and Computer Science
University of Kansas

Examples of open and closed networks

Open networks

γ={.6,.4,1};
μ={1,2,3};
r={{0,0.3,0.7},{0,0,0},{0,0,0}};
c={1,1,1};

MatrixForm[r]

𝒩=QueueingNetworkProcess[γ,r,μ,c];

Table[QueueProperties[{𝒩,i}], {i,1,3}]

Table[QueueProperties[{𝒩,i},"MeanSystemSize"],{i,3}]

Another example:

γ={4,5};μ={8,10};
r={{0,1/2},{1/4,0}};
MatrixForm[r]
c={1,1};
𝒩1=QueueingNetworkProcess[γ,r,μ,c];
Table[QueueProperties[{𝒩1,i}], {i,2}]

Solve for the arrival rates

Solve[4+.25*l2==l1&&5+.5*l1==l2, {l1,l2}]

Find the load and average length for each queue/server

roe12=(6./8)
length21=(roe12/(1-roe12))

roe22=(8./10)
length22=(roe22/(1-roe22))

Check Mean system Size

𝒟2node=StationaryDistribution[𝒩1];
Table[QueueProperties[{𝒩1,i}, "MeanSystemSize"], {i,1,2}]

Check loads

roe2node={1-Probability[x==0,{x,y}\[Distributed]𝒟2node]//N,
1-Probability[y==0,{x,y}\[Distributed]𝒟2node]//N}

Find P(1,1)

Probability[x==1&&y==1,{x,y}\[Distributed]𝒟2node]//N

Check

.05*.75*.8

Example 6-4 from text book

γ3={100,0,0};
μ3={800,400,400};
r3={{0,0.5,0.5},{.75,.25,0},{.25,0,0}};
c3={1,1,1};
MatrixForm[r3]
𝒩3=QueueingNetworkProcess[γ3,r3,μ3,c3];
MatrixForm[r3]
Table[QueueProperties[{𝒩3,i}], {i,1,3}]

Table[QueueProperties[{𝒩3,i}, "MeanSystemSize"], {i,1,3}]

data=RandomFunction[𝒩3,{0,10}];

ListStepPlot[data,Filling->Axis]

𝒟3=StationaryDistribution[𝒩3];

Probability there are 3 packets in the network

Probability[x+y+z==3,{x,y,z}\[Distributed]𝒟3]//N

Probabiity Node 1 is empty  = 1-(Subscript[ρ, 1])

Probability[x==0,{x,y,z}\[Distributed]𝒟3]//N

Load for each node

roe={1-Probability[x==0,{x,y,z}\[Distributed]𝒟3]//N,
1-Probability[y==0,{x,y,z}\[Distributed]𝒟3]//N,
1-Probability[z==0,{x,y,z}\[Distributed]𝒟3]//N}

Arrival rate at each none =(Subscript[λ, i])=(Subscript[μ, i])(Subscript[ρ, i])

μ3*roe

Probability of 1 packets in each node.

Probability[x==1&&y==1&&z==1,{x,y,z}\[Distributed]𝒟3]//N

Check

(1-roe[[1]])*roe[[1]]*(1-roe[[2]])*roe[[2]]*(1-roe[[3]])*roe[[3]]

Closed networks

γ4={0,0};
μ4={4,1};
r4={{.25,0.75},{1,0}};
c4={1,1};
MatrixForm[r4]
𝒩4=QueueingNetworkProcess[γ4,r4,μ4,c4,2];
MatrixForm[r4]
Table[QueueProperties[{𝒩4,i}], {i,1,2}]

State probabilities

PDF[𝒩4[∞],{0,2}]//N
 PDF[𝒩4[∞],{1,1}]//N
 PDF[𝒩4[∞],{2,0}]//N

Load on node 1

roe1=PDF[𝒩4[∞],{1,1}]+PDF[𝒩4[∞],{2,0}]

Load on node 2

roe2=PDF[𝒩4[∞],{1,1}]+PDF[𝒩4[∞],{0,2}]

Real arrival rates at node 1 and node 2

roe1*μ4[[1]]
roe2*μ4[[2]]

Expected number in each node

2*PDF[𝒩4[∞],{2,0}]+1*PDF[𝒩4[∞],{1,1}]
2*PDF[𝒩4[∞],{0,2}]+1*PDF[𝒩4[∞],{1,1}]

Check number in network = 2

2*PDF[𝒩4[∞],{2,0}]+1*PDF[𝒩4[∞],{1,1}]+2*PDF[𝒩4[∞],{0,2}]+1*PDF[𝒩4[∞],{1,1}]

Time delays in node 1 and node 2

((2*PDF[𝒩4[∞],{2,0}]+1*PDF[𝒩4[∞],{1,1}])/(roe1*μ4[[1]]))
((2*PDF[𝒩4[∞],{0,2}]+1*PDF[𝒩4[∞],{1,1}])/(roe2*μ4[[2]]))

Example 7.1 from book

γ7={0,0,0};
μ7={mu,mu,mu};
r7={{0,.5,.5},{1,0,0},{1,0,0}};
c7={1,1,1};
MatrixForm[r7]
𝒩7=QueueingNetworkProcess[γ7,r7,μ7,c7,2];
MatrixForm[r7]
Table[QueueProperties[{𝒩7,i}], {i,1,3}]

Find the load on each queue

𝒟7=StationaryDistribution[𝒩7];
roe={1-Probability[x==0,{x,y,z}\[Distributed]𝒟7]//N,
1-Probability[y==0,{x,y,z}\[Distributed]𝒟7]//N,
1-Probability[z==0,{x,y,z}\[Distributed]𝒟7]//N}

sys7=Table[QueueProperties[{𝒩7,i}, "MeanSystemSize"], {i,1,3}]

sys7[[1]]+sys7[[2]]+sys7[[3]]

This is analysis of sliding window protocol using closed network

γ5={0,0,0,0};
μ5={1,1,1,.5};
r5={{0,1,0,0},{0,0,1,0},{0,0,0,1},{1,0,0,0}};
c5={1,1,1,1};
MatrixForm[r5]
𝒩5=QueueingNetworkProcess[γ5,r5,μ5,c5,4];
MatrixForm[r5]
Table[QueueProperties[{𝒩5,i}], {i,1,4}]

Project 5

γ6={0,0,0,0,0};
μ6={2,2,1,1,1};
r6={{0,1,0,0,0},{0,0,0,0,1},{0,0,0,1,0},{0,0,0,0,1},{.5,0,.5,0,0}};
c6={1,1,1,1,1};
MatrixForm[r6]
𝒩6=QueueingNetworkProcess[γ6,r6,μ6,c6,4];
MatrixForm[r6]
Table[QueueProperties[{𝒩6,i}], {i,1,5}]