Commit dd725273 authored by Julian Zobel's avatar Julian Zobel
Browse files

Distributions for Movement Model speeds

Static & Gaussian Distributions
parent 623f8b8f
...@@ -23,6 +23,7 @@ package de.tud.kom.p2psim.api.topology.movement; ...@@ -23,6 +23,7 @@ package de.tud.kom.p2psim.api.topology.movement;
import java.util.Set; import java.util.Set;
import de.tud.kom.p2psim.api.topology.TopologyComponent; import de.tud.kom.p2psim.api.topology.TopologyComponent;
import de.tud.kom.p2psim.impl.topology.movement.distributions.ISpeedDistributionProvider;
import de.tudarmstadt.maki.simonstrator.api.component.sensor.location.IAttractionPoint; import de.tudarmstadt.maki.simonstrator.api.component.sensor.location.IAttractionPoint;
/** /**
...@@ -97,5 +98,14 @@ public interface MovementModel { ...@@ -97,5 +98,14 @@ public interface MovementModel {
* @param time * @param time
*/ */
public void setTimeBetweenMoveOperations(long time); public void setTimeBetweenMoveOperations(long time);
/**
* OPTIONAL: returns a movement speed provided by the model
*
* @return
*/
default public ISpeedDistributionProvider getMovementSpeedDistribution() {
throw new UnsupportedOperationException();
}
} }
...@@ -25,12 +25,10 @@ import java.util.Set; ...@@ -25,12 +25,10 @@ import java.util.Set;
import de.tud.kom.p2psim.api.common.HostProperties; import de.tud.kom.p2psim.api.common.HostProperties;
import de.tud.kom.p2psim.api.common.SimHost; import de.tud.kom.p2psim.api.common.SimHost;
import de.tud.kom.p2psim.api.topology.Topology; import de.tud.kom.p2psim.api.topology.Topology;
import de.tud.kom.p2psim.api.topology.TopologyComponent; import de.tud.kom.p2psim.api.topology.TopologyComponent;
import de.tud.kom.p2psim.api.topology.movement.MovementModel; import de.tud.kom.p2psim.api.topology.movement.MovementModel;
import de.tud.kom.p2psim.api.topology.placement.PlacementModel; import de.tud.kom.p2psim.api.topology.placement.PlacementModel;
import de.tudarmstadt.maki.simonstrator.api.Randoms; import de.tudarmstadt.maki.simonstrator.api.Randoms;
import de.tudarmstadt.maki.simonstrator.api.component.sensor.location.IAttractionPoint; import de.tudarmstadt.maki.simonstrator.api.component.sensor.location.IAttractionPoint;
...@@ -48,7 +46,6 @@ public class DefaultTopologyComponent extends AbstractTopologyComponent { ...@@ -48,7 +46,6 @@ public class DefaultTopologyComponent extends AbstractTopologyComponent {
private double currentMovementSpeed = -1; private double currentMovementSpeed = -1;
/** /**
* Create a TopologyComponent for the current host. * Create a TopologyComponent for the current host.
* *
...@@ -58,7 +55,7 @@ public class DefaultTopologyComponent extends AbstractTopologyComponent { ...@@ -58,7 +55,7 @@ public class DefaultTopologyComponent extends AbstractTopologyComponent {
*/ */
public DefaultTopologyComponent(SimHost host, Topology topology, public DefaultTopologyComponent(SimHost host, Topology topology,
MovementModel movementModel, PlacementModel placementModel, boolean registerAsInformationProviderInSiS) { MovementModel movementModel, PlacementModel placementModel, boolean registerAsInformationProviderInSiS) {
super(host, topology, movementModel, placementModel, registerAsInformationProviderInSiS); super(host, topology, movementModel, placementModel, registerAsInformationProviderInSiS);
} }
@Override @Override
...@@ -68,15 +65,28 @@ public class DefaultTopologyComponent extends AbstractTopologyComponent { ...@@ -68,15 +65,28 @@ public class DefaultTopologyComponent extends AbstractTopologyComponent {
@Override @Override
public double getMinMovementSpeed() { public double getMinMovementSpeed() {
HostProperties properties = getHost().getProperties(); try {
return movementModel.getMovementSpeedDistribution().getMinSpeed();
return properties.getMinMovementSpeed(); }
catch (UnsupportedOperationException e) {
// FIXME should not be used in the future anymore
// fallback
HostProperties properties = getHost().getProperties();
return properties.getMinMovementSpeed();
}
} }
@Override @Override
public double getMaxMovementSpeed() { public double getMaxMovementSpeed() {
HostProperties properties = getHost().getProperties(); try {
return properties.getMaxMovementSpeed(); return movementModel.getMovementSpeedDistribution().getMaxSpeed();
}
catch (UnsupportedOperationException e) {
// FIXME should not be used in the future anymore
// fallback
HostProperties properties = getHost().getProperties();
return properties.getMaxMovementSpeed();
}
} }
private void calcRandomMovementSpeed() { private void calcRandomMovementSpeed() {
...@@ -90,9 +100,18 @@ public class DefaultTopologyComponent extends AbstractTopologyComponent { ...@@ -90,9 +100,18 @@ public class DefaultTopologyComponent extends AbstractTopologyComponent {
@Override @Override
public double getMovementSpeed() { public double getMovementSpeed() {
if (currentMovementSpeed == -1) {
calcRandomMovementSpeed(); try {
if (currentMovementSpeed == -1) {
this.currentMovementSpeed = movementModel.getMovementSpeedDistribution().calculateSpeed();
}
} }
catch (UnsupportedOperationException e) {
if (currentMovementSpeed == -1) {
calcRandomMovementSpeed();
}
}
return this.currentMovementSpeed; return this.currentMovementSpeed;
} }
...@@ -116,9 +135,10 @@ public class DefaultTopologyComponent extends AbstractTopologyComponent { ...@@ -116,9 +135,10 @@ public class DefaultTopologyComponent extends AbstractTopologyComponent {
public Set<IAttractionPoint> getAllAttractionPoints() { public Set<IAttractionPoint> getAllAttractionPoints() {
return movementModel.getAllAttractionPoints(); return movementModel.getAllAttractionPoints();
} }
public static class Factory implements TopologyComponentFactory { public static class Factory implements TopologyComponentFactory {
@Override @Override
public TopologyComponent createTopologyComponent(SimHost host, public TopologyComponent createTopologyComponent(SimHost host,
Topology topology, MovementModel movementModel, Topology topology, MovementModel movementModel,
......
/*
* 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.movement.distributions;
import java.util.Random;
import de.tudarmstadt.maki.simonstrator.api.Randoms;
public class GaussianSpeedDistribution implements ISpeedDistributionProvider {
private Random random = Randoms.getRandom(GaussianSpeedDistribution.class);
private double std;
private double mean;
private double min = 0;
private double max = 10;
@Override
public double getMaxSpeed() {
return max;
}
@Override
public double getMinSpeed() {
return min;
}
@Override
public double calculateSpeed() {
double speed = random.nextGaussian() * std + mean;
Math.min(speed, max);
Math.max(speed, min);
return speed;
}
public void setStd(double std) {
this.std = std;
}
public void setMean(double mean) {
this.mean = mean;
}
public void setMin(double min) {
this.min = min;
}
public void setMax(double max) {
this.max = max;
}
}
/*
* 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.movement.distributions;
/**
* Interface for the provision of speed distributions.
*
* @author Julian Zobel
* @version 1.0, 30.11.2020
*/
public interface ISpeedDistributionProvider {
/**
* Minimum speed provided by this distribution.
*
* @return
*/
public double getMinSpeed();
/**
* Maximum speed provided by this distribution.
*
* @return
*/
public double getMaxSpeed();
/**
* Draw a speed value from this speed distribution.
*
* @return
*/
public double calculateSpeed();
}
/*
* 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.movement.distributions;
/**
* Static speed distribution provider, always returns 0.
*
* @author Julian Zobel
* @version 1.0, 30.11.2020
*/
public class StaticSpeedDistribution implements ISpeedDistributionProvider {
private double value = 0;
@Override
public double getMinSpeed() {
return value;
}
@Override
public double getMaxSpeed() {
return value;
}
@Override
public double calculateSpeed() {
return value;
}
public void setValue(double value) {
this.value = value;
}
}
...@@ -23,9 +23,7 @@ package de.tud.kom.p2psim.impl.topology.movement.modularosm; ...@@ -23,9 +23,7 @@ package de.tud.kom.p2psim.impl.topology.movement.modularosm;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Random; import java.util.Random;
import java.util.Set;
import java.util.Vector; import java.util.Vector;
import de.tud.kom.p2psim.api.scenario.ConfigurationException; import de.tud.kom.p2psim.api.scenario.ConfigurationException;
...@@ -37,6 +35,7 @@ import de.tud.kom.p2psim.api.topology.placement.PlacementModel; ...@@ -37,6 +35,7 @@ import de.tud.kom.p2psim.api.topology.placement.PlacementModel;
import de.tud.kom.p2psim.impl.simengine.Simulator; import de.tud.kom.p2psim.impl.simengine.Simulator;
import de.tud.kom.p2psim.impl.topology.DefaultTopology; import de.tud.kom.p2psim.impl.topology.DefaultTopology;
import de.tud.kom.p2psim.impl.topology.TopologyFactory; import de.tud.kom.p2psim.impl.topology.TopologyFactory;
import de.tud.kom.p2psim.impl.topology.movement.distributions.ISpeedDistributionProvider;
import de.tud.kom.p2psim.impl.topology.movement.modularosm.attraction.AttractionPointViz; import de.tud.kom.p2psim.impl.topology.movement.modularosm.attraction.AttractionPointViz;
import de.tud.kom.p2psim.impl.topology.movement.modularosm.attraction.IAttractionProvider; import de.tud.kom.p2psim.impl.topology.movement.modularosm.attraction.IAttractionProvider;
import de.tud.kom.p2psim.impl.topology.movement.modularosm.attraction.MobileAttractionPoint; import de.tud.kom.p2psim.impl.topology.movement.modularosm.attraction.MobileAttractionPoint;
...@@ -106,6 +105,8 @@ public class ModularMovementModel implements MovementModel, EventHandler, Attrac ...@@ -106,6 +105,8 @@ public class ModularMovementModel implements MovementModel, EventHandler, Attrac
protected IAttractionAssigmentStrategy attractionAssigment; protected IAttractionAssigmentStrategy attractionAssigment;
protected IAttractionProvider attractionProvider; protected IAttractionProvider attractionProvider;
protected ISpeedDistributionProvider speedProvider;
protected LocalMovementStrategy localMovementStrategy; protected LocalMovementStrategy localMovementStrategy;
...@@ -229,7 +230,11 @@ public class ModularMovementModel implements MovementModel, EventHandler, Attrac ...@@ -229,7 +230,11 @@ public class ModularMovementModel implements MovementModel, EventHandler, Attrac
throw new ConfigurationException( throw new ConfigurationException(
"TransitionStrategy is missing in ModularMovementModel!"); "TransitionStrategy is missing in ModularMovementModel!");
} }
} if(speedProvider == null) {
throw new ConfigurationException(
"SpeedDistributionProvider is missing in ModularMovementModel!");
}
}
@Override @Override
public void addComponent(SimLocationActuator comp) { public void addComponent(SimLocationActuator comp) {
...@@ -361,6 +366,11 @@ public class ModularMovementModel implements MovementModel, EventHandler, Attrac ...@@ -361,6 +366,11 @@ public class ModularMovementModel implements MovementModel, EventHandler, Attrac
} }
} }
@Override
public ISpeedDistributionProvider getMovementSpeedDistribution() {
return speedProvider;
}
/* /*
* ===================================================================================================== * =====================================================================================================
* === GETTER AND SETTER FUNCTIONS * === GETTER AND SETTER FUNCTIONS
...@@ -388,6 +398,15 @@ public class ModularMovementModel implements MovementModel, EventHandler, Attrac ...@@ -388,6 +398,15 @@ public class ModularMovementModel implements MovementModel, EventHandler, Attrac
} }
this.attractionProvider = attractionProvider; this.attractionProvider = attractionProvider;
} }
public void setISpeedDistributionProvider(ISpeedDistributionProvider speedDistributionProvider) {
if (speedDistributionProvider == null) {
throw new ConfigurationException(
"SpeedDistributionProvider is missing in ModularMovementModel!");
}
this.speedProvider = speedDistributionProvider;
}
public void setLocalMovementStrategy(LocalMovementStrategy localMovementStrategy) { public void setLocalMovementStrategy(LocalMovementStrategy localMovementStrategy) {
if (localMovementStrategy == null) { if (localMovementStrategy == null) {
......
...@@ -57,11 +57,8 @@ public class SocialGroupMovementModel extends ModularMovementModel { ...@@ -57,11 +57,8 @@ public class SocialGroupMovementModel extends ModularMovementModel {
protected IAttractionAssigmentStrategy groupAttractionAssignment; protected IAttractionAssigmentStrategy groupAttractionAssignment;
private LinkedHashSet<SimLocationActuator> singleHosts = new LinkedHashSet<SimLocationActuator>(); private LinkedHashSet<SimLocationActuator> singleHosts = new LinkedHashSet<SimLocationActuator>();
private int numberOfSingleHosts; private int numberOfSingleHosts;
@Override @Override
public void initialize() { public void initialize() {
...@@ -321,10 +318,11 @@ public class SocialGroupMovementModel extends ModularMovementModel { ...@@ -321,10 +318,11 @@ public class SocialGroupMovementModel extends ModularMovementModel {
@Override @Override
public void changeTargetLocation(SimLocationActuator actuator, IAttractionPoint ap) { public void changeTargetLocation(SimLocationActuator actuator, IAttractionPoint ap) {
if(singleHosts.contains(actuator)) { if(singleHosts.contains(actuator)) {
attractionAssigment.updateTargetAttractionPoint(actuator, ap); super.changeTargetLocation(actuator, ap);
} }
else { else {
groupAttractionAssignment.updateTargetAttractionPoint(actuator, ap); groupAttractionAssignment.updateTargetAttractionPoint(actuator, ap);
actuator.setMovementSpeed(this.speedProvider.calculateSpeed());
} }
} }
...@@ -475,5 +473,4 @@ public class SocialGroupMovementModel extends ModularMovementModel { ...@@ -475,5 +473,4 @@ public class SocialGroupMovementModel extends ModularMovementModel {
this.groupAttractionAssignment = groupAttractionAssignment; this.groupAttractionAssignment = groupAttractionAssignment;
} }
} }
...@@ -23,9 +23,9 @@ package de.tud.kom.p2psim.impl.topology.movement.modularosm.transition; ...@@ -23,9 +23,9 @@ package de.tud.kom.p2psim.impl.topology.movement.modularosm.transition;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
import de.tud.kom.p2psim.api.topology.movement.SimLocationActuator; import de.tud.kom.p2psim.api.topology.movement.SimLocationActuator;
import de.tud.kom.p2psim.impl.topology.movement.distributions.ISpeedDistributionProvider;
import de.tud.kom.p2psim.impl.topology.movement.modularosm.ISocialGroupMovementAnalyzer; import de.tud.kom.p2psim.impl.topology.movement.modularosm.ISocialGroupMovementAnalyzer;
import de.tud.kom.p2psim.impl.topology.movement.modularosm.ModularMovementModel; import de.tud.kom.p2psim.impl.topology.movement.modularosm.ModularMovementModel;
import de.tud.kom.p2psim.impl.topology.movement.modularosm.attraction.IAttractionProvider;
import de.tudarmstadt.maki.simonstrator.api.Event; import de.tudarmstadt.maki.simonstrator.api.Event;
import de.tudarmstadt.maki.simonstrator.api.EventHandler; import de.tudarmstadt.maki.simonstrator.api.EventHandler;
import de.tudarmstadt.maki.simonstrator.api.Monitor; import de.tudarmstadt.maki.simonstrator.api.Monitor;
...@@ -47,6 +47,8 @@ public class AttractionPointRoamingStrategy extends AbstractAttractionBasedAssig ...@@ -47,6 +47,8 @@ public class AttractionPointRoamingStrategy extends AbstractAttractionBasedAssig
ROAMING ROAMING
} }
protected ISpeedDistributionProvider roamSpeedProvider;
protected Map<SimLocationActuator, roamingTransitionState> roamingStates = new LinkedHashMap<>(); protected Map<SimLocationActuator, roamingTransitionState> roamingStates = new LinkedHashMap<>();
@XMLConfigurableConstructor({ "defaultPauseTimeMin", "defaultPauseTimeMax" }) @XMLConfigurableConstructor({ "defaultPauseTimeMin", "defaultPauseTimeMax" })
...@@ -58,6 +60,10 @@ public class AttractionPointRoamingStrategy extends AbstractAttractionBasedAssig ...@@ -58,6 +60,10 @@ public class AttractionPointRoamingStrategy extends AbstractAttractionBasedAssig
public void addComponent(SimLocationActuator comp) { public void addComponent(SimLocationActuator comp) {
this.roamingStates.put(comp, null); this.roamingStates.put(comp, null);
IAttractionPoint nextAP = getNewAttractionPointAssignment(comp); IAttractionPoint nextAP = getNewAttractionPointAssignment(comp);
// trigger recalculation of speed
comp.setMovementSpeed(-1);
updateTargetAttractionPoint(comp, nextAP); updateTargetAttractionPoint(comp, nextAP);
} }
...@@ -89,7 +95,10 @@ public class AttractionPointRoamingStrategy extends AbstractAttractionBasedAssig ...@@ -89,7 +95,10 @@ public class AttractionPointRoamingStrategy extends AbstractAttractionBasedAssig
private void roamAroundAttractionPoint(SimLocationActuator comp) { private void roamAroundAttractionPoint(SimLocationActuator comp) {
if(roamingStates.get(comp) == roamingTransitionState.PAUSE) { if(roamingStates.get(comp) == roamingTransitionState.PAUSE) {
IAttractionPoint currentAttractionPoint = this.assignments.get(comp); IAttractionPoint currentAttractionPoint = this.assignments.get(comp);
this.roamingStates.put(comp, roamingTransitionState.ROAMING); this.roamingStates.put(comp, roamingTransitionState.ROAMING);
comp.setMovementSpeed(roamSpeedProvider.calculateSpeed());
notifyListenersOfAssignmentUpdate(comp, currentAttractionPoint); notifyListenersOfAssignmentUpdate(comp, currentAttractionPoint);
} }
} }
...@@ -108,4 +117,8 @@ public class AttractionPointRoamingStrategy extends AbstractAttractionBasedAssig ...@@ -108,4 +117,8 @@ public class AttractionPointRoamingStrategy extends AbstractAttractionBasedAssig
this.roamAroundAttractionPoint(comp); this.roamAroundAttractionPoint(comp);
} }
} }
public void setRoamingSpeedDistribution(ISpeedDistributionProvider dist) {
this.roamSpeedProvider = dist;
}
} }
\ No newline at end of file
...@@ -23,9 +23,9 @@ package de.tud.kom.p2psim.impl.topology.movement.modularosm.transition; ...@@ -23,9 +23,9 @@ package de.tud.kom.p2psim.impl.topology.movement.modularosm.transition;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
import de.tud.kom.p2psim.api.topology.movement.SimLocationActuator; import de.tud.kom.p2psim.api.topology.movement.SimLocationActuator;
import de.tud.kom.p2psim.impl.topology.movement.distributions.ISpeedDistributionProvider;
import de.tud.kom.p2psim.impl.topology.movement.modularosm.ISocialGroupMovementAnalyzer; import de.tud.kom.p2psim.impl.topology.movement.modularosm.ISocialGroupMovementAnalyzer;
import de.tud.kom.p2psim.impl.topology.movement.modularosm.ModularMovementModel; import de.tud.kom.p2psim.impl.topology.movement.modularosm.ModularMovementModel;
import de.tud.kom.p2psim.impl.topology.movement.modularosm.attraction.IAttractionProvider;
import de.tudarmstadt.maki.simonstrator.api.Event; import de.tudarmstadt.maki.simonstrator.api.Event;
import de.tudarmstadt.maki.simonstrator.api.EventHandler; import de.tudarmstadt.maki.simonstrator.api.EventHandler;
import de.tudarmstadt.maki.simonstrator.api.Monitor; import de.tudarmstadt.maki.simonstrator.api.Monitor;
...@@ -48,6 +48,8 @@ public class InAreaRoamingTransitionStrategy extends AbstractAttractionBasedAssi ...@@ -48,6 +48,8 @@ public class InAreaRoamingTransitionStrategy extends AbstractAttractionBasedAssi
TRANSITION TRANSITION
} }
protected ISpeedDistributionProvider roamSpeedProvider;
protected Map<SimLocationActuator, roamingTransitionState> roamingStates = new LinkedHashMap<>(); protected Map<SimLocationActuator, roamingTransitionState> roamingStates = new LinkedHashMap<>();
protected final static int EVENT_ROAMING_PAUSE_ENDED = 2; protected final static int EVENT_ROAMING_PAUSE_ENDED = 2;
...@@ -63,6 +65,10 @@ public class InAreaRoamingTransitionStrategy extends AbstractAttractionBasedAssi ...@@ -63,6 +65,10 @@ public class InAreaRoamingTransitionStrategy extends AbstractAttractionBasedAssi
public void addComponent(SimLocationActuator comp) { public void addComponent(SimLocationActuator comp) {
this.roamingStates.put(comp, roamingTransitionState.TRANSITION); this.roamingStates.put(comp, roamingTransitionState.TRANSITION);
IAttractionPoint nextAP = getNewAttractionPointAssignment(comp); IAttractionPoint nextAP = getNewAttractionPointAssignment(comp);
// trigger recalculation of speed
comp.setMovementSpeed(-1);
updateTargetAttractionPoint(comp, nextAP); updateTargetAttractionPoint(comp, nextAP);
} }
...@@ -117,16 +123,11 @@ public class InAreaRoamingTransitionStrategy extends AbstractAttractionBasedAssi ...@@ -117,16 +123,11 @@ public class InAreaRoamingTransitionStrategy extends AbstractAttractionBasedAssi
private void roamAroundAttractionPoint(SimLocationActuator comp) { private void roamAroundAttractionPoint(SimLocationActuator comp) {
if(roamingStates.get(comp) != roamingTransitionState.TRANSITION) { if(roamingStates.get(comp) != roamingTransitionState.TRANSITION) {
IAttractionPoint currentAttractionPoint = this.assignments.get(comp); IAttractionPoint currentAttractionPoint = this.assignments.get(comp);
if(currentAttractionPoint == null) { if(currentAttractionPoint.getRadius() > 0) {
System.err.println("AP roaming failed: no AP"); this.roamingStates.put(comp, roamingTransitionState.ROAMING);
} comp.setMovementSpeed(roamSpeedProvider.calculateSpeed());
if(currentAttractionPoint.getRadius() > 0)
{
this.roamingStates.put(comp, roamingTransitionState.ROAMING);
updateTargetAttractionPoint(comp, currentAttractionPoint); updateTargetAttractionPoint(comp, currentAttractionPoint);
//notifyListenersOfAssignmentUpdate(comp, currentAttractionPoint);
} }
} }
} }
...@@ -158,7 +159,10 @@ public class InAreaRoamingTransitionStrategy extends AbstractAttractionBasedAssi ...@@ -158,7 +159,10 @@ public class InAreaRoamingTransitionStrategy extends AbstractAttractionBasedAssi
public void setGaussianPauseTime(boolean useGaussian) { public void setGaussianPauseTime(boolean useGaussian) {
useGaussianDistributedPauseTime = useGaussian; useGaussianDistributedPauseTime = useGaussian;
}
public void setRoamingSpeedDistribution(ISpeedDistributionProvider dist) {
this.roamSpeedProvider = dist;
} }
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment