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
f2ef599f
Commit
f2ef599f
authored
Mar 06, 2020
by
Julian Zobel
Browse files
Allow node placement in modular movement model
parent
930bb6e9
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/topology/movement/modularosm/ModularMovementModel.java
View file @
f2ef599f
...
...
@@ -125,6 +125,8 @@ public class ModularMovementModel implements MovementModel, EventHandler, Attrac
protected
Random
rand
=
Randoms
.
getRandom
(
ModularMovementModel
.
class
);
protected
boolean
placeNodesAtAP
=
false
;
public
ModularMovementModel
()
{
this
.
worldDimensions
=
Binder
.
getComponentOrNull
(
Topology
.
class
)
.
getWorldDimensions
();
...
...
@@ -132,6 +134,10 @@ public class ModularMovementModel implements MovementModel, EventHandler, Attrac
// scheduling initalization!
Event
.
scheduleImmediately
(
this
,
null
,
EVENT_INIT
);
}
public
void
setPlaceNodes
(
boolean
placeNodes
)
{
this
.
placeNodesAtAP
=
placeNodes
;
}
/**
* This Method will be not called from the Components. So we call this
...
...
@@ -173,6 +179,14 @@ public class ModularMovementModel implements MovementModel, EventHandler, Attrac
// strategy
for
(
SimLocationActuator
ms
:
moveableHosts
)
{
attractionAssigment
.
addComponent
(
ms
);
if
(
placeNodesAtAP
)
{
IAttractionPoint
assignment
=
attractionAssigment
.
getAssignment
(
ms
);
double
apRadius
=
(
assignment
.
hasRadius
()
?
Math
.
max
(
assignment
.
getRadius
(),
25.0
)
:
25.0
);
ms
.
updateCurrentLocation
(
this
.
addGaussianOffsetToPosition
(
new
PositionVector
(
assignment
),
apRadius
/
3
));
attractionAssigment
.
updateTargetAttractionPoint
(
ms
,
assignment
);
}
}
setTimeBetweenMoveOperations
(
timeBetweenMoveOperation
);
...
...
src/de/tud/kom/p2psim/impl/topology/movement/modularosm/SocialGroupMovementModel.java
View file @
f2ef599f
...
...
@@ -61,11 +61,7 @@ public class SocialGroupMovementModel extends ModularMovementModel {
private
Set
<
SimLocationActuator
>
singleHosts
=
new
LinkedHashSet
<
SimLocationActuator
>();
private
int
numberOfSingleHosts
;
private
boolean
placeNodesAtAP
=
false
;
public
void
setPlaceNodes
(
boolean
placeNodes
)
{
this
.
placeNodesAtAP
=
placeNodes
;
}
@Override
public
void
initialize
()
{
...
...
src/de/tud/kom/p2psim/impl/topology/movement/modularosm/groups/groupforming/AbstractGroupForming.java
View file @
f2ef599f
...
...
@@ -152,7 +152,7 @@ public abstract class AbstractGroupForming implements IGroupFormingBehavior {
delay
=
Time
.
MINUTE
;
}
System
.
out
.
println
(
Time
.
getFormattedTime
(
delay
)
);
//
System.out.println(Time.getFormattedTime(delay) );
Event
.
scheduleWithDelay
(
delay
,
new
EventHandler
()
{
@Override
...
...
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