# Efficient Control of a Non-Linear System Using a Modified Sliding Mode Control
## 2 Control Design
### PD Sliding Mode Control (PDSMC)
#### 2.3.2 Integration of PDSMC and SPO (PDSMCSPO)  
This section presents the integration of PDSMC with the sliding perturbation and (SPO). The fusion PDSMC with SPO generated a new robust control algorithm, PDSMCSPO, with perturbation compensation. This PDSMCSPO utilized only partial state feedback (position) to estimate the velocity and perturbation and utilizing this information to control the system.  
\[\hat{s}=k_{d}\cdot\hat{\epsilon}+k_{p}\cdot\hat{\epsilon} \tag{36}\]  
In the relation above, \(\hat{\epsilon}=\hat{x}-x_{d}\) was the estimated error. \(k_{p}\&k_{d}\) were proportional and the derivative gain of the proportional-integral-derivative controller (PID). It was assumed that \(k_{p}>1,\ \ 0<k_{d}<1\). The actual sliding surface is defined as below.  
The estimated error of the sliding surface is shown below.  
\[\widetilde{s}=\hat{s}-s \tag{37}\]  
By using Equation (28) and Equation (36) it can be computed as  
\[\widetilde{s}=k_{d}\cdot\dot{\widetilde{x}}_{1}+k_{p}\cdot\widetilde{x}_{1} \tag{38}\]  
The control \(\overline{u}\) was selected such that it satisfied the condition \(\hat{s}\cdot\hat{s}\leq 0\) during the reaching phase. To satisfy this condition, \(\hat{s}\) should be equal to \(\dot{\hat{s}}=-K\cdot sat(\hat{s})\). After taking the derivative of Equation (36) and using Equation (11), the following equation was obtained.  
\[\begin{split}\dot{\hat{s}}=k_{d}\cdot\alpha_{3}\cdot\overline{u}-& \widetilde{x}_{1}\Bigg{\{}\frac{k_{d}\cdot k_{2}}{\varepsilon_{o}}+\frac{k_{p }\cdot k_{1}}{\varepsilon_{o}}-\frac{k_{d}\cdot k_{1}^{2}}{\varepsilon_{o}} \Bigg{\}}-\bigg{\{}\frac{k_{d}\cdot k_{1}}{\varepsilon_{o}}\Bigg{\}}\, \widetilde{x}_{2}\\ +& k_{p}\big{\{}\hat{x}_{2}-\dot{x}_{d}\big{\}}-k_{d }\cdot\ddot{x}_{d}+k_{d}\cdot\dot{\psi}\end{split} \tag{39}\]  
In Equation (39) above, it was assumed that \(\widetilde{x}_{2}=0\) to enforce Equation (20). After putting the value of \(\dot{\hat{s}}\) in Equation (21), we get the following control input \(\overline{u}\).  
\[\overline{u}=\frac{1}{\alpha_{3}}[-\frac{K^{\prime}}{k_{d}}sat(\hat{s})+ \widetilde{x}_{1}\Bigg{\{}\frac{k_{p}\cdot k_{1}}{k_{d}\cdot\varepsilon_{o}}+ \frac{k_{2}}{\varepsilon_{o}}-\frac{k_{1}^{2}}{\varepsilon_{o}}\Bigg{\}}- \frac{k_{p}}{k_{d}}\big{\{}\hat{x}_{2}-\dot{x}_{d}\big{\}}-\dot{\psi}+\ddot{x} _{d}] \tag{40}\]After substituting Equation (40) into Equation (39), the resulting \(\dot{\hat{s}}\) dynamics had the effect of state estimation error as shown, but this time, the derivative gain was multiplied with this error and reduced the effect on the \(\dot{\hat{s}}\) dynamics because the value of this gain, \(k_{d}\), was less than unity.  
\[\dot{\hat{s}}=-\frac{K^{\prime}}{\varepsilon_{c}}\cdot\hat{s}-\frac{k_{d}\cdot k _{1}}{\varepsilon_{o}}\cdot\widetilde{x}_{2} \tag{41}\]  
In the equation above, it can be seen that during the reaching phase, the \(\dot{\hat{s}}\) dynamics were affected by the state estimates error \(\widetilde{x}_{2}\) to enforce the sliding condition in Equation (20).  
\[K^{\prime}>\frac{k_{d}\cdot k_{1}^{2}}{\varepsilon_{o}} \tag{42}\]  
When the system reached the sliding surface or the prescribed manifold \(|\hat{s}|\leq\varepsilon_{c}\), the actual s dynamics were obtained as shown below by using Equation (37).  
\[\dot{s}+\frac{K}{\varepsilon_{c}}s=\widetilde{x}_{1}\bigg{\{}\frac{k_{d}\cdot k _{2}}{\varepsilon_{o}}-\bigg{(}\frac{K}{\varepsilon_{c}}-\frac{k_{1}}{ \varepsilon_{o}}\bigg{)}\bigg{(}k_{p}-\frac{k_{1}\cdot k_{d}}{\varepsilon_{o }}\bigg{)}\bigg{\}}-\widetilde{x}_{2}\bigg{\{}\frac{K\cdot k_{d}}{\varepsilon _{c}}+k_{p}\bigg{\}}-k_{d}\cdot\widetilde{\psi} \tag{43}\]