Created
August 23, 2010 15:30
-
-
Save andrewgdunn/545717 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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