## 4 System Software Realization
### Impedance Measurement  
One important part of the host software is using the EMI method to quantify the damage to the structure. The flowchart for damage detection with impedance measurement is illustrated in Figure 10. First, choose a resistor group in Table 1 arbitrarily for amplifying the weak response of the PZT sensor and calculating the gain factor. Next, by programming the frequency sweep parameters, including start frequency, frequency increment, and the amount of increments, into AD5933 through serial communication, a sweep cycle begins. The sweep is followed by a calculation of the measured electric impedance. To be specific, the block representing the measuring of the electric impedance in Figure 10 is divided into three steps:  
Figure 9: The flow chart of impact monitoring.  
Step 1: Read the real number (R\({}_{\text{PZT}}\)) and the imaginary number (I\({}_{\text{PZT}}\)) of the PZT sensor via IC from AD5933.  
Step 2: Calculate the gain factor. This means that we first read the real number (R\({}_{\text{CAL}}\)) and the imaginary number (I\({}_{\text{CAL}}\)) of the calibration resistor, and then calculate the magnitude (A\({}_{\text{CAL}}\)) as Equation (3). The impedance of the calibration resistor, which has been already known, is marked as IM\({}_{\text{CAL}}\). The gain factor G\({}_{\text{CAL}}\) is calculated as Equation (4).  
\[\text{A}_{\text{CAL}} = \sqrt{\text{R}_{\text{CAL}}^{2}+\text{I}_{\text{CAL}}^{2}} \tag{3}\] \[\text{G}_{\text{CAL}} = \frac{1}{\text{IM}_{\text{CAL}}\times\text{A}_{\text{CAL}}} \tag{4}\]  
Step 3: Calculate the impedance of the PZT sensor as  
\[\text{IM}_{\text{PZT}} = \frac{1}{\text{G}_{\text{CAL}}\sqrt{\text{R}_{\text{CAL}}^{2}+ \text{I}_{\text{CAL}}^{2}}} \tag{5}\]  
After the impedance calculation, the system should check whether the result is within the range required by the resistor group in Table 1. If not, then the system needs to change the group and start a new cycle for impedance calculation. Note that Step 2 can be first finished offline to save computational resources.  
Several indices are adopted in the system to quantify the damage. Note that the data in the healthy state was already stored in memory before the occurrence of damage. As there is no such a technique that suits every kinds of structure [32], it is necessary to use several indices rather than a single one for damage quantification. The indices employed in the designed system are root mean square deviation (RMSD), mean absolute percentage deviation (MAPD), covariance (Cov), and correlation coefficient (CC) [4]. The RMSD can be expressed as  
\[\text{RMSD}(\%) = \sqrt{\frac{\sum_{i\ =\ 1}^{n}\left(G_{i}^{1}-G_{i}^{0}\right)^{2}} {\sum_{i\ =\ 1}^{n}\left(G_{i}^{0}\right)^{2}}} \tag{6}\]  
where \(G_{i}^{1}\) is the post-damage conductance at the \(i\) point and \(G_{i}^{0}\) is the corresponding value in health state. This is a nonparametric statistical damage index due to its computation not involving structure  
Figure 10: The flowchart of damage detection with impedance measurement.  
parameters. However, in many situations this index cannot differ between the incipient damage and other level of damage clearly.  
A variation of the RMSD is MAPD expressed as  
\[\text{MAPD}\ =\ \frac{100}{n}\sum_{i\ =\ 1}^{n}\frac{\left(G_{i}^{1}-G_{i}^{0} \right)}{G_{i}^{0}} \tag{7}\]  
The other two commonly used indicators--Cov and CC--are defined as  
\[Cov\!\left(\!G^{0},G^{1}\!\right)\ =\ \frac{1}{n}\sum_{i\ =\ 1}^{n}\left(G_{i}^{0}- \overline{G^{0}}\!\right)\!\left(\!G_{i}^{1}-\overline{G^{1}}\!\right) \tag{8}\]  
\[CC\ =\ \frac{Cov\!\left(\!G^{0},G^{1}\!\right)}{\sigma_{0}\sigma_{1}} \tag{9}\]  
where \(\overline{G^{0}}\) is the average value of the conductance in the health structure; \(\overline{G^{1}}\) is the average value of the conductance in the post-damaged structure; and \(\sigma_{0}\) and \(\sigma_{1}\) are the standard deviations of \(\overline{G^{0}}\) and \(\overline{G^{1}}\), respectively.