try {
Sensor s = (Sensor)p.getDevice(sensor+"-sensor");
if ( s == null )
Avrora.userError("Sensor device does not exist", sensor);
if ( ".".equals(fname) ) s.setSensorData(new RandomSensorData(getRandom()));
else s.setSensorData(new ReplaySensorData(p.getMicrocontroller(), fname));
} catch ( IOException e) {
throw Avrora.unexpected(e);
}
}