Skip to content

Commit

Permalink
Fix status not updated when calling setup on FMI 1.0 and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Lars Ivar Hatledal committed Jul 18, 2019
1 parent 42fd228 commit 6ee2c35
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,6 @@ abstract class AbstractModelInstance<out E : CommonModelDescription, out T : Fmi
return wrapper.write(vr, value)
}

private companion object {
private val LOG: Logger = LoggerFactory.getLogger(AbstractModelInstance::class.java)
}

override fun getFMUstate(): FmuState {
throw IllegalStateException("Feature not available for FMI 1.0")
}
Expand All @@ -154,4 +150,8 @@ abstract class AbstractModelInstance<out E : CommonModelDescription, out T : Fmi
throw IllegalStateException("Feature not available for FMI 1.0")
}

private companion object {
private val LOG: Logger = LoggerFactory.getLogger(AbstractModelInstance::class.java)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ class CoSimulationSlave internal constructor(

simulationTime = start

return true
return true.also {
wrapper.lastStatus = FmiStatus.OK
}
}

override fun exitInitializationMode(): Boolean {
return (wrapper.initializeSlave(startTime, stopTime).isOK()).also {
wrapper.lastStatus = FmiStatus.OK
}
return wrapper.initializeSlave(startTime, stopTime).isOK()
}

override fun doStep(stepSize: Double): Boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ open class ModelExchangeInstance internal constructor(

relativeTolerance = tolerance

return true
return true.also {
wrapper.lastStatus = FmiStatus.OK
}

}

override fun exitInitializationMode(): Boolean {
val toleranceControlled = relativeTolerance > 0
return (wrapper.initialize(toleranceControlled, relativeTolerance).isOK()).also {
wrapper.lastStatus = FmiStatus.OK
}
return wrapper.initialize(toleranceControlled, relativeTolerance).isOK()
}

override fun reset(): Boolean {
Expand Down

0 comments on commit 6ee2c35

Please sign in to comment.