0001
0002
0003
0004
0005
0006
0007
0008 function fig = simulhope_gui(ui,dir);
0009
0010 scrsz = get(0,'ScreenSize');
0011
0012
0013
0014
0015
0016
0017 mainfigure = figure(...
0018 'PaperUnits',get(0,'defaultfigurePaperUnits'),...
0019 'IntegerHandle','off',...
0020 'InvertHardcopy',get(0,'defaultfigureInvertHardcopy'),...
0021 'MenuBar','none',...
0022 'Name','SiMulHopE : Simple Multi-Hops Emulator / Simulator of Multi-Hops Environments',...
0023 'NumberTitle','off',...
0024 'PaperPosition',get(0,'defaultfigurePaperPosition'),...
0025 'PaperSize',get(0,'defaultfigurePaperSize'),...
0026 'PaperType',get(0,'defaultfigurePaperType'),...
0027 'Pointer','arrow',...
0028 'Units','pixels',...
0029 'Position',scrsz ,...
0030 'Renderer',get(0,'defaultfigureRenderer'),...
0031 'RendererMode','manual',...
0032 'Resize','off',...
0033 'HandleVisibility','callback',...
0034 'Tag','simulhope',...
0035 'UserData',zeros(1,0));
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061 frameoptions = uicontrol(...
0062 'Parent',mainfigure,...
0063 'ListboxTop',0,...
0064 'Position',[16/40*scrsz(3) 1/20*scrsz(4) 23/40*scrsz(3) 4/20*scrsz(4)],...
0065 'String',{ '' },...
0066 'Style','frame',...
0067 'Tag','frameoptions');
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077 model_text = uicontrol(...
0078 'Parent',mainfigure,...
0079 'HorizontalAlignment','left',...
0080 'ListboxTop',0,...
0081 'Position',[1/20*scrsz(3) 33/40*scrsz(4) 2/20*scrsz(3) 1/50*scrsz(4)],...
0082 'String','Type of model :',...
0083 'Style','text',...
0084 'Tag','model_text');
0085
0086 model = uicontrol(...
0087 'Parent',mainfigure,...
0088 'Callback','simulhope_handle',...
0089 'HorizontalAlignment','center',...
0090 'ListboxTop',0,...
0091 'Position',[5/20*scrsz(3) 33/40*scrsz(4) 3/30*scrsz(3) 1/50*scrsz(4)],...
0092 'String',{ 'street' 'city' 'hexagonal' },...
0093 'Style','popupmenu',...
0094 'Value',1,...
0095 'Tag','model');
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151 bs_density_title = uicontrol(...
0152 'Parent',mainfigure,...
0153 'HorizontalAlignment','left',...
0154 'ListboxTop',0,...
0155 'Position',[1/20*scrsz(3) 30/40*scrsz(4) 2/20*scrsz(3) 1/50*scrsz(4)],...
0156 'String','Total Network coverage :',...
0157 'Style','text',...
0158 'Tag','bs_density_title');
0159
0160 coverage_set = uicontrol(...
0161 'Parent',mainfigure,...
0162 'Position',[4/20*scrsz(3) 30/40*scrsz(4) 3/20*scrsz(3) 1/75*scrsz(4)],...
0163 'Callback','simulhope_handle',...
0164 'String',{ '' },...
0165 'Style','slider',...
0166 'Min',1,'Max',100,...
0167 'SliderStep',[5/100 5/100],...
0168 'Value',20,...
0169 'Tag','coverage');
0170
0171 coverage_txt = uicontrol(...
0172 'Parent',mainfigure,...
0173 'HorizontalAlignment','left',...
0174 'ListboxTop',0,...
0175 'Position',[1/20*scrsz(3) 29/40*scrsz(4) 2/20*scrsz(3) 1/50*scrsz(4)],...
0176 'String',' in coverage :',...
0177 'Style','text',...
0178 'Tag','coverage_txt');
0179
0180 coverage_disp = uicontrol(...
0181 'Parent',mainfigure,...
0182 'HorizontalAlignment','center',...
0183 'ListboxTop',0,...
0184 'Position',[4/20*scrsz(3) 29/40*scrsz(4) 3/20*scrsz(3) 1/50*scrsz(4)],...
0185 'String','20%',...
0186 'Style','text',...
0187 'Tag','coverage_disp');
0188
0189 nbs_txt = uicontrol(...
0190 'Parent',mainfigure,...
0191 'HorizontalAlignment','left',...
0192 'ListboxTop',0,...
0193 'Position',[1/20*scrsz(3) 28/40*scrsz(4) 2/20*scrsz(3) 1/50*scrsz(4)],...
0194 'String',' in nbr of BS :',...
0195 'Style','text',...
0196 'Tag','nbs_txt');
0197
0198 nbs = uicontrol(...
0199 'Parent',mainfigure,...
0200 'HorizontalAlignment','center',...
0201 'ListboxTop',0,...
0202 'Position',[4/20*scrsz(3) 28/40*scrsz(4) 3/20*scrsz(3) 1/50*scrsz(4)],...
0203 'String','4',...
0204 'Style','text',...
0205 'Tag','nbs');
0206
0207
0208
0209
0210
0211
0212
0213
0214
0215
0216
0217
0218
0219
0220
0221
0222
0223
0224
0225
0226
0227
0228
0229
0230
0231
0232
0233
0234
0235
0236
0237
0238
0239
0240
0241
0242
0243
0244
0245
0246
0247
0248
0249
0250
0251
0252
0253
0254
0255
0256
0257
0258
0259
0260
0261 nusers_text = uicontrol(...
0262 'Parent',mainfigure,...
0263 'HorizontalAlignment','left',...
0264 'ListboxTop',0,...
0265 'Position',[1/20*scrsz(3) 25/40*scrsz(4) 2/20*scrsz(3) 1/50*scrsz(4)],...
0266 'String','Number of users :',...
0267 'Style','text',...
0268 'Tag','nusers_text');
0269
0270 nusers = uicontrol(...
0271 'Parent',mainfigure,...
0272 'HorizontalAlignment','center',...
0273 'Callback','simulhope_handle',...
0274 'ListboxTop',0,...
0275 'Position',[4/20*scrsz(3) 25/40*scrsz(4) 3/20*scrsz(3) 1/50*scrsz(4)],...
0276 'String','5',...
0277 'Style','edit',...
0278 'Tag','nusers');
0279
0280
0281
0282
0283
0284
0285
0286 mobility_pedestrian_text = uicontrol(...
0287 'Parent',mainfigure,...
0288 'HorizontalAlignment','right',...
0289 'ListboxTop',0,...
0290 'Position',[1/20*scrsz(3) 24/40*scrsz(4) 1/20*scrsz(3) 1/50*scrsz(4)],...
0291 'String','pedestrian ',...
0292 'Style','text',...
0293 'Tag','mobility_text');
0294
0295 mobility_set = uicontrol(...
0296 'Parent',mainfigure,...
0297 'Position',[2/20*scrsz(3) 97/160*scrsz(4) 4/20*scrsz(3) 1/75*scrsz(4)],...
0298 'Callback','simulhope_handle',...
0299 'String',{ '' },...
0300 'Style','slider',...
0301 'Min',0,'Max',100,...
0302 'SliderStep',[5/100 5/100],...
0303 'Value',60,...
0304 'Tag','mobility_set');
0305
0306 mobility_vehicular_text = uicontrol(...
0307 'Parent',mainfigure,...
0308 'HorizontalAlignment','left',...
0309 'ListboxTop',0,...
0310 'Position',[6/20*scrsz(3) 24/40*scrsz(4) 1/20*scrsz(3) 1/50*scrsz(4)],...
0311 'String',' vehicular',...
0312 'Style','text',...
0313 'Tag','mobility_text');
0314
0315 nb_pedestrian_text = uicontrol(...
0316 'Parent',mainfigure,...
0317 'HorizontalAlignment','left',...
0318 'ListboxTop',0,...
0319 'Position',[1/20*scrsz(3) 23/40*scrsz(4) 5/20*scrsz(3) 1/50*scrsz(4)],...
0320 'String','Number of pedestrian users :',...
0321 'Style','text',...
0322 'Tag','nb_pedestrian_text');
0323
0324 nb_pedestrian = uicontrol(...
0325 'Parent',mainfigure,...
0326 'HorizontalAlignment','center',...
0327 'ListboxTop',0,...
0328 'Position',[5/20*scrsz(3) 23/40*scrsz(4) 2/20*scrsz(3) 1/50*scrsz(4)],...
0329 'String','3',...
0330 'Style','text',...
0331 'Tag','nb_pedestrian');
0332
0333 nb_vehicular_text = uicontrol(...
0334 'Parent',mainfigure,...
0335 'HorizontalAlignment','left',...
0336 'ListboxTop',0,...
0337 'Position',[1/20*scrsz(3) 22/40*scrsz(4) 5/20*scrsz(3) 1/50*scrsz(4)],...
0338 'String','Number of vehicular users :',...
0339 'Style','text',...
0340 'Tag','nb_vehicular_text');
0341
0342 nb_vehicular = uicontrol(...
0343 'Parent',mainfigure,...
0344 'HorizontalAlignment','center',...
0345 'ListboxTop',0,...
0346 'Position',[5/20*scrsz(3) 22/40*scrsz(4) 2/20*scrsz(3) 1/50*scrsz(4)],...
0347 'String','2',...
0348 'Style','text',...
0349 'Tag','nb_vehicular');
0350
0351
0352
0353
0354
0355 pspeed_text = uicontrol(...
0356 'Parent',mainfigure,...
0357 'HorizontalAlignment','left',...
0358 'ListboxTop',0,...
0359 'Position',[1/20*scrsz(3) 21/40*scrsz(4) 3/20*scrsz(3) 1/50*scrsz(4)],...
0360 'String','Speed for pedestrian [km/h] :',...
0361 'Style','text',...
0362 'Tag','pspeed_text');
0363
0364 pspeed = uicontrol(...
0365 'Parent',mainfigure,...
0366 'HorizontalAlignment','center',...
0367 'ListboxTop',0,...
0368 'Position',[4/20*scrsz(3) 21/40*scrsz(4) 3/20*scrsz(3) 1/50*scrsz(4)],...
0369 'String','3',...
0370 'Style','edit',...
0371 'Tag','pspeed');
0372
0373
0374
0375
0376
0377
0378
0379 vspeed_text = uicontrol(...
0380 'Parent',mainfigure,...
0381 'HorizontalAlignment','left',...
0382 'ListboxTop',0,...
0383 'Position',[1/20*scrsz(3) 20/40*scrsz(4) 3/20*scrsz(3) 1/50*scrsz(4)],...
0384 'String','Speed for vehicular [km/h] :',...
0385 'Style','text',...
0386 'Tag','vspeed_text');
0387
0388 vspeed = uicontrol(...
0389 'Parent',mainfigure,...
0390 'HorizontalAlignment','center',...
0391 'ListboxTop',0,...
0392 'Position',[4/20*scrsz(3) 20/40*scrsz(4) 3/20*scrsz(3) 1/50*scrsz(4)],...
0393 'String','50',...
0394 'Style','edit',...
0395 'Tag','vspeed');
0396
0397
0398
0399
0400
0401
0402
0403 lambda_text = uicontrol(...
0404 'Parent',mainfigure,...
0405 'HorizontalAlignment','left',...
0406 'ListboxTop',0,...
0407 'Position',[1/20*scrsz(3) 18/40*scrsz(4) 3/20*scrsz(3) 1/50*scrsz(4)],...
0408 'String','Messages arrivals rate (lambda) [messages/min] :',...
0409 'Style','text',...
0410 'Tag','lambda_text');
0411
0412
0413 lambda = uicontrol(...
0414 'Parent',mainfigure,...
0415 'HorizontalAlignment','center',...
0416 'ListboxTop',0,...
0417 'Position',[4/20*scrsz(3) 18/40*scrsz(4) 3/20*scrsz(3) 1/50*scrsz(4)],...
0418 'String','6',...
0419 'Style','edit',...
0420 'Tag','lambda');
0421
0422
0423
0424
0425
0426
0427
0428 tmax_text = uicontrol(...
0429 'Parent',mainfigure,...
0430 'HorizontalAlignment','left',...
0431 'ListboxTop',0,...
0432 'Position',[1/20*scrsz(3) 15/40*scrsz(4) 3/20*scrsz(3) 1/50*scrsz(4)],...
0433 'String','Simulation time [min]:',...
0434 'Style','text',...
0435 'Tag','tmax_text');
0436
0437
0438 tmax = uicontrol(...
0439 'Parent',mainfigure,...
0440 'HorizontalAlignment','center',...
0441 'ListboxTop',0,...
0442 'Position',[4/20*scrsz(3) 15/40*scrsz(4) 3/20*scrsz(3) 1/50*scrsz(4)],...
0443 'String','10',...
0444 'Style','edit',...
0445 'Tag','tmax');
0446
0447
0448
0449
0450
0451
0452
0453 display = axes(...
0454 'Parent',mainfigure,...
0455 'Units','pixels',...
0456 'Position',[16/40*scrsz(3) 6/20*scrsz(4) 23/40*scrsz(3) 13/20*scrsz(4)],...
0457 'Tag','display');
0458
0459
0460
0461
0462
0463
0464
0465 runbutton = uicontrol(...
0466 'Parent',mainfigure, ...
0467 'Callback','simulhope_callback', ...
0468 'ListboxTop',0, ...
0469 'Units','pixels',...
0470 'Position',[2/20*scrsz(3) 1/10*scrsz(4) 4/20*scrsz(3) 3/40*scrsz(4)],...
0471 'String','Run simulation', ...
0472 'Tag','Pushbutton');
0473
0474
0475
0476
0477
0478
0479
0480 plot_path = uicontrol(...
0481 'Parent',mainfigure,...
0482 'HorizontalAlignment','left',...
0483 'ListboxTop',0,...
0484 'Units','pixels',...
0485 'Position',[17/40*scrsz(3) 8/40*scrsz(4) 5/40*scrsz(3) 1/50*scrsz(4) ],...
0486 'String','Plot users mobility path',...
0487 'Style','checkbox',...
0488 'Tag','plotpath');
0489
0490
0491
0492
0493
0494
0495
0496 plot_delay = uicontrol(...
0497 'Parent',mainfigure,...
0498 'HorizontalAlignment','left',...
0499 'ListboxTop',0,...
0500 'Units','pixels',...
0501 'Position',[17/40*scrsz(3) 7/40*scrsz(4) 5/40*scrsz(3) 1/50*scrsz(4) ],...
0502 'String','Plot relative delay stats',...
0503 'Style','checkbox',...
0504 'Value',0,...
0505 'Tag','plot_delay');
0506
0507
0508
0509
0510
0511
0512
0513
0514 plot_buffer = uicontrol(...
0515 'Parent',mainfigure,...
0516 'HorizontalAlignment','left',...
0517 'ListboxTop',0,...
0518 'Units','pixels',...
0519 'Position',[17/40*scrsz(3) 6/40*scrsz(4) 5/40*scrsz(3) 1/50*scrsz(4) ],...
0520 'String','Plot memory stats',...
0521 'Style','checkbox',...
0522 'Tag','plot_buffer');
0523
0524
0525
0526
0527
0528
0529
0530 plot_hops = uicontrol(...
0531 'Parent',mainfigure,...
0532 'HorizontalAlignment','left',...
0533 'ListboxTop',0,...
0534 'Units','pixels',...
0535 'Position',[17/40*scrsz(3) 5/40*scrsz(4) 5/40*scrsz(3) 1/50*scrsz(4) ],...
0536 'String','Plot multihops stats',...
0537 'Style','checkbox',...
0538 'Tag','plot_hops');
0539
0540
0541
0542
0543
0544
0545 saveHandles.ui = ui ;
0546 saveHandles.dir = dir ;
0547 saveHandles.model = model ;
0548 saveHandles.nusers = nusers ;
0549 saveHandles.nbs = nbs ;
0550 saveHandles.mobility_set = mobility_set ;
0551 saveHandles.nb_pedestrian = nb_pedestrian; ;
0552 saveHandles.nb_vehicular = nb_vehicular ;
0553
0554 saveHandles.pspeed = pspeed ;
0555 saveHandles.vspeed = vspeed ;
0556 saveHandles.lambda = lambda ;
0557 saveHandles.tmax = tmax ;
0558 saveHandles.plot_path = plot_path ;
0559 saveHandles.plot_delay = plot_delay ;
0560 saveHandles.plot_buffer = plot_buffer ;
0561 saveHandles.plot_hops = plot_hops ;
0562 saveHandles.display = display ;
0563 saveHandles.coverage_set = coverage_set ;
0564 saveHandles.coverage_disp = coverage_disp;
0565
0566 set(mainfigure,'UserData',saveHandles);
0567
0568 if nargout > 0, fig = mainfigure; end
0569