Control System Design of an Underactuated Dynamic Body Weight Support System Using Its Stability

This paper discusses the stability of systems controlling patient body weight support systems which are used in gait re-education. These devices belong to the class of underactuated mechanical systems. This is due to the application of elastic shock-absorbing connections between the active part of the system and the passive part which impacts the patient. The model takes into account properties of the system, such as inertia, attenuation and susceptibility to the elements. Stability is an essential property of the system due to human–device interaction. In order to demonstrate stability, Lyapunov’s theory of stability, which is based on the model of system dynamics, was applied. The stability of the control system based on a model that requires knowledge of the structure and parameters of the equations of motion was demonstrated. Due to inaccuracies in the modeling of the rope (one of the basic elements of the device), an adaptive control system was introduced and its stability was also proved. The authors conducted simulation and experimental tests that illustrate the functionality of the analyzed control systems.


Introduction
For a patient who is post-stroke, post-trauma or post-surgery, the effectiveness of their therapeutic treatment is increased by starting rehabilitation as early as possible. The effectiveness of rehabilitation depends, to a great extent, on the intensity of the exercises performed. As a result, modern rehabilitation devices that operate with a high level of precision and reliability are becoming increasingly used in the practice of medicine. The design of contemporary rehabilitation equipment is being constantly developed and improved. The use of automated rehabilitation stations is particularly necessary in places where they can assist rehabilitants at work. One of the areas where the application of medical devices brings significant benefits is in learning to walk again, i.e., walking reeducation.
Walking re-education was originally a process used by physiotherapists who supported and protected the patient (rehabilitant). This process required a high involvement on the part of the rehabilitants, both due to the fact that the exercises were time-consuming and due to the heavy physical loads that were used. In order to improve matters, work aimed at designing rehabilitation equipment that would support the patient began [1]. The devices used in gait re-education may generally be divided into two basic types "wearables" and "non-wearables" [2].
The group of "wearable" devices includes mainly exoskeletons. One should bear in mind that exoskeletons were originally mainly used in industry and are still used in innovative industrial applications [3]. Since that time, continuous research on the development of exoskeletons has been conducted and the market offers devices driven by electric [4], hydraulic [5] and pneumatic drive systems [6]. Examples of exoskeletons that are applied for rehabilitation purposes include the HAL, ALEX, SCUT, ReWalk, or EKSO GT systems, that can be found in a review paper [7,8]. These devices are based on advanced, hybrid control algorithms that control the posture of the users and support them with the appropriate force [9], considering the interactions between the human and the robot [10]. Development work in the field of design, modelling and control of exoskeletons is still carried out and interesting examples are the results of the works [11][12][13][14].
In recent years, more and more research results have confirmed the effectiveness of the use of exoskeletons in rehabilitation practice [15]. Guidelines and efficient exercise programs have also been developed [16,17]. An important advantage of exoskeletons is the fact that they stimulate the patients to move in compliance with the correct gait patterns and force them to be active [18]. However, one should remember that rehabilitation with the use of exoskeletons cannot be used in all patients with gait disturbances. Due to the fact that the actions of the exoskeleton are initiated and controlled by the patient, a certain degree of functioning of the lower limbs and/or exteroceptive sensation are required [19]. Exoskeletons cannot be used in patients with large deformations of the lower limbs, which make it impossible to adapt the brace to the body (although persons after partial amputations and those who use prosthetics may exercise with the use of some exoskeletons). Other counterindications include, among others, obesity of the patient, unstable skeletal system, advanced osteoporosis, high spasticity or significant deformations of the spine, e.g., with a dysplasia of bones or cartilage [20,21].
An alternative approach consists in the application of "non-wearable" systems, which include both mobile devices (such as walkers and other assistive devices), as well as stationary systems equipped with a body weight support system (BWS). Relieving devices can also work with the exoskeleton, as well as with the treadmill.
Initially, the BWS systems operated like mechanical systems. This group may be divided into static body weight support systems and passive systems with counterweight, pulleys or springs. The newest gait rehabilitation support systems act dynamically, with the use of mechatronic body weight support systems [22]. Dynamic compensation of the patient's body weight enables support with a constant vertical force, regardless of the length of the rope and the position of the person who is exercising. This type of solution enables the patient to have a more natural gait while exercising. Dynamic relief systems also enable exercises that involve kneeling, sitting or stepping on obstacles [23]. In the initial phase of rehabilitation, the use of equipment with BWS requires the participation of a physiotherapist, who verifies the correctness of the learned gait pattern. As opposed to exoskeletons, exercising with the use of body weight support systems only may result in deviations from the correct way of movement [24]. Nevertheless, BWS systems provide great assistance to therapists and are commonly applied due to their universal purpose [25]. They may be both introduced in the initial phase of re-learning to walk and used to improve the pace of walking in persons who are able to move on their own. They can both be implemented in the initial phase of the gait re-education process and used to improve speed in people who move independently [26].
The ZeroG rehabilitation device is one of the first mechatronic body weight support system, launched onto the American market in [27,28], for the specific purpose of creating an effective walking re-education process, addressing the expectations of patients and rehabilitants. It is a technologically advanced BWS system mounted on a rail, which, in turn, is attached to the ceiling. The patient who exercises with this kind of device may walk normally, but only along a route corresponding to the shape of the rail. As a result, the physiotherapist may access the rehabilitating patient at all times and will only need to focus on improving the precision of their workout since the BWS works in a fully automated way. Recently, another version of this device has been launched onto the market. An alternative option for ZeroG may be a more compact system equipped with a treadmill; such devices were developed, amongst others, at the Tarbiat Modares University in Tehran [29] and at the Silesian University of Technology in Gliwice [30]. Other devices include those equipped with orthoses to support the movement of the lower limbs, e.g., the locomat [31,32] and ReoAmbulator [33], or having programmable foot-plate-bases, such as the G-EO system [34], that enforce the movement of lower limbs while walking [35].
Several other examples of devices used in walking re-education were presented in review studies [36][37][38].
The key components of the rehabilitation equipment presented above are the BWS systems. Dynamic systems are often equipped with a series elastic actuator (SEA) drive [39,40]. The concept of this solution (Figure 1) assumes that a susceptible element that will transmit an external load is introduced to the drive system. Tehran [29] and at the Silesian University of Technology in Gliwice [30]. Other devices include those equipped with orthoses to support the movement of the lower limbs, e.g., the locomat [31,32] and ReoAmbulator [33], or having programmable foot-plate-bases, such as the G-EO system [34], that enforce the movement of lower limbs while walking [35]. Several other examples of devices used in walking re-education were presented in review studies [36][37][38].
The key components of the rehabilitation equipment presented above are the BWS systems. Dynamic systems are often equipped with a series elastic actuator (SEA) drive [39,40]. The concept of this solution (Figure 1) assumes that a susceptible element that will transmit an external load is introduced to the drive system. This type of actuator is mainly designated for mechanisms that require high accuracy of force control at low mechanical impedance [41]. As a result, such mechanisms are widely used in exoskeletons and in the BWS systems of the various rehabilitation devices described above [42,43]. The series elastic actuator drive has one power driven element and the equations of motion contain two generalized co-ordinates, so it is classified as an underactuated mechanical system (UMS) [44][45][46].
UMSs are becoming increasingly popular in various sectors of industry. These solutions are used in manipulators, vehicles, or humanoid robots. The difficulty in controlling a UMS results from the fact that techniques developed for fully actuated systems cannot be applied here [47]. These systems are not subject to feedback linearization, but they possess nonholonomic constraints and non-minimum phase characteristics [48]. Developing stable algorithms to control this class of systems is an interesting and continuously developing engineering problem.
A literature review reveals that an effective solution in UMS control is the application of a sliding mode control with various modifications [49][50][51]. This method is often used due to its high accuracy and resistance to internal and external interference. The approach based on a sliding mode control consists of two stages. The first of these is the selection of variables in the state space, determining the area of sliding movement. The second one is designing a non-continuous feedback that may force the system to achieve a state on the defined sliding movement area in a finite time [52]. The issues related to the stability of these control systems were discussed in the studies [53,54]. However, a disadvantage of the sliding mode control is the occurrence of a vibration effect that is caused by the frequency of switching the control [55]. As a result of this, the sliding mode control is not used to control the functionality of BWS systems in rehabilitation equipment. Systems used to support the patient in accommodating loads are usually controlled with the use of proven methods, in particular PD, PI, or PID regulators. However, taking into account that active body weights support systems are underactuated mechanical systems, it seems beneficial to expand the standard feedback loop to a system with compensation, or an adaptive system. These approaches are commonly used for this class of devices [56][57][58][59]. Similar and interesting example of control the BWS systems is also the use of force sensorless admittance control [60].
However, the literature review shows that the stability of BWS systems has not been analyzed enough [61] and that they have only been verified experimentally. This paper presents two concepts for controlling BWS systems and demonstrates their stability with the use of the dynamic model and Lyapunov's theory of stability. First, the authors present a control algorithm based on a mathematical model of the controlled object that provides a general basis for control with compensation from system dynamics. This type of actuator is mainly designated for mechanisms that require high accuracy of force control at low mechanical impedance [41]. As a result, such mechanisms are widely used in exoskeletons and in the BWS systems of the various rehabilitation devices described above [42,43]. The series elastic actuator drive has one power driven element and the equations of motion contain two generalized co-ordinates, so it is classified as an underactuated mechanical system (UMS) [44][45][46].
UMSs are becoming increasingly popular in various sectors of industry. These solutions are used in manipulators, vehicles, or humanoid robots. The difficulty in controlling a UMS results from the fact that techniques developed for fully actuated systems cannot be applied here [47]. These systems are not subject to feedback linearization, but they possess nonholonomic constraints and non-minimum phase characteristics [48]. Developing stable algorithms to control this class of systems is an interesting and continuously developing engineering problem.
A literature review reveals that an effective solution in UMS control is the application of a sliding mode control with various modifications [49][50][51]. This method is often used due to its high accuracy and resistance to internal and external interference. The approach based on a sliding mode control consists of two stages. The first of these is the selection of variables in the state space, determining the area of sliding movement. The second one is designing a non-continuous feedback that may force the system to achieve a state on the defined sliding movement area in a finite time [52]. The issues related to the stability of these control systems were discussed in the studies [53,54]. However, a disadvantage of the sliding mode control is the occurrence of a vibration effect that is caused by the frequency of switching the control [55]. As a result of this, the sliding mode control is not used to control the functionality of BWS systems in rehabilitation equipment. Systems used to support the patient in accommodating loads are usually controlled with the use of proven methods, in particular PD, PI, or PID regulators. However, taking into account that active body weights support systems are underactuated mechanical systems, it seems beneficial to expand the standard feedback loop to a system with compensation, or an adaptive system. These approaches are commonly used for this class of devices [56][57][58][59]. Similar and interesting example of control the BWS systems is also the use of force sensorless admittance control [60].
However, the literature review shows that the stability of BWS systems has not been analyzed enough [61] and that they have only been verified experimentally.
This paper presents two concepts for controlling BWS systems and demonstrates their stability with the use of the dynamic model and Lyapunov's theory of stability. First, the authors present a control algorithm based on a mathematical model of the controlled object that provides a general basis for control with compensation from system dynamics. Next, an adaptive control algorithm is presented, whose application is justified by the mechanical properties of the controlled object. The object of research is a BWS system as a component of a mechatronic walking re-education device [62]. One of the key elements of this device is a polyester rope that connects the load between the system and the rehabilitant. The mathematical description of synthetic ropes is a highly complex problem and the existing modeling approaches to this issue require experimental testing [63]. Complex numerical modeling of ropes taking into account the individual fibers of the structure using the finite element method, similar to modeling composite materials, is also often used [64][65][66][67][68][69]. However, this approach makes it impossible to analyze the stability of the control system. As the parameters of synthetic ropes vary in time, the accuracy of rope models at a high number of loads is difficult to estimate [70,71]. Another problem is modeling the rope in a system where it passes through several pulleys. In order to simplify the model, the authors applied a widely used modeling process. This model omits the friction and sliding of the rope on the pulleys, does not take into account the differences in the tension of the rope on individual sections between pulleys and assumes linear characteristics of the rope, regardless of the number of load cycles. Adaptive systems that ensure good quality of control in spite of lack of knowledge or uncertainty of system parameters are well suited to such situations [72,73]. Therefore, the authors of the study developed and implemented an adaptive control algorithm, whose stability was demonstrated using Lyapunov's theory of stability. The functionality of the proposed control algorithms was tested and compared in simulation tests.

Physical Model of the Body Weight Support System
The main task of the BWS system is to maintain a constant supporting force for the whole duration of the exercise, including the upright standing of patients who use wheelchairs. Performing certain actions can involve significant vertical displacements of the patient's torso. During walking exercises these movements are not significant, but they may frequently occur. In order to ensure appropriate dynamics of the BWS system and a sufficient range of the vertical movement of the patient, patient relief systems are commonly equipped with two independent drive units: a rope drum drive and a drive that is responsible for minimizing the offset of the support force. A similar solution was used in the mechatronic walking re-education equipment that was tested for the purposes of this article. The BWS system is shown in Figure 2 and its detailed structure was presented in [30]. Next, an adaptive control algorithm is presented, whose application is justified by the mechanical properties of the controlled object. The object of research is a BWS system as a component of a mechatronic walking re-education device [62]. One of the key elements of this device is a polyester rope that connects the load between the system and the rehabilitant. The mathematical description of synthetic ropes is a highly complex problem and the existing modeling approaches to this issue require experimental testing [63]. Complex numerical modeling of ropes taking into account the individual fibers of the structure using the finite element method, similar to modeling composite materials, is also often used [64][65][66][67][68][69]. However, this approach makes it impossible to analyze the stability of the control system. As the parameters of synthetic ropes vary in time, the accuracy of rope models at a high number of loads is difficult to estimate [70,71]. Another problem is modeling the rope in a system where it passes through several pulleys. In order to simplify the model, the authors applied a widely used modeling process. This model omits the friction and sliding of the rope on the pulleys, does not take into account the differences in the tension of the rope on individual sections between pulleys and assumes linear characteristics of the rope, regardless of the number of load cycles. Adaptive systems that ensure good quality of control in spite of lack of knowledge or uncertainty of system parameters are well suited to such situations [72,73]. Therefore, the authors of the study developed and implemented an adaptive control algorithm, whose stability was demonstrated using Lyapunov's theory of stability. The functionality of the proposed control algorithms was tested and compared in simulation tests.

Physical Model of the Body Weight Support System
The main task of the BWS system is to maintain a constant supporting force for the whole duration of the exercise, including the upright standing of patients who use wheelchairs. Performing certain actions can involve significant vertical displacements of the patient's torso. During walking exercises these movements are not significant, but they may frequently occur. In order to ensure appropriate dynamics of the BWS system and a sufficient range of the vertical movement of the patient, patient relief systems are commonly equipped with two independent drive units: a rope drum drive and a drive that is responsible for minimizing the offset of the support force. A similar solution was used in the mechatronic walking re-education equipment that was tested for the purposes of this article. The BWS system is shown in Figure 2 and its detailed structure was presented in [30].   The BWS system is mostly used for maintaining a predefined support force while the patient is walking on a treadmill. Therefore, the main problem set by the authors was to verify the stability of algorithms used to control the operation of the BWS system during walking exercises. It should be noted that only one drive of the device is used during walking training, i.e., the series elastic actuator drive. The rope drum is activated generally when the patient is standing upright, or during exercises that involve significant vertical movement (squats, kneeling down, etc.). Thus, for the purposes of the research presented here, the rope drum drive was assumed to be inactive. The elements of the BWS system that play an important role during walking exercises are shown in Figure 3. In this drive, the servo motor (1) was connected to the propeller (2) with a pitch of h = 5 mm, which forces the first trolley to move (3) in the dynamic patient weight compensation system. One of the pulleys, which has a rope passing through it, was installed on the second trolley (5). Trolleys (3) and (5) are separated with springs (4) and can move linearly along the guiding rails (6). Hence, the movement of the second trolley depends on the sum of the forces acting on it as a result of the impact of springs and tension in the rope. The orthopedic harness that the patient wears is attached to one end of the rope. The other end is mounted in the rope drum, which is not shown in Figure 3.
Sensors 2021, 21, x FOR PEER REVIEW 5 of 31 The BWS system is mostly used for maintaining a predefined support force while the patient is walking on a treadmill. Therefore, the main problem set by the authors was to verify the stability of algorithms used to control the operation of the BWS system during walking exercises. It should be noted that only one drive of the device is used during walking training, i.e., the series elastic actuator drive. The rope drum is activated generally when the patient is standing upright, or during exercises that involve significant vertical movement (squats, kneeling down, etc.). Thus, for the purposes of the research presented here, the rope drum drive was assumed to be inactive. The elements of the BWS system that play an important role during walking exercises are shown in Figure 3. In this drive, the servo motor (1) was connected to the propeller (2) with a pitch of h = 5 mm, which forces the first trolley to move (3) in the dynamic patient weight compensation system. One of the pulleys, which has a rope passing through it, was installed on the second trolley (5). Trolleys (3) and (5) are separated with springs (4) and can move linearly along the guiding rails (6). Hence, the movement of the second trolley depends on the sum of the forces acting on it as a result of the impact of springs and tension in the rope. The orthopedic harness that the patient wears is attached to one end of the rope. The other end is mounted in the rope drum, which is not shown in Figure 3. Therefore, the system used to support a patients' body weight during walking exercises has three degrees of freedom. The physical model, together with the generalized coordinates used, is shown in Figure 4.
In this mathematical model of the system analyzed, two generalized coordinates are used, which are connected with the rotation angle of the rotor in the engine, and with the displacement of the pulley installed in the compensating system . Shifting the rope installation point to the patient's harness constitutes kinematic input. Therefore, the system used to support a patients' body weight during walking exercises has three degrees of freedom. The physical model, together with the generalized coordinates used, is shown in Figure 4.
In this mathematical model of the system analyzed, two generalized coordinates are used, which are connected with the rotation angle of the rotor in the engine, ϕ Z and with the displacement of the pulley installed in the compensating system x w . Shifting the rope installation point to the patient's harness constitutes kinematic input. Sensors 2021, 21, x FOR PEER REVIEW 6 of 31

Equations of Motion of the Body Weight Support System
The dynamic properties of the system are defined using differential equations of motion in the following form: where is the angular rotation of the drive motor shaft, is the displacement of the passive part of the system, is the reduced mass moment of inertia of the active part of the system, is the reduced mass of the passive part of the system, is the reduced resistance to the motion coefficient of the active part of the system, is the attenuation coefficient of the shock-absorbing system, is the modulus of elasticity of the shockabsorbing springs, is the modulus of elasticity of the rope, ℎ is the pitch of the ball screw thread in the drive system and is the drive torque. The equations of motion of the system are defined in form of the matrix:

Equations of Motion of the Body Weight Support System
The dynamic properties of the system are defined using differential equations of motion in the following form: where ϕ Z is the angular rotation of the drive motor shaft, x w is the displacement of the passive part of the system, I Z is the reduced mass moment of inertia of the active part of the system, m Z is the reduced mass of the passive part of the system, b Z is the reduced resistance to the motion coefficient of the active part of the system, b s is the attenuation coefficient of the shock-absorbing system, k s is the modulus of elasticity of the shockabsorbing springs, k l is the modulus of elasticity of the rope, h is the pitch of the ball screw thread in the drive system and M Z is the drive torque.
The equations of motion of the system are defined in form of the matrix: Sensors 2021, 21, 5051 7 of 31 using the following definitions: The equations of motion are then formulated in a more compact form: where M is the matrix of inertia, B is the matrix of attenuation coefficients, K is the matrix of elasticity modules, q is the vector of generalized coordinates, U is the control vector and ξ(t) is the disturbance vector. The Equations of motion (1) contain an expression that describes the reaction force of the elastic rope: This reaction force is the value that is to be calculated by using the system. Its determination, based on the co-ordinate x w , requires precise knowledge of the rope elasticity modulus, k l . Thus, the variables are transformed, so that x w , the coordinate from the equations of motion, is eliminated and the description of dynamic properties of the system is expressed as a function of force, F l .
Rope deformation is denoted as ∆ leading to the following equations: where Next, Equation (12) is multiplied by k l , giving In order to transform the description of the dynamic properties of the system into different variables, a new vector of coordinates is used and is referred to as the vector of task coordinates: It is assumed that all elements of Vector (14) are available for measurement. The following relation exists between the coordinates: In a compact matrix form, it may be presented as the relation between vectors θ and q in the following way: where The vector of generalized coordinates is determined from Equation (16): The notation is used to write Equation (19) in the form The derivatives of this equation are ..
Including Equations (21)-(23) in Equation (9), equations of motion were obtained and expressed in terms of task coordinates: Ordering the equation results in ME ..
With this approach, the description of the dynamic properties is presented in the form of a function comprising of the co-ordinate that describes the movement of the active part of the system and tension force of the rope. However, the variable describing the movement of the passive part of the system was eliminated, since it influences the tension force of the rope, but it is not the main object of interest in this paper. Equation (25) was presented in a more concise form: where and the physical description of the parameters is as follows: It is assumed that the parameters are the ranges of a constant. The formula m 2 ..
z p + k 2 z p corresponds to part of the system dynamics that is stimulated by the movement of the end of the rope. Knowledge of the parameters of the movement of the end of the rope enables us to take the formula into account, otherwise it may be treated as interference.
It should be noted that force F l is not controlled directly and that it is the variable that corresponds to the passive part of the system. The active, i.e., controlled, variable is ϕ Z . The system described belongs to the UMS class. As a result, the vector of task coordinates was decomposed as follows: where θ a is the vector of active coordinates and θ p is the vector of passive coordinates. In the case analyzed, these vectors take the following form: The matrix and vectors in Equation (26) are also decomposed in the following way: As a result, Equation (26) can be written in the form where Equations (26) and (44) will be used later in this article in the synthesis of system control.

Tracking Movement
In order to provide patient relief by using the device described in Section 2, it is necessary to calculate the force supporting the patient. Thus, the task of the control system is to track the movement of the trajectory. The task of performing tracking movements can be replaced with the task of stabilizing the error around the trajectory; this is a simpler issue from a mathematical point of view.
The trajectory set of the passive part of the system is defined as θ pd (t), which has continuous derivatives. It is also assumed that a trajectory exists for the active part of the system, θ ad (t), having continuous derivatives, i.e., . ..
The error in the calculation of the trajectory is defined as It may also be expressed in the form e = e T a e T p T , where e a and e p are the tracking errors of the active and passive parts of the system, respectively. The generalized tracking error was used: This may be expressed as s = s T a s T p T , where s a and s p are the generalized tracking errors of the active and passive parts of the system, respectively, and Λ is the matrix, where Λ = Λ T > 0. Matrix Λ may be written as follows: (51) can be broken down into further expressions: .
.. Equation (54) is included in Equation (26), resulting in the definition An auxiliary variable is defined as v = . θ d + Λe (56) and this is used in the definition of part of the system dynamics: resulting in M 1 Equation (58) describes the dynamic properties of the system as a function of the generalized tracking error. In this way, the problem of tracking the trajectory was transformed by the task of minimizing the tracking error.

Control Algorithm Based on the Mathematical Model
This section presents the control algorithm of the basic system, with the control law taking into account the dynamic properties described by the mathematical model. PD control was assumed, as well as perfect compensation control resulting from the description of system dynamics, i.e., where the f function is given by Equation (57) and PD control has the form where K D = K T D > 0. The K D matrix is a differential reinforcement matrix and K D Λ is a proportional reinforcement matrix. The K D matrix may be expressed as follows: where K Da = K T Da > 0 and K Dp = K T Dp > 0. At this stage, it was assumed that the f function is known, which means that the interference m 2 ..
z p + k 2 z p is also known. This requires the ability to measure the movement of the end of the rope generated by the patient. The f function given by Equation (57) was decomposed in the following way: where vectors Based on the decompositions of the vectors and matrices shown, the control (59) was expressed in the following form: giving The control vector U, given by Equation (65), has two component vectors; however, the second one, defined by Equation (67), is equal to zero. It is referred to as fictitious control, since it does not directly influence the movement of the passive part of the system. However, it describes the dynamic properties of part of the system, as it contains the f p function. This equation may be used to determine the trajectory of the active part of the system, whose calculation will ensure desirable behavior of the passive part, and, ultimately, the calculation of the trajectory θ pd . The detailed form of this equation is The vector of the velocity of the active part of the system was determined by Equation (68): It was assumed that matrix B 1pa is invertible. In the event that it is not a square matrix, the Moore-Penrose pseudoinverse should be applied, B + 1pa instead of B −1 1pa [74]. The velocity determined by Equation (69) was adopted as the set velocity of the active part of the system: Then, by integration and differentiation, the following is determined: ..
Equations (70)- (72) give the trajectory of the active part of the system and the purpose of the control system is to calculate this. The calculation of this trajectory will ensure the calculation of the trajectory of the passive part of the system, i.e., achieving the desirable tension force of the rope.

Stability of a Closed-Loop System
The stability of the closed-loop system, i.e., considering control, was demonstrated with the use of Lyapunov's theory of stability. Therefore, Lyapunov's function was used as a square form of the generalized tracking error: The The matrix of inertia M 1 is constant, hence . M 1 = 0, and the second part of function (74) equals zero. Considering the description of system dynamics in the form of Equation (58), the derivative of function L was written on system trajectories as Considering the form of vectors s, U and f, it was written using Equation (66). Function f p , determined by Equation (64), using Equation (69), gives Based on that, function (76) can now be written as As function L is positively defined in s space and the analysis performed demonstrates that the derivative . L is negatively semi-definite, according to Lyapunov's theory of stability, the variable s is limited. The application of Barbalat's lemma allows us to demonstrate that s converges to zero as a result of the convergence of error e to zero.

Discussion of Results
This approach requires setting the trajectory of the passive part of the system in time, which will constitute the basis for calculating the trajectory of the active part from Equation (70). The control law (66) enables the calculation of the trajectory of the passive part, i.e., obtaining the rope set tension force, because the dynamic properties of this part of the system have been taken into account in the trajectory of the active part. The calculation of the adopted control law requires knowledge of the parameters of the model (inertia, attenuation and elasticity), the state of the system (displacements and velocities) and interference.

Adaptive Control System
The main disadvantage of the control algorithm described in Section 5 is the fact that it requires thorough knowledge of the parameters of the mechanical system. Inaccurate knowledge of these parameters results in inaccurate control. Due to that, in this section, the authors introduce an adaptive control algorithm based on the mathematical structure of the mechanical system model. This algorithm does not require knowledge of the parameters of the object, which are being adapted during its operation.
The assumptions are that PD control and compensation control are generated by the adaptive controller, i.e., where PD control in the form K D s is described by Equation (60). Thef element approximates the f function given by Equation (57). The f function was decomposed according to Equation (62) and specific elements of this equation were written in linear form to the parameters, i.e., where Y a and Y p are the regression matrices and a is the vector of the model parameters.
Assuming that the parameter vector a is not exactly known, but the structure of the model is known, compensation control can be defined in the form: whereâ is the estimate of the parameter vector a. Based on the decomposition introduced, the control (79) was written in the following form: The first part of Equation (82), given by the relationship is the control of the active part of the system, while the expression is the fictitious control, as it does not directly influence the movement of the passive part of the system. Referring to the process described in Section 5, this equation was used to determine the trajectory of the active part of the system. The detailed form of Equation (84) is as follows: where theˆsymbol above matrices and vectors means that they are dependent on the estimates of parameters. The velocity vector of the active part of the system is determined from Equation (85): This is based on the assumption that matrixB 1pa is invertible. WhenB 1pa is not a square matrix, the Moore-Penrose pseudoinverse should be applied,B + 1pa instead of B −1 1pa [74]. The velocity given by Equation (86) was adopted as the set velocity of the active part of the system: By integrating and differentiating, the following was determined: ..
Equations (87)-(89) give the trajectory of the active part of the system, which is the purpose of the control system. This calculation will ensure the calculation of the trajectory of the passive part of the system, i.e., achieving the desirable rope tension force.
Note that the trajectory depends on the estimates of the model parameters. In the event that the adaptation of parameter estimates starts from zero, then the trajectory of the passive part of the system will be calculated with a large error in the initial phase of movement, in spite of the fact that the active part allows calculation of the trajectory. This error will diminish with the use of parameter estimates.

Stability of the Adaptive System
The stability of the closed-loop system was demonstrated with the use of Lyapunov's theory of stability. Therefore, Lyapunov's function was adopted as a square form of the generalized tracking error: where Γ is the matrix of adaptation reinforcement, such that Γ = Γ T > 0, e.g., Using the control Equation (82) and the decomposed form of the f function, it can be written as The expressionB 1pa . θ a was added and deducted in the matrix as below, to yield Using Equation (86), the expression in Equation (95) is written in the form B 1pa .
Then, function (95) can be rewritten in the following form: The law of model parameter adaptation is used in the form of a differential equation: Putting Equation (98) into Equation (97), the final result is obtained: As the function L is positively defined in the space of variable s and the conducted analysis demonstrates that the derivative . L is negatively semi-definite, according to Lyapunov's theory of stability, the variable s is limited. The application of Barbalat's lemma allows us to demonstrate that variable s is convergent to zero as a result of the convergence of error e to zero. The vector of parameter estimation error a is limited, but it was not proven that it converges to zero. However, this is not a problem for this work, since it is not the aim of this paper to control for parameter estimates to converge to actual parameters. It is acceptable if these parameters are limited.

Discussion of Results
This approach to the problem means that model parameter estimates are subject to change during the operation of the system. Tracking errors change the most in the initial phase of movement due to the mismatch of compensation control, so the PD regulator plays the main role. With the adaptation of parameter estimates, the quality of compensation control improves, which results in the lowering of tracking errors, thus reducing the signals generated by the PD regulator. It should be noted that the trajectory of the active part of the system is generated based on parameter estimates and, therefore, it is mismatched at the beginning of the movement; then, it is adjusted with the progressive adaptation. This influences the tracking errors of the passive part of the system. The calculation of the control law being used does not require knowledge of the parameters of the mathematical model (inertia, attenuation, elasticity) but only of the model structure. Knowledge of the state of the system (displacements and velocities) and interference is also necessary.

Simulation Research
Simulation tests consisted of simulating the behavior of the rehabilitation device based on the equations of movement and control laws discussed in previous sections. The data used for simulations are given in Table 1. The trajectory of the passive part of the system results from the medical support in reference to walking rehabilitation. Recommendations are that rehabilitated patients should be supported in order to enable them to focus on walking correctly. Therefore, the BWS system should maintain a constant rope tension, in spite of the vertical movement made by the patient's torso when walking. This is what determines the form of the trajectory of the passive part of the system.
For the tests, the interference resulting from the vertical movement of the patient's torso when walking was used. This was determined during experimental research in a rehabilitation center for patients who had suffered a stroke. The average trajectory of movement of their center of mass is described by the following equations: The interference is presented in Figure 5. It results in the fact that maintaining a constant rope tension requires controlling the movement of the active part of the system according to the trajectory that is generated on an ongoing basis during the device movement.
The interference is presented in Figure 5. It results in the fact that maintaining a constant rope tension requires controlling the movement of the active part of the system according to the trajectory that is generated on an ongoing basis during the device movement. The simulations considered both the presence and the absence of compensation for interference. Lack of such compensation means that control quality deteriorates. Compensation for the interference requires knowledge of the displacement, velocity and acceleration of the movement of the torso. Under real-life conditions, this requires using at least two sensors, a displacement sensor to determine the position of the torso and an accelerometer to measure its acceleration. The velocity may then be calculated by differentiation of the displacement in time or integration of acceleration. The problems that occur during such processing of the signal are commonly known. Differentiation leads to an increased share of noise in the signal, while integration causes signal drift. Therefore, both double differentiation and integration should be avoided. With reference to the above, the simulation tests included testing another approach, which took into account partial compensation of the interference that only requires knowledge of torso displacement. Such an The simulations considered both the presence and the absence of compensation for interference. Lack of such compensation means that control quality deteriorates. Compensation for the interference requires knowledge of the displacement, velocity and acceleration of the movement of the torso. Under real-life conditions, this requires using at least two sensors, a displacement sensor to determine the position of the torso and an accelerometer to measure its acceleration. The velocity may then be calculated by differentiation of the displacement in time or integration of acceleration. The problems that occur during such processing of the signal are commonly known. Differentiation leads to an increased share of noise in the signal, while integration causes signal drift. Therefore, both double differentiation and integration should be avoided. With reference to the above, the simulation tests included testing another approach, which took into account partial compensation of the interference that only requires knowledge of torso displacement. Such an approach is justi-fied by the fact that the velocity and acceleration of the torso are small and do not generate significant forces that would interfere with the tension force of the rope. Displacement, however, is of key importance. The simulation conditions are summarized in Table 2. Table 2. Variants of the simulated operating conditions of the rehabilitation device.

Variant 1
Total compensation of interference While walking, the rehabilitant uses a model movement given by Equation (101) and the kinematic parameters of the movement of the torso are known.

Variant 2
Partial compensation of interference While walking, the rehabilitant uses a model movement given by Equation (101) and the kinematic parameters of the movement of the torso are known.

Variant 3
Lack of compensation of interference While walking, the rehabilitant uses a model movement given by Equation (101) and the kinematic parameters of the movement of the torso are unknown.
The experiment tested the application of the control algorithm, based on the mathematical model, and of adaptive control. The equations describing the movement of the system, as well as control and adaptation laws used in the simulations, are presented in Appendix A. The main results are presented and discussed in this section, in order to compare methods. Figure 6 shows the line reaction force (trajectory of the passive part of the system) and the reaction force obtained for different variations of interference compensation using the analyzed control algorithms. Figure 6a shows the reaction force calculated by the control system based on the mathematical model, while Figure 6b shows the reaction force calculated by the adaptive model. approach is justified by the fact that the velocity and acceleration of the torso are small and do not generate significant forces that would interfere with the tension force of the rope. Displacement, however, is of key importance. The simulation conditions are summarized in Table 2.

Variant 1
Total compensation of interference While walking, the rehabilitant uses a model movement given by Equation (101) and the kinematic parameters of the movement of the torso are known.

Variant 2
Partial compensation of interference While walking, the rehabilitant uses a model movement given by Equation (101) and the kinematic parameters of the movement of the torso are known.

Variant 3
Lack of compensation of interference While walking, the rehabilitant uses a model movement given by Equation (101) and the kinematic parameters of the movement of the torso are unknown.
The experiment tested the application of the control algorithm, based on the mathematical model, and of adaptive control. The equations describing the movement of the system, as well as control and adaptation laws used in the simulations, are presented in Appendix A. The main results are presented and discussed in this section, in order to compare methods. Figure 6 shows the line reaction force (trajectory of the passive part of the system) and the reaction force obtained for different variations of interference compensation using the analyzed control algorithms. Figure 6a shows the reaction force calculated by the control system based on the mathematical model, while Figure 6b shows the reaction force calculated by the adaptive model. Each of the algorithms gives similar results for total and partial compensation of interference; the courses for variants 1 and 2 are almost identical. In these cases, the rope reaction force approaches the set value. In the variant without interference compensation, better results are obtained using the adaptive algorithm, since it tends to reduce control errors. Nevertheless, lack of knowledge of the interference has a decidedly negative influ- Each of the algorithms gives similar results for total and partial compensation of interference; the courses for variants 1 and 2 are almost identical. In these cases, the rope reaction force approaches the set value. In the variant without interference compensation, better results are obtained using the adaptive algorithm, since it tends to reduce control errors. Nevertheless, lack of knowledge of the interference has a decidedly negative influence on the rope reaction force, causing pulsation of the rope. The results presented confirm the thesis that considering torso displacement is of key importance from the point of view of interference compensation.
The total control signals are shown in Figure 7. For the first two variants of interference compensation, there are no significant differences between the overall control signals. In the variant without interference compensation, the course of control generated by the system based on the mathematical model is smoother than that for the adaptive model. In the latter case, control is characterized by rapid changes, particularly in the initial phase of operation. This is reflected in the course of tracking errors that are presented in Figures 8  and 9. (b) Figure 6. Rope reaction force: (a) calculated by the algorithm based on the mathematical model; (b) calculated using the adaptive algorithm.
Each of the algorithms gives similar results for total and partial compensation of interference; the courses for variants 1 and 2 are almost identical. In these cases, the rope reaction force approaches the set value. In the variant without interference compensation, better results are obtained using the adaptive algorithm, since it tends to reduce control errors. Nevertheless, lack of knowledge of the interference has a decidedly negative influence on the rope reaction force, causing pulsation of the rope. The results presented confirm the thesis that considering torso displacement is of key importance from the point of view of interference compensation.
The total control signals are shown in Figure 7. For the first two variants of interference compensation, there are no significant differences between the overall control signals. In the variant without interference compensation, the course of control generated by the system based on the mathematical model is smoother than that for the adaptive model. In the latter case, control is characterized by rapid changes, particularly in the initial phase of operation. This is reflected in the course of tracking errors that are presented in Figures  8 and 9.  The tracking errors do not differ significantly for total and partial interference compensation and for both control algorithms. However, for lack of compensation of interference in the adaptive model, tracking errors are characterized by relatively large fluctuations in the initial phase of system operation due to the mismatch of the compensation control based on the adapted parameters. Later, as the parameters are adapted, the fluctuations in tracking errors start to diminish. Unfortunately, this does not take place in the system based on the mathematical model. The tracking errors do not differ significantly for total and partial interference compensation and for both control algorithms. However, for lack of compensation of interference in the adaptive model, tracking errors are characterized by relatively large fluctuations in the initial phase of system operation due to the mismatch of the compensation control based on the adapted parameters. Later, as the parameters are adapted, the fluctuations in tracking errors start to diminish. Unfortunately, this does not take place in the system based on the mathematical model. Figure 10 presents the estimated parameters of the mathematical model without the compensation of disturbance. Values that deviate significantly from those used in the model of the system resulting from theoretical estimation were used as the initial values of estimated parameters. This simulated the operation of the control algorithm in an actual case when there is an uncertainty of the parameters. According to the proof, parameter estimates remain limited.

Experimental Results
The experiments involved tests of the rehabilitation device with the use of a control system based on the mathematical model and adaptive control system. Data used in the experimental research are presented in Table 3.

Experimental Results
The experiments involved tests of the rehabilitation device with the use of a control system based on the mathematical model and adaptive control system. Data used in the experimental research are presented in Table 3. The trajectory of the passive part of the system foresees a phase of tightening the rope, supporting the weight of the patient with a constant force while walking, and a phase of releasing the rope. Smooth changes in the rope tension force should ensure a comfortable interaction between the device and the patient. The given supporting load is described by the function where F 0 is the constant component of the force with low value that ensures constant tension of the rope and harness supporting the patient, F d is the value of the variable component of the force, c is the coefficient that is responsible for the pace of changes in the force in the rope tightening and releasing phases and t 1 and t 2 are the times of rope tightening and releasing, respectively. The experimental tests took into account the compensation of disturbances in the variant that involves the measurement of the patient's torso ( Figure 11). Figure 12 shows the set rope reaction force (trajectory of the passive part of the system) and the tension force obtained for two variants of the analyzed control algorithms. For the adaptive algorithm, the line tension force is more consistent with the set force. The maximum error from the set value of the force while walking did not exceed 15 N. This result is better in comparison with commercially used devices and comparable with the results obtained in newly published research works. For an algorithm based on a mathematical model, this error was about 25 N. Accurate maintenance of the set force value is impossible in this type of devices, due to the vertical displacements of the torso during walking. The oscillations around the set value visible in the graphs are caused by exactly the movements of the torso, which we interpret as disturbances. Figure 13 shows the trajectory of the active part of the system, i.e., the rotation angle of the motor shaft. The set trajectories differ slightly for each algorithm, because they are generated on an ongoing basis, depending on the trajectory of the passive part.
where is the constant component of the force with low value that ensures constant tension of the rope and harness supporting the patient, is the value of the variable component of the force, is the coefficient that is responsible for the pace of changes in the force in the rope tightening and releasing phases and and are the times of rope tightening and releasing, respectively.
The experimental tests took into account the compensation of disturbances in the variant that involves the measurement of the patient's torso ( Figure 11). Figure 12 shows the set rope reaction force (trajectory of the passive part of the system) and the tension force obtained for two variants of the analyzed control algorithms. For the adaptive algorithm, the line tension force is more consistent with the set force. The maximum error from the set value of the force while walking did not exceed 15 N. This result is better in comparison with commercially used devices and comparable with the results obtained in newly published research works. For an algorithm based on a mathematical model, this error was about 25 N. Accurate maintenance of the set force value is impossible in this type of devices, due to the vertical displacements of the torso during walking. The oscillations around the set value visible in the graphs are caused by exactly the movements of the torso, which we interpret as disturbances. Figure 13 shows the trajectory of the active part of the system, i.e., the rotation angle of the motor shaft. The set trajectories differ slightly for each algorithm, because they are generated on an ongoing basis, depending on the trajectory of the passive part. Figure 11. Disturbance of the system-displacement of the patient's torso.    The total control signals are presented in Figure 14. The highest amplitudes of signals were noted in the transition phases, i.e., during tightening and releasing of the rope. This results from the highest values of tracking errors in these periods ( Figure 15). Tracking errors are noticeable lower when the adaptive algorithm is used, in particular a few seconds after starting the system, because the control system has adapted the parameters. The estimated parameters of the mathematical model in the adaptive system are presented in Figure 16. Values that resulted from theoretical calculations were used as the initial values of estimated parameters. The total control signals are presented in Figure 14. The highest amplitudes of signals were noted in the transition phases, i.e., during tightening and releasing of the rope. This results from the highest values of tracking errors in these periods ( Figure 15). Tracking errors are noticeable lower when the adaptive algorithm is used, in particular a few seconds after starting the system, because the control system has adapted the parameters. The estimated parameters of the mathematical model in the adaptive system are presented in Figure 16. Values that resulted from theoretical calculations were used as the initial values of estimated parameters. adaptive algorithm.
The total control signals are presented in Figure 14. The highest amplitudes of signals were noted in the transition phases, i.e., during tightening and releasing of the rope. This results from the highest values of tracking errors in these periods ( Figure 15). Tracking errors are noticeable lower when the adaptive algorithm is used, in particular a few seconds after starting the system, because the control system has adapted the parameters. The estimated parameters of the mathematical model in the adaptive system are presented in Figure 16. Values that resulted from theoretical calculations were used as the initial values of estimated parameters.    According to the proof of stability, parameter estimates remain limited. Tracking errors are also limited, but not asymptotically convergent to zero, because the real-life system will always be burdened with interferences. As a result, tracking errors may, at the best, be near to zero. The designed control system strives to maintain the set force regardless of the torso movement of the rehabilitated patient. This has its advantages, as it ensures body weight support with a set force. However, it may also have some disadvantages. For example, if the rehabilitated patient is unable to stand on their own and start to sit down, the system will be unable to prevent it, as it cannot compensate for the total body weight of a human. This is illustrated in Figure 17.
As it can be seen in Figure 17b, the patient's torso lowers significantly in the 10-15th seconds, while the rope tension force (Figure 17a) is maintained on the set level. The designed control system strives to maintain the set force regardless of the torso movement of the rehabilitated patient. This has its advantages, as it ensures body weight support with a set force. However, it may also have some disadvantages. For example, if the rehabilitated patient is unable to stand on their own and start to sit down, the system will be unable to prevent it, as it cannot compensate for the total body weight of a human. This is illustrated in Figure 17. As it can be seen in Figure 17b, the patient's torso lowers significantly in the 10-15th seconds, while the rope tension force (Figure 17a) is maintained on the set level.

Conclusions
The authors of the study developed and tested two algorithms to control a BWS system. The algorithms are stable, which is particularly important if the device is applied for human rehabilitation. Their stability was proven theoretically and illustrated by simulation and experimental test results.
Two control algorithms are proposed in the paper. Both are based on a mathematical model; one requires knowledge of the model structure and parameters and the other (adaptive) requires only knowledge of the model structure. In the case under consideration, factors such as the computational complexity of the algorithm, or the measurement availability of the variables describing the system were not a challenge. A stationary

Conclusions
The authors of the study developed and tested two algorithms to control a BWS system. The algorithms are stable, which is particularly important if the device is applied for human rehabilitation. Their stability was proven theoretically and illustrated by simulation and experimental test results.
Two control algorithms are proposed in the paper. Both are based on a mathematical model; one requires knowledge of the model structure and parameters and the other (adaptive) requires only knowledge of the model structure. In the case under consideration, factors such as the computational complexity of the algorithm, or the measurement availability of the variables describing the system were not a challenge. A stationary rehabilitation device can be equipped with any number of sensors and a system ensuring real-time calculations. For this reason, when selecting the control algorithm, it was taken into account that there are many mathematical formalisms to describe the dynamics of mechanical systems, ensuring the correct structure of the model.
As a result of applying a passive shock absorbing system, the controlled device belongs to the UMS class. Controlling such systems is a complex issue, even more so as the aim is to control the force in the passive part of the system, not the position, as usually happens in UMS systems. Additionally, one of the components of the device is a rope, which only carries a tensile load, so it has to remain taut all the time. If the rope is not taut, the simulation results would not reflect the actual functionality of the system. The results presented in Figure 6 demonstrate that the line reaction force is higher than zero for the time greater than zero, so the rope remains taut.
The control laws presented enable the realization of the force in spite of the fact that one of the elements is passive, because the trajectory of the active element takes into account the dynamic properties of the passive element. The calculation of the control laws used requires knowledge of the model structure and state of the system. The research conducted demonstrates that knowledge of the torso displacement enables very good compensation of interference caused by human motion. In this case, the system trajectory is comparable to the trajectory for full compensation of interference. This result enables a simple system to be used to measure the vertical displacement of the torso in a real-life situation.
Verification tests were also performed on an actual rehabilitation station, including selecting control system parameters and testing algorithms for various interferences caused by human motion. The conducted tests demonstrate that the device realizes the control purpose, which is to maintain the set rope tension, thus, the set weight support force, very well. However, due to certain safety reasons, it is required that the device should be able to increase the weight support force in cases when the human torso is excessively lowered. This will protect the rehabilitated patient from falling down. Due to that, further research will be conducted in order to develop a control algorithm that will realize the set force supporting body weight and support torso displacement according to the adopted movement pattern at the same time.
Funding: This work was financially supported by statutory funds from the Faculty of Mechanical Engineering of the Silesian University of Technology in 2021.

Institutional Review Board Statement: Not applicable.
Informed Consent Statement: Informed consent was obtained from all subjects involved in the study.

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