Nonsmooth Modeling and Simulation for Switched