Skip to content

Instantly share code, notes, and snippets.

@andrewgdunn
Created August 23, 2010 15:30
Show Gist options
  • Save andrewgdunn/545717 to your computer and use it in GitHub Desktop.
Save andrewgdunn/545717 to your computer and use it in GitHub Desktop.
private static void ProcessRecievedData() {
Vector<Map<String, Value>> errorSensors = new Vector<Map<String, Value>>();
for(Object keySet : allSensors.keySet()) {
Sensor individualSensor = (Sensor)allSensors.get(keySet);
individualSensor.removeOutliers();
//Send the individual sensor to our filters, if there is a detected error we will make sure to set the falutIndex.
Map<String, Value> filterSensor = ErrorFinder.errorParams(individualSensor);
if(filterSensor.containsKey("faultIndex")) {
filterSensor.put("sensorId", Value.v(individualSensor.id));
errorSensors.add(filterSensor);
}
if(printDebug)
printMap(filterSensor);
}
// based on which sensors found faults, determine which component is problematic
Map<String, Value> finalError = ComponentError.finalError(errorSensors, allSensors);
//printMap(finalError);
if(finalError.size() >0)
reportError(finalError);
// wait for the Oracle response ...
try {
Thread.sleep(threadSleep);
} catch (Exception e) {
System.out.append(e.toString() + " " + e.getMessage());
}
// ... and then choose the lowest-cost action we have
if(recommendedAction != null) {
mainConnector.sendMessage(new CommandData(recommendedAction));
//System.out.println("DA recommendation: " + ((Command)(recommendedAction.toArray()[0])).getValue() + "\n" );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment