Detecting and Analyzing Frequency Events in Power Systems Using Tunable Parameters-Based Algorithms: Development, Optimization, and Analysis