Module: HostConcreteBuilder
- Defined in:
- lib/builders_examples/ruby_builders/Host_concrete_builder.rb,
lib/builders_examples/pdm_builders/PhaseI/Host_concrete_builder.rb,
lib/builders_examples/pdm_builders/PhaseIWithPriorityQueues/Host_concrete_builder.rb
Instance Method Summary collapse
- #build_output_representation ⇒ Object
- #componentsPdm ⇒ Object
- #generatorApplication ⇒ Object
- #linksPdm ⇒ Object
- #portsPdm ⇒ Object
- #receivingApplication ⇒ Object
Instance Method Details
#build_output_representation ⇒ Object
2 3 4 |
# File 'lib/builders_examples/ruby_builders/Host_concrete_builder.rb', line 2 def build_output_representation "hosts.push @topology.add_host \"#{id}\", #{ips}, \"#{mac}\", \"#{queue_capacity}\"" end |
#componentsPdm ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/builders_examples/pdm_builders/PhaseIWithPriorityQueues/Host_concrete_builder.rb', line 33 def componentsPdm components = '' # 1st we need the in/out ports components += portsPdm # 2nd we need the components components += generatorApplication if @out_elements.size > 0 components += receivingApplication if @in_elements.size > 0 # 3rd the lines components += linksPdm components end |
#generatorApplication ⇒ Object
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 |
# File 'lib/builders_examples/pdm_builders/PhaseIWithPriorityQueues/Host_concrete_builder.rb', line 138 def generatorApplication pdm_generator_application = " Atomic { Name = GeneratorApplication Ports = 0 ; 1 Path = PhaseI/FelixServer.h Description = Generates jobs. Distribution for the rate and jobSize are retrieved from the Flows assigned to this server Graphic { Position = -7740 ; -4365 Dimension = 630 ; 645 Direction = Down Color = 15 Icon = %datanetworks%generator.png } Parameters { } } Atomic { Name = Routing Ports = 1 ; #{@out_elements.size} Path = PhaseI/Router.h Description = InN: Incomming packets\\nInN: Outgoing packets \\n This model routes incoming packets to outports. The decision is based on the global table GlobalFlowBasedRoutingTable(flowId, routerName). If there are more than one possible outport, the model uses a routingPolicy (currently hardcoded to Round-Robin) to decide. Graphic { Position = -7740 ; -2115 Dimension = 615 ; 1785 Direction = Down Color = 15 Icon = %datanetworks%router.jpg } Parameters { } }" (0..@out_elements.size-1).each do |i| pdm_generator_application += " Coupled { Type = Coordinator Name = egressPort#{i} Ports = 1; 1 Description = Coupled DEVS model Graphic { Position = #{-7700 + (2000 * i)}; -120 Dimension = 990; 840 Direction = Down Color = 15 Icon = %datanetworks%egressport.jpg Window = 5000; 5000; 5000; 5000 } Parameters { } System { Inport { Name = Inport0 CoupledPort = 1 Description = Graphic { Position = -4725 ; -3525 Dimension = 450 Direction = Right } } Outport { Name = Outport0 CoupledPort = 1 Description = Graphic { Position = -930 ; 1575 Dimension = 525 Direction = Right } } Atomic { Name = portQueue Ports = 2 ; 2 Path = PhaseI/NetworkQueue.h Description = In0 Incomming packets to queue\\nIn1 Incoming signal to request dequeue\\nOut0 Outgoing dequeued packets\\nOut1 Outgoing queue lenght information\\n\\nQueues incoming packets and enqueues them as required by a\\nexternal entity. FIFO Policy (FirstInFirstOut). Provides information\\nits internal state. Graphic { Position = -3855 ; -2355 Dimension = 675 ; 675 Direction = Down Color = 15 Icon = %datanetworks%queue.png } Parameters { MaxCapacity = Str; #{id}.egressPort.queueCapacity ; Queue Capacity in Bytes. (Use -1 for INF capacity) ForcedPeriod = Str; -1 ; Force minimum period to transition. Use -1 for INF } } Atomic { Name = Link Ports = 1 ; 1 Path = PhaseI/Link.h Description = Vector to scalar signal Graphic { Position = -3990 ; -540 Dimension = 630 ; 630 Direction = Down Color = 15 Icon = %vectors%vec2scalar.svg } Parameters { link.capacity = Str; #{id}.egressPort#{i}.link.capacity ; Signal Index link.delay = Str; #{id}.egressPort#{i}.link.delay ; } } Point { ConectedLines = 3 ; 4 ; 5 ConectedExtrems = Org ; Org ; Org Position = -3705 ; 765 } Line { Source = Prt ; 1 ; 1 ; 0 Sink = Cmp ; 1 ; 1 ; -1 PointX = -4125 ; -3675 ; -3675 PointY = -3525 ; -3525 ; -2490 } Line { Source = Cmp ; 1 ; 1 ; 0 Sink = Cmp ; 2 ; 1 ; -1 PointX = -3675 ; -3675 ; -3675 PointY = -1575 ; -1575 ; -690 } Line { Source = Cmp ; 2 ; 1 ; 0 Sink = Pnt ; 1 ; -1 ; 0 PointX = -3675 ; -3705 ; -3705 PointY = 225 ; 225 ; 765 } Line { Source = Cmp ; 1 ; 2 ; -1 Sink = Pnt ; 1 ; -1 ; 0 PointX = -3375 ; -3375 ; -2775 ; -2775 ; -3705 PointY = -2490 ; -2775 ; -2775 ; 765 ; 765 } Line { Source = Pnt ; 1 ; -1 ; 0 Sink = Prt ; 2 ; 1 ; -1 PointX = -3705 ; -3705 ; -1065 PointY = 765 ; 1575 ; 1575 } } }" end pdm_generator_application end |
#linksPdm ⇒ Object
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/builders_examples/pdm_builders/PhaseIWithPriorityQueues/Host_concrete_builder.rb', line 86 def linksPdm links_pdm = '' # from generator (component 1) to router (component 2) if @out_elements.size > 0 # if there is a generator links_pdm += " Line { Source = Cmp ; 1 ; 1 ; 0 Sink = Cmp ; 2 ; 1 ; -1 PointX = -6300 ; -6300 ; -6300 PointY = -1725 ; -1725 ; -1140 }" end (1..@out_elements.size).each do |i| # from router (component 2) to egressLink (components 3,4.. outElems+2) links_pdm += " Line { Source = Cmp ; 2 ; #{i} ; 0 Sink = Cmp ; #{i+2} ; 1 ; -1 PointX = -6300 ; -6300 ; -6300 PointY = -1725 ; -1725 ; -1140 }" # from egressLink (components 3,4.. outElems+2) to outports links_pdm += " Line { Source = Cmp ; #{i+2} ; 1 ; 0 Sink = Prt ; #{i} ; 1 ; -1 PointX = #{-7200 + (2000 * (i-1))} ; #{-7200 + (2000 * (i-1))} ; #{-7200 + (2000 * (i-1))} PointY = 900 ; 3525 ; 3525 }" end # from inports to receiving app (0..@in_elements.size-1).each do |i| links_pdm +=" Line { Source = Prt ; #{(@out_elements.size + 1) + i} ; 1 ; 0 Sink = Cmp ; #{(@out_elements.size * 3) + 1} ; #{1 + i} ; -1 PointX = -8700 ; #{-8325 + (i * 300)} ; #{-8325 + (i * 300)} PointY = #{-3250 + (i*1000)} ; #{-3250 + (i*1000)} ; -90 }" end links_pdm end |
#portsPdm ⇒ Object
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 |
# File 'lib/builders_examples/pdm_builders/PhaseIWithPriorityQueues/Host_concrete_builder.rb', line 47 def portsPdm ports = '' # inports (0..@in_elements.size-1).each do |i| ports +=" Inport { Name = Inport#{i} CoupledPort = #{i+1} Description = Graphic { Position = -9330 ; #{-3250 + (i*1000)} Dimension = 510 Direction = Right } }" end # outports (0..@out_elements.size-1).each do |i| ports += " Outport { Name = Outport#{i} CoupledPort = #{i+1} Description = Graphic { Position = #{-7000 + (2000 * i)} ; 3600 Dimension = 555 Direction = Right } }" end ports end |
#receivingApplication ⇒ Object
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 |
# File 'lib/builders_examples/pdm_builders/PhaseIWithPriorityQueues/Host_concrete_builder.rb', line 310 def receivingApplication # atomic model for receiving application pdm_receiving_app = " Atomic { Name = ReceivingApplication Ports = #{@in_elements.size} ; 0 Path = PhaseI/Packetsink.h Description = Generates jobs. Distribution for the rate and jobSize are retrieved from the Flows assigned to this server Graphic { Position = -8490 ; 45 Dimension = 630 ; 675 Direction = Down Color = 15 Icon = %datanetworks%generator.png } Parameters { } }" pdm_receiving_app end |