1
moduleinterface INode
2
{
3
parameters:
4 int
address;
5
gates:
6
inout port[];
7
}
8
9
module SensorNode like INode
10
{
11
parameters:
12 int
address;
13
...
14
gates:
15
inout port[];
16
...
17
}
18
19
network Net6
20
{
21
parameters:
22 string
nodeType;
23
submodules:
24 node[6]: <nodeType>
like INode {
25 address =
index;
26
}
27
connections:
28
...
29 }
nodeType作为node[6]的类型,可以延迟到以后模拟时输入。例如,若将nodeType赋为SensorNode,则效果等同于:
node[6] : SensorNode;
同时,要求SensorNode必须是符合INode接口的。