# Wavelet-Based Analysis of Motor Current Signals for Detecting Obstacles in Train Doors
## 2 Dynamic Model of the Train Door
### Torque Control Model of DC Motor  
According to the EN 14752 standard, the speed and closing force of doors must be controlled to below specified limits. This prevents the pinching of an object trapped in a door and avoids seriously injuring passengers. In this study, a torque control method was employed to meet the standard. A DC motor was first modeled in MATLAB Simulink by assembling a physical network of Simscape blocks. These blocks, including an electrical resistor, an inductor, shaft inertia, and rotational friction, represented both the electrical equivalent circuit and the mechanical model of the DC motor. The variables in the electrical equivalent circuit of the brushed DC motor were the voltage \(V\) applied across the armature resistance \(R\), the inductance of the coil \(L\), the back EMF \(e\), and the current flowing in the armature \(i\). The variables in the mechanical model were the rotor moment of inertia \(I\), angular velocity \(\theta\), angular acceleration \(b\dot{\theta}\), and motor torque \(T\). A mathematical model of the DC motor can be obtained by combining the electrical equivalent circuit and free body diagram (Figure 1).  
Figure 1: DC motor equivalent diagram.  
The following explanation and Equations from (1) to (6) are given by [24], where the torque of the motor is proportional to the current in the armature coil and is expressed by (1), where \(T\) is the torque, \(k_{t}\) is the torque constant, and \(i\) is the current.  
\[T=K_{t}i \tag{1}\]  
The back EMF, \(e\), is proportional to the angular velocity of the shaft, with the proportionality constant being \(k_{e}\):  
\[e=K_{e}\dot{\theta} \tag{2}\]  
The system is modeled by summing the torques acting on the rotor inertia and integrating the acceleration to obtain the velocity. [PERSON]'s law is applied to the armature circuit. The integrals of the rotational acceleration and of the rate of change of the armature current are modeled as follows:  
\[\int\frac{d^{2}\theta}{dt^{2}}\ dt=\frac{d\theta}{dt} \tag{3}\]  
\[\int\frac{di}{dt}\ dt=i \tag{4}\]  
[PERSON]'s law and [PERSON]'s law are applied to the motor system to generate (5) and (6). The angular acceleration is equal to \(\frac{1}{f}\) multiplied by the sum of two terms (one positive and one negative). Similarly, the derivative of the current is equal to \(\frac{1}{L}\) multiplied by the sum of three terms (one positive and two negative).  
\[J\frac{d^{2}\theta}{dt^{2}}=T-b\frac{d\theta}{dt}\ \Rightarrow\ \frac{d^{2}\theta}{dt^{2}}=\frac{1}{f}\ \left(K_{t}i-b\frac{d\theta}{dt}\right) \tag{5}\]  
\[L\frac{di}{dt}=-Ri+V-e\Rightarrow\frac{di}{dt}=\frac{1}{L}\left(-Ri+V-K_{e} \frac{d\theta}{dt}\right) \tag{6}\]  
The torque of the DC motor is proportional to its current and is controlled by a torque command (Figure 2). The torque command input is converted into a current by dividing it by the motor's torque constant. A feedback current signal is obtained from the DC motor model by using a current sensor with a delay. The sensor reading of the current is subtracted from the current at a fixed point elsewhere in the circuit, and the resulting error is input to a current controller, which limits the maximum torque of the motor to the desired level. A proportional integral (PI) controller calculates the duty cycle of a pulse width modulation (PWM) signal to the H bridge that drives the DC motor. The output of the PI controller is scaled to 20-80% such that the duty cycle of the PWM signal is not at its maximum.  
Figure 2: Torque control of DC motor Simscape model.