2.1. The HzMAT optimal to the rest-to-rest orientation system
Based on Equation (3), the quadratic cost function is considered, and identify that the F in Equation (4) represents a dynamic cost in the system which is generated by the quadratic cost. Therefore, the dynamics or running cost presents the link relation between the quadratic cost and dynamic system constraint. Equation (10) is the quadratic cost function:
The f in the Hamiltonian condition is a dynamic constraint in the system. External control in the dynamics depends on the costate, state, and time. The costate represents the sensitivity of the system to perturbations and the states represent the current physical state of the system. Additionally, time is also a critical factor in external control since the time determines the duration of the control action and influences the overall performance of the system. Equation (11) displays the relationship between the dynamics and these factors.
Equation (11) provides insight into the relationship between the dynamic’s constraint and states. Equation (12) shows that the detail of dynamic constraint, represented by f in the Hamiltonian, influences the evolution of the state variables over time. The dynamic constraint is simplified by expressing the constraints as a set of equations that maintain the simplest structure, consisting of a first derivative and a derivative-free function.
For each state variable in the system, there is a corresponding costate variable, which represents the sensitivity of the system’s performance to perturbations in that state variable. Therefore, the Hamiltonian condition function is a combination of dynamic cost and dynamic constraints by Lagrangian, which include both the state and costate variables.
Based on Equation (5), the result of the partial derivative of the Hamiltonian condition functions with respect to the control value is calculated.
Therefore, referring to Equation (6), the adjoint equations in this condition are available. Equations (15) and (16) obtained by taking the partial derivative of the
and
using the Hamiltonian function are:
Table 4.
Table of proximal variable definitions.
Table 4.
Table of proximal variable definitions.
| Variable |
Definition |
|
The torque from the controller |
|
The Lagrangian about |
|
The Lagrangian about |
|
The derivative about the lagrangian |
|
The derivative about the lagrangian |
Equations (15) and (16) establish the relationship between the Lagrangian and constant through integral operation, while equations (17) and (18) demonstrate the obtained result:
where a and b are both constant.
By combining Equations (17) and (18), a straightforward relationship between control and time can be derived in Equation (20).
Integrate these equations and obtain the optimal control for both velocity v and angle
.
where a, b, c, and d are unknown constants.
Equations may contain unknown constants, therefore constructing a solvable equation needs to base on time and control. The solution to the equation requires the specification of boundary conditions. After satisfying these conditions, a time-optimal control under the given conditions is available.
Due to the boundary condition in Equation (2), the control function with respect to time from Equation (19) to (21) is displayed in Equation (23), (24) and (25):
Table 5.
Table of proximal variable definitions.
Table 5.
Table of proximal variable definitions.
| Variable |
Definition |
| t |
Time (dimensionless) |
|
a, b, c
|
Constants of integration |
2.2. The introduction of six control architectures
2.2.1. Open loop controller with the result of the HzMAT optimal analysis
By utilizing the optimal analysis result from the HzMAT with equation (22) as input, the ideal output for both theta and angular velocity can be derived through double integrator translation control. The control architecture is depicted in
Figure 3:
Figure 2.
Open-loop controller structure.
Figure 2.
Open-loop controller structure.
Figure 3.
P+V feedback controller structure.
Figure 3.
P+V feedback controller structure.
2.2.2. P+V feedback controller
Due to the feedback system, an ideal target (shown in
Figure 4) is set and the error between the target and the output theta can be calculated. The error is then multiplied by
and added to Kv times the output speed, forming the system input. After passing through the double integrator, the system provides output values for both theta and speed, which are then fed back into the input, completing the feedback loop.
Figure 4.
RTOC controller structure.
Figure 4.
RTOC controller structure.
The values of Kv and Kp used in this system are tuned based on the analysis of oscillation. the system’s steady state can be set as and . Where is the angular speed obtained from oscillation analysis, and is a parameter related to the system’s running time.
Table 6.
Table of proximal variable definitions for Figure 3 and 4.
Table 6.
Table of proximal variable definitions for Figure 3 and 4.
| Variable |
Definition |
|
The desired angle |
|
The position output |
| Kv |
A proportional value for P+V control |
| Kp |
A proportional value for P+V control |
| x |
System states |
|
The derivative of states |
|
The velocity output |
|
The actual velocity (the velocity output with the noise) |
|
The actual angle (the position output with the noise) |
|
The noise from the position sensor |
|
The noise from the velocity sensor |
2.2.3. Real-time optimal controller (RTOC)
RTOC is a real-time controller (shown in
Figure 5) that utilizes the HzMAT optimization with different boundary conditions. The HzMAT analysis can provide reference equations like equations (20), (21), and (22). Various final boundary conditions can help to solve the values of a, b, c, and d. These values will be utilized to determine the control u and subsequently calculate the output position and speed of the system. But in this manuscript, time, position, and velocity limitations keep the same for easy comparison.
Figure 5.
P+V feedback controller with double integrator patching filter.
Figure 5.
P+V feedback controller with double integrator patching filter.
2.2.4. P+V feedback control with double-integrator patching filter.
In the P+V feedback controller, a patching filter is introduced to optimize the basic target and enhance the system’s input to approach the ideal target. In the patching filter, there is a simple double integrator (shown in
Figure 6) that closely represents the dynamics of the open-loop plant. The
Kp and
Kv parameters remain unchanged.
Figure 6.
P+V controller with Control law inversion patching filter structure.
Figure 6.
P+V controller with Control law inversion patching filter structure.
| Variable |
Definition |
| s |
Complex variable for Laplace Transform |
|
The desired transformed angle |
|
The desired torque input |
|
The velocity output |
|
The position output |
|
The actual velocity (the velocity output with the noise) |
|
The actual angle (the position output with the noise) |
|
The noise from the position sensor |
|
The noise from the velocity sensor |
2.2.5. Gain-tuning P+V controller with double-integrator patching.
This control architecture still utilizes the P+V feedback control structure, complemented by a double integrator patching filter. However, the Kp and Kv parameters have been updated with brand-new values that are tested to improve the system’s ability to approach the ideal target. After careful selection and tuning, the Kp and Kv are set to 400 and 3, respectively.
2.2.6. P+V controller with Control law inversion patching filter.
This controller architecture is like the previous structure, with the primary difference being the use of a control law inversion patching filter. To achieve the HzMAT optimal control with the P+V controller, the input must be designed to be close to the final output.
Table 8.
variables definitions.
Table 8.
variables definitions.
| Variables |
Definitions |
Variables |
Definitions |
|
The desired angle |
|
The input of the control structure (angle) |
|
The actual angle |
|
The output of the control structure (control) |
|
The desired control |
Kv |
A proportional value for P+V control |
| u |
The actual control |
Kp |
A proportional value for P+V control |
As a reminder, the closed-loop control law is displayed in the equation (25):
Also, equation (25) can be written as equation (26) and (27). Equation (27) represents the ideal outcome of equation (26).
For the double integrator plant, equation (28) is the same as equation (27):
Equation (28) may be written in the s-domain based on Laplace Transform as
Therefore, an alternative patching filter is shown in the equation (30):
The control structure is displayed in
Figure 7:
Figure 7.
MATLAB® integration solver iteration with time on the abscissa and position and velocity on the ordinant. (a) the trajectory under the ode1 and step 0.01. (b) the trajectory under the ode4 and step 0.01. (c) the trajectory under the ode4 and step 0.0001.
Figure 7.
MATLAB® integration solver iteration with time on the abscissa and position and velocity on the ordinant. (a) the trajectory under the ode1 and step 0.01. (b) the trajectory under the ode4 and step 0.01. (c) the trajectory under the ode4 and step 0.0001.
Table 9.
Table of proximal variable definitions for Figure 7.
Table 9.
Table of proximal variable definitions for Figure 7.
| Variable |
Definition |
| s |
Complex variable for Laplace Transform |
| Kv |
A proportional value for P+V control |
| Kp |
A proportional value for P+V control |
|
The actual velocity (the velocity output with the noise) |
|
The actual angle (the position output with the noise) |
|
The noise from the position sensor |
|
The noise from the velocity sensor |
2.3. The MATLAB® solver selection
In the Simulink system, the solver plays a crucial role in determining the trajectory of the position and speed variables. Thereby the solver affects the accuracy and precision of the results. Therefore, selecting the appropriate solver and step size carefully for the analysis of the controllers’ performance is essential.
For the purposes of this manuscript, using an open-loop controller to evaluate the solver is convenient. When ode1 with a step size of 0.01 is tested, the resulting trajectory appears in
Figure 8 (a). To obtain more accurate results, using a different solver as a comparison is significant, such as ode4 with a step size of 0.01 whose trajectory is displayed in
Figure 8 (b). To further improve the accuracy and precision of the results, reducing the step size to 0.0001 is also an option, The objective trajectory with a step size of 0.0001 is shown in
Figure 8 (c).
Figure 8.
MATLAB® simulations with no noise with time on the abscissa and position and velocity on the ordinant. (a) The trajectory from the open loop. (b) The trajectory from the P+V controller. (c) The trajectory from the RTOC.
Figure 8.
MATLAB® simulations with no noise with time on the abscissa and position and velocity on the ordinant. (a) The trajectory from the open loop. (b) The trajectory from the P+V controller. (c) The trajectory from the RTOC.
The conclusion based on the trajectory of ode1 with a step size of 0.01 is obvious that the final angular speed fails to satisfy the rest-to-rest condition. As a result, ode1 may not be the optimal choice for our analysis. After switching to the ode4 solver, the final boundary condition appears to be better satisfied in
Figure 8 (b). Switching to the ode4 solver with a step size of 0.0001 did not significantly improve the final boundary condition. However, the running time increased significantly.
Table 10.
The performances of the open-loop system with different solvers and step length.
Table 10.
The performances of the open-loop system with different solvers and step length.
| Solver and step length |
End position |
End velocity |
Computational runtime |
Quadratic cost (vehicle fuel usage) |
| Ode1 solver with 0.01 step length |
1.0296 |
|
1.1338 |
6.0012 |
| Ode4 solver with 0.01 step length |
1 |
|
1.0502 |
6 |
| Ode4 solver with 0.0001 step length |
1 |
|
4.3162 |
6 |
To find a compromise between accuracy and efficiency, using the ode4 solve with a step size of 0.01 is an ideal option for the simulation. This should provide reasonably accurate results while also maintaining a manageable running time.