Hello,
Your callback activates when t==20.0. However, it is not certain the simulation will actually stop at that timestep (e.g. it might simulate a jump at time 19.67, and then the next one at time 21.23). Have you tried adding tstops=[20.0] to your solve(...) command? That might help.
Also, you can you ` to format code to make it look prettier: Discourse Guide: Code Formatting - Meta - Stonehearth Discourse