Smart ultrasonic welding of thermoplastic composites