Nonsmooth Simulation and Optimization for Plant Integration and Design