[TASK] Add tirePressure for all 4 tires.

This commit is contained in:
Jan Philipp Timme 2016-08-17 11:24:16 +02:00
parent f3ad040d67
commit 137425b81a
2 changed files with 17 additions and 5 deletions

View File

@ -38,7 +38,10 @@ public class Car {
private boolean motorOn;
private int motorRpm;
private int speed;
private double tirePressure;
private double tirePressure1;
private double tirePressure2;
private double tirePressure3;
private double tirePressure4;
// Sitzplätze? Reservierungen für X Personen?
@ -57,7 +60,10 @@ public class Car {
this.motorOn = false;
this.motorRpm = 0;
this.speed = 0;
this.tirePressure = (Car.MIN_TIRE_PRESSURE[carType] + Car.MAX_TIRE_PRESSURE[carType]) / 2.0;
this.tirePressure1 = (Car.MIN_TIRE_PRESSURE[carType] + Car.MAX_TIRE_PRESSURE[carType]) / 2.0;
this.tirePressure2 = (Car.MIN_TIRE_PRESSURE[carType] + Car.MAX_TIRE_PRESSURE[carType]) / 2.0;
this.tirePressure3 = (Car.MIN_TIRE_PRESSURE[carType] + Car.MAX_TIRE_PRESSURE[carType]) / 2.0;
this.tirePressure4 = (Car.MIN_TIRE_PRESSURE[carType] + Car.MAX_TIRE_PRESSURE[carType]) / 2.0;
// State data
this.currentState = CarState.LOCKED;
this.currentAction = CarAction.NONE;
@ -224,7 +230,10 @@ public class Car {
this.quads.add(new RdfQuadruple(eventIri, baseOnt+"motorRPM", ""+this.motorRpm+"^^http://www.w3.org/2001/XMLSchema#integer", time));
this.quads.add(new RdfQuadruple(eventIri, baseOnt+"speed", ""+this.speed+"^^http://www.w3.org/2001/XMLSchema#integer", time));
this.quads.add(new RdfQuadruple(eventIri, baseOnt+"handbrakeEngaged", ""+this.handbrakeEngaged+"^^http://www.w3.org/2001/XMLSchema#boolean", time));
this.quads.add(new RdfQuadruple(eventIri, baseOnt+"tirePressure", ""+this.tirePressure+"^^http://www.w3.org/2001/XMLSchema#double", time));
this.quads.add(new RdfQuadruple(eventIri, baseOnt+"tirePressure1", ""+this.tirePressure1+"^^http://www.w3.org/2001/XMLSchema#double", time));
this.quads.add(new RdfQuadruple(eventIri, baseOnt+"tirePressure2", ""+this.tirePressure2+"^^http://www.w3.org/2001/XMLSchema#double", time));
this.quads.add(new RdfQuadruple(eventIri, baseOnt+"tirePressure3", ""+this.tirePressure3+"^^http://www.w3.org/2001/XMLSchema#double", time));
this.quads.add(new RdfQuadruple(eventIri, baseOnt+"tirePressure4", ""+this.tirePressure4+"^^http://www.w3.org/2001/XMLSchema#double", time));
this.quads.add(new RdfQuadruple(eventIri, baseOnt+"locked", ""+this.isLocked+"^^http://www.w3.org/2001/XMLSchema#boolean", time));
}

View File

@ -106,7 +106,7 @@ public class RentACarSimulation implements Runnable {
+ "PREFIX f: <http://larkc.eu/csparql/sparql/jena/ext#> "
+ "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> "
+ "PREFIX car: <"+RentACarSimulation.BASE_ONTOLOGY_IRI+"> "
+ "SELECT ?car ?locked ?on ?speed ?rpm ?handbrake ?tirePressure "
+ "SELECT ?car ?locked ?on ?speed ?rpm ?handbrake ?tirePressure1 ?tirePressure2 ?tirePressure3 ?tirePressure4 "
+ "FROM STREAM <"+RentACarSimulation.CAR_STREAM_IRI+"> [RANGE 5s STEP 1s] "
+ "FROM STREAM <"+RentACarSimulation.DRIVER_STREAM_IRI+"> [RANGE 15s STEP 1s] "
+ "WHERE { "
@ -117,7 +117,10 @@ public class RentACarSimulation implements Runnable {
+ " ?e car:speed ?speed . "
+ " ?e car:motorRPM ?rpm . "
+ " ?e car:handbrakeEngaged ?handbrake . "
+ " ?e car:tirePressure ?pressure . "
+ " ?e car:tirePressure1 ?pressure1 . "
+ " ?e car:tirePressure2 ?pressure2 . "
+ " ?e car:tirePressure3 ?pressure3 . "
+ " ?e car:tirePressure4 ?pressure4 . "
+ "}";
}