An integrated approach to safety and security based on systems theory