diff --git a/src/main/scala/scim/components/Simulation.scala b/src/main/scala/scim/components/Simulation.scala index 05f31ba..d5830ff 100644 --- a/src/main/scala/scim/components/Simulation.scala +++ b/src/main/scala/scim/components/Simulation.scala @@ -69,9 +69,10 @@ class Simulation(config: Configuration) { // overwrite truth with value from configuration if this is the root group val prevTruth = if(subGroup.parent.isEmpty && !configTruths.isEmpty && configTruths.get.contains(subGroup)) { configTruths.get(subGroup) - // make sure parent actually calculates a ground truth + // make sure parent actually calculates a ground truth and is not a sensor child } else if(prevTruths.contains(subGroupParent) && subGroupParent.sensorParent.isEmpty) { - prevTruths(subGroupParent) + // pass the parents result of this tick instead of previous truth to child, to avoid lagging a tick behind + if(subGroup == subGroupParent) prevTruths(subGroup) else resultTruths(subGroupParent) } else { // this can happen if sensor parent has another sensor parent // TODO: A sensor with parent should not have children (warn in parser)