Proportional-Integral Sliding Mode Control with an Application in the Balance Control of a Two-Wheel Vehicle System

: A balance control method, the proportional-integral sliding mode control (PISMC), is proposed to control the tilt attitude of an experimental two-wheel vehicle system (TWVS). Based on our previous work of implementing a generalized PISMC to control a linearized dynamical system, this paper extends the algorithm to a wider range: First, the control design of a weighted-control system is proposed. Secondly, our algorithm was realized and veriﬁed in a TWVS using its original nonlinear model. Thirdly, a systematical way to tune parameters are presented. The robustness of the proposed algorithm is also discussed in this paper. The simulation results of this work validate that the PISMC has better robustness to counteract the external disturbances than the conventional sliding mode control (SMC) does. Additionally, the experimental results show that the PISMC is capable of autonomously balancing the TWVS more effectively than the conventional SMC. The successful implementation of our algorithm potentially extends the implementation of the PISMC to various nonlinear and emerging systems.


Introduction
This paper presents a controller called the proportional-integral sliding mode controller (PISMC). The sliding mode control (SMC) has been widely accepted as an efficient method for the tracking or balance control of an uncertain nonlinear system. The capability of achieving perfect performance in principle is also demonstrated in the presence of parameter uncertainties and bounded external input disturbances. The proposed PISMC combines the proportional sliding mode control (PSMC) and the integral sliding mode control (ISMC). There are two main contributions in this paper. First, the PISMC provides more parameters with which to tune the controller. As a consequence, it reduces adverse effects due to the external disturbances effectively. Second, this paper sets up an experiment as an example to demonstrate the tracking accuracy in a nonlinear system. This example also shows how this algorithm can be implemented to a physical system. Though the name PISMC may sound similar to some algorithms regarding the PID sliding surface, the definition of sliding surface and the mathematical expression of PISMC are different.
The main structure of SMC theory was brought out by Utkin, a former USSR scholar, in 1977 [1]. After the original theory, various applications and extensions of the theory were proposed and presented. Some of the examples are given and reviewed in the following. In 1994, Sira-Ramirez et al. [2] proposed a dynamic multivariable discontinuous feedback control strategy 1.
Design of sliding surface for the controlled system: Our paper presents s = 2ė + (λ + 2α)e + α 2 edτ. In [15], the sliding surface was designed as s = k p e + k i edτ.

2.
The system of control in this paper is nonlinear, whereas the system in [15] was a linearized system. 3.
Because the system to control in [15] was linear, their proposed controller was merely a function of the system, given by where f is the original form representing a nonlinear function describing the deviation from linearity in term of disturbances and un-modeled dynamics. Our controller, however, has two major differences from theirs: First, we do not employ the remainder of the nonlinearity terms directly. Instead, we employ the bound of the remainder nonlinearity terms. Secondly, the saturation function in our controller is more than a sgn(s) function; the selection of parameters is different. 4.
The tuning procedures of parameters are discussed in this paper, but not in [15].
The work presented in this paper extends the work presented in [19] to a wider range. The following novelties or contributions are presented in this paper. First, differently from the commonly known ISMC, PISMC, and PID sliding surface, which usually each have the sliding surface of s = k p e + k I edτ + k dė + k 1 e(0) + k 2ė (0) and five parameters or more to tune, our algorithm in [19] extends the sliding surface to the nth order derivative of the output error with only two parameters to tune. In [19], however, a system of unweighted control was considered. Based on the work in [19], this paper proposes the sufficient condition to design a control for a system of weighted control. Secondly, our algorithm was realized and verified in a two wheel vehicle system. In the literature, researchers either applied their work to nonlinear systems using numerically simulated results [21,24], or realized their algorithms in a linear system [20,22,23]. Although nonlinearities were considered in [22,23], they were treated as disturbances instead of dynamics themselves. This paper not only verifies our capability of controlling a nonlinear system by numerical simulations, but also realizes the algorithms in a TWVS using its original nonlinear model. Instead of treating the nonlinearities as disturbances like works in the literature, we dealt with the nonlinearity as the dynamics itself. The successful implementation of our algorithm in a practical nonlinear mechanical system indicates that it is possible to extend the application of the PISMC to a wide range of nonlinear systems, such as the control of microfluidics-based devices [25,26]. Thirdly, tuning of control parameters is always critical in designing a control. In our proposed algorithms, there are only four parameters to tune for all systems. From analysis and past experience, we roughly understand the effects of these parameters, though they were not rigorously proven. Systematic tuning procedures are also presented in this paper.
In detail, we first briefly review the SMC and PSMC and their drawbacks. The algorithms and control law by PISMC are then introduced. Before applying the PISMC control law to real cases, robustness, systematic tuning procedures, and performance are then discussed. Having shown the robustness and good performance of our algorithm, the control design for a weighted-control system is proposed. This paper then derives the dynamic model of an experimental TWVS with given parameters. The PISMC was designed based on the TWVS model, and all the input information was obtained from the real tests which were conducted by the TWVS. The corresponding control to stabilize the TWVS was derived based on the proposed PISMC algorithm, and tested in experiments. Discussion of experimental results and a conclusion are provided to demonstrate the validity of our proposed algorithm.

Conventional Sliding Mode Control
The theory of SMC has been extensively applied in linear and nonlinear systems, and different practical engineering control problems. Studies in the past few decades have demonstrated that the SMC methodology provides a systematic approach to solving control engineering problems. By introducing a sliding mode to the control of a system, one can achieve both stabilization and disturbance rejection.
The conventional PSMC is considered as a proportional type which forces system states to slide into the predetermined sliding surface, and to reach the origin of the phase plane eventually. When the state-trajectory is sliding on the sliding surface, the corresponding dynamic performance of the system is governed by the equations of the sliding surface. Therefore, the PSMC has a strong robustness against external uncertainties and disturbances.
There are two major requirements for the PSMC. The first one is to design a sliding surface. Then the states are enforced to slide into the sliding surface by the switching the control law. Secondly, each of the tracking points on the sliding surface must satisfy the sliding conditions. The switch of the control law is determined by the predefined switching conditions. With the help of the control switch, the trajectory can be guided into the region bounded by boundary layers. Governed by the sliding conditions, the trajectory gradually moves onto the sliding surface and steps forward to the target point.
Consider a desired signalx d (t) and the system outputx(t), where both ofx d (t) andx(t) are in R. The objective of the PSMC is to make the system's output approach the desired signal when t → ∞; i.e., Here, we define the tracking error as where e(t) ∈ R. Before the PSMC is applied, a sliding surface must be designed in advance. The goal of the PSMC is to guide the system trajectory toward the sliding surface, which naturally leads the trajectory to the target point in the end. Based on the magnitude of errors, we define a time-varying linear differential function in R n , s(x, t), named the condition space [27], given by where λ is a positive constant. The equation s(x, t) = 0 represents a sliding surface passing through the origin of the phase plane. According to the above equation, s = 0 is an (n − 1)th-order linear differential equation, and all the eigenvalues of the characteristic equation are located in the left complex plane. Once the sliding surfaces are determined, we may start to design the controller and define the sliding conditions as follows [27].
where η > 0, andṡ denotes the time derivative of s.

Proportional-Integral Sliding Mode Control
To improve the performance of a SMC, this paper adopts a PISMC as our algorithm. Consider a dynamic system described by an nth-order nonlinear differential equatioñ wherex ∈ R is the output of the dynamic system, f is the system function and must be at least once differentiable,ũ ∈ R is the system input, and t is time. We define the state vector, X = x,ẋ, · · · ,x (n−1) T , for future derivations. Assumption 1. Consider (6) and assume that there exists an uncertain parameter ∆ f in the dynamic function f (X, t), satisfying wheref is the estimation and ∆ f is the variation of function f . Assume givenF the boundary of system uncertainty [27].
The goal of the PISMC proposed in this paper is to design a switching control law to let the outputx(t) approach a givenx d (t), as shown in (2). To design the control system, the system states are assumed to be attainable via a state observer, which sometimes requires measurement of an output or output error, as defined in (3). The sliding surface of the PISMC consists of two sliding surfaces, s 1 and s 2 , the proportional sliding surface and the integral sliding surface, respectively. Here, as defined in (4), and where λ > 0, α > 0, ξ e (t) = t 0 e(τ)dτ. The operator (d/dt + γ) n is defined as where γ ∈ R is a parameter to tune, and n m denotes the k-combinations of a set having n elements.
Applying the operator to a function h(t) yields where the superscript with parentheses denotes the order of derivative, while the superscript without parentheses denotes the power of the parameter γ. In our case, γ = λ or γ = α. They are two complementary parameters, which provide the capability of tuning the gains of controller. We note that the expansion of (9) is different from the conventional PSMC or PID sliding surface, since λ and α are generally distinct. The PISMC is designed as [19]: where, by letting s = s 1 + s 2 ,û eq = −f −ŵ, (13) v sw = −ksgn(s), and The controller design is summarized in Theorem 1. Theorem 1. [19] Consider the system of (6) which satisfies Assumption 1. Let the functionũ be specified in (12) withũ eq being equivalent signal and v sw being switching control defined in (13) and (14), respectively. The gain k is designed to satisfy (5) with the definition ofŵ given in (15). If there is a k and an η > 0 such that then the tracking error as defined in (3) will tend to a neighborhood of zero within a finite time.
Proof. The proof is a brief version of [19] for further usage. Define the following Lyapunov function Choose an appropriateũ to satisfyV(s) < 0. Then, The sufficient condition of (18) to ensure the stability of system and to satisfy the sliding conditions as in (5) is given byV as stated in (16). It is also conclusive from (18) that e(t) converges to the neighborhood around origin of the phase plane for any trajectory.
In fact, in the control signal there is a the discontinuous contribution v sw , caused by the discontinuous switching function (sgn). This function results in an infinitely large switching frequency. However, this infinitely large switching frequency can not be realized in real physical system. Therefore, a switching component with extremely high-speed is applied. That way, the state trajectory would oscillate around the two sides of s = 0 which results in the chattering phenomenon.
In order to reduce the chattering problem, the concept of boundary layers for a sliding surface is employed, as depicted in Figure 1. The definition of boundary layers is given by The error phase-plane of boundary layers of a sliding surface, s, coincides with the boundary range of ε. Note that s = ±Φ is the boundary layer. Since the switch action can not be completed in a blink of time and the effect of delay exists, the state trajectoryX would oscillate between the boundary layers. Figure 1 is the 2nd-order error phase plane, and it is the most common way to mitigate the oscillation by replacing the sliding surface with the boundary layers. v sw is the switching law of the controller, defined as follows Here sat(s, Φ) is the saturation function defined by

Alternative from of the Controller
In this paper, we assume that all states are attainable via state observers, but do not touch the design of the observer. The original design of the controllerũ in (12) may require additional estimation of e (n) , which may need to employ new gain(s).
In order to avoid this drawback, an alternative design ofũ is proposed by reducing the order of e (n) . (3) leads to To haveV < 0, the controlũ was originally designed as As a result, (22) can be rewritten as or,ũ To eliminate ∆ f , we here re-designũ as That is, replace the originalŵ by lettingŵ We claim that this controller works, and this controller does not need to measure e (n) .
The proof is given as follows:

Robustness Discussion
Unlike the design concept of conventional SMC, the insensitivity is included in the dynamics model and also guaranteed in our algorithm. In the conventional SMC design, a precise dynamics model is employed and the perturbation is viewed as an extra input. An example is given in Equation (22) in [28]. The change rate of s is formulated bẏ and the robustness is discussed based on this formulation. In our approach, however, the perturbations are already included in the parameter k for v sw . Recall that k =F + η, whereF is the bound of the model variation, satisfyingf =f + ∆ f and |∆ f | ≤F.
LetX =X n + ∆X, whereX n is the nominal states. Then, wheref (X) =f (X n ) and ∆ f includes all the remainder terms. By properly investigating and choosing the bound of ∆ f . The influence of perturbations is included and considered in the control. The advantage of our approach is that the robustness of the control is guaranteed with a proper choice ofF, and we do not have to worry about specific perturbations. The drawback, of course, it that the control might be inefficient ifF is defined too large for the purpose of robustness.

Parameter Tuning
In the proposed algorithm, there are four parameters to tune in total: λ and α to construct s-surface, η to construct v sw , and Φ to determine the saturation function. We have tried to analytically understand the effect of each parameter. However, this is too difficult due to the complexity of nonlinear systems and mathematics. Instead, approximated properties in a 2nd order system are analyzed, and numerical simulations are presented to demonstrate the potential effect of each parameter, so that readers will have some ideas on our tuning procedures. Notably, numerical examples are not solid proofs. An effect may vary in different cases.
The example from [19] is employed to study the effect of each parameter, and how to tune these parameters. The example, given as follows, was originally from [27] and employed to demonstrate the validity of the our proposed algorithm: x + a(t)ẋ 2 cos 3x =ũ.
The function a(t) is unknown but varies within the range 1 ≤ a(t) ≤ 2. Let The control input of SMC is Notably, we employed this example in our work in [19], and showed the validity of our work. In this paper, however, we employ this example to show the properties and influences of parameters. As a result, despite the dynamical equation and parameters of the equation being directly employed from [27], other settings are changed. For example, we used state errors and their derivatives, instead of the output rate in the reference. The parameters of the controller are different from those in the reference. The desired signalx d is set as unit step for investigating transient properties, which is different from the originalx d = sin(πt/2). Therefore, the comparison occurs between our PISMC and SMC to know the parameters better. It did not occur between our PISMC and the SMC of the reference.

Effect of Φ
Φ is the parameter to determine the switching method and reduce the chattering phenomenon, as shown in (21). However, the larger the value of Φ, the more sluggish the response. As Φ → ∞, sat(s, Φ) = s/Φ. As Φ → 0, sat(s, Φ) = sgn(s), which usually causes chattering phenomenon. Consider the case Φ → ∞, so that sat(s, Φ) = s/Φ. Since s is finite in general, |s|/Φ < 1. The smaller the |s|, the smaller the |s| 2 /Φ. The decreasing rate of the Lyapunov function is influenced bẏ The original saturation function sat(s, Φ) = sgn(s) bringsV ≤ −η|s|. The condition to have a more greatly decreasing rate of the Lyapunov function is given by or equivalently, |s| > Φ. Therefore, a large Φ is not helpful in speeding up the converge of the system. Figure 2 demonstrates the comparison. Φ = 100 in Figure 2a, whereas Φ = 0.1 in Figure 2b. Other parameters are set identical. It is obvious that the responses with smaller Φ are faster, regardless of the type of controls.

Effect of η
It can be expected that the larger the value of η, the more decreasing the rate of the Lyapunov function fromV ≤ −η|s|. Suppose |s| > Φ at beginning. The upper bound forV is given in (33). Since V = s 2 /2 = |s| 2 /2, we conclude the upper bound of V satisfieṡ (35) implies that V converges exponentially with time constant τ η = Φ/2η. Figure 3 demonstrates the comparison. η = 100 in Figure 3a, whereas η = 0.01 in Figure 3b. Other parameters are set identically. It is obvious that the responses with large η are faster, regardless of the type of controls.

Effect of λ
The role and influence of λ on a higher order system is unclear. However, we may approach this problem through a second order system like the example. When n = 2, our algorithm suggests s =ė + λe andũ =ũ R − λė under the SMC assumption, whereũ R contains the remainder terms ofũ. From the structure ofũ we conclude that the role of λ is roughly the gain of a conventional P-controller in a negative feedback. A proper choice of λ would stabilize the system. Too large a value of λ may destabilize the system, or have the system converged sluggishly.
On the other hand, the function of SMC is to force s = 0 first. Then, the property of s = 0 will force e = 0 when t approaches infinity. Since s =ė + λe, implying that e converges exponentially with time constant τ λ = 1/λ, too small a value of λ will cause the system to converge sluggishly. From our experience, 1 ≤ λ ≤ 10 is a better choice. Figure 4 demonstrates the comparison. λ = 100 in Figure 4a, λ = 1 in Figure 4b, and λ = 0.01 in Figure 4c. Other parameters are set identically. It is obvious that the responses with too large or too small λ are sluggish, if the SMC control is considered.
A similar statement can be made for α. The function of our algorithm is to force s = 0 first. The property of s = 0 will then force z = 0 when t approaches infinity. Since s = 2z + (λ + 2α)ż + α 2 z, z converges exponentially if the discriminant is greater than zero, and converges oscillatorily if the discriminant is less than zero, where the discriminant is defined as Defining α = ρλ and ρ > 0 yields The condition for z to converge exponentially is 0 < ρ ≤ 1.2. This approximation is not accurate enough because the actual behavior of z is also influenced by other parameters. We may conclude z converges oscillatorily if ρ ≥ 1.
Given ρ ≥ 1, the overshoot of z is influenced by damping ratio of the system. The damping ratio ζ can be approximated by when ρ = 1, ζ = 2.213. When ρ → ∞, ζ = √ 2. Since e =ż, the oscillation of ζ does not directly equal the oscillation of e. Moreover, the nonlinearity of the system also makes the quantitative prediction inaccurate. However, the trend of the oscillation must be similar. The larger the value α is, the smaller the overshoot e has. Figure 5 demonstrates the comparison. α = 10 in Figure 5a, α = 1 in Figure 5b, and α = 0.1 in Figure 5c. Other parameters are set identically. It is obvious that a very small ρ = α/λ causes no overshooting in the system. This is reasonable. When α = 0, the algorithm degenerates to a conventional SMC. Although large ρ causes overshooting, the magnitude is small.
The time constant of convergence for an oscillatory z can be approximated by when ρ → 0, τ α = 2/λ. When ρ → ∞, τ α → 0. Although large ρ suppresses overshooting and speeds up the convergence of outputs, α = ρλ grows exponentially compared to the contribution to control signals. Hence, the trade-off of a fast response is a very large control. A very large control is usually energy consuming or impossible in implementation.

Tuning Procedures
From previous analysis and our experience, the tuning procedures applying our algorithm are concluded as follows: 1.
Select η. Large η is helpful to speed up the convergence. However, the value of η is proportional toũ. Too large a value of η may cause too large a control signal. 3.

4.
Select ρ and α = ρλ. If an oscillatory response is allowed, ρ can be selected to be larger than 1.
If not, a smaller ρ is suggested.

5.
Estimate the transient properties: (a) The overshoot can be estimated from damping ratio ζ = (1 + 2ρ)/ √ 2ρ for ρ ≥ 1. (b) Estimate the total time constant. Since the convergence procedure is s → 0 and then e → 0, the total time constant of convergence, τ e can be approximated by τ e = τ η + τ α . (c) The settling time t s , according to control theory, approximated by t s = 4τ e .

6.
Build the nonlinear mathematical mode and run numerical simulations with initially selected parameters. Tune the parameters according to the transient performance and the effect of parameters. 7.
Remember to keep α as small as possible, because a large α usually indicates a very large control input.

Effectiveness of the Algorithm
As aforementioned, there are only four parameters to tune in total for an arbitrarily high order system: λ and α to construct s-surface, η to construct v sw , and Φ to determine the saturation function. Usually, a higher order controller has more parameters to tune. Using only four parameters to control an arbitrarily high order system may sacrifice potential performance more parameters may bring, but it simplifies the tuning procedures.
On the other hand, the proposed algorithm has more degrees of freedom to adjust the system's performance, compared to the conventional SMC algorithm. Although those characteristics may result in complexity in selecting parameters, with the aforementioned methods and analysis, one is able to tune parameters systematically and efficiently.
Another concern is the cost of the control. Better performance may result from greater effort, such as a larger control signal or greater energy consumption. From our experiences, though not rigorously proven, in some cases the proposed algorithm actually costs less than the conventional SMC, which only tunes λ to build the sliding surface and Φ to defined the boundary layer.
An example is presented in Figure 6. The example was simulated using the aforementioned nonlinear system. In order to evaluate the control laws, a cost function J is defined as follows: Two control laws were employed to control the system: the SMC and our proposed PISMC. Parameters were tuned so that the two systems had similar settling times. A smaller overshoot occurred in the system using PISMC. Table 1 lists the parameters: The simulations in Figure 6 show that the proposed algorithm costs less while keeping similar transient performance. Notably, under the designated parameters, chattering occurs once using the control from SMC. As a result, it can be concluded that our algorithm performs better than the conventional SMC in this specific case.

PISMC for a Weighted-Control System
Based on the work in [19], we extend our work to a nonlinear system of weighted control, which is usually described by the differential equations whereũ,x ∈ R are the input and output, respectively, and f ,g : R n → R are smooth functions. The gaing is unknown, yet assumed to be uniformly bounded.
We assume that the control input may enter multiplicatively in the dynamics, and it is natural to choose our estimateĝ of gaing as the geometric mean of the above bounds.
Assumption 2 can then be written in the form of where Since the PISMC is designed to be robust to the bounded multiplicative uncertainty, as in (43), we call β the gain margin of our design, by analogy to the terminology used in linear control. Let The PISMCũ * is modified from the aforementionedũ and it has the form: where theû eq and v sw are defined in (13) and (14), respectively. We summarize the controller design in Theorem 2.
If there exits a k * such that then the tracking error as defined in (3) will tend to the neighborhood of zero within a finite time.
Proof. To prove that PISMCũ * satisfies the sliding conditions, the following Lyapunov function is employed: If we chooseũ * as in (46), then follow similar steps as those in (18): We obtaingĜ and henceV < 0. This ensures that any trajectory e(t) converges to the neighborhood around of origin in the phase plane.

Comparison of Sliding Surfaces
The design of sliding surface is inherited from [19], whereas the design of control is extended to a weighted-control system. The design of sliding surface in our algorithm extends to the nth order system, and, thus, is considerably different from conventional SMC and PID sliding surface. Table 2 presents the differences.

Implementation in a Two-Wheel Vehicle System
This paper extends the design of PISMC controller to a weighted-control system from the work in [19]. Procedures for tuning parameters are also presented in the proceeding section. The third effort of this paper is to implement the proposed control algorithm in a nonlinear system, which is very rare in the literature. A TWVS was built for the implementation and verification of the algorithm. The novelty of this experiment is the employment of its original nonlinear dynamics, instead of commonly used linearized dynamics.

Model of Two-Wheel Vehicle System
The dynamic equations for the TWVS were derived for analysis and for the controller design. Figure 7 shows the free body diagram of the TWVS.  Figure 7a. The shaft of the two wheels goes through the center of mass (cm) of the cart, and a pendulum is installed in the cm of the cart through a hinge. A motor kit is installed on each wheel to drive the wheel. Assume that there is no slip occurred between the wheels and the ground, and no torque exists between the cart and the pendulum. Moreover, this example experiment only considers the longitudinal motion. Therefore, forces and torques in the lateral motion are assumed balanced and not considered.
In order not to distract readers from the main stream of this paper, the detailed derivation of equations of motion is provided in the Appendix A. Notation is defined either in Figure 7 or in the Appendix A. The dynamics of the TWVS are represented as follows: Define M total = M + m + 2M w + 2J w /R 2 and J s = J p + ml 2 . The equations of motion of the TWVS can be written as where where ∆ = det(A) = M total J s − m 2 l 2 cos 2 θ.

Parameter Set-Up of PISMC System
In this section, a numerical simulation and an experiment of PISMC applying to a TWVS are presented. The dynamics of TWVS are defined in (52), and in the simulation, the parameters were selected as m = 1.076 kg, M = 1.012 kg, M w = 0.064 kg, R = 0.85 m, l = 0.18 m, J p = 0.00221925 N-m, and J w = 0.00132 N-m. Let 5.5 = β min ≤g(X, t) ≤ β max = 11. We haveĜ = 0.1286 and β = √ 2. Set λ = 10, α = 1, η = 5, and Φ = 1. The PISMCũ * can be computed from (46). Figure 8 shows the architecture of the simulation and the actual hardware implementation of the PISMC. The measured output signal was compared with the reference signal and the calculations were performed to produce the switching signal and the equivalent signal. The overall control signal (switching signal + equivalent signal) was sent to the motor driving board to control the real system. In the experiment, the motor driving board contained two PIC18F258 microcontrollers. One microcontroller computed the control signal based on the PISMC algorithm, whereas the other handled the readings of sensors. The computational capability of a PIC18F258 microcontroller is actually powerful enough to implement the proposed algorithm. However, due to the inherit complexity and difficulty in the TWVS, the preliminary goal was to achieve the autonomous balance by a simplified structure. Therefore, the experiment focused on the tilt angle control only, described by the equation ofθ in (52). A simple flow chart is shown in Figure 9.  Figure 9. The experiment focused on the tilt angle control (x = θ) only, due to the inherit complexity and difficulty in the two-wheel vehicle system (TWVS).

Balance Control Simulation Results
Simulation results are presented in Figures 10-12. For the first simulation, Figure 10 shows the system responses of the TWVS balancing with no external disturbances and the initial condition is (x d (0),ẋ d (0)) = (1, 0). We note that the settling time to reachx d and the error of the PISMC are smaller and converge quicker than that of the conventional SMC. It is evident that the PISMC presented in this paper is effective for the TWVS to reach the desired attitudes around the equilibrium point in short a period. The stability and accuracy are both maintained in the balance simulation. For the second simulation, Figure 12 shows the system responses of the TWVS with external disturbances. To examine the disturbance rejection property afforded by the proposed control, we consider to simulate the system with initial condition of (x d (0),ẋ d (0)) = (−0.5, 0), and the system external disturbance is sin(2πt). Figure 11 shows thatx d settles down to the steady state and the amplitude of the errors are smaller. The results also verify that the PISMC is capable of tracking the desired states and the errors converge steadily to the neighborhood of zero.
The performance of the system with the proposed PISMC is better than the use of the SMC controller such that no overshoot, shorter rise time, and shorter settling time were obtained from the proposed controller. The variations of the control efforts are shown in Figure 10 which indicates that the SMC signal is smaller in magnitude and the system settles down in 1.2 s. Several quantitative performance indicators of the attitude tracking qualities for SMC and PISMC controllers are summarized in Table 3. Variations of the sliding signal for SMC and PISMC are illustrated in Figure 10. It shows that magnitudes of the variations are smaller in PISMC. Variations of the sliding surface during the control are illustrated in Figure 10 as well. One notes that the sliding function is s(t) = 0 when the error signal is not zero. This means that the sliding mode is in the reaching surface up to about 0.92 s, and then arrives the sliding surface. When it reaches to the sliding surface, theoretically it is expected the sliding function to be zero (i.e., s(t) = 0). In practical applications, there are always some small deviations and fluctuations at the output measured variable because of uncertainties and disturbances. Here, the average value of the sliding function is zero s(t) = 0. As shown in Figures 10-12, we note that these remarkable results are obtained without involving too much control effort.

The TWVS Platform
In this study, an experimental TWVS was developed as the experimental platform for gathering data to simulate and verify the proposed controller design. A picture of the TWVS is shown in Figure 13. The TWVS was equipped with a microchip (PIC 18F258)-based onboard computer module which was responsible for the data processing and the autonomous control. The main onboard electronic sensor was the self-developed IMU which consisted of the gyroscope and the accelerometer circuit. They were used to collect data from system identification and to output commands for automatic balance. The main control system was composed of the Borland C++ Builder. Figure 13. Onboard computer module of the two-wheel vehicle system.

Attitude Sensors
In general, the orientation of the inertial measurement unit (IMU) is derived from the inertial sensors, i.e., accelerometer and gyroscope sensors. All these sensors provide analog signals, so an analog-to-digital converter (ADC) is required to acquire the data. Therefore, the PIC18F258 made by Microchip Technology, with 8-channel 10-bit ADC, was used. In order to increase the computational efficiency and to perform the data fusion algorithm, microchips (PIC 18F258) served as the processing units of the low-cost IMU, and they communicated with each other through the built-in RS232 bus. The configuration of this self-developed IMU is depicted in Figure 14. This self-developed, low-cost IMU was used to offer attitudes and angular rates for the onboard computer module. The outputs of IMU were Euler angles, angular rates, and accelerations. Although the IMU performs well in normal conditions, its outputs always suffer from unpredictable errors such as moving due to the motor vibrations. The chassis on the TWVS induced vibrations and affected the onboard hardware to some extent. Without proper installation, the IMU probably gives inapplicable outputs. Therefore, vibration isolation or reduction became an important issue for our IMU on a moving platform. Some vibration reduction materials were tested and finally a kind of sound deadening sheet for cars was chosen. The IMU was surrounded by several layers of the sound deadening sheet and then cased into a box.

Balance Control Experiment Results
For the first experiment with no external disturbances, Figure 15 shows the TWVS tracking responses using the proposed PISMC and the conventional SMC. In experimental results, the original tilt angle was approximately ±2 degrees, and the tilt rate was approximately ±25 degrees/s. Comparing the top left plot (PISMC) to the top right plot (SMC), one notes that the tilt angle result of the proposed PISMC controller had no overshoot, shorter rise time, and shorter settling time than that of the conventional SMC controller. Importantly, the experimental result shows that the PISMC held balance well for the developed TWVS. The results of the second TWVS experiment with external disturbances are shown in Figure 16, which shows that the output of tilt angle by the PISMC can be tracked well to follow the desired angle. The robustness of the TWVS with the PISMC is better than that of the conventional SMC. It also demonstrates that the PISMC can give reasonable angle output of the tilt motion in experiments. Comparing the PISMC results with the SMC results, the PISMC has smaller oscillation, smaller overshoot, shorter rise time, and shorter settling time than the conventional SMC. The results of the TWVS experiments validate the balance control capability of the PISMC.

Conclusions
This paper presents a generalized proportional-integral sliding mode control (PISMC) method and the design of the associated controls. Our previous work generalized the PISMC to an nth order, unweighted-control system with only two parameters to tune. This paper extends the work to an nth order, weighted-control system. The bounds of dynamic variation, usually including state perturbations and disturbances, were employed to design the associated controller. The advantage of this approach is to avoid measuring the uncertainties. A systematic procedure to tune parameters was analyzed and proposed. Numerical simulations of a nonlinear system are presented to demonstrate the validity of the procedure. Robustness of the proposed algorithm is discussed, and the performance is shown to be better than a conventional SMC under certain parameters through the comparison of costs. These examples also demonstrate that the presence of one more parameter from the integral part brings one more degree of freedom with which to tune the system. In addition, the design of a balance control system for a TWVS is presented to validate the algorithm. The simulation results show that the PISMC autonomously balances the TWVS effectively in both disturbed and undisturbed circumstances, validating the robustness of the algorithm. The performance of the PISMC is also better than that of the conventional SMC. The balance control experiments of the developed TWVS yielded encouraging results that validate the feasibility and the effectiveness of the proposed PISMC controller. The successful implementation of the proposed PISMC using the original nonlinear dynamics potentially extends the applications of the PISMC to various nonlinear and emerging systems. Acknowledgments: The authors would like to dedicate this paper to the late Fei-Bin Hsiao for his precious comments on this work.

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

Appendix A. Derivation of Dynamic Model
First, consider the dynamics of the left wheel. All notations denoted by subscripts of L and R are associated with the the left and right wheels, respectively. Let A L be the contact point with the ground; H L be the friction; N L be the normal force by the ground; F xL and F y L be the forces exerted by the cart; M L be the mass of the wheel; W L = M L g be the weight; T L be the controlling torque provided by the motor; and R be the radius of the two wheels.
The dynamic equations of the wheels in the cart-body-fixed frame are shown as follows where J L is the moment of inertia of the wheel and θ L is the rolling angle of the wheel. A similar process can be applied to the right wheel and yields The assumption of no slipping leads toẍ L = Rθ L andẍ L = Rθ R . Assume the two wheels are identical. Then M L = M R = M w , J L = J R = J w ,ẍ L =ẍ R =ẍ, θ L = θ R = θ w T L = T R =ũ * . Notably, θ w is defined positive to have the TWVS move toward +i The dynamics of the cart is given as follows: where M is the mass of the cart. Since longitudinal forces are assumed to be exerted passing through the cm and lateral forces are balanced, there is no equation for torques. This also implies that the cart-body-fixed frame does not rotate and it is, hence, coincident with the inertial frame. The equations of the pendulum's translation are derived with respect to the cm of the pendulum, whereas the equation of the rotation is derived with respect to the lower tip of the pendulum for convenience, where the pendulum is linked to the cart. Therefore, the equations of motion are obtained by [29] ∑ F = ma G , (A4) where m is the mass of the pendulum; J p is the moment of inertia about the pendulum cm. Moreover, r G is the position vector pointing from the tip to the pendulum cm, and a G is the acceleration of the pendulum cm. The two terms can be found by where l is the half length of the pendulum and a c =ẍi is the acceleration of the cart. Expanding (A4) through (A7) yields (49) and Moreover, H L =ũ * /R − J wẍ /R 2 and H R =ũ * /R − J wẍ /R 2 . Consequently, (A10) can be re-written as (50), given as