Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Valores de ph mais relevantes, update de documentação #60

Merged
merged 1 commit into from
Jan 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ public static void main(String[] args) throws InterruptedException, IOException{
//Adicionar todos os valores de pH à base de dados
for(int i = 0; i<monitoresPH.size(); i++) {
for(int z = 0; z<monitoresPH.get(i).getValues().size(); z++) {
//Curl em windows
// String com = "curl -X POST -H \"Content-Type: application/json\" -d \"{\\\"sensorId\\\" : \\\" " + Integer.toString(monitoresPH.get(i).getId()) + " \\\", \\\"value\\\" : \\\" " + Double.toString(monitoresPH.get(i).getValues().get(z)) + " \\\"}\" http://localhost:8080/api/test/phmeasures";
// String com = "curl -X POST -H \"Content-Type: application/json\" -d \'{\"sensorId\" : \" " + Integer.toString(monitoresPH.get(i).getId()) + " \", \"value\" : \" " + Double.toString(monitoresPH.get(i).getValues().get(z)) + " \"}\' http://localhost:8080/api/test/phmeasures"; //Se estiver a correr em linux
// curl -X POST -H "Content-Type: application/json" -d '{"sensorId" : "4", "value" : "7.6"}' http://localhost:8080/api/test/phmeasures
// String com = "curl -X POST -H \"Content-Type: application/json\" -d \'{\"sensorId\" : \"" + Integer.toString(monitoresPH.get(i).getId()) + "\", \"value\" : \"" + Double.toString(monitoresPH.get(i).getValues().get(z)) +"\"}\' \"http://localhost:8080/api/test/phmeasures\"";

//Curl em Linux
String[] com = {"curl", "-X", "POST", "-H", "Content-Type: application/json", "-d", "{\"sensorId\" : \"" + Integer.toString(monitoresPH.get(i).getId()) + "\", \"value\" : \"" + Double.toString(monitoresPH.get(i).getValues().get(z)) +"\"}", "http://localhost:8080/api/test/phmeasures"};
try {
pr = rt.exec(com);
Expand All @@ -99,9 +99,10 @@ public static void main(String[] args) throws InterruptedException, IOException{
//Adicionar todos os valores de humidade à base de dados
for(int i = 0; i<monitoresHum.size(); i++) {
for(int z = 0; z<monitoresHum.get(i).getValues().size(); z++) {
//Curl em windows
// String com = "curl -X POST -H \"Content-Type: application/json\" -d \"{\\\"sensorId\\\" : \\\" " + Integer.toString(monitoresHum.get(i).getId()) + " \\\", \\\"value\\\" : \\\" " + Integer.toString(monitoresHum.get(i).getValues().get(z)) + " \\\"}\" http://localhost:8080/api/test/hummeasures";
// String com = "curl -X POST -H \"Content-Type: application/json\" -d \'{\"sensorId\" : \" " + Integer.toString(monitoresHum.get(i).getId()) + " \", \"value\" : \" " + Double.toString(monitoresHum.get(i).getValues().get(z)) + " \"}\' http://localhost:8080/api/test/hummeasures"; //Se estiver a correr em linux
// String com = "curl -X POST -H \"Content-Type: application/json\" -d \'{\"sensorId\" : \"" + Integer.toString(monitoresHum.get(i).getId()) + "\", \"value\" : \"" + Double.toString(monitoresHum.get(i).getValues().get(z)) +"\"}\' \"http://localhost:8080/api/test/hummeasures\"";

//Curl em Linux
String[] com = {"curl", "-X", "POST", "-H", "Content-Type: application/json", "-d", "{\"sensorId\" : \"" + Integer.toString(monitoresHum.get(i).getId()) + "\", \"value\" : \"" + Double.toString(monitoresHum.get(i).getValues().get(z)) +"\"}", "http://localhost:8080/api/test/hummeasures"};
try {
pr = rt.exec(com);
Expand All @@ -120,8 +121,11 @@ public static void main(String[] args) throws InterruptedException, IOException{
String mode = p.getMode();
if(mode == "Low") {
p.generateAcidicSoil(1/regs_per_day);
// Curl em windows
// String com = "curl -X POST -H \"Content-Type: application/json\" -d \"{\\\"sensorId\\\" : \\\" " + Integer.toString(p.getId()) + " \\\", \\\"value\\\" : \\\" " + Double.toString(p.getValues().get(p.getValues().size()-1)) + " \\\"}\" http://localhost:8080/api/test/phmeasures";
String com = "curl -X POST -H \"Content-Type: application/json\" -d \'{\"sensorId\" : \" " + Integer.toString(p.getId()) + " \", \"value\" : \" " + Double.toString(p.getValues().get(p.getValues().size()-1)) + " \"}\' http://localhost:8080/api/test/phmeasures"; //Se estiver a correr em linux

//Curl em linux
String[] com = {"curl -X POST -H \"Content-Type: application/json\" -d \'{\"sensorId\" : \" " + Integer.toString(p.getId()) + " \", \"value\" : \" " + Double.toString(p.getValues().get(p.getValues().size()-1)) + " \"}\' http://localhost:8080/api/test/phmeasures"};

try {
pr = rt.exec(com);
Expand All @@ -131,8 +135,12 @@ public static void main(String[] args) throws InterruptedException, IOException{
}
if(mode == "Medium") {
p.generateNeutralSoil(1/regs_per_day);

// Curl em windows
// String com = "curl -X POST -H \"Content-Type: application/json\" -d \"{\\\"sensorId\\\" : \\\" " + Integer.toString(p.getId()) + " \\\", \\\"value\\\" : \\\" " + Double.toString(p.getValues().get(p.getValues().size()-1)) + " \\\"}\" http://localhost:8080/api/test/phmeasures";
String com = "curl -X POST -H \"Content-Type: application/json\" -d \'{\"sensorId\" : \" " + Integer.toString(p.getId()) + " \", \"value\" : \" " + Double.toString(p.getValues().get(p.getValues().size()-1)) + " \"}\' http://localhost:8080/api/test/phmeasures"; //Se estiver a correr em linux

//Curl em linux
String[] com = {"curl -X POST -H \"Content-Type: application/json\" -d \'{\"sensorId\" : \" " + Integer.toString(p.getId()) + " \", \"value\" : \" " + Double.toString(p.getValues().get(p.getValues().size()-1)) + " \"}\' http://localhost:8080/api/test/phmeasures"};
try {
pr = rt.exec(com);
}catch(Exception e) {
Expand All @@ -141,8 +149,12 @@ public static void main(String[] args) throws InterruptedException, IOException{
}
if(mode == "High") {
p.generateBasicSoil(1/regs_per_day);

// Curl em windows
// String com = "curl -X POST -H \"Content-Type: application/json\" -d \"{\\\"sensorId\\\" : \\\" " + Integer.toString(p.getId()) + " \\\", \\\"value\\\" : \\\" " + Double.toString(p.getValues().get(p.getValues().size()-1)) + " \\\"}\" http://localhost:8080/api/test/phmeasures";
String com = "curl -X POST -H \"Content-Type: application/json\" -d \'{\"sensorId\" : \" " + Integer.toString(p.getId()) + " \", \"value\" : \" " + Double.toString(p.getValues().get(p.getValues().size()-1)) + " \"}\' http://localhost:8080/api/test/phmeasures"; //Se estiver a correr em linux

//Curl em linux
String[] com = {"curl -X POST -H \"Content-Type: application/json\" -d \'{\"sensorId\" : \" " + Integer.toString(p.getId()) + " \", \"value\" : \" " + Double.toString(p.getValues().get(p.getValues().size()-1)) + " \"}\' http://localhost:8080/api/test/phmeasures"};
try {
pr = rt.exec(com);
}catch(Exception e) {
Expand All @@ -157,8 +169,12 @@ public static void main(String[] args) throws InterruptedException, IOException{
String mode = h.getMode();
if(mode == "Low") {
h.generateDrySoil(1/regs_per_day);

// Curl em windows
// String com = "curl -X POST -H \"Content-Type: application/json\" -d \"{\\\"sensorId\\\" : \\\" " + Integer.toString(h.getId()) + " \\\", \\\"value\\\" : \\\" " + Integer.toString(h.getValues().get(h.getValues().size()-1)) + " \\\"}\" http://localhost:8080/api/test/hummeasures";
String com = "curl -X POST -H \"Content-Type: application/json\" -d \'{\"sensorId\" : \" " + Integer.toString(h.getId()) + " \", \"value\" : \" " + Integer.toString(h.getValues().get(h.getValues().size()-1)) + " \"}\' http://localhost:8080/api/test/phmeasures"; //Se estiver a correr em linux

//Curl em linux
String[] com = {"curl -X POST -H \"Content-Type: application/json\" -d \'{\"sensorId\" : \" " + Integer.toString(h.getId()) + " \", \"value\" : \" " + Integer.toString(h.getValues().get(h.getValues().size()-1)) + " \"}\' http://localhost:8080/api/test/phmeasures"};
try {
pr = rt.exec(com);
}catch(Exception e) {
Expand All @@ -167,8 +183,12 @@ public static void main(String[] args) throws InterruptedException, IOException{
}
if(mode == "Medium") {
h.generateNeutralSoil(1/regs_per_day);

// Curl em windows
// String com = "curl -X POST -H \"Content-Type: application/json\" -d \"{\\\"sensorId\\\" : \\\" " + Integer.toString(h.getId()) + " \\\", \\\"value\\\" : \\\" " + Integer.toString(h.getValues().get(h.getValues().size()-1)) + " \\\"}\" http://localhost:8080/api/test/hummeasures";
String com = "curl -X POST -H \"Content-Type: application/json\" -d \'{\"sensorId\" : \" " + Integer.toString(h.getId()) + " \", \"value\" : \" " + Integer.toString(h.getValues().get(h.getValues().size()-1)) + " \"}\' http://localhost:8080/api/test/phmeasures"; //Se estiver a correr em linux

//Curl em linux
String[] com = {"curl -X POST -H \"Content-Type: application/json\" -d \'{\"sensorId\" : \" " + Integer.toString(h.getId()) + " \", \"value\" : \" " + Integer.toString(h.getValues().get(h.getValues().size()-1)) + " \"}\' http://localhost:8080/api/test/phmeasures"};
try {
pr = rt.exec(com);
}catch(Exception e) {
Expand All @@ -177,8 +197,12 @@ public static void main(String[] args) throws InterruptedException, IOException{
}
if(mode == "High") {
h.generateMoistSoil(1/regs_per_day);

//Curl em windows
// String com = "curl -X POST -H \"Content-Type: application/json\" -d \"{\\\"sensorId\\\" : \\\" " + Integer.toString(h.getId()) + " \\\", \\\"value\\\" : \\\" " + Integer.toString(h.getValues().get(h.getValues().size()-1)) + " \\\"}\" http://localhost:8080/api/test/hummeasures";
String com = "curl -X POST -H \"Content-Type: application/json\" -d \'{\"sensorId\" : \" " + Integer.toString(h.getId()) + " \", \"value\" : \" " + Integer.toString(h.getValues().get(h.getValues().size()-1)) + " \"}\' http://localhost:8080/api/test/phmeasures"; //Se estiver a correr em linux

//Curl em linux
String[] com = {"curl -X POST -H \"Content-Type: application/json\" -d \'{\"sensorId\" : \" " + Integer.toString(h.getId()) + " \", \"value\" : \" " + Integer.toString(h.getValues().get(h.getValues().size()-1)) + " \"}\' http://localhost:8080/api/test/phmeasures"};
try {
pr = rt.exec(com);
}catch(Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public MonitorPH(int given_id, String mode, int freq, int instant) { //instant
public void generateAcidicSoil(int days) {
if(days>0) {
for(int i = 0; i<this.reg_freq*days; i++) {
double value = getRandomDoubleInRange(0,7);
double value = getRandomDoubleInRange(4,6);
this.values.add(value);
}
}
Expand All @@ -38,7 +38,7 @@ public void generateAcidicSoil(int days) {
public void generateNeutralSoil(int days) {
if(days>0) {
for(int i = 0; i<this.reg_freq*days; i++) {
double value = getRandomNumberUsingInts(4,10);
double value = getRandomNumberUsingInts(6,8);
this.values.add(value);
}
}
Expand All @@ -47,7 +47,7 @@ public void generateNeutralSoil(int days) {
public void generateBasicSoil(int days) {
if(days>0) {
for(int i = 0; i<this.reg_freq*days; i++) {
double value = getRandomNumberUsingInts(7,14);
double value = getRandomNumberUsingInts(7,9);
this.values.add(value);
}
}
Expand Down