3model = Network(
'model');
5node{1} = Delay(model,
'Delay');
6node{2} = Queue(model,
'Queue1', SchedStrategy.PS);
7node{3} = Queue(model,
'Queue2', SchedStrategy.PS);
9node{3}.setNumServers(2);
12jobclass{1} = ClosedClass(model,
'Class1', N(1), node{1}, 0);
13jobclass{2} = ClosedClass(model,
'Class2', N(2), node{1}, 0);
14jobclass{3} = ClosedClass(model,
'Class3', N(3), node{1}, 0);
15jobclass{4} = ClosedClass(model,
'Class4', N(4), node{1}, 0);
17node{1}.setService(
jobclass{1}, Exp(1));
18node{1}.setService(
jobclass{2}, Exp(2));
19node{1}.setService(
jobclass{3}, Exp(1));
20node{1}.setService(
jobclass{4}, Exp(1));
22node{2}.setService(
jobclass{1}, Exp(3));
23node{2}.setService(
jobclass{2}, Exp(4));
24node{2}.setService(
jobclass{3}, Exp(5));
25node{2}.setService(
jobclass{4}, Exp(1));
27node{3}.setService(
jobclass{1}, Exp(1));
28node{3}.setService(
jobclass{2}, Exp(3));
29node{3}.setService(
jobclass{3}, Exp(5));
30node{3}.setService(
jobclass{4}, Exp(2));
35P{1,1} = [0,1,0; 0,0,1; 0,0,0];
36P{1,2} = [0,0,0; 0,0,0; 1,0,0];
37P{1,3} = [0,0,0; 0,0,0; 0,0,0];
38P{1,4} = [0,0,0; 0,0,0; 0,0,0];
40P{2,1} = [0,0,0; 0,0,0; 1,0,0];
41P{2,2} = [0,1,0; 0,0,1; 0,0,0];
42P{2,3} = [0,0,0; 0,0,0; 0,0,0];
43P{2,4} = [0,0,0; 0,0,0; 0,0,0];
45P{3,1} = [0,0,0; 0,0,0; 0,0,0];
46P{3,2} = [0,0,0; 0,0,0; 0,0,0];
47P{3,3} = [0,1,0; 0,0,1; 0,0,0];
48P{3,4} = [0,0,0; 0,0,0; 1,0,0];
50P{4,1} = [0,0,0; 0,0,0; 0,0,0];
51P{4,2} = [0,0,0; 0,0,0; 0,0,0];
52P{4,3} = [0,0,0; 0,0,0; 1,0,0];
53P{4,4} = [0,0,1; 0,0,0; 0,0,0];
58M = model.getNumberOfStations();
59K = model.getNumberOfClasses();
61% This part illustrates the execution of different solvers
62fprintf(1,
'This example illustrates the calculation of probabilities via normalizing constants.\n')
66options = Solver.defaultOptions;
73 1, 0, 2, 1];% rows set to -1 are ignored in the calculation of the marginal probabilities
75 node{i}.setState(n(i,:));
77state = model.getState;
79solver = CTMC(model,options);
81 Pr = solver.getProbAggr(node{i});
82 fprintf(1,
'Station %d is in state %s with probability %d\n',i,mat2str(state{i}),Pr);
86solver = NC(model,options);
88 Pr = solver.getProbAggr(node{i});
89 fprintf(1,
'Station %d is in state %s with probability %d\n',i,mat2str(state{i}),Pr);