Intelligent Permanent Magnet Motor-Based Servo Drive System Used for Automated Tuning of Piano

: This paper presents an intelligent permanent magnet synchronous motor-based servo drive system used in automated piano tuning applications. The permanent magnet synchronous motor-based drives are able to improve the accuracy of the piano tuning process in comparison with the traditional direct-current motor-based and step motor-based servo drives. To explain the techniques, ﬁrstly, the structure and principles of the automated piano tuning devices with a surface-mounted permanent magnet synchronous motor-based drive system integrated are introduced, illustrating that it is feasible to implement the proposed piano tuning strategy. Secondly, the piano tuning devices have two functions: low-speed rotation and position holding. To ensure that the surface-mounted permanent magnet synchronous motor can rotate stably over the low-speed range with strong anti-interference capacity, a double closed-loop speed-regulation-based control scheme is employed. And to ensure high position control performance, a fuzzy-adaptive triple closed-loop position-regulation-based control scheme is employed. It terms of the control schemes, it deserves to be mentioned that main contributions include, ﬁrstly, the parameters of the proportional integral controllers in the double closed-loop speed-regulation structure is tuned relying on both stability and bandwidth analyses. Then, a fuzzy-adaptive proportional integral controller is specially-designed for the triple closed-loop position-regulation to adapt to the piano tuning applications. Simulation is conducted on a 20 rpm three-phase permanent magnet synchronous motor servo drive-based piano tuning system to validate the proposed piano tuning method and to verify the proposed control techniques.


Introduction
The piano is one of the most popular musical instruments, attracting an increasing number of users at present [1]. To play heart-warming tunes by using a piano, the pitch of each string needs to be appropriate, making piano tuning important for both piano hobbyists and professional pianists. However, it is well-known that tuning a piano is complicated because there are over two hundred strings to be tuned and professional temperament knowledge is required [2]. Concerning this issue, piano tuning has been studied for over three hundred years, since the birth of the piano, with a variety of tuning techniques developed, which can be divided into three main categories: manual tuning, semi-automated tuning and automated tuning [3][4][5][6].
As for manual tuning, professional tuners who have good musical ears, knowledge about musical theories and mechanical capabilities are qualified for this job [3]. By controlling the tension of the strings with a tuning hammer, the pitch of each string is adjusted to the desired levels. In the process of tuning, the ears, brain and hands of the tuners serve for sound detection, pitch judgment and mechanical operation, respectively. As for the judging rules of intonations, they are the experience and knowledge collected by the tuners. Undoubtedly, the manual tuning method is totally human-dependent, but this does not mean that it is simple for every piano user to master the skills. In terms of the semi-automated tuning strategies, external electronic devices are employed to aid the piano tuners' aural and analytical tasks [4]. The commonly used aided devices include KORG Chromatic Tuner CA-30, KORG Digital Tuner DT-3 and Peterson Virtual Strobe Tuner VS-1, etc. Usually, these aids can directly detect the pitch generated by each string and tell the tuners how flat or sharp a particular string is. Then, hand-operated tuning hammers such as an impact wrench are used to turn the pins connected with the piano strings [7][8][9]. When it comes to the automated tuning methods, they become more advanced because the tuning process can be free of manual mechanical operations. Specifically, in comparison with the semi-automated tuning approaches, electronic devices are also needed for sound detection and pitch analysis, but after that, they will generate control signals to actuate a motorized system to turn the pins, tightening or loosening the strings automatically [5,6]. The features of the three tuning techniques are compared in Table 1. From the table, it can be concluded that firstly, the manual tuning is only applicable to the situations when there is an available professional technician, leading to the fact that the piano users cannot adjust the pitch at any time they wish. Secondly, with the help of the aided devices, it becomes easier for the users to grasp the piano tuning procedures. However, training about mechanical operations is still required. Thirdly, by using the automated tuning systems, a piano can be easily tuned by any user whenever and wherever they wish, and no training is required. Consequently, from the perspective of convenience, the automated tuning shows a greater competitiveness than the other two tuning strategies, thereby deserving in-depth investigation. Many scholars have carried out research into the automated piano tuning systems, which, however, are mainly focused on mechanisms, sound processing, system design and control algorithms, etc. In detail, [10] shows that a piano can be tuned by minimizing the Shannon entropy of the preprocessed Fourier spectra. This mechanism contributes to a precise stretch curve and pitch fluctuation adjustment. In the literature [11], a novel sound synthesis method based on numerical simulation is discussed to achieve the harmonic relations of different strings. In [12][13][14], the structure and components of different automated tuning products are introduced. Simultaneously, the cheerful market prospect of these kinds of products is analyzed at length. A novel reinforcement learning control strategy that relies on the prior knowledge of the relationship between impact setting and pitch change is proposed in [8]. Undoubtedly, these studies have significantly promoted the application of automated tuning techniques. However, it must be mentioned that there are still many technical issues to be solved before the technology becomes mature. For example, in the tuning process, the previous motorized actuation systems used for pin turning cannot satisfy all the functional requirements which include: (1) that the actuation

Structure and Principles of the Proposed Tuning Devices
The structure of the proposed piano tuning devices is shown in Figure 1, which are mainly composed of a sound detection device, a pitch analysis device, surface-mounted permanent magnet synchronous motor-based actuators and the components of the piano. The sound detection device is a microphone, collecting the sounds generated by each string. The sound detection device is connected with a computer, on which a sound analysis software is installed, and they constitute the pitch analysis device. When the sound is input into the computer, the fundamental frequency of the signal (representing the tension of the string) can be extracted by using fast Fourier transform algorithms, which can be used to judge the intonation [8,31,32]. Then, the detected frequency is compared with the standard value, which is stored in the computer. It must be mentioned that the standard fundamental frequencies of all strings can be provided by the piano manufacturers, and the users can enter them into the analysis software manually. After pitch analysis, the error (∆f ) between the detected frequency and the standard frequency is treated as the control signal of the surface-mounted permanent magnet synchronous motor-based drive, determining whether the double closed-loop speed-regulation algorithm or the triple closedloop position-regulation algorithm should be used to control the electric motors. The motor shaft is connected with gears, reducing the output speed and increasing the output torque of the actuator. Finally, a junction at the end of the shaft of the output gear, which matches the head of the pins, can turn the pins so as to change the tension of the strings.

Piano Tuning Device and Its Servo Drive System
This section, firstly, introduces the structure and working principles of the proposed permanent magnet synchronous motor drive-based tuning devices. Then, the surfacemounted permanent magnet synchronous motor-based servo drive system with particular features (suitable for the tuning devices) is presented.

Structure and Principles of the Proposed Tuning Devices
The structure of the proposed piano tuning devices is shown in Figure 1, which are mainly composed of a sound detection device, a pitch analysis device, surface-mounted permanent magnet synchronous motor-based actuators and the components of the piano. The sound detection device is a microphone, collecting the sounds generated by each string. The sound detection device is connected with a computer, on which a sound analysis software is installed, and they constitute the pitch analysis device. When the sound is input into the computer, the fundamental frequency of the signal (representing the tension of the string) can be extracted by using fast Fourier transform algorithms, which can be used to judge the intonation [8,31,32]. Then, the detected frequency is compared with the standard value, which is stored in the computer. It must be mentioned that the standard fundamental frequencies of all strings can be provided by the piano manufacturers, and the users can enter them into the analysis software manually. After pitch analysis, the error (∆f) between the detected frequency and the standard frequency is treated as the control signal of the surface-mounted permanent magnet synchronous motor-based drive, determining whether the double closed-loop speed-regulation algorithm or the triple closed-loop position-regulation algorithm should be used to control the electric motors. The motor shaft is connected with gears, reducing the output speed and increasing the output torque of the actuator. Finally, a junction at the end of the shaft of the output gear, which matches the head of the pins, can turn the pins so as to change the tension of the strings.  When using the proposed devices to tune a piano automatically, the implementation procedures are as follows (see Figure 2): When using the proposed devices to tune a piano automatically, the implementation procedures are as follows (see Figure 2): Step 1: User plays a key Step 2: Sound detection device collects sounds Step 3: Pitch analysis device analyzes sounds Step 4: Actuator turns pins Step 5: Repeat Stop until in tune Figure 2. Implementation procedures when using the proposed automated tuning devices.
Step 1: The user plays one note, and the corresponding string generates sounds which are a mixture of sinusoidal tones at different fundamental frequencies.
Step 2: The sound detection device collects the sounds and transmits the signals into the pitch analysis device.
Step 3: The pitch analysis device extracts the fundamental frequencies of the sounds and compares them with the pre-input standard frequencies.
Step 4: The frequency errors ∆f are used to control the surface-mounted permanent magnet synchronous motor-based servo drive system. The goal of this step is as follows: If ∆f is not zero, turn the pins of the piano to reduce the errors. If ∆f reaches zero, the pins exactly maintain at the position. The logic of how to use ∆f to actuate the drive system will be detailed in Section 2.2.
Step 5: The tuning process is repeated until the pitch of the string is in tune, which can be represented by the frequency error displayed on the pitch analysis device.

Surface-Mounted Permanent Magnet Synchronous Motor-Based Servo Drive System
As shown in Figure 1, the servo drive system is composed of hardware and software of the surface-mounted permanent magnet synchronous motor drive, and gear. This part mainly illustrates them and the design methods with reference to the aforementioned functional requirements (low-speed rotation and position holding). In addition, considering that the surface-mounted permanent magnet synchronous motor drive is the core of the servo system, of which control parameters are required to be tuned in practice, the mathematical model of it is established, laying the ground for further analysis in Section 2 and Section 3.

a) Hardware
The hardware of the surface-mounted permanent magnet synchronous motor drive contains four main parts (see Figure 1), including a direct-current source that supplies power and voltage to the system, an inverter that converts direct current power into alternating current power, a motor that converts the electrical energy to the mechanical one, and the signal processing components (analog circuits and digital signal processor, etc.) As for the gear, it is part of the hardware of the servo system as well, connecting with the motor shaft (with gear ratio of N:1) and provides a junction to match with the pins of the piano. In order to satisfy the functions of low-speed rotation and position holding, the following points need to be noted at the design stage.
On the one hand, firstly, [12] illustrates that the maximum output rotating speed of the gear is 2.4°/s (0.042 rad/s). However, the literature also clarifies that although this speed can ensure a relatively high precision, it is still possible that large tuning errors can be generated. This represents in a lower pin-turning speed, which should be considered in an automated piano tuning system. Hence, as for a surface-mounted permanent magnet synchronous motor-based tuning device, which can operate stably in low-speed condi- Step 1: The user plays one note, and the corresponding string generates sounds which are a mixture of sinusoidal tones at different fundamental frequencies.
Step 2: The sound detection device collects the sounds and transmits the signals into the pitch analysis device.
Step 3: The pitch analysis device extracts the fundamental frequencies of the sounds and compares them with the pre-input standard frequencies.
Step 4: The frequency errors ∆f are used to control the surface-mounted permanent magnet synchronous motor-based servo drive system. The goal of this step is as follows: If ∆f is not zero, turn the pins of the piano to reduce the errors. If ∆f reaches zero, the pins exactly maintain at the position. The logic of how to use ∆f to actuate the drive system will be detailed in Section 2.2.
Step 5: The tuning process is repeated until the pitch of the string is in tune, which can be represented by the frequency error displayed on the pitch analysis device.

Surface-Mounted Permanent Magnet Synchronous Motor-Based Servo Drive System
As shown in Figure 1, the servo drive system is composed of hardware and software of the surface-mounted permanent magnet synchronous motor drive, and gear. This part mainly illustrates them and the design methods with reference to the aforementioned functional requirements (low-speed rotation and position holding). In addition, considering that the surface-mounted permanent magnet synchronous motor drive is the core of the servo system, of which control parameters are required to be tuned in practice, the mathematical model of it is established, laying the ground for further analysis in Sections 2 and 3.

a) Hardware
The hardware of the surface-mounted permanent magnet synchronous motor drive contains four main parts (see Figure 1), including a direct-current source that supplies power and voltage to the system, an inverter that converts direct current power into alternating current power, a motor that converts the electrical energy to the mechanical one, and the signal processing components (analog circuits and digital signal processor, etc.) As for the gear, it is part of the hardware of the servo system as well, connecting with the motor shaft (with gear ratio of N:1) and provides a junction to match with the pins of the piano. In order to satisfy the functions of low-speed rotation and position holding, the following points need to be noted at the design stage.
On the one hand, firstly, [12] illustrates that the maximum output rotating speed of the gear is 2.4 • /s (0.042 rad/s). However, the literature also clarifies that although this speed can ensure a relatively high precision, it is still possible that large tuning errors can be generated. This represents in a lower pin-turning speed, which should be considered in an automated piano tuning system. Hence, as for a surface-mounted permanent magnet synchronous motor-based tuning device, which can operate stably in low-speed conditions, the operating speed can be designed as half of the maximum value, that is, 1.2 • /s (0.021 rad/s). Secondly, in order to employ a gear with a moderate gear ratio, which is with high precision [33], the rated speed ω m_rd of the surface-mounted permanent magnet synchronous motor can be designed as 2.1 rad/s (20 rpm), at which many surface-mounted permanent magnet synchronous motor servo motors can work stably without significant ripples. Thirdly, since the motor speed and the output speed of the tuning device are determined, the gear ratio r can be selected: In practice, the gear box DKM 8GBK100BH is a good choice for speed reduction in the servo drive system.
On the other hand, to take full advantage of the position holding function of a surfacemounted permanent magnet synchronous motor drive, it is necessary to install a position sensor with high resolution in the motor. In this aspect, resolvers and encoders are competitive sensor alternatives [34]. However, compared with the encoders, considering that the resolvers have the advantages of high stability and high adaptability, it is more suitable for the piano tuning application. Practically, a resolver and a 16-bit resolution tracking resolver-to-digital (R/D) converter AD2S1210 can be used to constitute the system [25]. In this case, the resolution res (minimum position changing step in mechanical position) of the sensor can be calculated as: where p r is the number of pole pairs of the resolver. Based on (2), it is obvious that when p r = 1, res is 0.0055 • . And if p r rises, the minimum resolvable position will get smaller (higher resolution). It must be mentioned that because the rotor speed is calculated based on the position information, the resolver with high resolution contributes to lower speed detection ripples as well, helping to exert the aforementioned function of low-speed rotation. b) Software As shown in Figure 1, two different control schemes are incorporated, which are selected by the frequency error ∆f. Specifically, after ∆f is detected, the sign of its value is judged. When ∆f is non-zero, the double closed-loop speed-regulation scheme with good low-speed control performance [34] is adopted, and when ∆f is zero, the triple closed-loop position-regulation scheme with a marked position control performance [35] is adopted for control.
The implementations of the double closed-loop speed-regulation strategy are as follows: Step 1: Speed reference calculation: If ∆f > 0, s 1 = 1, but if ∆f < 0, s 1 = −1. Then, the reference speed ω m_r is calculated as: Based on (3), when ∆f is positive, the motor rotates positively. Otherwise, it reverses. These show that the corresponding string of the piano is tightened or loosened, respectively.
Step 2: State measurement and coordinate transformation: The phase currents i a , i b , rotor position θ and rotating speed ω m are measured by using sensors. Then, the currents are transformed to the direct-quadrature (d,q)-axis currents i d , i q by using i a , i b and θ [34], with intermediate variables (α,β-axis currents) i α , i β .
Step 3: Speed regulation and current reference generation: The error between ω m_r and ω m passes through an automatic speed regulator, generating q-axis current reference i q_r . Then, considering that for a surface-mounted permanent magnet synchronous motor, the largest torque will be generated under the fixed current when the d-axis current remains at zero, the d-axis current reference i d_r is set as 0 in this research (see Figure 1).
Step 4: Current regulation: The errors between i q_r and i q , and between i d_r and i d pass through two automatic current regulators, respectively.
Step 5: Space vector pulse width modulation signal generation: The outputs of the two automatic current regulators are adopted to generate control signals based on the space vector pulse width modulation theories [34]. Step 6: Actuation: The space vector pulse width modulation signals are applied to the inverter and motor.
The implementations of the triple closed-loop position-regulation strategy are as follows: Step 1: Position reference determination: When the frequency error ∆f is zero, the instantaneous rotor position θ _r is recorded, and it is set as the position reference. In this case, the rotor position is expected to be controlled to maintain at θ _r .
Step 2: Position regulation and speed reference calculation: The error between θ _r and θ passes through an automatic position regulator whose parameters need to be tuned using a fuzzy controller. The output of the automatic position regulator is treated as the speed reference ω m_r .
Step 3~Step 7 are consistent with Step 2~Step 6 in the above implementation procedures of the double closed-loop speed-regulation scheme.
From the above analysis, the main difference between the two control techniques is that their control objectives are different. Besides, the purpose of the double closed-loop speed-regulation strategy is to adjust the pitch of the string to approaching the standard value, while the triple closed-loop position-regulation is able to eliminate the overshoot caused by the double closed-loop speed-regulation so as to achieve accurate tuning. Finally, it must be mentioned that in terms of the speed regulation and current regulation parts, they share the identical control algorithms.

c) Modeling of Surface-Mounted Permanent Magnet Synchronous Motor drive
The models of the main components (motor, inverter and proportional integral controller) of the surface-mounted drive, which are needed for parameter tuning in this paper, are established in this part.
Firstly, assuming that the iron saturation and hysteresis loss are assumed negligible [36], the mathematical model describing the electrical and mechanical dynamics of a surface-mounted permanent magnet synchronous motor in the d, q rotating frame is: where u d *, u q * are the dq-axis control voltages without considering decoupling (see Figure 1). The stator winding resistance is R s . Ψ f is the rotor flux. L s is the stator inductance of the motor. T l is the load torque, and T e is the electromagnetic torque. Then, p m represents the number of pole pairs of the motor. J is the inertia of the rotor and B is the friction coefficient. From (4) and (5), it can be seen that a coupling effect exists, which will degrade the control performance. Therefore, in real applications, a feedback decoupling method is usually adopted to solve the problem, as shown in Figure 3.  After decoupling, the electrical model of the machine can be reconstructed as: After decoupling, the electrical model of the machine can be reconstructed as: where u d , u q are the dq-axis control voltages with decoupling considered. Furthermore, applying the Laplace Transformation to (6)-(8), the motor model (taking the q-axis properties as an example) in the s-domain can be depicted in Figure 4, where T l can be regarded as an external disturbance.  After decoupling, the electrical model of the machine can be reconstructed as: where ud, uq are the dq-axis control voltages with decoupling considered. Furthermore, applying the Laplace Transformation to (6)-(8), the motor model (taking the q-axis properties as an example) in the s-domain can be depicted in Figure 4, where Tl can be regarded as an external disturbance. Secondly, ignoring the delay effects of the dead zone and switch delay, the inverter can be described by a first-order model: where kinv is the magnification of the inverter, and it is 1 when the space vector pulse width modulation strategy is adopted. Ts is the switching period. Thirdly, as for the automatic speed regulator, automatic current regulators and automatic position regulator (proportional integral controllers), the transfer functions of them are: where ks_p, kc_p and kp_p are the scaling factors, and ks_i, kc_i and kp_i are the scaling and integral factors of the automatic speed regulator, automatic current regulators and automatic position regulator, respectively.

Proportional Integral Controller Design for Double Closed-Loop Speed-Regulation Scheme
As shown in Figure 1, one automatic speed regulator and two automatic current regulators are incorporated into the double closed-loop speed-regulation control scheme. The Secondly, ignoring the delay effects of the dead zone and switch delay, the inverter can be described by a first-order model: where k inv is the magnification of the inverter, and it is 1 when the space vector pulse width modulation strategy is adopted. T s is the switching period. Thirdly, as for the automatic speed regulator, automatic current regulators and automatic position regulator (proportional integral controllers), the transfer functions of them are: where k s_p , k c_p and k p_p are the scaling factors, and k s_i , k c_i and k p_i are the scaling and integral factors of the automatic speed regulator, automatic current regulators and automatic position regulator, respectively.

Proportional Integral Controller Design for Double Closed-Loop Speed-Regulation Scheme
As shown in Figure 1, one automatic speed regulator and two automatic current regulators are incorporated into the double closed-loop speed-regulation control scheme. The parameters of them are closely related to the speed performance. Specifically, if parameters of the controllers endow the surface-mounted permanent magnet synchronous motor drive with a large bandwidth, although the system response speed is high, the external disturbances are more inclined to bring about speed ripples. Undoubtedly, this reduces the accuracy of the pin-turning process. However, as illustrated in Section 2, when the motor needs to rotate, its speed should stabilize at a constant value. In this case, a fast response is unnecessary, leading to the fact that a large bandwidth is not required. Instead, to increase speed stability and piano-tuning accuracy, the parameters of the proportional integral controllers are supposed to be tuned, endowing the system with a low bandwidth. Overall, this part introduces a parameter tuning design method based on amplitude-frequency analysis, which includes two sequential stages: (1) current-loop analysis, and (2) speed-loop analysis.

Current-Loop Analysis
Considering that the parameters of the d-axis and q-axis automatic current regulators can be set as the same values for the surface-mounted permanent magnet synchronous motor drives in practice, as long as the parameters of the q-axis controller are tuned, the parameters of the d-axis one can be determined simultaneously. For the sake of intuitiveness, Energies 2021, 14, 6627 9 of 23 the control diagram of the q-axis current loop is illustrated in Figure 5. The open-loop transfer function G ot (s) and the closed-loop transfer function G ct (s) can be described as in (11) and (12), respectively. When designing the proportional integral controllers used in the piano-tuning applications, the main tasks include: stability analysis and bandwidth analysis, which can only rely on the closed-loop transfer function.

Current-Loop Analysis
Considering that the parameters of the d-axis and q-axis automatic current regulato can be set as the same values for the surface-mounted permanent magnet synchronou motor drives in practice, as long as the parameters of the q-axis controller are tuned, th parameters of the d-axis one can be determined simultaneously. For the sake of intuitiv ness, the control diagram of the q-axis current loop is illustrated in Figure 5. The open loop transfer function Got(s) and the closed-loop transfer function Gct(s) can be describe as in (11) and (12), respectively. When designing the proportional integral controllers use in the piano-tuning applications, the main tasks include: stability analysis and bandwidt analysis, which can only rely on the closed-loop transfer function.

a) Stability analysis
Based on (12), the characteristic equation Dc(s) of the system can be written as: Then, in order to use the Routh's stability criterion to analyze the stability of the sy tem, Table 2 shows the Routh table of the current control loop. To make the current contr loop stable, the following equations require must be satisfied:

a) Stability analysis
Based on (12), the characteristic equation D c (s) of the system can be written as: Then, in order to use the Routh's stability criterion to analyze the stability of the system, Table 2 shows the Routh table of the current control loop. To make the current control loop stable, the following equations require must be satisfied: Obviously, from the current control loop, it can be seen that the system stability is related to the parameters of the drive system, such as the machine inductance, resistance and sampling period. What can be directly derived from (14) is that, firstly, the integral factor of the automatic current regulator should be positive, and secondly, that it is more complicated to illustrate the range of the scaling factor. For the sake of intuitiveness, a surface-mounted permanent magnet synchronous motor whose parameters are given in Table 3 is taken as an example to present the relationship of the scaling factor versus k c_i and T s (see Figure 6). In Figure 6, to make the system stable, k c_p should be over the critical plane and k c_i must be larger than zero. Besides, it can be noted that, on the one hand, when the integral factor (or the switching period) is fixed, the larger the switching period (or the integral factor) is, the larger k c_p should be. On the other hand, the range of k c_p is large. In other words, k c_p can be set as a very small value, where even k c_i stands at a relatively high position. surface-mounted permanent magnet synchronous motor whose parameters are given in Table 3 is taken as an example to present the relationship of the scaling factor versus kc_i and Ts (see Figure 6). In Figure 6, to make the system stable, kc_p should be over the critical plane and kc_i must be larger than zero. Besides, it can be noted that, on the one hand, when the integral factor (or the switching period) is fixed, the larger the switching period (or the integral factor) is, the larger kc_p should be. On the other hand, the range of kc_p is large. In other words, kc_p can be set as a very small value, where even kc_i stands at a relatively high position.

b) Bandwidth analysis
The bandwidth of a system can be reflected by the amplitude-frequency characteristics. Based on the automatic control theories, the bandwidth of the system is defined as the frequency range between zero and the upper limit at which the magnification decreases to 70.7% of the magnitude when the frequency is zero [37]. Theoretically, the smaller the bandwidth is, the stronger the anti-interference capacity of a system becomes. On the contrary, if a system has a large bandwidth, although the response speed grows,

b) Bandwidth analysis
The bandwidth of a system can be reflected by the amplitude-frequency characteristics. Based on the automatic control theories, the bandwidth of the system is defined as the frequency range between zero and the upper limit at which the magnification decreases to 70.7% of the magnitude when the frequency is zero [37]. Theoretically, the smaller the bandwidth is, the stronger the anti-interference capacity of a system becomes. On the contrary, if a system has a large bandwidth, although the response speed grows, the disturbances are more inclined to be introduced. To ensure a high piano-tuning accuracy, the bandwidth of the system needs to be limited.
As for (12), the amplitude-frequency characteristic can be obtained as follows: Then, the magnitude of G ct when ω = 0 can be calculated as: where M c (0) represents the magnitude of G ct when ω = 0. Hence, based on the definition of the bandwidth, the bandwidth of the current loop can be obtained by solving the following equation: → | k c_p jω b_c +k c_i −L s T s jω b_c 3 −(R s T s +L s )ω b_c 2 +(R s +k c_p )jω b_c +k c_i | = 0.707 (17) where ω b_c is the bandwidth of the current loop. Unluckily, there are no specific solutions (ω b_c ) to (17). Hence, the formula needs to be simplified properly. As for a servo permanent magnet synchronous motor whose parameters are similar to those in Table 3, the orders of Ignoring the impacts of the small terms, (17) can be simplified as: And ω b_c can be calculated as: In addition, as for the surface-mounted permanent magnet synchronous motor working at the rated speed ω m_rd during the piano-tuning process, the frequency of the phase currents ω current are: In practice, ω b_c should be designed to be larger than ω current , and only by this can the motor work normally during control; that is, Considering that the speed of the servo motor is low, even ω b_c is set as ten times of ω current , the overall bandwidth of the system is not large, and this is adopted in this research. Hence, it can be derived that: Further, combining (14) and (23), the automatic current regulator parameters that can ensure both stability and low bandwidth can be obtained as: When using (24) to design the automatic current regulator, firstly, k c_p is set as a value that is larger than 0.5R s . Then, substitute the selected k c_p into the second equation in (24) to calculate k c_i . Finally, use the first inequation in (24) to judge whether the values of k c_p and k c_i are suitable. For example, for the surface-mounted permanent magnet synchronous motor drive whose parameters are consistent with those in Table 3 (when the switching period T s = 0.1 ms), the parameters of the automatic current regulator can be designed as k c_p = 0.5 and k c_i = 24 for a case study in this paper.

Speed-Loop Analysis
Since the current control loop has been analyzed, its transfer function G ct (s) can be directly incorporated into the control diagram of the speed loop used for automatic speed regulator design (see Figure 7). To analyze the stability and bandwidth characteristics, with reference to (12), treat the load torque as the external disturbance and the speed-loop transfer function of the system G ct_sp (s), which can be written as: 1.5pΨ f [k s_p k c_p s 2 +(k s_p k c_i +k s_i k c_p )s+k s_i k c_i ] a 4 s 4 +a 3 s 3 +a 2 s 2 +a 1 s+a 0 a 4 = JL s T s · a 3 = JR s T s + JL s + BL s T a 2 = JR s + Jk c_p + BR s T s + BL s + 1.5pΨ f k s_p k c_p a 1 = Jk c_i + BR s + Bk c_p + 1.5pΨ f k s_p k c_i + 1.5pΨ f k s_i k c_p a 0 = Bk c_i + 1.5pΨ f k s_i k c_i (25) as kc_p =0.5 and kc_i =24 for a case study in this paper.

Speed-Loop Analysis
Since the current control loop has been analyzed, its transfer function Gct(s) can be directly incorporated into the control diagram of the speed loop used for automatic speed regulator design (see Figure 7). To analyze the stability and bandwidth characteristics, with reference to (12), treat the load torque as the external disturbance and the speed-loop transfer function of the system Gct_sp(s), which can be written as: The Routh table of the speed loop is shown in Table 4. To make the system stable, the following equations must be satisfied:

a) Stability analysis
Based on (25), the characteristic equation D sp (s) of the system can be written as: The Routh table of the speed loop is shown in Table 4. To make the system stable, the following equations must be satisfied:  Being different to (14), after substituting (25) into (27), even though k c_p and k c_i are known, the relation of k s_p , k s_i and the motor parameters are still complicated, which cannot be described using intuitive expressions. Hence, instead of directly illustrating the inherent properties reflected by (27), the method of how to use it to design the parameters of the automatic speed regulator will be synthesized after bandwidth analysis.

b) Bandwidth design
Unlike the current loop, whose bandwidth mainly influences the current performance, the bandwidth of the speed loop is closely related to the disturbances introduced by the speed. Considering that the speed can be regarded as a constant value (zero frequency) when the machine operates stably, the speed-loop bandwidth can be designed to be very low theoretically [38], which contributes to attenuating the speed ripples caused by the external disturbances. Substituting jω into (25), the amplitude-frequency characteristic can be obtained: And the magnitude M sp (0) of G ct_sp when ω = 0 is: Hence, the bandwidth of the speed loop can be obtained by solving the following equation: → | −k s_p k c_p ω b_sp 2 +(k s_p k c_i +k s_i k c_p )jω b_sp +k s_i k c_i a 4 ω b_sp 4 −a 3 jω b_sp 3 −a 2 ω b_sp 2 +a 1 jω b_sp +a 0 | = 0.707k s_i k c_i Bk c_i +1.5pΨ f k s_i k c_i (30) where ω b_sp is the bandwidth of the speed loop. Similarly, there are no analytical solutions (ω b_sp ) to (30) because it is an eight-order equation. In this case, even using the simplification method that ignores the terms with low ODs, it is not easy to solve (30) either, and the reasons are as follows. By analyzing the ODs of a 0 , a 1 , a 2 , a 3 and a 4 , a 3 and a 4 are small enough to be ignored compared to a 0 , a 1 and a 2 . This happens because the latter three variables contain 1.5pΨ f k s_p k c_p , 1.5pΨ f k s_i k c_p and 1.5pΨ f k s_i k c_i , respectively, in which p, Ψ f and the controller parameters are usually much larger than the parameters (including inductance, resistance and switching period, etc.) of the surface-mounted permanent magnet synchronous motor drive. However, when a 3 and a 4 are set as zero, (30) becomes a four-order equation, which is still a difficult mathematical problem. On this ground this part employs a "direct bandwidth setting" method to design k s_p and k s_i . In detail, according to [38], there is no lower limit for the bandwidth of the speed loop because the working frequency of this loop is nearly zero in theory. In this research, for a low-speed servo drive, ω b_sp is selected as twice the magnitude of the rated speed; that is, Furthermore, substitute (31) into (30) and the relationship between k s_p and k s_i can be derived as: 2 +4(k s_p k c_i +k s_i k c_p ) 2 ω m_rd 2 (a 5 −6pΨ f k s_p k c_p ω m_rd 2 +1.5pΨ f k s_i k c_i ) 2 +(a 6 +3pΨ f k s_p k c_i ω m_rd +3pΨ f k s_i k c_p ω m_rd ) 2 = 0.707k s_i k c_i Bk c_i +1.5pΨ f k s_i k c_i So far, (27) and (32) constitute the parameter design criteria for automatic speed regulators. When using them, firstly, set k s_p as a positive value artificially. Then, substitute it into (32) to calculate k s_i . It must be mentioned that the designed k s_p and k s_i , which satisfy (32), can ensure that the speed loop has a low bandwidth. Finally, substitute k s_p and k s_i into (27) to judge if they can make the system stable. Finally, as for the surface-mounted permanent magnet synchronous motor drive shown in Table 3, for a case study, if T s = 0.1 ms, k c_p = 0.5 and k c_i = 24, the automatic speed regulator parameters can be set as k s_p = 1 and k s_i = 32.35.

Fuzzy-Adaptive Proportional Integral Controller Design for Triple Closed-Loop Position-Regulation Scheme
As illustrated in Section 2.2, the automatic position regulator is employed to control the surface-mounted permanent magnet synchronous motor rotor to accurately maintain the position where ∆f makes zero. The position control loop is able to eliminate the overshoot caused by the double closed-loop speed-regulation strategy effectively, avoiding slight deviations. The position control process can be divided into two stages: overshoot elimination and position holding. Comparatively speaking, the former stage requires a relatively higher response speed, while the latter one needs a stronger anti-interference capability. Hence, it is necessary to design an adaptive bandwidth to achieve the goals. This section introduces a fuzzy adaptive proportional integral controller with a higher bandwidth in the overshoot elimination stage, and with a lower bandwidth in the positionholding stage.

Proposed Fuzzy Afdaptive Proportional Integral Controller
The detailed block diagram of the proposed fuzzy adaptive proportional integral controller (see Figure 2) is depicted in Figure 8, where ∆θ is the error between the reference position and the real position, K in is the input scaling factor. In, Out p and Out i are the input and outputs of the fuzzy inference engine, respectively, D p and D i are the outputs of the defuzzification component, K op and K oi are the output scaling factors, ∆k p_p and ∆k p_i are the compensation values for automatic position regulator parameters, k p_p0 and k p_i0 are the initial scaling and integral factors for the automatic position regulator, k p_p and k p_i are the real scaling and integral factors, ω m_r is the output of the automatic position regulator and it represents the reference speed.  As for the proposed fuzzy adaptive controller, there are three main features w need to be addressed. Firstly, the fuzzy controller is a single-input-two-output cont This is not a typical two-dimensional controller that uses both the error of control va (position) and the differential of the error as the inputs [39]. This structure is reaso because in the piano tuning applications, the change rate of ∆θ is small enough to b tected when the position loop works. Hence, as long as an overshoot can be distingu suitable proportional integral parameters can be generated. Secondly, the operating m anisms of the fuzzy adaptive proportional integral controller can be described as be ∆θ is small, or even zero, the fuzzy controller will generate compensations that endo system with a small bandwidth, but if ∆θ is large, the proportional integral controll rameters used for control should ensure a relatively large bandwidth. Thirdly, the controller contains five parts, namely, fuzzification, fuzzy control rules, membership tion, defuzzification and adjustment, and their design processes will be detailed ne As for the proposed fuzzy adaptive controller, there are three main features which need to be addressed. Firstly, the fuzzy controller is a single-input-two-output controller. This is not a typical two-dimensional controller that uses both the error of control variable (position) and the differential of the error as the inputs [39]. This structure is reasonable because in the piano tuning applications, the change rate of ∆θ is small enough to be detected when the position loop works. Hence, as long as an overshoot can be distinguished, suitable proportional integral parameters can be generated. Secondly, the operating mechanisms of the fuzzy adaptive proportional integral controller can be described as being if ∆θ is small, or even zero, the fuzzy controller will generate compensations that endow the system with a small bandwidth, but if ∆θ is large, the proportional integral controller parameters used for control should ensure a relatively large bandwidth. Thirdly, the fuzzy controller contains five parts, namely, fuzzification, fuzzy control rules, membership function, defuzzification and adjustment, and their design processes will be detailed next.

Fuzzification
By using the fuzzification component, the inputs are converted to the values in the fuzzy domain. Based on the standardization control theory, the fuzzy domain can be set as [−1, 1] [40]. Therefore, K in can be set as the reciprocal of the maximum position error ∆θ max , namely, It should be noted that ∆θ max is not a certain value, and instead, it is an anticipated value. In other words, the designer can artificially determine the magnitude of it. In this research, that the position overshoot reaches 0.5 • (0.0087 rad) is treated as the worst condition, thereby ∆θ max = 0.0087.

Fuzzy Control Rules
The fuzzy control rules are adopted to build bridges between the input and the outputs. In order to create appropriate control rules, linguistic expressions are supposed to be defined. In this research, the linguist expressions are positive large (PL), positive medium (PM), positive small (PS), zero (ZO), negative small (NS), negative medium (NM) and negative large (NL). For the output Out p corresponding to the proportional integral scaling factor, the fuzzy subset is {ZO, NS, NM, NL}, while for Out i corresponding to the integral factor, the subset is {ZO, PS, PM, PL}. The rationale behind these settings is that the initial parameters k p_p0 and k p_i0 are designed to endow the system with a pretty large bandwidth, which will be detailed in Section 4.2.4. As for the variable In, the fuzzy subset is {PL, PM, PS, ZO, NS, NM, NL} because it can be either negative or positive. Tables 5 and 6 present the fuzzy control rules extracted from the existing knowledge for the scaling and integral parameters, respectively, which can be summarized as follows: the larger the magnitude of ∆θ is, the smaller the compensation values (∆k p_p ,∆k p_i ) for automatic position regulator parameters are.  Relying on Tables 5 and 6, the fuzzy control rules can be defined as the form of "if-then", that is, If In is A, Then Out p is B and Out i is C.
where A is the fuzzy subset corresponding to the input In. B and C are the fuzzy subsets corresponding to the outputs Out p and Out i , respectively.

Membership Functions
For a fuzzy controller, the membership functions represent the degree of truth, working together with the control rules to solve the fuzzy inference problem quantitatively. The membership functions for In, Out p and Out i are depicted in Figure 9. It can be seen that in Figure 9a, the outputs of the function are between 0 and 1, while the inputs range from −1 to 1. In Figure 9b,c, although the degree of membership is still between 0 and 1, the fuzzy domain becomes [−1, 0] and [0, 1], respectively, which are consistent with the corresponding fuzzy subsets. Besides, it can be seen that intersections of NM and NL domains in Figure 9b and intersections of PM and PL domains in Figure 9c are weak. This draws clear lines between the large range and medium range for the output compensation values. In the piano tuning process, this kind of membership function is sensitive once the position error is small, reducing the system bandwidth efficiently.
The membership functions for In, Outp and Outi are depicted in Figure 9. It can be seen that in Figure 9a, the outputs of the function are between 0 and 1, while the inputs range from −1 to 1. In Figure 9b,c, although the degree of membership is still between 0 and 1, the fuzzy domain becomes [−1, 0] and [0, 1], respectively, which are consistent with the corresponding fuzzy subsets. Besides, it can be seen that intersections of NM and NL domains in Figure 9b and intersections of PM and PL domains in Figure 9c are weak. This draws clear lines between the large range and medium range for the output compensation values. In the piano tuning process, this kind of membership function is sensitive once the position error is small, reducing the system bandwidth efficiently.

Defuzzification
Because Outp and Outi are still fuzzy sets, they cannot be directly adopted for adjusting the parameters of the automatic position regulator. Therefore, they must be converted to explicit values by using a defuzzification component. In engineering, the most commonly-used strategy is the centroid defuzzification which contains most of the inference results [39]: where m is the number of membership functions, v(xi) and u(yi) are the membership degrees corresponding to the output scaling and integral factor compensations, xi and yi are the values corresponding to their membership degrees.

Adjustment
After defuzzification, the ranges of the outputs Dp and Di are [−1, 0] and [0, 1], respectively. Then, the positive output scaling factors Kop and Koi are required to adjust Dp and Di to the decent values. Specifically, the compensation values ∆kp_p and ∆kp_i can be obtained by:

Defuzzification
Because Out p and Out i are still fuzzy sets, they cannot be directly adopted for adjusting the parameters of the automatic position regulator. Therefore, they must be converted to explicit values by using a defuzzification component. In engineering, the most commonly-used strategy is the centroid defuzzification which contains most of the inference results [39]: where m is the number of membership functions, v(x i ) and u(y i ) are the membership degrees corresponding to the output scaling and integral factor compensations, x i and y i are the values corresponding to their membership degrees.

Adjustment
After defuzzification, the ranges of the outputs D p and D i are [−1, 0] and [0, 1], respectively. Then, the positive output scaling factors K op and K oi are required to adjust D p and D i to the decent values. Specifically, the compensation values ∆k p_p and ∆k p_i can be obtained by: Finally, the real-time scaling and integral factors of the automatic position regulator can be described as: where k p_p0 and k p_i0 are the initial scaling and integral factors, respectively, and as mentioned in Section 4.2.2, they should be specially designed. In detail, considering that a proportional integral controller will more or less reduce the bandwidth of the system inevitably on the basis of its properties [37], k p_p0 and k p_i0 can be set as values that rarely reduce the overall system bandwidth or the bandwidth of the double closed-loop speedregulation structure. In this case, the following inequation needs to be satisfied: In this research, k p_p0 is ten times of k p_i0 . For example, k p_p0 = 3.5 and k p_i0 = 0.35 as a case study. Then, based on the existing knowledge, if the bandwidth of the system needs to be reduced, what we need to do is only to decrease the scaling factor and increase integral factor. This is the reason why the fuzzy subsets and membership functions for Out p and Out i are designed that way in Sections 4.2.2 and 4.2.3.

Simulation Verifications
Considering that the main purpose of this paper is to develop a servo drive system for the automated piano tuning devices, simulation is conducted on a three-phase surfacemounted permanent magnet synchronous motor drive whose parameters are consistent with those in Table 3 to verify the effectiveness of the proposed surface-mounted permanent magnet synchronous motor-based servo drive system and validate the proposed control methods. Besides, the switching period of the system is set as 0.1 ms, and the parameters of the controllers comply with the typical values mentioned in the previous sections (as a case study), that is, k c_p = 0.5 and k c_i = 24, k s_p = 1, k s_i = 32.35, k p_p0 = 3.5 k p_i0 = 0.35. The simulation systems are shown in Figure 10, which are established in MATLAB/Simulink 2018a. The system in Figure 10a is mainly used for analyzing the performance of the proposed drive system (including structure and design methods), while the system in Figure 10b is used to simulate the real tuning process, with frequency response and frequency feedback considered (more complying with the realistic situations). As for the simulation concerning the performance of the drive system, what needs to be explained include that, firstly, the error (∆f ) between the detected frequency and standard frequency of a piano string is given manually, simulating the sound detection device and pitch analysis device processes. Secondly, the desired output load torque of the motor is assumed to be 3 Nm, which can be further amplified through the gear. Thirdly, external disturbances are considered for the speed control and position control processes, which is going to prove that the controller parameter design methods based on bandwidth analysis have strong anti-interference capability. Fourthly, for the sake of comprehensiveness, four cases are analyzed in simulation: Case 1: ∆f is larger than zero; Case 2: ∆f is less than zero; Case 3: ∆f equals zero; Case 4: ∆f switches to zero from a nonzero value. In terms of the simulation considering realistic situations, one more case is analyzed: Case 5: the frequency adjustment characteristics are presented. the controller parameter design methods based on bandwidth analysis have strong antiinterference capability. Fourthly, for the sake of comprehensiveness, four cases are analyzed in simulation: Case 1: ∆f is larger than zero; Case 2: ∆f is less than zero; Case 3: ∆f equals zero; Case 4: ∆f switches to zero from a nonzero value. In terms of the simulation considering realistic situations, one more case is analyzed: Case 5: the frequency adjustment characteristics are presented.

Case 1
That ∆f is larger than zero means that the motor needs to rotate positively. In this case, s1 of the "control logic part" in Figure 11 is 1, s2 is 1. Then, the double closed-loop speed-regulation control strategy will be used to actuate the motor. Between 0 and 5.0 s, the motor speed is directly fed back, while between 5.0 s and 10.0 s, white noises (magnitude is 1.0 rpm) are added to the feedback speed, simulating the external disturbances. Figure 11 shows the simulation setup and the control performance of the surface-mounted permanent magnet synchronous motor-based servo drive system when ∆f is larger than zero. Firstly, the machine speed can stabilize at the reference level and the currents are stable during the whole test. Secondly, when there are no external disturbances, the rotor speed ripples are about ± 0.5 rpm (0.052 rad/s). When the speed loop experiences external disturbances, the speed ripples increase slightly, which increases to ± 0.65 rpm (0.068 rad/s). The reason why the speed ripples become larger is that the white noises (disturbances) contain the low-frequency components, which can be introduced into the system inevitably. Finally, when the speed transfers to the gear, the output of it is stable as well. The maximum speed ripples arising from the motor side are ± 0.025 rpm and ± 0.0325 rpm

Case 1
That ∆f is larger than zero means that the motor needs to rotate positively. In this case, s 1 of the "control logic part" in Figure 11 is 1, s 2 is 1. Then, the double closed-loop speed-regulation control strategy will be used to actuate the motor. Between 0 and 5.0 s, the motor speed is directly fed back, while between 5.0 s and 10.0 s, white noises (magnitude is 1.0 rpm) are added to the feedback speed, simulating the external disturbances. Figure 11 shows the simulation setup and the control performance of the surface-mounted permanent magnet synchronous motor-based servo drive system when ∆f is larger than zero. Firstly, the machine speed can stabilize at the reference level and the currents are stable during the whole test. Secondly, when there are no external disturbances, the rotor speed ripples are about ±0.5 rpm (0.052 rad/s). When the speed loop experiences external disturbances, the speed ripples increase slightly, which increases to ±0.65 rpm (0.068 rad/s). The reason why the speed ripples become larger is that the white noises (disturbances) contain the low-frequency components, which can be introduced into the system inevitably. Finally, when the speed transfers to the gear, the output of it is stable as well. The maximum speed ripples arising from the motor side are ±0.025 rpm and ±0.0325 rpm in the first and the second half test period, respectively. This can ensure that the pins of the piano can be turned slowly, improving the accuracy of the piano tuning process.
zero. Firstly, the machine speed can stabilize at the reference level and the currents are stable during the whole test. Secondly, when there are no external disturbances, the rotor speed ripples are about ± 0.5 rpm (0.052 rad/s). When the speed loop experiences external disturbances, the speed ripples increase slightly, which increases to ± 0.65 rpm (0.068 rad/s). The reason why the speed ripples become larger is that the white noises (disturbances) contain the low-frequency components, which can be introduced into the system inevitably. Finally, when the speed transfers to the gear, the output of it is stable as well. The maximum speed ripples arising from the motor side are ± 0.025 rpm and ± 0.0325 rpm in the first and the second half test period, respectively. This can ensure that the pins of the piano can be turned slowly, improving the accuracy of the piano tuning process.  Figure 11. Simulation results when ∆f is larger than zero.

Case 2
When ∆f < 0, the motor needs to rotate negatively. Hence, s 1 is −1 and s 2 is 1. The simulation setups are the same as those in Case 1. Figure 12 illustrates the simulation setup and the control performance of the surface-mounted permanent magnet synchronous motor-based servo drive system when ∆f is less than zero. It can be seen that, firstly, being similar to Figure 11, the speed and current are stable. Secondly, although the speed ripples between 5.0 s and 10.0 s are the same as those in Figure 11, between 0 and 10 s, they become ten percent higher. But it needs to be mentioned that the speed ripples still stand at low positions, which do not influence the accuracy of the piano tuning process.

Case 2
When ∆f < 0, the motor needs to rotate negatively. Hence, s1 is −1 and s2 is 1. The simulation setups are the same as those in Case 1. Figure 12 illustrates the simulation setup and the control performance of the surface-mounted permanent magnet synchronous motor-based servo drive system when ∆f is less than zero. It can be seen that, firstly, being similar to Figure 11, the speed and current are stable. Secondly, although the speed ripples between 5.0 s and 10.0 s are the same as those in Figure 11, between 0 and 10 s, they become ten percent higher. But it needs to be mentioned that the speed ripples still stand at low positions, which do not influence the accuracy of the piano tuning process. By looking at the verification results of Case 1 and Case 2, it can be found that the surface-mounted permanent magnet synchronous motor-based servo drive can work stably over the low-speed conditions, which comply with the working environment of the piano tuning process. Hence, it can be concluded that a surface-mounted permanent magnet synchronous motor-based servo drive is applicable in practice. By looking at the verification results of Case 1 and Case 2, it can be found that the surface-mounted permanent magnet synchronous motor-based servo drive can work stably over the low-speed conditions, which comply with the working environment of the piano tuning process. Hence, it can be concluded that a surface-mounted permanent magnet synchronous motor-based servo drive is applicable in practice.

Case 3
When ∆f = 0, the motor needs to rotate negatively. Hence, s 2 is −1. In this case, the triple closed-loop position-regulation control scheme is employed for motor control. For the sake of analysis, the rotor position is controlled to maintain at 1 rad in this part (θ _r = 1). Between 0 and 5.0 s, the rotor position is directly fed back, while between 5.0 s and 10.0 s, the white noises (magnitude is 0.05 rad) are added to the feedback position, simulating the external disturbances. The simulation results when ∆f equals zero are demonstrated in Figure 13. It can be seen that the position can maintain at the references level with slight ripples. The ripples are ±0.02 rad and ±0.024 rad in the first and second half test period, respectively. This proves that the surface-mounted permanent magnet synchronous motor-based servo drive is able to exert a good position-holding function, achieving a high tuning accuracy.  Figure 14 shows the performance of the servo drive system when ∆f switches to zero from 1.0 at 5.0 s. Firstly, between 0 and 5.0 s, the motor rotates stably and the rotor position continues to increase, and after about 7.5 s, the speed decreases to zero and the position levels off constantly. This illustrates that the proposed surface-mounted permanent magnet synchronous motor-based servo drive is able to achieve the low-speed rotation and position holding functions in the dynamic process. Secondly, At 5.0 s when ∆f changes, it takes a while before the rotor speed decreases to the same as those down to zero. In this period, the motor position must continue to increase, leading to position overshoot. This is inevitable for the proposed system, even if the fuzzy controller is adopted, because this is determined by the properties of the system. It must be mentioned that even for a directcurrent motor-based or step motor-based servo drive system, when the pitch of a string is detected to be in tune, the bus voltage is removed to stop the tuning devices. The position overshoot is still inevitable because it must take a short time before the voltage and currents in the machine disappear totally. From the perspective of this point, the proposed surface-mounted permanent magnet synchronous motor drive with a high-resolution position sensor installed and position control algorithms integrated must have a higher tuning accuracy. Finally, at 5.0 s, the recorded rotor position is 31.235 rad. After 5.0 s, although the position overshoot occurs, the motor can rotate back and level off at 31.235 rad eventually. This represents that the proposed piano tuning strategy is of high precision.  Figure 14 shows the performance of the servo drive system when ∆f switches to zero from 1.0 at 5.0 s. Firstly, between 0 and 5.0 s, the motor rotates stably and the rotor position continues to increase, and after about 7.5 s, the speed decreases to zero and the position levels off constantly. This illustrates that the proposed surface-mounted permanent magnet synchronous motor-based servo drive is able to achieve the low-speed rotation and position holding functions in the dynamic process. Secondly, At 5.0 s when ∆f changes, it takes a while before the rotor speed decreases to the same as those down to zero. In this period, the motor position must continue to increase, leading to position overshoot. This is inevitable for the proposed system, even if the fuzzy controller is adopted, because this is determined by the properties of the system. It must be mentioned that even for a direct-current motor-based or step motor-based servo drive system, when the pitch of a string is detected to be in tune, the bus voltage is removed to stop the tuning devices. The position overshoot is still inevitable because it must take a short time before the voltage and currents in the machine disappear totally. From the perspective of this point, the proposed surface-mounted permanent magnet synchronous motor drive with a high-resolution position sensor installed and position control algorithms integrated must have a higher tuning accuracy. Finally, at 5.0 s, the recorded rotor position is 31.235 rad. After 5.0 s, although the position overshoot occurs, the motor can rotate back and level off at 31.235 rad eventually. This represents that the proposed piano tuning strategy is of high precision.

Case 5
To verify the frequency characteristics in the process of the tuning, as is shown in Figure 10b, the standard frequency f_r of the string is assumed to be 3.1 Hz. Besides, assume that the detected frequency f is positively related to the rotor position θ, which can be described as: f = 0.5θ. In the beginning, the rotor position is zero, and the frequency of the string is zero as well. In this case, ∆f is 3.1. Hence, the anticipated system performance characteristics are as follows. The motor speeds up to 20 rpm at first. When the rotor position reaches 6.2 rad, the position holding algorithm maintains the position at this level and maintains the motor speed at zero. In this process, the frequency error continuously declines. Figure 15 shows the simulation results of the tuning process. Between 0 and 2.98 s, and the frequency error approaches zero from 3.1 Hz. This happens because the motor speed is 20 rpm, adjusting the frequency to the standard value. An interesting phenomenon is that the dynamic speed, position and current performance characteristics are similar to those in Figure 14. This illustrates that no matter how the frequency error changes (modest or sharp change), the position and speed responses are similar when the frequency reaches the standard value. Especially, the speed will change from 20 or −20 to 0 immediately.

Case 5
To verify the frequency characteristics in the process of the tuning, as is shown in Figure 10b, the standard frequency f _r of the string is assumed to be 3.1 Hz. Besides, assume that the detected frequency f is positively related to the rotor position θ, which can be described as: f = 0.5θ. In the beginning, the rotor position is zero, and the frequency of the string is zero as well. In this case, ∆f is 3.1. Hence, the anticipated system performance characteristics are as follows. The motor speeds up to 20 rpm at first. When the rotor position reaches 6.2 rad, the position holding algorithm maintains the position at this level and maintains the motor speed at zero. In this process, the frequency error continuously declines. Figure 15 shows the simulation results of the tuning process. Between 0 and 2.98 s, and the frequency error approaches zero from 3.1 Hz. This happens because the motor speed is 20 rpm, adjusting the frequency to the standard value. An interesting phenomenon is that the dynamic speed, position and current performance characteristics are similar to those in Figure 14. This illustrates that no matter how the frequency error changes (modest or sharp change), the position and speed responses are similar when the frequency reaches the standard value. Especially, the speed will change from 20 or −20 to 0 immediately.

Conclusions
In order to simplify and improve the accuracy of the piano tuning process, this paper proposes an automated surface-mounted permanent magnet synchronous motor servo drive-based tuning technique. The main contributions of this paper include: Figure 15. Simulation results when the frequency gradually approaches zero from a non-zero value.

Conclusions
In order to simplify and improve the accuracy of the piano tuning process, this paper proposes an automated surface-mounted permanent magnet synchronous motor servo drive-based tuning technique. The main contributions of this paper include: (1) The structure and principles of the automated surface-mounted permanent magnet synchronous motor servo drive-based tuning system are explained. The advantages of this kind of system over the direct-current/step motor-based system are that, firstly, the surfacemounted permanent magnet synchronous motor drive has higher control performance in the low-speed conditions, and secondly, the high-resolution position sensors are adopted to accurately achieve the position holding function.
(2) To ensure that the motor can work stably in the low-speed conditions, without being influenced by the external disturbances, both stability and bandwidth analyses are adopted to design the parameters of the automatic current regulator and automatic speed regulator. In this paper, the parameter design criteria that are suitable for the piano tuning applications are derived, which have seldom been studied previously.
(3) A fuzzy-adaptive proportional integral controller (structure, fuzzification, membership functions, fuzzy rules, deffuzification and adjustment) is specially designed to adapt to the piano tuning applications. Finally, simulation results prove that the proposed automated piano tuning techniques are effective.

Data Availability Statement:
The data presented in this study are available on request from the corresponding author. The data are not publicly available due to privacy.

Conflicts of Interest:
The authors declare no conflict of interest.