Você está na página 1de 2

Project Log

ZHOU ZHOU
02 Apr 2010

Performance
Simulation of swapping luggage

Basic idea:

Two passengers with their own luggage moving towards to the clean cupboard after the security
screening area. Luggage get swapped in the clean cupboard area. An alert will be generated for
the event of swapping.

Implementation:

Randomly get 2 passenger Ids, use 2 static variable to store the ids.

We assume pidList is an arrayList which stores all the passenger Ids.

Int random = (int)(pidList.size() * Math.random());

public static String PID_1 = pidList.get(random);

Use the same way to get another passenger ID randomly and stored into another static variable.

These 2 passengers with their own luggage are moving towards to the clean cupboard after
they've passed the security screening area. Here, I wrote a method named startSwapSimulation to
generate location for the randomly picked passengers.

currentP_id=passengerList.get(i);
if(currentP_id.equals(PID_1))
{
this.startSwapBagSimulation(currentP_id);
}

public void startSwapBagSimulation(String pId)


{
ArrayList <String> luggageList = map_passenger_luggage.get(pId);

for(int j=0; j<luggageList.size(); j++)


{
Element item_2 = newDom.createElement("Item");
Element assetID_2 = newDom.createElement("AssetID");
assetID_2.setTextContent(luggageList.get(j));
item_2.appendChild(assetID_2);
Element groups_2 = newDom.createElement("Groups");
Element group_2 = newDom.createElement("group");
Element group_3 = newDom.createElement("group");
group_2.setTextContent("luggage");
groups_2.appendChild(group_2);
group_3.setTextContent(passengerList.get(i));
groups_2.appendChild(group_3);
item_2.appendChild(groups_2);
Element location_2 = newDom.createElement("Location");
int random=(int)(2*Math.random());
if(random==0)
{
presentLuggageX = presentPassengerX + (int)(5*Math.random());
presentLuggageY = presentPassengerY + (int)(5*Math.random());
}
else
{
presentLuggageX = presentPassengerX - (int)(5*Math.random());
presentLuggageY = presentPassengerY - (int)(5*Math.random());
}
Element xLoc_2 = newDom.createElement("x");
xLoc_2.setTextContent(""+presentLuggageX);
location_2.appendChild(xLoc_2);
Element yLoc_2 = newDom.createElement("y");
yLoc_2.setTextContent(""+presentLuggageY);
location_2.appendChild(yLoc_2);
Element zLoc_2 = newDom.createElement("z");
zLoc_2.setTextContent("0");
location_2.appendChild(zLoc_2);
item_2.appendChild(location_2);
Element zoneElement_2 = newDom.createElement("Zone");
zoneElement_2.setTextContent(zone);
item_2.appendChild(zoneElement_2);
Element timestamp_2 = newDom.createElement("Timestamp");
timestamp_2.setTextContent(this.getTimestampString());
item_2.appendChild(timestamp_2);
root.appendChild(item_2);
}

startSwapSimulation method is quite simular to the createLocationReport, a difference is


startSwapSimulation method subject to make the 2 passengers moving towards to the clean
cupboard area. StartSwapSimulation method not only generate the location of the passengers, but
also the location of the luggage.

Each passenger takes 2 luggage, one or both of the luggage will get swapped with the luggage of
the other passenger. In order to separate the luggage of different passengers, the whole swapping
procedure will be highlighted by using balloon or colors or shapes.

To Do List

• Finalize the simulation of swapping


• Start phone tracking and trace simulation

Você também pode gostar