[fix] fixed change behaviour time and truth issues
- targettime + 1 to reach the target at the configured time - output now correctly uses recalculated truth
This commit is contained in:
@@ -179,7 +179,7 @@ package object behaviour {
|
|||||||
if(inTruth.isEmpty) return None
|
if(inTruth.isEmpty) return None
|
||||||
val range: Double = args.getParam("range", 1.0)
|
val range: Double = args.getParam("range", 1.0)
|
||||||
val target: Double = args.getParam("target", inTruth.get + 5)
|
val target: Double = args.getParam("target", inTruth.get + 5)
|
||||||
val targetTime: Int = args.getParam("targetTime", time.getNormalized + 1) * time.tickfactor.getOrElse(1)
|
val targetTime: Int = args.getParam("targetTime", time.getNormalized + 1) * time.tickfactor.getOrElse(1) + 1
|
||||||
val center: Vector[Int] = args.getParam("center", Vector(0, 0))
|
val center: Vector[Int] = args.getParam("center", Vector(0, 0))
|
||||||
val distOffset: Option[Double] = args.getParam[Double]("distOffset")
|
val distOffset: Option[Double] = args.getParam[Double]("distOffset")
|
||||||
val offsetTimes: Option[Vector[Int]] = args.getParam[Vector[Int]]("time")
|
val offsetTimes: Option[Vector[Int]] = args.getParam[Vector[Int]]("time")
|
||||||
@@ -198,7 +198,7 @@ package object behaviour {
|
|||||||
(target + offset - truth) / (targetTime - time.time).toDouble
|
(target + offset - truth) / (targetTime - time.time).toDouble
|
||||||
} else { 0 }
|
} else { 0 }
|
||||||
|
|
||||||
Some(inTruth.get + rngRange + step)
|
Some(truth + rngRange + step)
|
||||||
}
|
}
|
||||||
|
|
||||||
def humidFromTemp (cell: Cell, time: Time, inTruth: Option[Double], args: Option[FunctionArgs]): Option[Double] = {
|
def humidFromTemp (cell: Cell, time: Time, inTruth: Option[Double], args: Option[FunctionArgs]): Option[Double] = {
|
||||||
|
|||||||
@@ -125,13 +125,13 @@ class SimulationConfigParser(input: Map[String, Any], simulationBehaviours: Simu
|
|||||||
traversableToMap[Cell, SensorCount](cells, parseCell)
|
traversableToMap[Cell, SensorCount](cells, parseCell)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: multiply time by tickfactor
|
// don't add tickfacor here, this is done in parseTruth with config.time()
|
||||||
private def parseTimeLineElement(timeLineElement: Any): (Int, Option[Int]) = {
|
private def parseTimeLineElement(timeLineElement: Any): (Int, Option[Int]) = {
|
||||||
timeLineElement match {
|
timeLineElement match {
|
||||||
case timeLineElement: Vector[_] => val elementVector = timeLineElement.asInstanceOf[Vector[Int]]
|
case timeLineElement: Vector[_] => val elementVector = timeLineElement.asInstanceOf[Vector[Int]]
|
||||||
(elementVector(0) * config.tickfactor, if(elementVector.size > 1) Some(elementVector(1) * config.tickfactor) else None)
|
(elementVector(0), if(elementVector.size > 1) Some(elementVector(1)) else None)
|
||||||
case timeLineElement: Map[_, _] => val elementMap = timeLineElement.asInstanceOf[Map[String, Int]]
|
case timeLineElement: Map[_, _] => val elementMap = timeLineElement.asInstanceOf[Map[String, Int]]
|
||||||
(elementMap("start") * config.tickfactor, if(elementMap.contains("end")) Some(elementMap("end") * config.tickfactor) else None)
|
(elementMap("start"), if(elementMap.contains("end")) Some(elementMap("end")) else None)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user