-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconcert.ned
88 lines (81 loc) · 2.1 KB
/
concert.ned
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package whythehellisthisfailing;
// ------------------ SIMPLE ------------------//
simple Smartphone
{
parameters:
int interval = default(intuniform(1, 10));
@display("i=device/cellphone");
gates:
inout antennaGate;
}
simple Antenna
{
parameters:
@display("i=device/antennatower");
gates:
inout deviceGate[];
inout headerGate;
}
simple Header
{
parameters:
@display("i=misc/cloud");
gates:
inout antennaGate[];
}
// ------------------ CHANNELS ------------------//
channel FibberChannel extends ned.DatarateChannel
{
datarate = 1Gbps;
delay = 100us;
@display("ls=orange,2");
}
// Wifi and 4G channels have similar bandwidth and differs in range.
channel WirelessChannel extends ned.DatarateChannel
{
// Average between 4G upstream (75Mbps) and downstream (300Mbps).
datarate = 180Mbps;
delay = 100us;
@display("ls=blue,2,da");
}
// ------------------ MODULES ------------------//
module IspNetwork
{
parameters:
int numHosts = default(10);
int numAntennas = default(2);
@display("i=block/network");
submodules:
header: Header {
@display("p=60,71");
}
antenna[numAntennas]: Antenna {
@display("p=60,144,r,200");
}
smartphone[numHosts]: Smartphone {
@display("p=59,219,m,5");
}
connections:
// connects antenas to the header
for i=0..sizeof(antenna)-1 {
antenna[i].headerGate <--> FibberChannel <--> header.antennaGate++;
}
// distributes smartphones nodes between antenas
for i=0..sizeof(smartphone)-1 {
smartphone[i].antennaGate <--> WirelessChannel <--> antenna[intuniform(0, numAntennas-1)].deviceGate++;
}
}
// ------------------ NETWORKS ------------------//
network ConcertNetwork
{
parameters:
@display("i=block/network2");
submodules:
AtAndTNetwork: IspNetwork {
@display("p=77,90");
}
VerizonNetwork: IspNetwork {
@display("p=276,90");
}
connections:
}