The technological advancement in Cyber-Physical Systems (CPS) has seen more sophisticated hardware, leading to systems that are complex, interconnected, and require automation. This trend has made modern CPS fragile and susceptible to faults. Traditional methods for fault detection and diagnosis are unable to adequately scale up to handle the faults that occur in CPS because of the tight interconnectivity between the physical and cyber parts of CPS. Also, real-time requirements present new challenges that are not sufficiently addressed by traditional fault-tolerant design approaches, therefore more intelligent methods are now needed to deal with these faults. To address these issues, we propose an approach to formally define faults, detect, and diagnose faults, and accommodate faults for fault tolerance.For fault detection and diagnosis, we propose a generic fault detection and diagnosis (FDD) scheme capable of diagnosing CPS faults in real-time. The scheme is developed to accommodate different modeling methods but for clarity of explanation, we adapt it to the DEVS formalism. To test the scheme, we implemented a library to store fault codes in a data structure and developed intelligent logic to ensure faults are correctly detected and isolated. We also propose a purely data-driven approach to detect faults in CPS where we have no control over the design of the control system. Our data-driven methods thrive on setting rigorous processes and workflows to ensure that representative data is collected for CPS to ensure that FDD techniques perform optimally.