# Prognostics of Electromechanical Actuator with Partial Time Scaling Invariant Temporal Alignment
## Appendix A Global Algorithm: Time Series Alignment, Section 5  
```
1:Input:\(\widehat{X}_{j}^{l}\) and \(\widehat{Y}_{j}^{h}\) are source and target cloud points \(\Theta_{j}^{h,*}\) a list containing the two optimal projection directions (hyperparameters) weightArray an array containing weights (hyperparameters) Output:\(\widehat{X}_{T}\) source cloud point moved towards the target cloud point
2:functionTimeSeriesAlignment(\(\widehat{X}_{j}^{l}\), \(\widehat{Y}_{j}^{h}\), \(\Theta_{j}^{h,*}\), weightArray)
3:\(\mathsf{dirIndex}\gets 0\)
4:\((\mathsf{flag},\mathsf{noIter},\mathsf{counterIter})\leftarrow(1,1,1)\)
5:\(\mathbb{X}_{j}^{l}\leftarrow\widehat{X}_{j}^{l}[\cdot]\)
6:\(\mathsf{cost}\leftarrow\mathbf{42}\)
7:while\(\mathsf{cost}>0\)do
8:if\(\mathsf{localCost}<0\)then
9:if\(\mathsf{flag}\)then
10:\(\mathsf{dirIndex}\leftarrow\mathsf{dirIndex}+1\)
11:\(\mathsf{flag}\gets 0\)
12:else
13:break
14:endif
15:endif
16:/*Cloud point projection and indexation */
17:\(\mathsf{dirPoint}\leftarrow\Theta_{j}^{h,*}[\mathsf{dirIndex}]\)
18:\(\mathsf{projSrcWIndex}\leftarrow\mathsf{integer array of}\left(\mathsf{length}( \widehat{X}_{j}^{l}),2\right)\)
19:\(\mathsf{projTargetWIndex}\leftarrow\mathsf{integer array of}\left(\mathsf{length}( \widehat{Y}_{j}^{h}),2\right)\)
20:for\(i\gets 0\)to\(\mathsf{length}(\widehat{X}_{j}^{l})\)
21:\(\mathsf{projSrcWIndex}\leftarrow\left(\widehat{X}_{j}^{l}\Theta_{j}^{h,*}[i],i\right)\)
22:endfor
23:for\(j\gets 0\)to\(\mathsf{length}(\widehat{Y}_{j}^{h})\)do
24:\(\mathsf{projTargetWIndex}\leftarrow\left(\widehat{Y}_{j}^{h}\Theta_{j}^{h,*}[i],i\right)\)
25:endfor
26:projSrc \(\leftarrow\)\(\mathsf{integer array of}\left(\mathsf{length}(\widehat{X}_{j}^{l})\right)\)
27:projTarget \(\leftarrow\)\(\mathsf{integer array of}\left(\mathsf{length}(\widehat{Y}_{j}^{h})\right)\)
28:projTarget \(\leftarrow\)\(\mathsf{integer array of}\left(\mathsf{length}(\widehat{Y}_{j}^{h})\right)\)
29:/*Sort projected points by values */
30:\(\mathsf{projSrcWIndex}\leftarrow\mathsf{projSrcWIndex}.\mathsf{sort}( \mathsf{by}=\mathsf{value})\)
31:\(\mathsf{projTargetWIndex}\leftarrow\mathsf{projTargetWIndex}.\mathsf{sort}( \mathsf{by}=\mathsf{value})\)
32:/*Cente an array with only projected values */
33:for\(i\gets 0\)to\(\mathsf{length}(\widehat{X}_{j}^{l})\)do
34:\(\mathsf{projSrc}\leftarrow\mathsf{projSrcWIndex}[i,0]\)
35:endfor
36:for\(j\gets 0\)to\(\mathsf{length}(\widehat{Y}_{j}^{h})\)do
37:\(\mathsf{projTarget}\leftarrow\mathsf{projTargetWIndex}[j,0]\)
38:endfor
39:
40:/*Nearest neighbor quadratic assignment */
41:\(\mathsf{mnAssignArray}\leftarrow\mathsf{Quadratic\ Assignment}(\mathsf{ projSrc},\mathsf{projTarget},\mathsf{length}(\widehat{X}_{j}^{l}),\mathsf{length}( \widehat{Y}_{j}^{h}))\)
42:

## References

* _[PERSON] et al. (2017)_ [PERSON]; [PERSON]; [PERSON]; [PERSON]; [PERSON] Prognostics and Health Management for Maintenance Practitioners--Review, Implementation and Tools Evaluation. _Int. J. Progn. Health Manag._**2017**, \(8\), 31. [CrossRef]
* _[PERSON] et al. (2021)_ [PERSON]; [PERSON]; [PERSON]; [PERSON] A Novel Deep Clustering Method and Indicator for Time Series Soft Partitioning. _Energies_**2021**, _14_, 5530. [CrossRef]
* _[PERSON] (1978)_ [PERSON]; [PERSON] Dynamic programming algorithm optimization for spoken word recognition. _IEEE Trans. Acoust. Speech Signal Process._**1978**, _26_, 43-49. [CrossRef]
* _[PERSON] (2019)_ [PERSON]; [PERSON] Curve Registration and Mean Estimation using Warplets. In Proceedings of the 1 st International Conference on Advances in Signal Processing and Artificial Intelligence (ASPAI 2019), Barcelona, Spain, 20-21 March 2019. * _[PERSON] et al. (2008)_ [PERSON]; [PERSON]; [PERSON]; [PERSON] A Similarity-Based Prognostics Approach for Remaining Useful Life Estimation of Engineered Systems. In Proceedings of the 2008 International Conference on Prognostics and Health Management, Denver, CO, USA, 6-9 October 2008; pp. 1-6. [CrossRef]
* _[PERSON] (2008)_ [PERSON]; [PERSON] _Turbofin Engine Degradation Simulation Data Set_; NASA: Washington, DC, USA, 2008.