Introduction

Earthquake early warning systems (EEWSs) aim to reduce the earthquake damages by taking precautions for high tension lines, nuclear, chemical and gas filling plants, pipelines, airports and operations centers, hospitals, subways, high-speed trains, elevators in skyscrapers and shopping centers, and many more potential targets (Harben 1991; Goltz 2002; Alcik et al. 2009). These systems can also be used to warn people protect themselves from the damage of an earthquake by performing simple actions such as “drop, cover and hold on”. The EEWS idea was first introduced by Cooper (1868). In recent years, developments in electronics, communication and computer technologies have made significant contributions to EEWSs in terms of data acquisition and processing. Heaton (1985) proposed a seismic network called the Seismic Computerized Alert Network (SCAN) for Southern California. However, the first established EEWS was developed by Ashiya (2004) to provide automatic braking of high-speed trains for Japan Railways. The Urgent Earthquake Detection and Alarm System (UrEDAS) approach, introduced by Nakamura (1988) and used by Japan Railways, is the most famous scientific approach. Another EEWS has been developed to alert the highway workers in Oakland, California by Bakun et al. (1994). In later years, it has also been introduced the more advanced versions of the UrEDAS such as Compact UrEDAS, Fast Response Equipment against Quake Load (FREQL) and Earthquake Quick Alarm System (EQAS). Allen (2007) introduced a regional EEWS called the Earthquake Alarm System (ElarmS). Cua and Heaton (2007) introduced the Virtual Seismologist (VS) based on the Bayesian approach. It has been tested in many seismic networks worldwide (Carranza et al. 2017; Picozzi et al. 2015a; Behr et al. 2016). Satriano et al. (2010) proposed the Probabilistic and Evolutionary Early Warning System (PRESTo) that determines the epicenter and magnitude of an earthquake in real-time. Kong et al. (2016) developed a global smartphone seismic network (MyShake). Consequently, the EEWSs have currently been establishing and testing in many countries such as Canada (Taale et al. 2021), China (Peng et al. 2009, 2011, 2015, 2021; Hu et al. 2021), Costa Rica (Protti 2001; Brooks et al. 2021), Greece (Diagourtas 2008; Diagourtas et al. 2008), India (Mittal et al. 2019), Italy (Olivieri et al. 2008; Zollo et al. 2009; Colombelli et al. 2012; Picozzi et al. 2015b; Caruso et al. 2017; D’Alessandro et al. 2018; D’Alessandro et al. 2020), Japan (Nakamura 1988; Odaka et al. 2003; Ashiya 2004; Kamigaichi 2004; Nakamura 2004; Okada et al. 2004; Nakamura et al. 2006; Nakamura 2008; Kamigaichi et al. 2009; Doi 2011; Colombelli et al. 2012; Uga et al. 2012), Kyrgyzstan (Bindi et al. 2015), Mexico (Espinosa-Aranda et al. 1992, 1995; Iglesias 2007; Espinosa-Aranda et al. 2009; Suarez et al. 2009), New Zealand (Prasanna et al. 2022), Romania (Wenzel et al. 1999; Böse et al. 2007; Espinosa-Aranda et al. 2011), South Korea (Sheen et al. 2017; Lee et al. 2019; Wu et al. 2021), Taiwan (Teng et al. 1997; Wu and Kanamori 2005a, b; Hsiao et al. 2009; Chen et al. 2015; Hsu et al. 2020), Türkiye (Erdik et al. 2003; Fischer et al. 2012; Kafadar 2017; Tunç et al. 2023), and United States (Kanamori et al. 1991; Gee et al. 1996; Wald et al. 1999a, 2000; Lockman and Allen 2005; Allen 2007; Allen et al. 2009; Kanamori 2015; Minson et al. 2015; Given et al. 2018; Nof et al. 2019).

EEWSs are based on the principle of detecting and characterizing an earthquake that may cause damage and then issuing an alarm. They are classified into two categories: regional and on-site (Allen et al. 2009). The regional EEWSs consist of a seismic network located in an area near the epicenter. The on-site EEWSs contain one or more seismic stations located near the target area. In areas very close to the epicenter, on-site EEWSs are more useful than regional EEWSs (Kanamori 2015). In the literature, there are many approaches based on the regional/on-site EEWS performed by various researchers. For example, Allen (1978) developed a computer program based on the short term averaging/long term averaging (STA/LTA) for the automatic detection and timing of earthquakes on a single seismic trace. Wu and Kanamori (2005b) introduced an on-site threshold-based EEWS that compares the average period and peak displacement to corresponding thresholds. Wu and Kanamori (2008) described the τc (the average period of the initial 3 s of the P-wave) and Pd (the maximum amplitude of a high-pass filtered vertical displacement during the initial 3 s of the P-wave) methods developed for earthquake early warning purposes. Zollo et al. (2010) also proposed a threshold-based technique, and then Colombelli et al. (2012) and Peng et al. (2015) tested their method in Japan and China, respectively. Peng et al. (2013) developed an integrated on-site EEWS called EDAS-MAS. Bindi et al. (2015) introduced an on-site EEWS for Bishkek in Kyrgyzstan. Picozzi et al. (2015b) proposed an on-site EEWS for schools in southern Italy. Caruso et al. (2017) developed an on-site EEWS based on P waves for Italy. D’Alessandro et al. (2020) performed a study about the optimization of low-cost monitoring systems for on-site earthquake early warning of critical infrastructures in Italy. Hsu and Nieh (2020) proposed an on-site EEWS using smartphones in Taiwan. Won et al. (2020) developed an on-site low-cost IOT sensor for smart earthquake detection and notification. Hu et al. (2021) improved resolution and cost performance of low-cost mems seismic sensor in China. Song et al. (2022) introduced an on-site alert-level EEWS using machine-learning-based prediction equations. Labanan et al. (2022) developed an on-site EEWS for one private higher educational institution and its nearby community in Manila, Philippines. Chandrakumar et al. (2022) conducted a comprehensive literature review for EEWSs based on low-cost ground motion sensors.

In this study, we aimed to develop an on-site EEWS called ESenTRy (Earthquake SenTRy). For this purpose, we developed a user friendly graphical user interface that can read and analyze the acceleration data in real-time, and issue an alarm for three-level depending on the user-defined threshold values. We used the instrumental modified Mercalli intensity approach to compute the intensity of the earthquake in real-time. Although traditional on-site EEWSs are based on the analysis of single station data, we used an approach that allows the analysis of both single-station and multi-station data. Ultimately, we performed two simulations to test the reliability of ESenTRy using the strong motion data from Türkiye and presented the results in detail.

This paper was organized as: Section “ESenTRy overview” contains the schematic illustration of ESenTRy and its details, and mathematical background of the instrumental modified Mercalli intensity. Section “Algorithm and implementation” deals with the format of the data packets and the algorithm developed to read the Güralp Compressed Format seismic data. Section “Test applications” presents the applications performed to test the reliability of ESenTRy.

ESenTRy overview

ESenTRy consists of single or multiple seismic stations placed at or near the target area and a data center. In this system, a seismic station includes a CMG-5TDE accelerometer, GPS and modem components. ESenTRy enables single-station data analysis like classic on-site EEWSs and additionally uses an algorithm that allows real-time analysis of multi-station data. The data center also consists of two computers running the Scream! and ESenTRy software, switch, modbus and speaker components. ESenTRy uses the internet/intranet to communicate and transfer data. The schematic illustration of ESenTRy is shown in Fig. 1. It utilizes the instrumental modified Mercalli intensity MMI, a strong motion index, to estimate the intensity of the seismic event from the real-time strong motion data. Although there are many intensity scales to determine the earthquake intensity such as Rossi-Forel (RF) (De Rossi 1883), Mercalli-Cancani-Sieberg (MCS) (Sieberg 1932), Medmedev-Sponheur-Karnik (MSK) (Medvedev et al. 1965) and Japon (JMA) (Japanese Meteorological Agency 1996), the modified Mercalli intensity developed by Wood and Neumann (1931) is widely used worldwide.

Fig. 1
figure 1

Schematic illustration of ESenTRy

TheMMI can be calculated from the destructive intensity, DI or real-time intensity, RI. The Compact UrEDAS first use the power density of the earthquake vibration from the inner product of the acceleration a (cm/s2) and velocity v (m/s) vectors to estimate the destructiveness of an earthquake. However, since it is a very large value, in practice the logarithm of absolute value of this inner product are used, and the DI, one of the strong motion indices, can be calculated as follows (Nakamura and Saita 2007a):

$$DI={log}\left|a.v\right|$$
(1)

During an earthquake, the maximum value of DI is related to earthquake damage, and it can be calculated in real-time. The relationships between DI and other strong motion indices, the RI and MMI, can be explained using the following empirical relations (Nakamura and Saita 2007b):

$$RI=DI+2.4$$
(2)
$$MMI= \frac{11}{7}RI+0.50=\frac{11}{7}DI+4.27$$
(3)

The MMI scale ranges from I to X+, and describes the intensity of a seismic event (Fig. 2a). Figure 2b shows the change in MMI as a function of time. Nakamura and Saita (2007b) examined the relationships between the MMI and peak ground acceleration, 5 Hz peak ground acceleration and peak ground velocity using the definitions of Richter (1958); Bolt (1993); Wald et al. (1999b), and presented in detail. The change of MMI during an earthquake is also demonstrated with simulations in Sect. “Algorithm and implementation” in detail.

Fig. 2
figure 2

a Modified Mercalli Intensity scale. (modified from Wald et al. 2000), b change in MMI as a function of time. The black circles show the alert points for each user-defined alarm level

Algorithm and implementation

The CMG-5TDE is a digital force-balance strong motion accelerometer manufactured by Güralp Systems Limited, and used for many purposes such as seismology, hazard mitigation and civil engineering applications. This sensor offers remote control and monitoring with an on-board Linux-based acquisition module (Güralp 5TDE 2024). Scream! (Güralp Scream! 2024), a freely-available Windows and Linux application for Güralp instruments is used in the data center for the configuration of these seismometers, real-time data acquisition and monitoring, and can be downloaded by following the steps in ESenTRy user manual (ESenTRy Github repository 2024). In addition, Scream! can receive and transmit Güralp Compressed Format (GCF) data over serial or dial-up links, TCP/IP, UDP/IP or other file transfer protocols. The GCF is a block-based format developed by Güralp Systems for storing seismic data, and the algorithms developed for reading GCF data is first shared in detail within the scope of this study (GCF Reference 2021). Each block is 1024 bytes long and the first 16 bytes contain the header information. The header includes a System ID and Stream ID that identify the digitizer and associated channel. It also contains a start time in seconds, sample rate, number of samples, format of the samples and some additional helpful information. There are three kinds of the first word in the header block (Fig. 3).

Fig. 3
figure 3

(modified from GCF Reference 2021)

Three different header information used in the GCF data; non-extended System ID (a), extended System ID (b) and double-extended System ID (c), and strong motion data blocks (d).

The early format shown in Fig. 3a is not typically used by current Güralp digitizer models but must be accepted by any compliant software implementation, and bit 31 of the first word is 0 (GCF Reference 2021). The format shown in Fig. 3b is typically used by Güralp CD24 and DM24 digitizers, and bits 31 and 30 of the System ID word are 1 and 0, respectively. The format shown in Fig. 3c is typically used by Güralp Minimus and Affinity digitizers, and both bits 31 and 30 of the System ID word are 1. For each data format in Fig. 3b and c, bits 29, 28 and 27 are used to identify the digitizer gain; 000 (No variable-gain stage fitted), 001 (×1), 010 (×2), 011 (×4), 100 (×8), 101 (×16), 110 (×32) and 111 (×64). In the first word, bit 26 identifies the digitizer type t; 1 (CD24) and 0 (DM24). The second byte of the fourth header word (Sample rate) indicates the number of samples per second; 157 (0.1), 161 (0.125), 162 (0.2), 164 (0.25), 167 (0.5), 171 (400), 174 (500), 175 (800), 176 (1000), 179 (2000), 181 (4000), 182 (625), 191 (1250), 193 (2500) and 194 (5000). The tap-table look-up (TTL), an index into one of several a digitizer-specific tables of decimation chain configurations, is the first byte of the fourth word of the header (GCF Reference 2021). The GCF format supports variable compression, and is identified in the fourth word of the header; 1 (signed 32-bit differences), 2 (signed 16-bit differences) and 4 (signed 8-bit differences). The number of records (Nº of records) has a maximum value of 250, allowing a maximum of 1000 samples per packet; signed 32-bit differences (1× Nº of records), signed 16-bit differences (2× Nº of records) and signed 8-bit differences (4× Nº of records). The next blocks contain the strong motion results (Fig. 3d). The absolute value of the first sample is known as forward integration constant (FIC). The value of the difference following the FIC is zero and each difference is expressed by 1, 2 or 4 bytes, depending on the compression code (Comp). For a final check, the block contains the absolute value of the last sample named reverse integration constant (RIC) after the differences.

ESenTRy uses the readSystemIDStreamID function to read the System ID and Stream ID from the first and second words in the GCF data (Fig. 4a). First, this function reads the first byte and reverses this byte array. Then, the algorithm decides the header type (non-extended System ID, extended System ID or double-extended System ID) and calls the IDToStr function to convert the base 36 data (System ID and Stream ID) into string format (Fig. 4b). After that, the readBlock function reads the date and start time of the data packet, TTL, sample per second, compression code, number of record, end time of the data packet and strong motion data (Fig. 5). Besides, the setSPS function returns the sample per second (Fig. 6).

Fig. 4
figure 4

Flowchart diagrams of the readSystemIDStreamID (a) and IDToStr (b) functions

Fig. 5
figure 5

Flowchart diagram of the readBlock function

Fig. 6
figure 6

Flowchart diagram of the setSPS function

ESenTRy consists of several graphical user interfaces designed to monitor the received data packets, Modbus terminal messages, computed strong motion indices for each station, as well as define the UDP communication parameters, alarm threshold values, seismic stations, and Modbus clients. The initial parameters needed by ESenTRy are saved into an INI file. This file contains the stream IDs and their gain factors for each station, number of stream and delay time for network trigger, automatic start time, host IP and port number, archive directory, alarm levels (Level-1, Level-2 and Level-3), cutoff frequency for low-pass filter, and IPs, passwords and alias names for Modbus clients. A detailed explanation of ESenTRy graphical user interfaces is provided in the user manual (ESenTRy Github repository 2024).

The main code whose flowchart diagram is given in Fig. 7 reads the INI file that contains the initial parameters and starts listening the UDP server. When the first data packed is received, it calls the readSystemIDStreamID function. If the streamID is available in the defined streamIDs, it calls the readBlock function and obtains the parameters required to read the strong motion results. For the first data packet, the code calls the calcFilterCoef function to calculate the low-pass filter coefficients and filter the strong motion data. After that, it calls the calcSMIndices function to estimate the strong motion indices (destructive intensities, real-time intensities and instrumental modified Mercalli intensities) from the filtered strong motion results, then it displays the estimated strong motion indices via graphical user interfaces (Fig. 8a). Ultimately, it compares the estimated maximum MMI to the user-defined alarm threshold values and decides whether to issue an alarm, and then calls the alarmEvent function (Fig. 8b). In case of multi-station analysis, ESenTRy waits for a user-defined number of station data to exceed the threshold value for a certain user-defined period, and decides whether to issue an alarm.

Fig. 7
figure 7

Flowchart diagram of the ESenTRy main code

Fig. 8
figure 8

Flowchart diagrams of the calcSMIndices (a) and alarmEvent (b) functions (NNT: Number of Network Trigger, NTT: Network Trigger Time)

Test applications

In this section, two simulations have been performed to test the effectiveness and reliability of ESenTRy. For both simulations, the alarm threshold values for Level-1, Level-2 and Level-3 are set to 1, 2 and 5. The cutoff frequency of low-pass filter is also set to 5 Hz. In the first example, we used the single station data to issue an early warning alarm for the magnitude 7.7 earthquake that occurred on February 6, 2023, at 01:17:32 UTC in Pazarcık, Kahramanmaraş from Türkiye. The epicenter (yellow star) and seismic stations (green triangles) used in the first simulation are shown in Fig. 9. The distances between the epicenter and stations KHMN and T2131 are approximately 23 km and 346 km, respectively. The number of network trigger is set to 1 for single station analysis.

Fig. 9
figure 9

The locations of the epicenter and recording stations of KOERI (KHMN station) and TCDD (T2131 station) for the earthquake used in the first simulation (KOERI: Boğaziçi University Kandilli Observatory and Earthquake Research Institute, TCDD: Turkish Railways)

The strong motion data recorded by KHMN and T2131 stations are shown in Fig. 10a and c, respectively. As shown in Fig. 10b, the highest MMI value for KHMN station is estimated as 9.876 (Violent (IX)) from the strong motion data in Fig. 10a, and ESenTRy alerts the ModBus clients and issues an alarm at 01:17:38 UTC (Level-2) and 01:17:40 UTC (Level-3). The P-wave arrival time for Mw 7.7 Kahramanmaraş-Pazarcık earthquake is 01:17:37:675 UTC for KHMN station, and ESenTRy issues an alarm approximately 0.5 s after the P-wave arrival time for Level-2.

Fig. 10
figure 10

For the first simulation, (a) seismogram recorded by KHMN station, (b) MMI values computed from the seismic data in (a), (c) seismogram recorded by T2131 station, (d) MMI values computed from the seismic data in (c). The waveforms in the white-framed windows are the strong motion data filtered using a 5 Hz low-pass filter

The second highest MMI value in Fig. 10b is 6.991 (Strong (VI)) and belongs to the Mw 6.6 Gaziantep-Nurdağı earthquake occurred on February 6, 2023, at 01:28:16 UTC in Türkiye. For the second seismic event, ESenTRy issues an alarm at 01:28:18 UTC (Level-2) and 01:28:22 UTC (Level-3). The P-wave arrival time for Mw 6.6 Gaziantep-Nurdağı earthquake is 01:28:16:480 UTC for KHMN station. The time difference between the Level-2 alarm trigger time and P-wave arrival time is 1.5 s. The highest MMI value for T2131 station is estimated 4.77 (Light (IV)) from the strong motion data in Fig. 10c, and ESenTRy warns at 01:18:35 UTC (Level-1) and issues an alarm at 01:18:53 UTC (Level-2). The P-wave arrival time for Mw 7.7 Kahramanmaraş-Pazarcık earthquake is 01:18:23:500 UTC for T2131 station, and ESenTRy issues an alarm 29.5 s after the P-wave arrival time for Level-2. The estimated intensity values are compatible with the intensity map prepared by AFAD (AFAD 2024a). The second highest MMI value in Fig. 10d is 2.636 (Weak (II-III)), and belongs to the Mw 6.6 Gaziantep-Nurdağı earthquake. The next MMI peaks are caused by the low magnitude aftershocks. In the Mw 7.7 Kahramanmaraş-Pazarcık earthquake, a time difference of 2.5 s is observed between the Level-2 alarm trigger time and S-wave arrival time for the KHMN station, which was 23 km away from the epicenter. This time difference is estimated as 14.5 s for the station T2131, which is 346 km away from the epicenter.

In the second example, we used the multiple station data to issue an early warning alarm for the magnitude 5.9 earthquake that occurred on November 23, 2022, at 01:08:15 UTC in Gölyaka, Düzce from Türkiye. The epicenter and seismic stations used in the second simulation are shown in Fig. 11. The distances between the epicenter and seismic stations (A0101, A0102, A0201, A0202 and A0301) are approximately 173 km.

Fig. 11
figure 11

The locations of the epicenter and recording stations of TCDD for the earthquake used in the second simulation

The number of network trigger and network trigger time are set to 3 and 5 s for multiple station analysis, respectively. In this case, the developed algorithm waits for the MMI value estimated for at least 3 stations to exceed the threshold levels within 5 s, and issues an alarm or cancels it depending on the situation. The strong motion data recorded by A0101, A0102, A0201, A0202 and A0301 stations are shown in Fig. 12a. As shown in Fig. 12b, the highest MMI value for A0202 station is estimated as 3.838 (Weak (II-III)) from the strong motion data in Fig. 12a, and ESenTRy alerts the ModBus clients and issues an alarm at 01:08:46 UTC (Level-2). The P wave arrival time for Mw 5.9 Düzce-Gölyaka earthquake is approximately 01:08:43 UTC for A0101, A0102, A0201, A0202 and A0301 stations, which are approximately 173 km away from the epicenter. The time differences between the Level-2 alarm trigger time and the P-wave and S-wave arrival times are 3 and 16 s, respectively. The next consecutive MMI peaks are caused by the metro line in the area. The estimated intensity is compatible with the intensity map prepared by AFAD (AFAD 2024b).

Fig. 12
figure 12

For the second simulation, (a) seismograms recorded by A0101, A0102, A0201, A0202 and A0301 stations, (b) MMI values computed from the seismic data in (a). The waveform in the white-framed window is the strong motion data filtered using a 5 Hz low-pass filter

Conclusions

In this study, an on-site earthquake early warning system called ESenTRy, consisting of a CMG-5TDE accelerometer, GPS and various components, has been developed. The ESenTRy software can read the Güralp Compressed Format strong motion data in real-time and estimate the intensity of the seismic event using an algorithm based on the instrumental modified Mercalli intensity approach. The ESenTRy algorithm supports the single or multi-station analysis, and has the features of computing the intensity in real-time when an earthquake occurs, comparing it with defined alarm threshold levels, issuing an alarm and alerting the defined Modbus clients. The success of the developed algorithm has been tested with two simulations, and satisfactory results have been obtained. The results obtained from the test applications showed that, depending on the distance of the stations to the epicenters, the time difference between the Level-2 alarm trigger times and S-wave arrival times varied between 1.5 and 16 s, while the time difference between the Level-2 alarm trigger times and P-wave arrival times varied between 0.5 and 29.5 s. The ESenTRy algorithm can be revised to design a practical embedded systems based on MEMS accelerometers and microcomputers for school, office and many more purposes or computer-aided systems based on different type of accelerometers for scientific researches.