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
2210da77
Commit
2210da77
authored
May 28, 2020
by
Julian Zobel
Browse files
Removed sysouts.
Error correction in JSON Attraction Generator
parent
263438bf
Changes
9
Hide whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/analyzer/metric/MetricAnalyzer.java
View file @
2210da77
...
...
@@ -92,17 +92,7 @@ public class MetricAnalyzer implements Analyzer {
}
for
(
MetricOutput
outputChannel
:
outputs
)
{
outputChannel
.
onStop
();
}
System
.
out
.
println
(
" 0..2 >> "
+
TracefileMovementModel
.
ZERO_TO_2
);
System
.
out
.
println
(
" 2..5 >> "
+
TracefileMovementModel
.
_2_to_5
);
System
.
out
.
println
(
" 5..10 >> "
+
TracefileMovementModel
.
_5_to_10
);
System
.
out
.
println
(
" 10..30 >> "
+
TracefileMovementModel
.
TEN_TO_THIRTY
);
System
.
out
.
println
(
" 30..60 >> "
+
TracefileMovementModel
.
THIRTY_TO_SIXTY
);
System
.
out
.
println
(
" 60..120 >> "
+
TracefileMovementModel
.
SIXTY_TO_120
);
System
.
out
.
println
(
" 120..300 >> "
+
TracefileMovementModel
.
_120_TO_300
);
System
.
out
.
println
(
" 300..600 >> "
+
TracefileMovementModel
.
_300_TO_600
);
System
.
out
.
println
(
" 600 ++ >> "
+
TracefileMovementModel
.
ABOVE_600
);
}
}
/**
...
...
src/de/tud/kom/p2psim/impl/linklayer/mac/AbstractMacLayer.java
View file @
2210da77
...
...
@@ -873,21 +873,23 @@ public abstract class AbstractMacLayer implements MacLayer {
messageDropped
(
DropReason
.
QUEUE_FULL
,
message
);
// FIXME BR DEBUG Print it
// int idx = 0;
// for (QueueEntry qe : queue) {
// Message msg = qe.getMessage();
// while (msg.getPayload() != null) {
// msg = msg.getPayload();
// }
// System.out.println(idx + " "
// + msg.getClass().getSimpleName() + " "
// + msg.toString());
// idx++;
// }
// System.out.println("[AbstractMacLayer] debug output");
// int idx = 0;
// for (QueueEntry qe : queue) {
// Message msg = qe.getMessage();
// while (msg.getPayload() != null) {
// msg = msg.getPayload();
// }
// System.out.println(idx + " "
// + msg.getClass().getSimpleName() + " "
// + msg.toString());
// idx++;
// }
}
else
{
// still a spot in the queue, add message and notify MAC
queue
.
add
(
new
QueueEntry
(
receiver
,
message
));
handleNewQueueEntry
();
handleNewQueueEntry
();
}
}
}
...
...
src/de/tud/kom/p2psim/impl/topology/movement/modularosm/ModularMovementModelViz.java
View file @
2210da77
...
...
@@ -186,20 +186,20 @@ public class ModularMovementModelViz extends JComponent
}
}
g2
.
setColor
(
Color
.
black
);
PositionVector
p1
=
GPSCalculation
.
transformGPSWindowToOwnWorld
(
51.813680
,
8.783510
);
PositionVector
p2
=
GPSCalculation
.
transformGPSWindowToOwnWorld
(
51.806795
,
8.804239
);
g2
.
fillRect
(
VisualizationInjector
.
scaleValue
(
p1
.
getX
()),
VisualizationInjector
.
scaleValue
(
p1
.
getX
()),
VisualizationInjector
.
scaleValue
(
p2
.
getX
())
-
VisualizationInjector
.
scaleValue
(
p1
.
getX
()),
VisualizationInjector
.
scaleValue
(
p2
.
getY
())-
VisualizationInjector
.
scaleValue
(
p1
.
getY
()));
p1
=
GPSCalculation
.
transformGPSWindowToOwnWorld
(
51.821036
,
8.771151
);
p2
=
GPSCalculation
.
transformGPSWindowToOwnWorld
(
51.814987
,
8.779090
);
g2
.
fillRect
(
VisualizationInjector
.
scaleValue
(
p1
.
getX
()),
VisualizationInjector
.
scaleValue
(
p1
.
getX
()),
VisualizationInjector
.
scaleValue
(
p2
.
getX
()
-
p1
.
getX
()),
VisualizationInjector
.
scaleValue
(
p2
.
getY
()
-
p1
.
getY
()));
//
g2.setColor(Color.black);
//
PositionVector p1 = GPSCalculation.transformGPSWindowToOwnWorld(51.813680,8.783510);
//
PositionVector p2 = GPSCalculation.transformGPSWindowToOwnWorld(51.806795,8.804239);
//
//
g2.fillRect(VisualizationInjector.scaleValue(p1.getX()), VisualizationInjector.scaleValue(p1.getX()),
//
VisualizationInjector.scaleValue(p2.getX()) - VisualizationInjector.scaleValue(p1.getX()),
//
VisualizationInjector.scaleValue(p2.getY())- VisualizationInjector.scaleValue(p1.getY()));
//
//
p1 = GPSCalculation.transformGPSWindowToOwnWorld(51.821036,8.771151);
//
p2 = GPSCalculation.transformGPSWindowToOwnWorld(51.814987, 8.779090);
//
//
g2.fillRect(VisualizationInjector.scaleValue(p1.getX()), VisualizationInjector.scaleValue(p1.getX()),
//
VisualizationInjector.scaleValue(p2.getX() - p1.getX()),
//
VisualizationInjector.scaleValue(p2.getY() - p1.getY()));
...
...
src/de/tud/kom/p2psim/impl/topology/movement/modularosm/SocialGroupMovementModel.java
View file @
2210da77
...
...
@@ -21,16 +21,13 @@
package
de.tud.kom.p2psim.impl.topology.movement.modularosm
;
import
java.util.LinkedHashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Vector
;
import
de.tud.kom.p2psim.api.scenario.ConfigurationException
;
import
de.tud.kom.p2psim.api.topology.Topology
;
import
de.tud.kom.p2psim.api.topology.movement.SimLocationActuator
;
import
de.tud.kom.p2psim.api.topology.movement.local.LocalMovementStrategy
;
import
de.tud.kom.p2psim.impl.topology.movement.modularosm.attraction.IAttractionProvider
;
import
de.tud.kom.p2psim.impl.topology.movement.modularosm.groups.MovementGroupContainer
;
import
de.tud.kom.p2psim.impl.topology.movement.modularosm.groups.SocialMovementGroup
;
import
de.tud.kom.p2psim.impl.topology.movement.modularosm.groups.groupencounter.IGroupEncounterBehavior
;
...
...
@@ -106,6 +103,7 @@ public class SocialGroupMovementModel extends ModularMovementModel {
.
setScaleFactor
(
timeBetweenMoveOperation
/
(
double
)
Time
.
SECOND
);
attractionAssigment
.
addAttractionAssignmentListener
(
this
);
attractionAssigment
.
setAttractionProvider
(
attractionProvider
);
// This adds the mobile hosts (smartphones/users) to the transition
// strategy
...
...
src/de/tud/kom/p2psim/impl/topology/movement/modularosm/attraction/JSONAttractionGenerator.java
View file @
2210da77
...
...
@@ -23,14 +23,12 @@ package de.tud.kom.p2psim.impl.topology.movement.modularosm.attraction;
import
java.io.FileInputStream
;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.util.LinkedList
;
import
java.util.List
;
import
org.apache.commons.io.IOUtils
;
import
org.json.JSONArray
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
de.tud.kom.p2psim.impl.topology.movement.modularosm.GPSCalculation
;
import
de.tud.kom.p2psim.impl.util.oracle.GlobalOracle
;
import
de.tudarmstadt.maki.simonstrator.api.util.XMLConfigurableConstructor
;
/**
...
...
src/de/tud/kom/p2psim/impl/topology/movement/modularosm/attraction/RandomAttractionGenerator.java
View file @
2210da77
...
...
@@ -24,9 +24,7 @@ import java.util.LinkedList;
import
java.util.List
;
import
java.util.Random
;
import
de.tud.kom.p2psim.api.scenario.ConfigurationException
;
import
de.tud.kom.p2psim.api.topology.Topology
;
import
de.tud.kom.p2psim.impl.topology.util.PositionVector
;
import
de.tudarmstadt.maki.simonstrator.api.Binder
;
import
de.tudarmstadt.maki.simonstrator.api.Randoms
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.location.IAttractionPoint
;
import
de.tudarmstadt.maki.simonstrator.api.util.XMLConfigurableConstructor
;
...
...
@@ -72,6 +70,8 @@ public class RandomAttractionGenerator extends AbstractAttractionProvider {
this
.
maximumRadius
=
maximumRadius
;
this
.
minimumRadius
=
minimumRadius
;
this
.
minimumDistance
=
minimumDistance
;
createAttractionPoints
();
}
@Override
...
...
src/de/tud/kom/p2psim/impl/topology/movement/modularosm/groups/groupforming/AbstractGroupForming.java
View file @
2210da77
...
...
@@ -293,7 +293,7 @@ public abstract class AbstractGroupForming implements IGroupFormingBehavior {
IAttractionPoint
result
=
null
;
long
maxDuration
=
0
;
for
(
IAttractionPoint
ap
:
movementModel
.
getA
llA
ttractionPoints
())
{
for
(
IAttractionPoint
ap
:
movementModel
.
getAttractionPoints
())
{
for
(
SimLocationActuator
host
:
HostAtAttractionPointCounter
.
getHostsOfAttractionPoint
(
ap
,
movementModel
.
getAllLocationActuators
()))
{
INodeID
id
=
host
.
getHost
().
getId
();
long
duration
=
stayDuration
.
get
(
id
).
getA
();
...
...
@@ -311,7 +311,7 @@ public abstract class AbstractGroupForming implements IGroupFormingBehavior {
protected
IAttractionPoint
getAttractionPointWithMostHosts
()
{
IAttractionPoint
apCandidate
=
null
;
int
size
=
0
;
for
(
IAttractionPoint
ap
:
movementModel
.
getA
llA
ttractionPoints
())
{
for
(
IAttractionPoint
ap
:
movementModel
.
getAttractionPoints
())
{
int
numberOfHostsInAP
=
HostAtAttractionPointCounter
.
getHostCountOfAttractionPoint
(
ap
,
movementModel
.
getAllLocationActuators
());
if
(
numberOfHostsInAP
>
size
)
{
apCandidate
=
ap
;
...
...
src/de/tud/kom/p2psim/impl/topology/movement/modularosm/groups/groupforming/DefaultGroupForming.java
View file @
2210da77
...
...
@@ -92,7 +92,7 @@ public class DefaultGroupForming extends AbstractGroupForming {
@Override
protected
void
assembleGroup
()
{
IAttractionPoint
apCandidate
=
movementModel
.
getAttractionPoints
().
get
(
rand
.
nextInt
(
movementModel
.
getA
llA
ttractionPoints
().
size
()));
IAttractionPoint
apCandidate
=
movementModel
.
getAttractionPoints
().
get
(
rand
.
nextInt
(
movementModel
.
getAttractionPoints
().
size
()));
if
(
apCandidate
==
null
)
{
return
;
}
...
...
src/de/tud/kom/p2psim/impl/topology/movement/modularosm/transition/AbstractAttractionBasedAssignmentStrategy.java
View file @
2210da77
...
...
@@ -31,7 +31,6 @@ import de.tud.kom.p2psim.impl.topology.movement.modularosm.IAttractionBasedMovem
import
de.tud.kom.p2psim.impl.topology.movement.modularosm.attraction.IAttractionProvider
;
import
de.tudarmstadt.maki.simonstrator.api.Monitor
;
import
de.tudarmstadt.maki.simonstrator.api.Randoms
;
import
de.tudarmstadt.maki.simonstrator.api.Time
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.location.IAttractionPoint
;
/**
...
...
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