Parameterised models
Add parameterisation of IOSA models.
Introduce a module_template
command to define templates of a module with placeholder arguments, that can be later instantiated as desired.
Consider the following example for the 3-tandem queue:
const int c = 8;
const int lambda = 1;
const float mu1 = 3;
const float mu2 = 4.5;
const float mu3 = 7.3;
module_template Queue(c,in,out,mu)
q: [0..{c}];
clk: clock; // Queue processing ~ Exponential({mu})
// Packet arrival
[{in}?] q == 0 -> (q'= q+1) & (clk'= exponential({mu}));
[{in}?] q > 0 & q < {c} -> (q'= q+1);
[{in}?] q == {c} -> ;
// Packet processing
[{out}!] q == 1 @ clk -> (q'= q-1);
[{out}!] q > 1 @ clk -> (q'= q-1) & (clk'= exponential({mu}));
endmodule
module Arrivals
clk0: clock; // External arrivals ~ Exponential(lambda)
[P0!] @ clk0 -> (clk0'= exponential(lambda));
endmodule
module_instance(1) Queue(c,P0,P1,mu1);
module_instance(2) Queue(c,P1,P2,mu2);
module_instance(3) Queue(c,P2,P3,mu3);
where the commands
module_instance(<suffix>) Queue(<args>)
instantiate the Queue
module template as follows:
-
_<suffix>
is appended to the module instance name- so a module called
Queue_1
will be created
- so a module called
-
_<suffix>
is appended to all variable names of the module instance- so module
Queue_1
will have variablesq_1
andclk_1
- so module
- every matching argument in the
<args>
list replaces the placeholders in the module template- so the first line of module
Queue_1
will beq_1: [0..c];
- so the first line of module