Commit 6829ab85 authored by Julian Zobel's avatar Julian Zobel 🦄
Browse files

Added a field for experiments db with "fisnihed withput errors"

parent 8ddb64ed
......@@ -289,7 +289,7 @@ public class Simulator implements RandomGeneratorComponent, GlobalComponent {
so.simulationFinished();
}
ExperimentDAO.simulationFinished();
ExperimentDAO.simulationFinished(finishedWithoutError);
}
/**
......
......@@ -175,13 +175,14 @@ public class UAVTopologyComponent extends AbstractTopologyComponent implements S
if(this.position.getAltitude() != 0) {
this.setState(UAVstate.CRASHED);
Monitor.log(this.getClass(), Level.WARN, "[UAVTopologyComponent] UAV " + getUAVComponent().getHost().getId() + " crashed at " + getRealPosition(), "");
PositionVector l = getCurrentLocation();
l.setAltitude(0);
this.updateCurrentLocation(l);
uavOverlayComponent.shutdown();
shutdownCommunication();
Monitor.log(this.getClass(), Level.WARN, "[UAVTopologyComponent] UAV " + getUAVComponent().getHost().getId() + " crashed at " + getRealPosition(), "");
} else {
this.setState(UAVstate.OFFLINE);
......
......@@ -106,12 +106,14 @@ public class ExperimentDAO extends DAO {
}
/** Called by the {@link Time} when the simulation is shut down. */
public static void simulationFinished() {
public static void simulationFinished(boolean finishedWithoutError) {
// If there is no experiment object, no measurements have been made,
// and hence, there is no reason to contact the database.
if (experiment == null)
return;
updateFinishedWithoutError(finishedWithoutError);
updateEndDate();
commitQueue();
finishCommits();
......@@ -125,4 +127,10 @@ public class ExperimentDAO extends DAO {
experiment.setEndDate(new Date());
update(experiment);
}
private static void updateFinishedWithoutError(boolean finishedWithoutError) {
experiment.setFinishedWithoutErrors(finishedWithoutError);
update(experiment);
}
}
......@@ -48,6 +48,11 @@ public class Experiment {
* The end date of this experiment
*/
private Date endDate;
/**
* If the simulation finished without errors
*/
private boolean finishedWithoutError;
/**
* The description of this experiment (easy readable)
......@@ -90,6 +95,7 @@ public class Experiment {
this.name = name;
this.system = system;
this.workload = workload;
this.finishedWithoutError = null;
}
public Experiment() {
......@@ -122,6 +128,10 @@ public class Experiment {
public String getWorkload() {
return workload;
}
public boolean hasFinishedWithoutErrors() {
return finishedWithoutError;
}
public void setId(int id) {
this.id = id;
......@@ -146,6 +156,10 @@ public class Experiment {
public void setWorkload(String workload) {
this.workload = workload;
}
public void setFinishedWithoutErrors(boolean noerrors) {
finishedWithoutError = noerrors;
}
public Date getEndDate() {
return endDate;
......@@ -159,6 +173,6 @@ public class Experiment {
public String toString() {
return "Experiment [id=" + id + ", seed=" + seed + ", date=" + date
+ ", endDate=" + endDate + ", name=" + name + ", system="
+ system + ", workload=" + workload + "]";
+ system + ", workload=" + workload + ", no Errors="+ finishedWithoutError +"]";
}
}
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