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
722b46a9
Commit
722b46a9
authored
Nov 15, 2019
by
Julian Zobel
Browse files
GAUSS Distribution for waiting times instead of pure random
parent
ef423c3a
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/topology/movement/AbstractMovementModel.java
View file @
722b46a9
...
...
@@ -124,8 +124,8 @@ public abstract class AbstractMovementModel implements MovementModel {
double
minLength
,
double
maxLength
)
{
assert
minLength
<=
maxLength
;
PositionVector
delta
=
null
;
if
(
oldPosition
.
getDimensions
()
==
2
)
{
if
(
oldPosition
.
getDimensions
()
==
2
||
(
oldPosition
.
getDimensions
()
==
3
&&
oldPosition
.
getAltitude
()
==
0
)
)
{
double
angle
=
random
.
nextDouble
()
*
2
*
Math
.
PI
;
double
length
=
random
.
nextDouble
()
*
(
maxLength
-
minLength
)
+
minLength
;
...
...
src/de/tud/kom/p2psim/impl/topology/movement/modularosm/transition/AbstractAttractionBasedTransitionStrategy.java
View file @
722b46a9
...
...
@@ -51,9 +51,9 @@ public abstract class AbstractAttractionBasedTransitionStrategy implements ITran
private
List
<
AttractionAssignmentListener
>
listeners
=
new
LinkedList
<>();
pr
ivate
long
pauseTimeMin
=
0
;
pr
otected
long
pauseTimeMin
=
0
;
pr
ivate
long
pauseTimeMax
=
0
;
pr
otected
long
pauseTimeMax
=
0
;
protected
final
static
int
EVENT_PAUSE_ENDED
=
1
;
...
...
@@ -99,6 +99,8 @@ public abstract class AbstractAttractionBasedTransitionStrategy implements ITran
return
(
long
)
(
rnd
.
nextDouble
()
*
(
pauseTimeMax
-
pauseTimeMin
))
+
pauseTimeMin
;
}
public
void
setMinPauseTime
(
long
minPauseTime
)
{
if
(
minPauseTime
<
0
)
{
throw
new
ConfigurationException
(
...
...
src/de/tud/kom/p2psim/impl/topology/movement/modularosm/transition/InAreaRoamingTransitionStrategy.java
View file @
722b46a9
...
...
@@ -67,16 +67,29 @@ public class InAreaRoamingTransitionStrategy extends AbstractAttractionBasedTran
// start roaming if the AP was reached
if
(
roamingStates
.
get
(
comp
)
==
roamingTransitionState
.
TRANSITION
)
{
// schedule the end of the roaming phase, which will make a new transition
Event
.
scheduleWithDelay
(
g
etPauseTime
(
),
this
,
comp
,
EVENT_PAUSE_ENDED
);
// schedule the end of the roaming phase, which will make a new transition
Event
.
scheduleWithDelay
(
g
aussianDistributionPauseTime
(
pauseTimeMax
-
pauseTimeMin
,
0.5
*(
pauseTimeMax
-
pauseTimeMin
)
),
this
,
comp
,
EVENT_PAUSE_ENDED
);
}
this
.
roamingStates
.
put
(
comp
,
roamingTransitionState
.
PAUSE
);
// schedule roaming
Event
.
scheduleWithDelay
(
Time
.
SECOND
*
30
,
this
,
comp
,
EVENT_ROAMING_PAUSE_ENDED
);
Event
.
scheduleWithDelay
(
gaussianDistributionPauseTime
(
Time
.
MINUTE
*
1
,
Time
.
MINUTE
)
,
this
,
comp
,
EVENT_ROAMING_PAUSE_ENDED
);
}
/**
* Use a gaussian distribution for the pause time interval generation, using a mean value and a standard deviation
*
* @return
*/
private
long
gaussianDistributionPauseTime
(
double
mean
,
double
std
)
{
double
x
=
rnd
.
nextGaussian
()
*
std
+
mean
;
if
(
x
<=
0
)
return
gaussianDistributionPauseTime
(
mean
,
std
*
0.9
);
return
(
long
)
x
;
}
private
void
roamAroundAttractionPoint
(
SimLocationActuator
comp
)
{
if
(
roamingStates
.
get
(
comp
)
!=
roamingTransitionState
.
TRANSITION
)
{
AttractionPoint
currentAttractionPoint
=
this
.
assignments
.
get
(
comp
);
...
...
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