RINASim  October 2016
Documentation of framework for OMNeT++
ned.php
Go to the documentation of this file.
1 //
2 // This program is free software: you can redistribute it and/or modify
3 // it under the terms of the GNU Lesser General Public License as published by
4 // the Free Software Foundation, either version 3 of the License, or
5 // (at your option) any later version.
6 //
7 // This program is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 // GNU Lesser General Public License for more details.
11 //
12 // You should have received a copy of the GNU Lesser General Public License
13 // along with this program. If not, see http://www.gnu.org/licenses/.
14 //
15 
16 <?php
17 
18 class C {
19  static $p;
20  static $t;
21  static $f;
22  static $s;
23  static $e;
24 
25  static $w;
26  static $wt;
27  static $wf;
28  static $ws;
29  static $we;
30 
31  static $mt;
32  static $mf;
33  static $ms;
34  static $me;
35 
36  static function iniVals($p, $t, $f, $s, $e) {
37  C::$p = $p;
38  C::$t = $t;
39  C::$f = $f;
40  C::$s = $s;
41  C::$e = $e;
42 
43  $tc = $p*($t+1)-1;
44  $fc = $p*($f+1)-1;
45  $sc = $f*($s+1)-1;
46  $ec = $e*($f+1)-1;
47 
48  $mc = max($tc, $fc, $sc, $ec);
49  C::$w = $mc * 60;
50  C::$wt = C::$w/$tc;
51  C::$wf = C::$w/$fc;
52  C::$ws = C::$w/$sc;
53  C::$we = C::$w/$ec;
54 
55  C::$mt = 45 + 30*$mc/$tc;
56  C::$mf = 45 + 30*$mc/$fc;
57  C::$ms = 45 + 30*$mc/$sc;
58  C::$me = 45 + 30*$mc/$ec;
59 
60  }
61 
62  static function X() {
63  return C::$w+60;
64  }
65 
66  static function TX($i, $j) {
67  return C::$mt+C::$wt*($i*(C::$t+1)+$j);
68  }
69  static function FX($i, $j) {
70  return C::$mf+C::$wf*($i*(C::$f+1)+$j);
71  }
72  static function SX($i, $j) {
73  return C::$ms+C::$ws*($i*(C::$s+1)+$j);
74  }
75  static function EX($i, $j) {
76  return C::$me+C::$we*($i*(C::$f+1)+$j);
77  }
78 }
79 C::iniVals($p, $t, $f, $s, $e);
80 
81 ?>
82 
83 
84 package rina.examples.Routing.BigDC;
85 
86 import ned.DatarateChannel;
87 import rina.src.DAF.AE.AEData.AEData;
88 import rina.src.Other.FlowsListener.FlowListener;
89 import rina.src.Other.Infection.InfectedDCRouter;
90 
91 network BigDC
92 {
93  @display("bgb=<?= C::X();?>,500");
94  submodules:
95 <?php
96  for($i = 0; $i < $p; $i++) {
97  for($j = 0; $j < $t; $j++) {
98 ?>
99  T_<?=$i;?>_<?=$j;?>: InfectedDCRouter {
100  @display("p=<?=C::TX($i,$j);?>,400");
101  }
102 <?php
103  }
104  }
105 ?>
106 
107 <?php
108  for($i = 0; $i < $p; $i++) {
109  for($j = 0; $j < $f; $j++) {
110 ?>
111  F_<?=$i;?>_<?=$j;?>: InfectedDCRouter {
112  @display("p=<?=C::FX($i,$j);?>,300");
113  }
114 <?php
115  }
116  }
117 ?>
118 
119 <?php
120  for($i = 0; $i < $f; $i++) {
121  for($j = 0; $j < $s; $j++) {
122 ?>
123  S_<?=$i;?>_<?=$j;?>: InfectedDCRouter {
124  @display("p=<?=C::SX($i,$j);?>,200");
125  }
126 <?php
127  }
128  }
129 ?>
130 
131 <?php
132  for($i = 0; $i < $e; $i++) {
133  for($j = 0; $j < $f; $j++) {
134 ?>
135  E_<?=$i;?>_<?=$j;?>: InfectedDCRouter {
136  @display("p=<?=C::EX($i,$j);?>,100");
137  }
138 <?php
139  }
140  }
141 ?>
142 
143 
144  flowListener: FlowListener { @display("p=60,30"); }
145 
146  connections:
147 <?php
148  for($i = 0; $i < $p; $i++) {
149  for($j = 0; $j < $t; $j++) {
150  for($k = 0; $k < $f; $k++) {
151 ?>
152  T_<?=$i;?>_<?=$j;?>.medium++ <--> TF_Link <--> F_<?=$i;?>_<?=$k;?>.medium++;
153 <?php
154  }
155  }
156  }
157 ?>
158 
159 <?php
160  for($i = 0; $i < $p; $i++) {
161  for($j = 0; $j < $f; $j++) {
162  for($k = 0; $k < $s; $k++) {
163 ?>
164  F_<?=$i;?>_<?=$j;?>.medium++ <--> FS_Link <--> S_<?=$j;?>_<?=$k;?>.medium++;
165 <?php
166  }
167  }
168  }
169 ?>
170 
171 <?php
172  for($i = 0; $i < $e; $i++) {
173  for($j = 0; $j < $f; $j++) {
174  for($k = 0; $k < $s; $k++) {
175 ?>
176  E_<?=$i;?>_<?=$j;?>.medium++ <--> ES_Link <--> S_<?=$j;?>_<?=$k;?>.medium++;
177 <?php
178  }
179  }
180  }
181 ?>
182 
183 }
184 
185 
186 channel TF_Link extends DatarateChannel {
187  parameters:
188  datarate = 1Gbps;
189  delay = 0;
190  per = 0;
191  ber = 0;
192 }
193 
194 channel FS_Link extends DatarateChannel {
195  parameters:
196  datarate = 10Gbps;
197  delay = 0;
198  per = 0;
199  ber = 0;
200 }
201 
202 channel ES_Link extends DatarateChannel {
203  parameters:
204  datarate = 10Gbps;
205  delay = 0;
206  per = 0.00;
207  ber = 0.0;
208 }
209 
static $f
Definition: ned.php:21
static $p
Definition: ned.php:19
static $wf
Definition: ned.php:27
static EX($i, $j)
Definition: ned.php:75
static X()
Definition: ned.php:62
$t
Definition: action.php:14
static $s
Definition: ned.php:22
$e
Definition: action.php:17
static iniVals($p, $t, $f, $s, $e)
Definition: ned.php:36
static TX($i, $j)
Definition: ned.php:66
static $mf
Definition: ned.php:32
static $ws
Definition: ned.php:28
static $we
Definition: ned.php:29
static FX($i, $j)
Definition: ned.php:69
$f
Definition: action.php:15
$s
Definition: action.php:16
static $mt
Definition: ned.php:31
if(isset($_GET['show'])) else if(isset($_GET['download'])) $p
Definition: action.php:13
static SX($i, $j)
Definition: ned.php:72
Definition: ned.php:18
static $ms
Definition: ned.php:33
static $e
Definition: ned.php:23
static $t
Definition: ned.php:20
static $wt
Definition: ned.php:26
static $w
Definition: ned.php:25
static $me
Definition: ned.php:34