@physicboy @RDunn
After your comment, let compare our understanding
- time (t) in Trunc() is next timestep (no happened yet)
- This time (t) is sent into main function to get its output and store into tmp.
if (tmp != *inst)
is equivalent to compare next step output (tmp.) and current output (inst->), this compare should be discrete, if they are different, a state change is confirmed, and should reduce timestep
** can use any kind of logic to detect a change event, not limit to if(tmp != *inst)- if condition trigger, set *timestep = ttol to reduce timestep temporary
- ** Remark : time (t) in #1 may or may not be used for an actual next step. If no *timestep changes, this time (t) and its output data is next time step data. But if *timestep changes, simulator goes back in time and reduce timestep at this region to calculate the result (if not go back in time, I cannot explain why timestep can reduce before state change).