Hello Steven, I will explain the problem in more detail and with two figures. Figure 1:

I want to see the motion (position) of an object inside a box, when some external forces are applied. If the grey square is sit down due to the resultant of these forces, I must apply the following conditions: speed = 0, acceleration = 0. Hence, the two time integration of the acceleration should give me the position (h) which is expected to be zero, until the sum of forces change and the square lifts. In Figure 2 is given the other possible condition.

When the sum of forces in upward direction overcome that in downward direction, the square is lifted up to the ceiling of the box and the motion is no further allowed due to physical reason. In this case I need to apply again the initial conditions: speed = 0, acceleration = 0, as long as the sum of forces remain the same.
As you can see, there is a certain similarity with the ballode example, but in my case I need to account a limitation of the motion in both directions while in the ballode the limit was only the floor.
Thank you
