# NDSolve: ProcessEquations and Reinitialize with Piecewise functions

I am having trouble with using NDSolveReinitialize when the system consists of a pieceise function.

If we define the ODE system

 simplesys = {r'[t] ==
Piecewise[{{1, 0 <= t <= 10}, {0, 10 <= t <= 20}}, 0], r[0] == 0};


and process the equations with

state = First@NDSolveProcessEquations[simplesys, r, t]


this works perfectly fine. However, when I try to reinitilize the ODE system with a new initial condition

newstate = NDSolveReinitialize[state, {r[0] == 2}]


this fails with the message

NDSolveReinitialize::ntcs: Cannot solve constraint equations for initial conditions.


This is due to the piecewise function in the system, I haven't got this problem for other types of systems, it only occurs when I have piecewise function. How can I solve this issue?

-
In this specific case you can replace Piecewise[...] with UnitStep[10 - t]. –  b.gatessucks Aug 14 '13 at 6:51
Thanks for the quick response @b.gatessucks. Works absolutely fine now :) –  jaclea Aug 14 '13 at 6:55