Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Simonstrator
PeerfactSim.KOM
Commits
b0b1e4bc
Commit
b0b1e4bc
authored
Dec 04, 2016
by
Marc Schiller
Browse files
Start of model-based segment database.
parent
8b84112a
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/topology/views/FiveGTopologyView.java
View file @
b0b1e4bc
...
...
@@ -37,12 +37,14 @@ import de.tud.kom.p2psim.impl.topology.PositionVector;
import
de.tud.kom.p2psim.impl.topology.views.FiveGTopologyView.CellLink
;
import
de.tud.kom.p2psim.impl.topology.views.fiveg.FiveGTopologyDatabase
;
import
de.tud.kom.p2psim.impl.topology.views.fiveg.FiveGTopologyDatabase.Entry
;
import
de.tud.kom.p2psim.impl.topology.views.fiveg.ModelBasedSegmentDatabase
;
import
de.tudarmstadt.maki.simonstrator.api.Event
;
import
de.tudarmstadt.maki.simonstrator.api.EventHandler
;
import
de.tudarmstadt.maki.simonstrator.api.Host
;
import
de.tudarmstadt.maki.simonstrator.api.Time
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.handover.HandoverSensor
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.location.Location
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.location.LocationListener
;
import
de.tudarmstadt.maki.simonstrator.api.util.XMLConfigurableConstructor
;
import
edu.emory.mathcs.backport.java.util.Arrays
;
...
...
@@ -96,6 +98,8 @@ public class FiveGTopologyView extends AbstractTopologyView<CellLink> {
private
FiveGTopologyDatabase
databaseAccessPoints
=
null
;
private
boolean
databaseWantsLocationUpdates
=
false
;
/**
* Configuration setting: all group IDs of nodes that act as cloudlets
* (e.g., act as basestations with a lower delay, whatever that means w.r.t.
...
...
@@ -213,12 +217,12 @@ public class FiveGTopologyView extends AbstractTopologyView<CellLink> {
null
);
}
}
/**
* Check, if a node moved into a new segment. If so, we need to update
*
the
HandoverSensor to trigger the listeners. We only need to check
*
nodes that
are included in the list of ap-enabled nodes (i.e., they
*
already have a
HandoverSensor-instance).
* Check, if a node moved into a new segment. If so, we need to update
the
* HandoverSensor to trigger the listeners. We only need to check
nodes that
* are included in the list of ap-enabled nodes (i.e., they
already have a
* HandoverSensor-instance).
*/
protected
void
checkAPAssociations
()
{
for
(
HandoverSensor5G
sensor
:
handoverSensors
)
{
...
...
@@ -232,7 +236,7 @@ public class FiveGTopologyView extends AbstractTopologyView<CellLink> {
databaseAccessPoints
.
getEntryFor
(
segId
,
false
)
!=
null
);
}
}
/*
* FIXME the not-so-elegant approach of updating all max-BWs
*/
...
...
@@ -240,9 +244,9 @@ public class FiveGTopologyView extends AbstractTopologyView<CellLink> {
updateMaxMacBandwidth
(
mobileClient
);
}
}
long
lastMovementTimestamp
=
0
;
@Override
public
void
onLocationChanged
(
Host
host
,
Location
location
)
{
super
.
onLocationChanged
(
host
,
location
);
...
...
@@ -250,6 +254,10 @@ public class FiveGTopologyView extends AbstractTopologyView<CellLink> {
lastMovementTimestamp
=
Time
.
getCurrentTime
();
checkAPAssociations
();
}
if
(
databaseWantsLocationUpdates
)
{
((
ModelBasedSegmentDatabase
)
database
).
onLocationChanged
(
host
,
location
);
}
}
/**
...
...
@@ -353,6 +361,9 @@ public class FiveGTopologyView extends AbstractTopologyView<CellLink> {
public
void
setDatabase
(
FiveGTopologyDatabase
database
)
{
assert
this
.
database
==
null
;
this
.
database
=
database
;
if
(
LocationListener
.
class
.
isAssignableFrom
(
database
.
getClass
()))
{
this
.
databaseWantsLocationUpdates
=
true
;
}
}
/**
...
...
@@ -485,10 +496,11 @@ public class FiveGTopologyView extends AbstractTopologyView<CellLink> {
}
@Override
public
boolean
isConnected
()
{
if
(
apLinkData
!=
null
)
return
apLinkData
.
getConnectivity
();
if
(
linkData
!=
null
)
return
linkData
.
getConnectivity
();
public
boolean
isConnected
()
{
if
(
apLinkData
!=
null
)
return
apLinkData
.
getConnectivity
();
if
(
linkData
!=
null
)
return
linkData
.
getConnectivity
();
return
false
;
}
...
...
src/de/tud/kom/p2psim/impl/topology/views/fiveg/ModelBasedSegmentDatabase.java
0 → 100644
View file @
b0b1e4bc
/*
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.KOM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* PeerfactSim.KOM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PeerfactSim.KOM. If not, see <http://www.gnu.org/licenses/>.
*
*/
package
de.tud.kom.p2psim.impl.topology.views.fiveg
;
import
de.tud.kom.p2psim.api.linklayer.mac.MacLayer
;
import
de.tud.kom.p2psim.impl.linklayer.mac.AbstractMacLayer
;
import
de.tud.kom.p2psim.impl.linklayer.mac.SimpleMacLayer
;
import
de.tudarmstadt.maki.simonstrator.api.Host
;
import
de.tudarmstadt.maki.simonstrator.api.Time
;
import
de.tudarmstadt.maki.simonstrator.api.component.ComponentNotAvailableException
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.location.Location
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.location.LocationListener
;
public
class
ModelBasedSegmentDatabase
extends
AbstractGridBasedTopologyDatabase
implements
LocationListener
{
public
ModelBasedSegmentDatabase
()
{
super
(
100
,
true
);
super
.
setSupportCloudlets
(
true
);
}
@Override
protected
Entry
createEntryFor
(
int
segmentID
,
boolean
isCloudlet
)
{
// TODO Handle Cloudlets differently?
return
new
ModelBasedEntry
(
segmentID
);
}
@Override
public
void
onLocationChanged
(
Host
host
,
Location
location
)
{
try
{
System
.
out
.
println
(
host
.
getComponent
(
SimpleMacLayer
.
class
).
getMacAddress
());
}
catch
(
ComponentNotAvailableException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
}
public
class
ModelBasedEntry
implements
FiveGTopologyDatabase
.
Entry
{
private
final
int
segment
;
private
boolean
connectivity
=
true
;
public
ModelBasedEntry
(
int
segment
)
{
this
.
segment
=
segment
;
}
@Override
public
int
getSegmentID
()
{
return
segment
;
}
@Override
public
double
getDropProbability
(
boolean
isUpload
)
{
if
(!
getConnectivity
())
{
return
1
;
}
// TODO Return Drop Probability based on Model
return
0
;
}
@Override
public
long
getLatency
(
boolean
isUpload
)
{
if
(!
getConnectivity
())
{
return
9999
*
Time
.
MILLISECOND
;
}
// TODO Return Latency based on Model
return
0
;
}
@Override
public
long
getBandwidth
(
boolean
isUpload
)
{
if
(!
getConnectivity
())
{
return
0
;
}
// TODO Return Bandwidth based on Model
return
0
;
}
@Override
public
boolean
getConnectivity
()
{
return
connectivity
;
}
@Override
public
void
setConnectivity
(
boolean
connectivity
)
{
this
.
connectivity
=
connectivity
;
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment