The solution is that I need to implement a when sample(starttime, timesteps) then because Openmodelica does not do it on its own.
when sample(starttime, timesteps) then