1function newmodel = removeClass(model,
jobclass)
2% SELF = REMOVECLASS(SELF, CLASS)
4% Remove the specified CLASS from the model
5newmodel = model.copy();
7if hasSingleClass(newmodel)
8 if newmodel.classes{1}.name ==
jobclass.name
9 line_error(mfilename,
'The network has a single class, it cannot be removed from the model.');
14 nClasses = length(newmodel.classes);
15 r = newmodel.getClassByName(
jobclass.name).index; %
class to remove
16 remaining = setdiff(1:nClasses, r);
18 % check with SEPT/LEPT
19 for i=1:length(newmodel.nodes)
20 switch class(newmodel.
nodes{i})
21 case {
'Delay',
'DelayStation',
'Queue'}
22 newmodel.nodes{i}.schedStrategyPar = newmodel.nodes{i}.schedStrategyPar(remaining);
23 newmodel.nodes{i}.serviceProcess = newmodel.nodes{i}.serviceProcess(remaining);
24 newmodel.nodes{i}.classCap = newmodel.nodes{i}.classCap(remaining);
25 newmodel.nodes{i}.server.serviceProcess = newmodel.nodes{i}.server.serviceProcess(remaining);
26 newmodel.nodes{i}.output.outputStrategy = newmodel.nodes{i}.output.outputStrategy(remaining);
28 newmodel.nodes{i}.server.updateClassSwitch(newmodel.nodes{i}.server.csFun(remaining,remaining));
29 newmodel.nodes{i}.output.outputStrategy = newmodel.nodes{i}.output.outputStrategy(remaining);
31 line_error(mfilename,
'Cannot dynamically remove classes in models with caches. You need to re-instantiate the model.');
33 newmodel.nodes{i}.arrivalProcess = newmodel.nodes{i}.arrivalProcess(remaining);
34 newmodel.nodes{i}.classCap = newmodel.nodes{i}.classCap(remaining);
35 newmodel.nodes{i}.input.sourceClasses = newmodel.nodes{i}.input.sourceClasses(remaining);
36 %self.nodes{i}.server.serviceProcess = self.nodes{i}.server.serviceProcess(remaining);
37 newmodel.nodes{i}.output.outputStrategy = newmodel.nodes{i}.output.outputStrategy(remaining);
39 newmodel.nodes{i}.output.outputStrategy = newmodel.nodes{i}.output.outputStrategy(remaining);
42 newmodel.classes = newmodel.classes(remaining);
43 newmodel.reset(
true); % require a complete re-initialization including state