A set of tools for piecewise affine (PWA) systems: approximation of nonlinear systems by PWA systems, stability analysis of PWA systems and controller synthesis for PWA systems