public void register() { debug.out.println("RADIOMODEL: registering radio model plugin"); connectivityGraph = new Hashtable(); EmpiricalModel empiricalModel = new EmpiricalModel(); models.put("empirical", empiricalModel); curModel = empiricalModel; // User can use scaling factor to adjust DiscModel dm; dm = new DiscModel(10.0); models.put("disc10", dm); dm = new DiscModel(100.0); models.put("disc100", dm); dm = new DiscModel(1000.0); models.put("disc1000", dm); updateModel(); }
// Recalculate the loss rate for the pair of motes based on their // distance and the current model public void updateLossRate(MoteSimObject moteSender, MoteSimObject moteReceiver) { double distance = moteSender.getDistance(moteReceiver); double prob = curModel.getPacketLossRate(distance, this.scalingFactor); debug.out.println( "RADIOMODEL: " + moteSender + "->" + moteReceiver + " dist " + distance + " scale " + scalingFactor + " prob " + prob); long scaledBitLossRate = (long) (curModel.getBitLossRate(prob) * 10000); debug.out.println( "RADIOMODEL: sampleLossRate " + "[moteSender " + moteSender + "] 1" + "[moteReceiver " + moteReceiver + "] " + "[packetLossRate " + prob + "] " + "[scaledBitLossRate " + scaledBitLossRate + "]"); connectivityGraph.put(graphKey(moteSender, moteReceiver), new Double(prob)); if (autoPublish) { publishLossRate(moteSender, moteReceiver, prob); } }
public void setLossRate(int senderID, int receiverID, double prob) { connectivityGraph.put(graphKey(senderID, receiverID), new Double(prob)); }
public void setLossRate(MoteSimObject sender, MoteSimObject receiver, double prob) { connectivityGraph.put(graphKey(sender, receiver), new Double(prob)); }