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

Minor changes in social group movement

parent 26bd2c12
...@@ -38,8 +38,9 @@ import de.tudarmstadt.maki.simonstrator.api.component.network.NetworkComponent.N ...@@ -38,8 +38,9 @@ import de.tudarmstadt.maki.simonstrator.api.component.network.NetworkComponent.N
* @author Bjoern Richerzhagen * @author Bjoern Richerzhagen
* @version 1.0, 25.02.2012 * @version 1.0, 25.02.2012
* *
* @changes: * @author Julian Zobel
* Louis Neumann - setting LORA to "unlimited" bandwith * added LoRa PHY
*
*/ */
public enum PhyType { public enum PhyType {
...@@ -95,7 +96,7 @@ public enum PhyType { ...@@ -95,7 +96,7 @@ public enum PhyType {
* Assuming the following defaults: zero link-layer packet loss, 0.3 kbit/s BW, * Assuming the following defaults: zero link-layer packet loss, 0.3 kbit/s BW,
* 500us latency, 1kByte MTU * 500us latency, 1kByte MTU
*/ */
LORA(NetInterfaceName.LORA, 0, 1 * Rate.Gbit_s, LORA(NetInterfaceName.LORA, 0, 300 * Rate.bit_s,
500 * Time.MICROSECOND, 1024, true); 500 * Time.MICROSECOND, 1024, true);
......
...@@ -42,8 +42,9 @@ public interface TopologyComponent extends SimHostComponent, ...@@ -42,8 +42,9 @@ public interface TopologyComponent extends SimHostComponent,
* Binder-class. * Binder-class.
* *
* @return * @return
* use Binder.getComponent(Topology.class) instead! * @deprecated use Binder.getComponent(Topology.class) instead!
*/ */
@Deprecated
public Topology getTopology(); public Topology getTopology();
} }
...@@ -188,6 +188,9 @@ public class SocialGroupMovementModel extends ModularMovementModel { ...@@ -188,6 +188,9 @@ public class SocialGroupMovementModel extends ModularMovementModel {
} }
// TODO Move each group
Event.scheduleWithDelay(timeBetweenMoveOperation, this, null, EVENT_MOVE); Event.scheduleWithDelay(timeBetweenMoveOperation, this, null, EVENT_MOVE);
} }
...@@ -243,7 +246,20 @@ public class SocialGroupMovementModel extends ModularMovementModel { ...@@ -243,7 +246,20 @@ public class SocialGroupMovementModel extends ModularMovementModel {
Monitor.getOrNull(ISocialGroupMovementAnalyzer.class).onGroupMovesToAttractionPoint(group); Monitor.getOrNull(ISocialGroupMovementAnalyzer.class).onGroupMovesToAttractionPoint(group);
} }
doLocalMovement(host, destination); doLocalMovement(host, destination);
PositionVector leaderPos = host.getRealPosition();
LinkedHashSet<SimLocationActuator> groupMembers = groupContainer.getGroupMembers(host);
groupMembers.remove(host); // remove leader
for (SimLocationActuator groupMember : groupMembers) {
// Assign small offset to the host depending on the leaders position.
PositionVector offset = new PositionVector(rand.nextDouble() * LEADER_GROUP_DISTANCE, rand.nextDouble() * LEADER_GROUP_DISTANCE);
PositionVector newPos = leaderPos.plus(offset);
// Update location of host, which will be around the leaders location.
groupMember.updateCurrentLocation(newPos);
}
} }
else { else {
// inform analyzer of waiting group // inform analyzer of waiting group
...@@ -252,10 +268,6 @@ public class SocialGroupMovementModel extends ModularMovementModel { ...@@ -252,10 +268,6 @@ public class SocialGroupMovementModel extends ModularMovementModel {
} }
} }
} }
else {
// while other nodes just follow the group leader
followLeader(host);
}
} }
} }
......
...@@ -170,7 +170,7 @@ public class SocialMovementGroup { ...@@ -170,7 +170,7 @@ public class SocialMovementGroup {
} }
public LinkedHashSet<SimLocationActuator> getMembers() { public LinkedHashSet<SimLocationActuator> getMembers() {
return members; return new LinkedHashSet<SimLocationActuator>(members);
} }
public void setMembers(LinkedHashSet<SimLocationActuator> participants) { public void setMembers(LinkedHashSet<SimLocationActuator> participants) {
......
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