Commit 83db3cd8 authored by Nicolas Seydoux's avatar Nicolas Seydoux
Browse files

Added an initial pause at sensor start

parent df14893b
......@@ -74,6 +74,7 @@ public class Sensor extends Thread {
public void run(){
try {
String observation="";
Thread.sleep(this.config.getInitialSleep());
while(true){
// This boolean is updated when replaying values that might be nan
Boolean observationValid = true;
......
......@@ -16,6 +16,7 @@ public class Configuration {
private Boolean reasoning;
private String datafile;
private String sensorId;
private Integer initialSleep;
public Integer getCycleDuration() {
return cycleDuration;
......@@ -120,5 +121,13 @@ public class Configuration {
public void setSensorId(String sensorId) {
this.sensorId = sensorId;
}
public Integer getInitialSleep() {
return initialSleep;
}
public void setInitialSleep(Integer initialSleep) {
this.initialSleep = initialSleep;
}
}
......@@ -8,6 +8,8 @@ import argparse
logging.basicConfig(level=logging.DEBUG)
SENSOR_INITIAL_SLEEP=120000
BASE_URL = "http://example.com/ns#"
def serialize_number(number):
......@@ -203,7 +205,8 @@ def parse_topology(topology_name, common_knowledge, topology, node_list, upper_n
"port":9000+node_id,
"cycleDuration":800,
"measures":topology["measures"],
"reasoning":False
"reasoning":False,
"initialSleep":SENSOR_INITIAL_SLEEP
}
set_host(node, topology, upper_node)
sensor_ref = { "endpoint":node["host"]+":"+str(node["port"]),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment