This project is a C++ implementation of a Fuzzy Logic Expert System created for the CSci 141 - Intelligent Systems course.
Fuzzy Deterministic Seismic Hazard Analysis (FDSHA) is a method that uses human-like, IF-THEN rules and fuzzy logic to calculate the Peak Ground Acceleration (PGA) at a site.
Instead of relying on complex, rigid formulas, the program takes general, descriptive information about a fault's magnitude, its distance to a site, and its type to calculate a precise measure of ground shaking (PGA).
The system uses a fuzzy logic engine to process inputs and determine the final hazard level.
The program accepts three numerical (crisp) inputs from the user.
- Maximum Magnitude (Mmax): The earthquake's magnitude on the Richter Scale (e.g.,
4.5to8.5) - Source-to-Site Distance (R): The distance from the fault in kilometers (e.g.,
0to200) - Fault Type (F): A normalized index representing the fault type (e.g., Normal
≈ -0.08, Thrust≈ 0.08)
Based on the inputs and its rule base, the system calculates one output.
- Peak Ground Acceleration (PGA): The final measure of the seismic hazard, expressed in units of g (acceleration of gravity)
The program flow involves fuzzification (converting numbers to fuzzy terms), inference (applying rules), aggregation (combining results), and defuzzification (converting the fuzzy result back to a number).
To get a local copy up and running, follow these simple steps.
You will need a C++ compiler, such as g++.
- Clone the repo:
git clone [https://github.com/Shinkrbs/fdsha.git](https://github.com/Shinkrbs/fdsha.git)
- Navigate into the project directory:
cd fdsha - Compile the source code (replace
main.cppwith your file's name):g++ main.cpp -o fdsha_final
- Run the program:
./fdsha_final
Once running, the program will prompt you to enter the three input values.
For example, using the data from the "Low Hazard" test case.
Input:
Enter Maximum Magnitude (Mmax, typically 4.5 to 8.5): 5
Enter Source-to-Site Distance (R, in km, typically 0 to 200): 180
Enter Fault Type Index (F, e.g., Thrust: 0.08, Normal: -0.08): -0.09
Output:
--- ANALYSIS RESULT ---
Inputs Used:
Mmax (Magnitude): 5
R (Distance): 180 km
F (Fault Index): -0.09
Calculated Peak Ground Acceleration (PGA): 0.0544111 g
Final Hazard Verdict: Negligible (Very Low Hazard)
This work is based on the methods described in the following paper:
- Afsari, N., Abdipour, M. S., & Taghizadeh-Farahmand, F. (2022). Seismic hazard analysis from deterministic method using fuzzy logic in Anzali Port. Earth Science Informatics, 15(2), 793-806.