1classdef OpenSignal < OpenClass
2 % OpenSignal Signal
class for open queueing networks
4 % OpenSignal
is a specialized OpenClass
for modeling signals in open
5 % queueing networks. Unlike regular customers, signals can have special
6 % effects on queues they visit, such as removing jobs (negative signals)
7 % or unblocking servers (reply signals).
9 % For closed networks, use ClosedSignal instead.
12 % - SignalType.NEGATIVE: Removes a job from the destination queue
13 % - SignalType.REPLY: Unblocks servers waiting
for a reply
17 % model = Network(
'OpenModel');
18 % source = Source(model,
'Source');
19 % sink = Sink(model,
'Sink');
20 % queue = Queue(model,
'Queue', SchedStrategy.FCFS);
21 % reqClass = OpenClass(model,
'Request');
22 % replySignal = OpenSignal(model,
'Reply', SignalType.REPLY).forJobClass(reqClass);
25 % Copyright (c) 2012-2026, Imperial College London
26 % All rights reserved.
29 signalType % SignalType constant (NEGATIVE, REPLY)
30 targetJobClass % JobClass that this signal
is associated with
31 removalDistribution % DiscreteDistribution for number of removals (empty = remove exactly 1)
32 removalPolicy % RemovalPolicy constant (RANDOM, FCFS, LCFS)
37 function self = OpenSignal(model, name, signalType, prio)
38 % OPENSIGNAL Create an open signal class instance
40 % @param model Network model to add the signal class to
41 % @param name String identifier for the signal class
42 % @param signalType SignalType constant (default: SignalType.NEGATIVE)
43 % @param prio Optional priority level (default: 0)
44 % @return self OpenSignal instance
49 if nargin < 3 || isempty(signalType)
50 signalType = SignalType.NEGATIVE;
53 self@OpenClass(model, name, prio);
54 self.signalType = signalType;
55 self.targetJobClass = [];
56 self.removalDistribution = [];
57 self.removalPolicy = RemovalPolicy.RANDOM;
59 if model.isJavaNative()
60 % Replace the OpenClass Java
object with a Signal
object
61 self.obj = jline.lang.Signal(model.obj, name, signalType, prio);
65 function type = getSignalType(self)
66 % GETSIGNALTYPE Get the signal type
67 type = self.signalType;
70 function self = forJobClass(self, jobClass)
71 % FORJOBCLASS Associate
this signal with a job
class
73 % For REPLY signals,
this specifies which job
class's servers
74 % will be unblocked when this signal arrives.
76 % @param jobClass The JobClass to associate with this signal
77 % @return self The modified Signal instance (for chaining)
79 self.targetJobClass = jobClass;
81 jobClass.replySignalClass = self;
85 function jobClass = getTargetJobClass(self)
86 % GETTARGETJOBCLASS Get the associated job class
87 jobClass = self.targetJobClass;
90 function idx = getTargetJobClassIndex(self)
91 % GETTARGETJOBCLASSINDEX Get the index of the associated job class
92 if isempty(self.targetJobClass)
95 idx = self.targetJobClass.index;
99 function b = isCatastrophe(self)
100 % ISCATASTROPHE Check if this is a catastrophe signal
102 % @return b true if signalType is SignalType.CATASTROPHE
103 b = (self.signalType == SignalType.CATASTROPHE);
106 function dist = getRemovalDistribution(self)
107 % GETREMOVALDISTRIBUTION Get the removal distribution
108 dist = self.removalDistribution;
111 function self = setRemovalDistribution(self, dist)
112 % SETREMOVALDISTRIBUTION Set the removal distribution
113 self.removalDistribution = dist;
116 function policy = getRemovalPolicy(self)
117 % GETREMOVALPOLICY Get the removal policy
118 policy = self.removalPolicy;
121 function self = setRemovalPolicy(self, policy)
122 % SETREMOVALPOLICY Set the removal policy
123 self.removalPolicy = policy;