wip
This commit is contained in:
parent
0046143d82
commit
5f12c0c813
1 changed files with 4 additions and 15 deletions
|
@ -1,7 +1,5 @@
|
|||
package ch.usi.inf.sa4.sanmarinoes.smarthut.service;
|
||||
|
||||
import ch.usi.inf.sa4.sanmarinoes.smarthut.models.Sensor;
|
||||
import ch.usi.inf.sa4.sanmarinoes.smarthut.models.Sensor.SensorType;
|
||||
import ch.usi.inf.sa4.sanmarinoes.smarthut.models.Thermostat;
|
||||
import ch.usi.inf.sa4.sanmarinoes.smarthut.models.ThermostatRepository;
|
||||
import ch.usi.inf.sa4.sanmarinoes.smarthut.socket.SensorSocketEndpoint;
|
||||
|
@ -40,19 +38,10 @@ public class ThermostatService {
|
|||
|
||||
double x;
|
||||
Random ran = new Random();
|
||||
;
|
||||
if (thermostat.getTypical() == null) {
|
||||
BigDecimal typical = Sensor.TYPICAL_VALUES.get(SensorType.TEMPERATURE);
|
||||
|
||||
x = (ran.nextInt(typical.intValue()) + thermostat.getErr().intValue()) * 0.975 + 1;
|
||||
|
||||
} else {
|
||||
x =
|
||||
(ran.nextInt(thermostat.getTypical().intValue())
|
||||
+ thermostat.getErr().intValue())
|
||||
(ran.nextInt(thermostat.getTypical().intValue()) + thermostat.getErr().intValue())
|
||||
* 0.975
|
||||
+ 1;
|
||||
}
|
||||
updateValueForThermostat(thermostat, new BigDecimal(x));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue