8/14/2019 Gearshift Mechanism Nonlinear Torque Control
1/59
BACKSTEPPING TORQUE CONTROL FOR
CYLINDRICAL CAM IN SEQUENTIAL TYPE GEAR
SHIFT MECHANISM
By
PRIYANSHU AGARWAL
DECEMBER 2009
Department of Mechanical and Aerospace Engineering
State University of New York at Buffalo
Buffalo, New York 14260
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
2/59
i
Abstract
Faster and efficient gear shifts have always been the demand of automobile industry. Be
it an automatic transmission having distinctly low efficiency or an automated manual
transmission with combined benefits of automatic and manual gearboxes, the
phenomenon of gear shift has always been the area of interest. Sequential type gear shift
mechanisms have been increasingly employed in automated manual transmissions due to
their suitability to readily available (rotary) actuators. However, there is a dearth of
published literature addressing the issue of modeling the dynamics of the system and
developing a torque controller for such a gear shift mechanisms. The objective of this
work is to first model the dynamics of the mechanism and then to design a controller for
governing the torque applied on the cylindrical cam for the given mechanism parameters
and time varying reference input. Both the issues i.e. reducing shifting time and
improving efficiency of shifting can be addressed by the successful implementation of
such a torque controller.
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
3/59
ii
Acknowledgement
I am highly thankful to Professor Tarunraj Singh for his support during the execution of
this work. Not only did he equip me with the technical skills required to deal with the
challenges involved in the problem, but his motivating examples of the work done by
some of the brilliant students from previous batches proved to be a constant source of
motivation for accomplishing this work.
Finally, I am also thankful to my colleagues in the course of Applied Nonlinear Control
who had technical discussions at times on the subject and always motivated me to explore
the unexplored.
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
4/59
iii
Contents
Abstract
Acknowledgement
Contents
List of Symbols
1 Introduction1.1 Motivation
1.2 Necessity of Torque Control1.3 Problem Formulation
1.4 Challenges Involved
1.5 Report Organization
2 Background2.1 Mechanism description
2.1.1 Purpose
2.1.2 Construction
2.1.3 Working
2.2 Existing Controllers
3 Mathematical methods3.1 Mathematical Modeling
3.1.1 Fork Cantilever Beam Analogy
3.1.2 Drum Dynamics Equations
3.1.3 Fork Free Body Diagram
3.2 Governing Differential Equation and State-Space Representation
3.2.1 Governing Equation
3.2.2 System Analogy3.2.3 Shift Force Behavior
4 Implementation4.1 Basic Controller
4.1.1 Backstepping Control Law Derivation
4.1.2 Standard Least Squares Estimator
4.2 Tracking Controller
4.2.1 Backstepping Control Law Derivation
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
5/59
iv
4.3 Actual Controller
4.3.1 Backstepping Control Law
4.3.2Standard Least Squares Estimator4.3.3 State Estimator (Integrator)
4.4 Model Linearization for Parameter Estimation
4.5 Standard Least Squares Estimator with Linearized Model
5 Results5.1 Basic Controller
5.1.1 Simulation with known Coefficient of Friction
5.1.2 Simulation with unknown Coefficient of Friction
5.2 Tracking Controller
5.2.1 Simulation with known Coefficient of Friction5.2.2 Simulation with unknown Coefficient of Friction
5.3 Actual Controller
5.4 Virtual Reality Simulation
6 DiscussionBibliography
Appendix
A.1 MATLAB code for solving equations involved in the Mathematical Model of
the Dynamics of the Gearshift Mechanism
A.2 MATLAB code for Basic Controller with parameter estimation and
asymptotically stabilizing origin (Known Coefficient of Friction)
A.3 MATLAB code for Tracking Controller with parameter estimation and
reference output tracking (Known Coefficient of Friction)
A.4 MATLAB code for Final Controller with parameter and state estimation,
noise, reference output tracking and Virtual Reality Simulation. (Known
Coefficient of Friction)A.5 MATLAB code for Basic Controller with parameter estimation using
linearized model for asymptotically stabilizing origin (Unknown Coefficient of
Friction)
A.6 MATLAB code for Tracking Controller with parameter estimation and
reference output tracking (Unknown Coefficient of Friction)
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
6/59
1
Chapter 1
Introduction
The problem of control of a gearshift mechanism in an automated manual transmission is a challenging
problem. Apart from developing a mathematically accurate model of the mechanism, the biggestchallenge towards developing a perfect controller is the lack of repeatability in the process of gearshift
itself. Every time a gearshift is effected there are numerous parameters involved in deciding the exact
effort required for the gearshift mechanism to bring this change. There are parameters that are constantand are inherently locked in the geometry of the components of the mechanism. And there are the ones
that vary with vehicle speed, gearshift mode, road load etc. And this becomes increasingly true for a
sequential type gearshift mechanism in an automated manual transmission where the lack of appropriate
control can lead to either quick wear of drive-train components such as clutch or synchronizers in caseof a synchromesh transmission.
1.1 MotivationThe direction, position and velocity of the fork during the shift can be governed by appropriate design and
control of the mechanism. What makes a mechanism proficient in gearshift is the ease with which it canachieve the required dynamically varying force on the shift fork during gearshift. However, what makes
designing a controller for the mechanism difficult is the fact that the phenomenon of gearshift lasts for afraction of a second. This demands that the response time of the controller be extremely low. Thus, there
exist apparently irreconcilable requirements for the controller to achieve all these objectives. This calls for adetailed study of the dynamics of the mechanism to make the system more amenable to control by
developing better controllers. The development of a controller in the context of sequential type mechanism becomes more important due to the inherent suitability of the mechanism for automation due to readily
available rotary actuators.
Figure 1-1 Gearshift mechanism as a component of the drive-train
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
7/59
2
1.2 Necessity of Torque ControlThe following are the reasons why torque control of a gearshift mechanism becomes an absolute
necessity:
1. It will help in faster, more efficient and smoother gear shifts.2. There exists a dynamically varying force demand on Gearshift Forks.3. The extremely low gear shift time demands very-high response.4. There is also a variation of torque requirement between different gears.5. The mechanism has variation of torque requirement within same gear with variation in driving
conditions (vehicle speed, gear shift mode etc.).
1.3 Problem FormulationThe objective is to design a controller for governing the torque applied on the cylindrical cam of a
sequential type gear shift mechanism in presence of parametric uncertainties for the following given
inputs:Mechanism Parameters (dimensions and friction coefficients)Reference signal (in the form of output or states of the system) as a function of timeThe problem of designing a controller can be divided into two categories:
1. Controller to asymptotically stabilize the origin of the system states.2. Controller for tracking a given feasible trajectory. This requires zero tracking error to be an
equilibrium.
The report deals with both the type of controllers along with means to handle parametric uncertainty inthe model dynamics. However, the report does not deals with the optimization of the controller gains
which is necessary to ensure performance.
Both the issues i.e. reducing shifting time and improving efficiency of shifting can be addressed by the
successful implementation of such a torque controller.
Figure 1-2 Basic control block diagram
The system represented in Figure 1-2 illustrates the basic control block diagram of the system.
1.4 Challenges InvolvedThe following are the challenges involved in designing a controller for the gearshift mechanism:
1. Mathematical Modeling of the Dynamics of the Mechanism
Gearshift Mechanism
DynamicsController
Estimator
Reference
Signal
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
8/59
3
A mathematical model need to be developed that can accurately represent the dynamics of the system.
The model will incorporate the effects of friction between various components. The presence of friction
makes the system highly nonlinear.
2. Model Parameter UncertaintiesThe model involves parameters such as sleeve force spring and damping coefficients that are not knownbeforehand and has to be estimated online. The presence of such uncertainties makes the controller and
estimator to run in tandem and still perform satisfactorily.
3. Controller DesignA controller that can handle the highly nonlinear system yet ensure successful tracking of reference
signal need to be developed. Also, in absence of a reference model some kind of a self-tuning techniqueneed to be employed for controlling the torque.
1.5 Report Organization
Chapter 1 deals with an introduction of the problem targeted in this work.
Chapter 2 deals with a basic overview of the mechanism.
Chapter 3 discusses the mathematical development involved in modeling the dynamics of the system.
Chapter 4 presents the various controllers developed for torque control.
Chapter 5 documents the results obtained by simulating the controllers developed.
Chapter 6 discusses the various results and concludes with the possible future work.
Appendix A contains a MATLAB code for the various controllers developed for the torque control ofthe sequential type gearshift mechanism.
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
9/59
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
10/59
5
Shift Lever-1 (Guitar shaped with a welded splined shaft)
Shifter Lever-2 (Cross Lever)
Torsion Spring
Tension Spring
The drum, fork rail and splined shaft with shift lever-1 are supported in the casing. The shift lever-1 and shiftlever-2 are assembled along with the springs as shown in Figure 1 a). The star wheel is attached to the drum
with the help of a bolt and the drum is free to rotate about its axis. The drum is provided with grooves on itscircumference. Furthermore, the fork is provided with a lug that protrudes from its head. The lug on the fork
engages in the groove on the drum. The Fork legs rests on the gear collar (not shown in figure) and the forkis constrained to move axially on the fork rail. In addition to this, the star wheel is provided with projected
lugs on its front face on which the shift lever-2 rests. Shift lever-2 is connected to shift lever-1 through arevolute joint and tension spring between the two ensures that the shift lever-2 maintains contact with the star
wheel lugs. A torsion spring is provided on shift lever-1 to reposition the lever after shifting the gear to itsoriginal position. The entire assembly is inside a transmission casing. Figure 1 b) shows the automated
version of the same mechanism. In this case the drum is rotated using a motor through gearing. The detentlever is provided to keep the drum stationary on each engaged gear position.
2.1.3 WorkingThe shift lever-1 is rotated with the help of a push-pull type cable. As shift lever-1 rotates, it rotates shift
lever-2 which in turn rotates the star wheel. Since, the star wheel is rigidly connected with the drum, thedrum is also indexed by the same angle. The configuration of the two levers and star wheel is such that the
system is always indexed by a fixed angle for one stroke of the shift levers. Due to this fixed rotation of thedrum the forks engaged in the grooves on the drum surface move axially on the fork rail by a fixed distance.
This axial movement of the fork leads to the axial movement of the shifting sleeve which leads to shifting ofthe corresponding gear. The fact to be noted here is that a single fork is manipulated by the mechanism
during a gearshift under load. The magnitude and pattern of required drum torque governs the gearshift feelin the manual version. However, the main concern in the automated version is minimization of the peaktorque due to actuator size limitations.
2.2 Existing Controllers
Figure 2-2 Gearshift Mechanism used in Mercedes Smart Fortwo.Though there are few products in the market that implement automated gearshift in the context of
synchromesh transmissions using sequential type gear shift mechanism. However, the reluctance of theirdevelopers to disclose the details of the mechanism and its control has led to unavailability of published
literature that can be referred. Also, whether such controllers handle parametric uncertainty is not known.
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
11/59
6
Chapter 3
Mathematical Methods
This chapter deals with the development of the mathematical model for the dynamics of the gearshiftmechanism. Free body diagrams are developed for the various components in the mechanism and finally
a differential equation governing the dynamics of the system is obtained.
3.1 Mathematical ModelingThe objective of the mathematical model and the assumptions involved are as follows:
Objective: To develop a differential equation that can represent the dynamics of the mechanism. More precisely, to develop a relationship that can relate the torque applied on the cylindrical cam with its
angular acceleration and the axial force resisting this motion applied on the fork.
Assumptions:
1. While gearshift both the fork legs make continuous contact with the gearshift sleeve. This ensures thatwhen the fork is loaded both the legs experience equal deformation in axial direction. This is indeed
critical for the gearshift sleeve, as differential loading might tilt the sleeve and can even increase the fork
required to shift it during a gearshift. This assumption neglects the influence of variation of tolerancesinvolved during manufacturing of components.
2. The fork lug is always in contact with the drum groove wall. This assumption signifies that the model
does not take into account any nonlinearity in terms of contact between the fork and the drum. So, anyunique position of the drum signifies unique position of the fork provided that the drum groove
geometry is known.
3. Drum bearings have no frictional losses. This ensures no frictional moment is acting to diminish theapplied torque on the drum.
4.All bodies are rigid. No deformation of the bodies involved in the system is considered.5.Both the fork legs have same area moment of inertia. Though the moment of inertia of the fork legswill differ and will also vary with the distance from the fork center line. In order to avoid complexities,
the influence of these parameters on force distribution among the two fork legs has been neglected.
6.The coefficient of friction is same for all contacts. Usually the coefficient of friction between thecomponents is that of standard lubricated steel to steel contact. However, at times the fork is fixed with
the rail in which case the fork rail slides in the transmission casing which is usually a pressure die-castedaluminum component.
Figure 3-1 represents a simplified model of the mechanism to be used for developing the mathematical
model of the system. The torque TD is acting on the drum due to which drum experiences an angular
acceleration of which in turn accelerates the fork by . The gearshift sleeve also offers a force of Ffa1and Ffa2on the two fork legs which amounts to the total force acting on the fork axially.
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
12/59
7
Figure 3-1 Simplified representation of the mechanism with external forces & moments acting on it
3.1.1 Fork Cantilever Beam Analogy
According to this analogy the fork leg is considered to be a simple cantilever beam which bends in the
presence of an external load. Figure 3-2(a) represents the formula for the maximum deflection of acantilever beam. It can be easily seen that for a given deformation the load acting on the beam isinversely proportional to the cube of the length of the beam.
As per the above mentioned analogy the two fork legs can be represented as two cantilever beams whichundergo same deflection under load. The condition of equal deflection comes from the assumption that
the two legs make continuous contact with the gearshift sleeve. So, the distribution of axial force on fork
legs is considered to be inversely proportional to the cube of their arm lengths from rail center line.
Hence, the fork acting on the fork can be distributed on the two legs accordingly.
(a)
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
13/59
Figure 3-2
deflectionrepresenta
Considerin
(1
2
1
faF =
The dimen
3.1.2 Dru
Gearshift
f a cantiltion of for
g the afore
(
) (
2
2
32 2
1
faF A
E
+
+ +
ions A1,A
Dynamic
Figure 3-
(b)
ork legs r
ver beam,legs as t
entioned
)
)
32 2
2
32 2 2
2 2
E
A E+
, E1 and E2
Equation
3 Develope
presented
b) Forceso cantilev
nalogy the
can be ref
s
d View of
as two can
cting on tr beams
force Ffa1c
rred in the
rum Profil
tilever bea
e two legs
an be dedu
Figures 3.5
e & Force
(c)
ms. a) For
of gearshi
ed to be a
and 3.6.
Componen
mula for
ft fork, an
follows:
ts acting on
aximum
c) Simpli
it
fied
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
14/59
9
Figure 3-3 represents a developed view of the drum obtained by unwrapping the drum groove profile.
Also shown is a zoomed view of the fork lug and the forces acting on the drum due it.
Now, from Newtons second law of motion
So, the net torque acting on the drum is given by
where,flrepresents the friction force developed between the fork lug and the drum and is given by
Further in Figure 3-3 it can be seen in the zoomed view of the fork lug traversing the drum groove thatthe drum groove ramp angle is related to the angular rotation of the drum and the axial movement of the
fork as given below
(A)
Also, the instantaneous axial velocity of the fork is related to the angular velocity of the drum by the
following equation
(B)
Differentiating the above equation we can obtain the following expression
(C)
Also, by integrating equation (A) we can get the following expression forx.
(D)
3.1.3 Fork Free Body Diagram
Figure 3-4 represents the free body diagram of the fork. The reaction of friction force fl and force R1aswas discussed in the previous section also acts on the fork lug. View U represents the top view of the
fork lug with these reactions acting on it. Now, in order to develop a better understanding of the system
in term so axial force and tangential force, these forces are distributed among the axial force F A,tangential force FT and a moment Mf. The axial force FA tries to tilt the fork due to which normal
reactions Ny1 and Ny2 from the rail are developed in order to avoid tilting. The tangential force tries to
move the component in its direction. However, the almost symmetric location of the fork lug avoidsdevelopment of substantial moment in one direction due to which the two reactions Nx1 and Nx2 from the
rail are acting in the same direction. The reactions Nx1, Nx2, Ny1 and Ny2 thus lead to the friction forces
fx1,fx2,fy1 andfy2 respectively. The gearshift sleeve also applies force Ffton the fork leg as the force FT
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
15/59
10
Figure 3-4 Free-Body Diagram of Fork
also tries to rotate the fork about the rail center. Due to the force Fft a corresponding friction force alsoacts on the fork leg which is developed between the fork and gearshift sleeve.
The tangential force, axial force and the moment as discussed above are given by the following
equations
The friction forcesfx1,fx2,fy1 andfy2 are related to the corresponding normal reactions between the fork
and the rail by the following expressions
A coordinate system XFYFZF as represented in Figure 3-4 is also attached with the fork for convenientlyhandling forces and moments acting on the fork. It is also to be noted that it is only in the axial direction
that the fork experiences acceleration, in all other directions the forces acting on the fork are in
equilibrium.
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
16/59
11
3.1.3.1 Equilibrium in XFYF Plane
Figure 3-5 Free-Body Diagram of Fork representing forces in XFYF plane.
Considering the forces acting on the fork in XF, YF direction and moment acting along ZF, we have
Since, the fork does not experience any acceleration (linear or angular) in these directions the net forcesand moments are equated to zero in the above equations.
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
17/59
12
3.1.3.2 Equilibrium in XFZF Plane
Figure 3-6 Free-Body Diagram of Fork representing forces in XFZF plane.
Considering the fork in XFZF plane, the fork experiences an acceleration in the ZF direction. So, the
equations are:
3.1.3.3 Equilibrium in YFZF Plane
As forces along XF,YF, ZF have already been taken care of, the only quantity left to be considered is
moment about XF axis.
Thus, the moment equation is given by
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
18/59
13
Figure 3-7 Free-Body Diagram of Fork representing forces in YFZF plane
3.2 Governing Differential Equation and State-Space RepresentationNow, we have all the equations that capture the dynamics of the system. All we need is to solve them in
order to obtain the final expression for the drum angular acceleration.
3.2.1 Governing Equation
All the above mentioned equations i.e. Equation (1) (13) & (A) (F) are solved using SymbolicToolbox in MATLAB to obtain the following expression:
(14)
where,f1(),f2() andf3() are given by the following expressions
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
19/59
where,
ki sare cons
the drum g
As can be
axial force
The actual
in Appendi
3.2.2 Syste
It can be ea
mass sprin
damping c
3.2.3 Shift
A precise
along with
complexiti
tants whic
oove profi
seen, the s
acting on t
expression
x A.1
m Analogy
Figure 3-8
sily seen fr
-damper s
efficient th
Force Beh
odel for th
characteris
s the shift
depend on
e.
stem is hi
e fork.
obtained
Gearshift
om the sys
stem havi
at varies as
avior
e shift forc
tics of the
force is a
various m
ghly non-li
or the subs
Mechanis
em equatio
g time var
a function
e behavior
clutch. Thi
sumed to
1
chanism p
ear with
tituted val
analogy
ns that the
ing forces
of the displ
ill involv
s in itself i
ehave as
4
rameters a
unctions o
es of the
with a ma
earshift m
acting on t
acement o
mathemat
s another a
combinati
nd
state coup
echanism
s spring-d
echanism d
e mass in
the mass.
ical modeli
rea of rese
on of a sp
which
led with d
arameters
mper syst
ynamics is
pposite dir
ng of the e
rch. So, in
ing with
depends
um torque
can be refe
em
analogous
ections and
tire drive-
order to a
s as the sp
on
and
rred
o a
a
rain
oid
ring
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
20/59
constant an
value of K
componentbehavior o
So, mathe
Substitutin
Now, the S
d a dampe
s and Bs is
of whichthe shift f
Figure 3
atically th
the expre
tate-Space
system wi
assumed t
compressesrce.
-9 Shift for
axial forc
sion for th
epresentat
th Bs as the
be unkno
the spring
ce behavio
can be rep
axial forc
on of the s
1
damping
wn. The a
and anoth
r represen
resented as
in the fin
stem is as
5
oefficient
ial force f
er compon
tation as a
follows:
l equation
follows:
s shown i
om the fo
ent is dissi
spring-da
14), we ge
Figure 3-
k Ffa acts
pated due
per syste
the follow
(15)
. However
n the slee
o the dam
ing equatio
, the
e a
ing
n
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
21/59
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
22/59
17
values for the unknown parameters Ks and Bs. The estimated parameters and the states are provided to the
controller for evaluating the input for the next instant.
4.1.1 Backstepping Control Law Derivation
It can be seen from the state-space representation developed in the previous section that system is instrict feedback form which is as follows:
Strict Feedback Form
So, the control law can be derived as follows:
where, u = TD is the torque input for the drum.
Since, the Lyapunov function is negative definite this ensures asymptotic convergence of the states to
zero.
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
23/59
18
4.1.2 Standard Least Squares Estimator
A standard least squares estimator is developed for parameter estimation with the following cost
function.
Cost Function
The following are various update laws used for parameter updation and gain matrix updation:
Parameter Update Law
So, for the present system it becomes
Gain Matrix Update Law
where,
4.2 Tracking ControllerThe tracking controller has the capability of tracking a reference signal. It has the following control
objective and assumptions:
Control Objective: To design a control law to track the reference signal asymptotically.
Assumptions:
1. Full state feedback is available.
2. Parameters Ks and Bs are unknown and constant.
3. The reference signal is in the form of states of the system.
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
24/59
19
Figure 4-2 represents the control block diagram for the tracking controller. Here the controller works on
the new states z1 and z2 which are the difference of the actual states and the reference signal. The
estimation process is the same as defined for the previous controller.
Figure 4-2 Control block diagram of Tracking Controller
4.2.1 Backstepping Control Law Derivation
The control law is now derived for the states z1 and z2 is as follows:
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
25/59
20
where, u = TD
The negative definiteness of the Lyapunov function guarantees asymptotic convergence of the states to
the reference signal.
4.3 Actual Controller
Figure 4-3 Actual mechanism with plan for state, output measurement and state estimation
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
26/59
21
The actual controller is based on the fact that there will always be some noise in measurement.
Furthermore, in actual system a full state feedback can be avoided by measuring one of the states and
estimating the other one using the first one. Since, differentiating the signal to estimate a state leads tonoisy estimation, the technique of integration is used to estimate the angular position of the drum using
its angular velocity.
The control objective and assumptions of the controller are as follows:
Control Objective: To design a control law to track the reference signal asymptotically.
Assumptions:
1. Outputy and Statex2 is available as feedback.2. Parameters Ks and Bs are unknown and constant.
3. There is noise present in measurement.
Figure 4-4 Control block diagram of Actual Controller
Figure 4-4 illustrates the control block diagram of the actual controller. The noise is introduced in the
measured signals. The integrator is used to estimate the state x1 using state x2. Also, the estimated signal is
now used in parameter estimation.
4.3.1 Backstepping Control Law
The control law for this controller remains same as derived for the previous controller with the following
modifications:
1. The measured value of x1 is now replaced with the estimated value obtained using an integrator.2. High frequency noise is introduced in the measured states.
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
27/59
22
where, z1 and z2 includes the high frequency noise signal.
The negative definiteness of the Lyapunov function as derived in the control law derivation of thetracking controller still holds good and so the states will converge to the reference signal asymptotically.
4.3.3 Standard Least Squares EstimatorThe estimator for the actual system is the same with a modification that the estimated value of x1 is now
used in the estimator to estimate the parameters.
4.3.3 State Estimator (Integrator)
The state x1 is estimated by integrating the state x2 which also contains the noise signal. So, the
differential equation for estimator becomes
where, n2 represents the high frequency noise signal introduced in the state x2 during measurement.
4.4 Model Linearization for Parameter Estimation
The above developed parameter estimators are based on the assumption that the coefficient of frictionbetween the various components is precisely known. However, the coefficient of friction is not known
always. Since, the system is highly nonlinear the influence of coefficient of friction plays a vital role in
determining the behavior of the system. In actual vehicle there is always an uncertainty involved indetermining the value of coefficient of friction due to variation in lubrication. Even the viscosity of the
lubricant varies with temperature which in turn varies the coefficient between the interacting surfaces.
Thus, there is always a variation in the coefficient of friction which cannot be predicted, though the
range of variation might be narrow. Thus, this demands an estimation of the coefficient of friction byusing an estimator. However, considering the highly nonlinear dynamics of the system the estimation of
the coefficient of friction would be difficult.
The functions f1, f2 and f3 are functions of state and the coefficient of friction. Now, the Taylor seriesexpansion for a function about a point 0 is given by
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
28/59
23
Now, neglecting higher order terms, we can obtain
where, f11(0) represents the value of the function at 0 andf12represents the value of the derivate of the
function with respect to at 0.
Thus, each of the nonlinear function can be replaced by its linear approximation to give rise to the
following state-space representation of the system:
The unknown parameters in the model are then combined in such a manner that the reduced systems will
have unknowns that appear linearly. The value of functionsf11
,f
12, f
21, f
22,f
31andf
32is mentioned in
Appendix A.1
4.5 Standard Least Squares Estimator with Linearized ModelA standard least squares estimator is then developed using this linearized model.
The parameter update law is given by
where,
The gain matrix update law is given by
where, P is a 5x5 gain matrix. Also, the input will now have the values of functionf1, f2 and f3 evaluated
for the estimated value of the coefficient of friction.
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
29/59
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
30/59
25
Table 4-4 Mechanism Parameters used in Simulation
5.1.1.2 Simulation Results
0 1 2 3 4 5 6 7 8 9 100
5
10
15
time (s)
Y
(deg)
Y vs t
0 1 2 3 4 5 6 7 8 9 10-14
-12
-10
-8
-6
-4
-2
0
time (s)
dY/dt(deg/s)
dY/dt vs t
0 1 2 3 4 5 6 7 8 9 10-0.3
-0.2
-0.1
0
0.1
0.2
0.3
0.4
0.5
time (s)
Ffa(kg)
Ffa vs t
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
31/59
26
Figure 5-1 Simulation results for basic controller with known coefficient of friction
The simulation results showed the following:1. Both the states i.e. drum angular position and velocity, converge to zero asymptotically as is
expected.
2. Output i.e. the axial force developed on the fork also converges asymptotically to zero.3. However, due to decay of states to zero the signal matrix of the parameter estimator is notpersistently exciting and it converges to zero in the course of time.4. As a result of signal matrix converging to zero, the gain matrix for the estimator doesnt converge to
zero, which is obvious from the following equation for gain updation.
5. The unknown parameters do not converge to their true value. However, they become constant aftercertain time, which can be explained by the following equation for parameter updation.
0 1 2 3 4 5 6 7 8 9 10-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
time (s)
W
W (Signal Matrix) vs t
W1
W2
0 1 2 3 4 5 6 7 8 9 100
10
20
30
40
50
60
70
time (s)
P
P (Gain Matrix) vs t
P11
P12
P21
P22
0 1 2 3 4 5 6 7 8 9 102
4
6
8
10
12
14
16
18
20
time (s)
Ks(kg/mm)
Ks vs t
Ksreal
Kshat
0 1 2 3 4 5 6 7 8 9 100
5
10
15
20
25
30
time (s)
Bs(kgs/m)
Bs vs t
Bsreal
Bshat
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
32/59
27
As the signal matrix converged to zero the updation of parameters stop due to which they remain
constant.
5.1.2 Simulation with unknown Coefficient of Friction (Linearized model for Parameter
Estimation)
This section presents the result for the unknown coefficient of friction case.
5.1.2.1 Simulation Inputs
The following additional inputs (different values) are used for the simulation of this controller.
real = 0.14
(0) = 0.50 = 0.16
K (backstepping) = 1000
5.1.2.2 Simulation Results
0 1 2 3 4 5 6 7 8 9 100
5
10
15
time (s)
Y(deg)
Y vs t
0 1 2 3 4 5 6 7 8 9 10-14
-12
-10
-8
-6
-4
-2
0
time (s)
dY/dt(deg/s)
dY/dt vs t
0 1 2 3 4 5 6 7 8 9 10-15
-10
-5
0
5
10
time (s)
Ffa(kg)
Ffa vs t
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
33/59
28
Figure 5-2 Simulation results for basic controller with unknown coefficient of friction
The simulation results showed the following:1. Both the states i.e. drum angular position and velocity; converge to zero asymptotically in almost the
same time as was for the known coefficient of friction case.
2. Output i.e. the axial force developed on the fork also converges asymptotically to zero in almost thesame time.
3. However, there is appreciable difference in the signal matrix of the estimator between the two cases.The signal matrix converged to zero in the unknown coefficient of friction case much rapidly.
4. In this case the estimation of the coefficient of friction also takes place. There is considerable errorin the estimated value of the coefficient. However, the error became constant in the course of time.
This error in estimation can be attributed to the fact that the signal matrix decayed to zero rapidly inthis case.
5. The unknown parameters also become constant after certain time, which can be explained by thefollowing equation for parameter updation.
0 1 2 3 4 5 6 7 8 9 10-5
0
5
10
15
20
25
30
35
40
time (s)
W
W (Signal Matrix) vs t
W1
W2
W3
W4
W5
0 1 2 3 4 5 6 7 8 9 10-0.3
-0.2
-0.1
0
0.1
0.2
0.3
0.4
0.5
time (s)
vs t
ureal
uhat
0 1 2 3 4 5 6 7 8 9 10-5
0
5
10
15
20
25
time (s)
Ks(kg/mm)
Ks vs t
Ksreal
Kshat
0 1 2 3 4 5 6 7 8 9 10-10
-5
0
5
10
15
20
25
30
35
time (s)
Bs(kgs/m)
Bs vs t
Bsreal
Bshat
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
34/59
29
However, the steady-state error in estimation is more in this case then the known coefficient case.
5.2Tracking ControllerThe tracking controller as discussed in the previous chapter is also simulated for the two cases discussedin the previous section.
5.2.1 Simulation with known Coefficient of Friction
This section presents the results of the tracking controller for the known coefficient of friction case.
5.2.1.1 Simulation Inputs
xr = sin(t)
5.2.1.2 Simulation Results
0 1 2 3 4 5 6 7 8 9 10-60
-40
-20
0
20
40
60
80
time (s)
Y
(deg)
Y vs t
Yr
Y
0 1 2 3 4 5 6 7 8 9 10-60
-40
-20
0
20
40
60
time (s)
dY/dt(deg/s)
dY/dt vs t
Yrdot
Ydot
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
35/59
30
0 1 2 3 4 5 6 7 8 9 10-5
0
5
10
15
20
25
30
35
40
45
time (s)
Ffa(kg)
Ffa vs t
Ffar
Ffa
0 10 20 30 40 50 60 70 80 90 100-0.005
0
0.005
0.01
0.015
0.02
0.025
0.03
0.035
0.04
time (s)
P
P(Gain Matrix) vs t
P11
P12
P21
P22
0 5 10 15 20 25-8
-6
-4
-2
0
2
4
6
8
10
time (s)
W
W (Signal Matrix) vs t
W1
W2
0 100 200 300 400 500 600 700 800 900 10000
0.1
0.2
0.3
0.4
0.5
0.6
0.7
time (s)
Bs(kgs/m)
Bs vs t
Bsreal
Bshat
0 100 200 300 400 500 600 700 800 900 10004
4.1
4.2
4.3
4.4
4.5
4.6
4.7
4.8
4.9
5
time (s)
Ks(kg/mm)
Ks vs t
Ksreal
Kshat
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
36/59
31
Figure 5-3 Simulation results for tracking controller with known coefficient of friction
The simulation results showed the following:1. Both the states i.e. drum angular position and velocity, tracks the reference signal asymptotically.2. Output i.e. the axial force developed on the fork which is combination of the two states and the
unknown parameters also tracks the reference signal asymptotically.3. The signal matrix of the estimator is persistently exciting in this case.4. Due to persistently exciting signal matrix, the gain matrix for the estimator converges to zero.5. The unknown parameters also converge to their true value asymptotically.5.2.2 Simulation with unknown Coefficient of Friction (Linearized model for Parameter
Estimation)
The simulation results for the unknown coefficient of friction are presented in this section.
5.1.2.1 Simulation Inputs
The following additional inputs (different values) are used for the simulation of this controller.real = 0.14
(0) = 0.40 = 0.16
K(backstepping) = 10;
P0 = [0.001:0.001:0.025];
0 1 2 3 4 5 6 7 8 9 10-60
-40
-20
0
20
40
60
time (s)
Y
(deg)
Y vs t
Yr
Y
0 1 2 3 4 5 6 7 8 9 10-60
-40
-20
0
20
40
60
time (s)
dY/dt(deg/s)
dY/dt vs t
Yrdot
Ydot
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
37/59
32
Figure 5-4 Simulation results for tracking controller with unknown coefficient of friction
0 1 2 3 4 5 6 7 8 9 10-5
0
5
10
15
20
25
30
35
time (s)
Ffa(kg)
Ffa vs t
Ffar
Ffa
0 1 2 3 4 5 6 7 8 9 10-1
0
1
2
3
4
5
6
time (s)
W
W (Signal Matrix) vs t
W1
W2
W3
W4
W5
0 1 2 3 4 5 6 7 8 9 100.1
0.15
0.2
0.25
0.3
0.35
0.4
0.45
time (s)
vs t
ureal
uhat
0 1 2 3 4 5 6 7 8 9 103.8
4
4.2
4.4
4.6
4.8
5
time (s)
Ks(kg/mm
)
Ks vs t
Ksreal
Kshat
0 1 2 3 4 5 6 7 8 9 10-0.6
-0.5
-0.4
-0.3
-0.2
-0.1
0
0.1
0.2
time (s)
Bs(kgs/m)
Bs vs t
Bsreal
Bshat
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
38/59
33
The simulation results showed the following:
1. The controller had hard time tracking both the states i.e. drum angular position and velocity.2. The output i.e. the axial force developed on the fork also shows large variations between the actual
and the reference signal.
3. The signal matrix of the estimator remains persistently exciting in this case.4. Even when the signal matrix is persistently exciting the coefficient of friction do not converge to its
true value.
5. The unknown parameters also do not converge to their respective true values.5.3 Actual ControllerThe actual controller discussed in the previous chapter is simulated in the following section. Due to theinability of the tracking controller to track the reference signal for the unknown coefficient of friction
case, it becomes pointless to simulate the same for the actual controller which includes noise and state
estimation. The following section presents the result with only the known coefficient of friction.
5.3.1 Simulation Inputs
Apart from the simulation inputs of the tracking controller with known coefficient of friction, thefollowing inputs are used for the simulation.
Noise (x2)n2 = 0.2sin(20*t)
Noise (y)
ny = sin(20*t)
The noise signal is modeled as a high frequency periodic disturbance from a rotating source which might
be the engine or the rotating driveline with huge inertia.
5.3.2 Simulation Resutls
The simulation results showed the following:
0 1 2 3 4 5 6 7 8 9 10-60
-40
-20
0
20
40
60
80
time (s)
Y
(deg
)
Y vs t
Yr
Y
Yhat
0 1 2 3 4 5 6 7 8 9 10-80
-60
-40
-20
0
20
40
60
80
time (s)
dY/dt(deg
/s)
dY/dt vs t
Yrdot
Ydot
Ydot measured
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
39/59
34
Figure 5-5 Simulation results for actual controller with known coefficient of friction
0 1 2 3 4 5 6 7 8 9 10-5
0
5
10
15
20
25
30
35
40
45
time (s)
Ffa(kg)
Ffa vs t
Ffar
Ffa
Ffa measured
0 5 10 15 20 25-10
-8
-6
-4
-2
0
2
4
6
8
10
time (s)
W
W (Signal Matrix) vs t
W1
W2
0 10 20 30 40 50 60 70 80 90 100-0.005
0
0.005
0.01
0.015
0.02
0.025
0.03
0.035
0.04
time (s)
P
P(Gain Matrix) vs t
P11
P12
P21
P22
0 100 200 300 400 500 600 700 800 900 10004
4.1
4.2
4.3
4.4
4.5
4.6
4.7
4.8
4.9
5
time (s)
Ks(kg/mm)
Ks vs t
Ksreal
Kshat
0 100 200 300 400 500 600 700 800 900 10000
0.1
0.2
0.3
0.4
0.5
0.6
0.7
time (s)
Bs(kgs/m)
Bs vs t
Bsreal
Bshat
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
40/59
35
1. The estimated drum angular position tracks the actual position and in due course of time both ofthem track the reference signal.
2. The measured state follows the actual state though with lesser deviations, however there are slightdeviations of the two from the reference signal due to high frequency noise present in the
measurement. Such deviations can be dealt with by appropriate filtering of the measured state.3. Output i.e. the axial force developed on the fork also tracks the reference signal asymptotically with
small deviations present due to noise in the measured signal.
4. The signal matrix of the parameter estimator is persistently exciting in this case.5. Due to persistently exciting signal matrix, the gain matrix for the estimator converges to zero
asymptotically.
6. The unknown parameters also converge to their true value asymptotically.5.4 Virtual Reality Simulation
In order to understand the physical behavior of the system a simulation is developed in MATLAB using
Virtual Reality Toolbox for the results obtained for the actual controller. The variation in angular
velocity was appreciable in the simulation of the 3d-model.
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
41/59
36
Chapter 6
Discussion
The basic controller with known coefficient of friction worked satisfactorily for asymptoticallyconverging states to zero. The basic controller with unknown coefficient of friction worked as good as
the one with known value. The tracking controller worked satisfactorily for the known coefficient of
friction case. However, the tracking controller with unknown coefficient of friction was unable to trackthe reference signal. The actual controller worked well for the known coefficient for friction case.
The results showed that the unknown coefficient of friction case is difficult to handle with, in real world.
When it comes to determining the asymptotic stability using a controller the parameter estimator with alinearized model worked as good as a known parameter case, with states decaying to zero in almost the
same time for the two cases. However, the parameter estimation failed to track the reference signal withthe linearized model against the perfect tracking achieved by the known parameter case controller. The
results also showed that the standard least squares estimator is immune to noise in the signal matrix.
Thus, a first order linearization of the system for parameter estimation is not sufficient for a gearshift
mechanism which is a highly nonlinear system to not only estimate the unknown parameters accurately
but also for reference signal tracking.
The future work for dealing with the problem of control of a gearshift mechanism might involve
improving the model that has been developed and to improve the controller. The model can be modifiedto take into account the nonlinearity in the model due to deformation of the fork. Also, the variation inarea moment of inertia of the two legs of the fork can be taken into account for more realistic
distribution of forces. The controller for the unknown coefficient of friction case can be developed
considering the second order approximation of the nonlinear functions involved. However, it will lead tomore number of unknown parameters in the model to be estimated which need to be dealt with
accordingly.
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
42/59
37
Bibliography
[1] Chaouch S., Nait-Sait M (2006), Backstepping control design for position and speed trackingof DC motors.
[2] Aneke N. P. I., Nijmeijerz H. and Jager A. G. (2003), Tracking control of second-orderchained form systems by cascaded backstepping, International journal of robust and nonlinear
control.
[3] Xie Chengkang, (2004), Nonlinear Output Feedback Control: An Analysis of Performance and
Robustness, Phd thesis, UNIVERSITY OF SOUTHAMPTON.
[4] Faa J L, Rong J W(2001), A Hybrid Computed Torque Controller Using Fuzzy Neural Network for
Motor-Quick-Return Servo Mechanism, IEEE/ASME TRANSACTIONS ON MECHATRONICS,
VOL. 6, NO. 1, MARCH 2001
[5] Yang Z; Wu J; Mei J; Gao J and Huang T (2008), Mechatronic Model Based Computed Torque
Control of a Parallel Manipulator, International Journal of Advanced Robotic Systems, Vol. 5, No. 1ISSN 1729-8806, pp.123-128.
[6] Yang Z; Wu J; Mei J (2007), Motor-mechanism dynamic model based neural network optimizedcomputed torque control of a high speed parallel manipulator, Mechatronics 17 (2007) 381390.
[7] Weiwei S., Shuang C (2009), Nonlinear computed torque control for a high-speed planar parallelmanipulator, Mechatronics 19 (2009) 987992.
[8] Rothbart H. A., Cam design handbook, McGraw-Hill Handbooks, 2004, pp. 27-55.
[9] Norton R. L., Cam design and manufacturing handbook, Industrial Press, Inc., pp. 177-312.
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
43/59
- 1 -
Appendix A
A.1 MATLAB code for solving equations involved in the Mathematical Model of the
Dynamics of the Gearshift Mechanismclc;clear all;close all;
syms R1FAFTFft_fNx1Nx2Ny1Ny2FfaTDthetaRDuIDmfzeta_angCA2A1B1B2
E1E2O1O2O3ddlphigammadotgammadot2K1K2dthetadgammaDsi;
Eqn = 'FA -R1*(cos(theta)-u*sin(theta)) ,
FT -R1*(sin(theta)+u*cos(theta)),
FT+Fft_f*cos(zeta_ang)-Nx1-Nx2,FT*sin(phi)+Ny1-Ny2-Fft_f*sin(zeta_ang),
-FT*C+Fft_f*A2/cos(zeta_ang),
FA*C*sin(phi)+Ffa*((A2^2+E2^2)^(3/2)/((A1^2+E1^2)^(3/2) +(A2^2+E2^2)^(3/2))*E1-(1-(A2^2+E2^2)^(3/2)/((A1^2+E1^2)^(3/2)+ (A2^2+E2^2)^(3/2)))*E2)+
Fft_f*cos(zeta_ang)*O3+Nx2*O2-Nx1*O1+u*(Nx1+Nx2)*d/2+u*R1*dl/2*cos(phi)-
u*Fft_f*Dsi*cos(zeta_ang),
-FA*C*cos(phi)-FT*sin(phi)*O3-Ffa*((A2^2+E2^2)^(3/2)/((A1^2+E1^2)^(3/2)+
(A2^2+E2^2)^(3/2))*A1-(1-(A2^2+E2^2)^(3/2)/((A1^2+E1^2)^(3/2)+
(A2^2+E2^2)^(3/2)))*A2)+Ny1*B1+Ny2*B2-u*Ny1*d/2+u*Ny2*d/2+u*R1*dl*sin(phi)/2-
u*Fft_f*((A1+A2)/2-Dsi*sin(zeta_ang)),
FA-u*(Ny1+Ny2+Nx1+Nx2)-Ffa-u*Fft_f-mf*RD*(tan(theta)*gammadot2+
sec(theta)^2*dthetadgamma*gammadot^2),
TD -R1*(sin(theta)+u*cos(theta))*RD-ID*gammadot2';
S = solve(Eqn,FA,FT,Fft_f,Nx1,Nx2,Ny1,Ny2,R1,gammadot2)
gammadot2_val = S.gammadot2fun_sim = vpa(simplify(subs(simplify(gammadot2_val),{dl,RD, zeta_ang, C,A2, A1, B1,
B2, E1, E2, O1, O2, O3, d, phi, ID, mf, Dsi} ,{8.3, 24.5, 31.61*pi/180, 14.95,
45.35, 87.09, 17.64, 84.35, 33.91,33.91, 85.44, 16.55, 67.8, 13, 62.08*pi/180, 200,
0.2, 74.63})))f1 = vpa(simplify(subs(fun_sim,{TD, Ffa, gammadot,u} ,{1,0,0,0.16})),4)f2 = vpa(simplify(subs(fun_sim,{TD, Ffa, gammadot,u} ,{0,1,0,0.16})),4)f3 = vpa(simplify(subs(fun_sim,{TD, Ffa, gammadot,u} ,{0,0,1,0.16})),4)
-----------------------------------------------------------------------------------
The expressions obtained for f1, f2 and f3f1 = .3906e-2*cos(theta)*(-.2294e21*cos(theta)-.4584e18+.1275e21*sin(theta))/
(.8091e20*sin(theta)*cos(theta)-.6243e20*cos(theta)^2-.3581e18*cos(theta)-.1168e21)
f2 =.8896e18*cos(theta)*(4.*cos(theta)+25.*sin(theta))/(.8091e20*sin(theta)*cos(theta)-
.6243e20*cos(theta)^2-.3581e18*cos(theta)-.1168e21)
f3 = .4671e19*dthetadgamma*(4.*cos(theta)+25.*sin(theta))/cos(theta)/
(.8091e20*sin(theta)*cos(theta)-.6243e20*cos(theta)^2-.3581e18*cos(theta)-.1168e21)
-----------------------------------------------------------------------------------------------------------The expressions obtained for f11, f12, f21, f22, f31 and f32.
f11 =.1562e-1*cos(theta).*(.2293e9*cos(theta)+.4584e6-
.1275e9*sin(theta))./(.2497e9*cos(theta).^2+.4670e9+.1432e7*cos(theta)-
.3236e9*sin(theta).*cos(theta))
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
44/59
- 2 -
f12 =-4.882*cos(theta).*(.3153e15*cos(theta).^3-.3155e15*cos(theta)-
.8563e13*cos(theta).^2+.7925e15*sin(theta).*cos(theta).^2+.8563e13+.6851e12*sin(the
ta).*cos(theta)-.1186e16*sin(theta))./(.4239e17*cos(theta).^4-
.3379e18*cos(theta).^2-.7153e15*cos(theta).^3+.1616e18*cos(theta).^3.*sin(theta)-
.2181e18-
.1338e16*cos(theta)+.3023e18*sin(theta).*cos(theta)+.9271e15*sin(theta).*cos(theta)
.^2)
f21 =-
.3558e7*cos(theta).*(4.*cos(theta)+25.*sin(theta))./(.2497e9*cos(theta).^2+.4670e9+
.1432e7*cos(theta)-.3236e9*sin(theta).*cos(theta))
f22 =-500.*cos(theta).*(.3237e15*cos(theta).^3-
.4609e15*cos(theta)+.2731e12*cos(theta).^2-
.1016e15*sin(theta).*cos(theta).^2+.3711e14*sin(theta)+.3299e13*sin(theta).*cos(the
ta))./(.4239e17*cos(theta).^4-.3379e18*cos(theta).^2-
.7153e15*cos(theta).^3+.1616e18*cos(theta).^3.*sin(theta)-.2181e18-
.1338e16*cos(theta)+.3023e18*sin(theta).*cos(theta)+.9271e15*sin(theta).*cos(theta)
.^2)
f31 =-
.1868e8*dtdg*(4.*cos(theta)+25.*sin(theta))./cos(theta)./(.2497e9*cos(theta).^2+.46
70e9+.1432e7*cos(theta)-.3236e9*sin(theta).*cos(theta));
f32 =-.4670e9*dtdg*(.1657e10*cos(theta).^2-.2479e10+.1432e7*cos(theta)-
.6595e9*sin(theta).*cos(theta)+.1790e8*sin(theta))./(.4239e17*cos(theta).^4-
.3379e18*cos(theta).^2-.7153e15*cos(theta).^3+.1616e18*cos(theta).^3.*sin(theta)-
.2181e18-
.1338e16*cos(theta)+.3023e18*sin(theta).*cos(theta)+.9271e15*sin(theta).*cos(theta)
.^2)
A.2 MATLAB code for Basic Controller with parameter estimation andasymptotically stabilizing origin (Known Coefficient of Friction)function Basic_Controllerclc;clear all;global Ksreal Bsreal ktheta RDktheta = 0.5;RD = 24.5;sgn =1;Ksreal = 20;Bsreal = 30;Kshat0 = 3;Bshat0 = 4;
P0 = [40 50;60 70];
y0 = [0.25 0 Kshat0 Bshat0 P0(1,1) P0(1,2) P0(2,1) P0(2,2)]; %gamma gammadot Kshat
Bshat P(1,1) P(1,2) P(2,1) P(2,2)
[T Y] = ode45(@mysystem,linspace(0,5),y0); %gamma gammadot Kshat Bshat P(1,1)
P(1,2) P(2,1) P(2,2)figure;plot(T,Y(:,1)*180/pi,'-');grid onxlabel('time (s) \rightarrow','FontSize',12);ylabel('Y (deg)\rightarrow','FontSize',12);title('Y vs t','FontSize',15);
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
45/59
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
46/59
- 4 -
P = [y(5) y(6);y(7) y(8)];
u = (-y(2)-y(1)-K_bs*(y(1)+y(2))-f2_val*Kshat*RD*log(sec(theta_val))/(ktheta)-
(f2_val*Bshat*RD*tan(theta_val)+f3_val)*y(2))/f1_val;dy(1) = y(2); %gamma gammadot Kshat Bshat P(1,1) P(1,2) P(2,1) P(2,2)dy(2) =
f1_val*u+f2_val*(Ksreal*RD*log(sec(theta_val))/(ktheta)+Bsreal*RD*tan(theta_val)*y(
2))+f3_val*y(2);dy(3) = -
(P(1,1)*RD*log(sec(theta_val))/(ktheta)+P(1,2)*RD*tan(theta_val)*y(2))*(W*[Kshat
Bshat]'-(Ksreal*W(1)+Bsreal*W(2)));dy(4) = -
(P(2,1)*RD*log(sec(theta_val))/(ktheta)+P(2,2)*RD*tan(theta_val)*y(2))*(W*[Kshat
Bshat]'-(Ksreal*W(1)+Bsreal*W(2)));dy(5) = -(P(1,1)*W(1)+P(1,2)*W(2))*(W(1)*P(1,1)+W(2)*P(2,1));dy(6) = -(P(1,1)*W(1)+P(1,2)*W(2))*(W(1)*P(1,2)+W(2)*P(2,2));dy(7) = -(P(2,1)*W(1)+P(2,2)*W(2))*(W(1)*P(1,1)+W(2)*P(2,1));dy(8) = -(P(2,1)*W(1)+P(2,2)*W(2))*(W(1)*P(1,2)+W(2)*P(2,2));
A.3 MATLAB code for Tracking Controller with parameter estimation and
reference output tracking (Known Coefficient of Friction)function Tracking_Controllerclc;clear all;close all;global Ksreal Bsreal ktheta RDktheta = 0.5;RD = 24.5;sgn =1;Ksreal = 5;Bsreal = 0.1;Kshat0 = 4;Bshat0 = 0.01;P0 = [0.02 0.01;
0.03 0.04];ref = @(T) sin(T);refdot = @(T) cos(T);y0 = [0.5 -0.5 Kshat0 Bshat0 P0(1,1) P0(1,2) P0(2,1) P0(2,2)]; %z(gamma-gammaref)
zdot(gammadot-gammadotref) Kshat Bshat P(1,1) P(1,2) P(2,1) P(2,2)[T Y] = ode45(@mysystem,[0,10],y0); %z(gamma-gammaref) zdot(gammadot-gammadotref)
Kshat Bshat P(1,1) P(1,2) P(2,1) P(2,2)figure;p = plot(T,ref(T)*180/pi,'-b',T,(Y(:,1)+ref(T))*180/pi,'-r');grid on
legend(p,'Yr','Y',4);xlabel('time (s) \rightarrow','FontSize',12);ylabel('Y (deg)\rightarrow','FontSize',12);title('Y vs t','FontSize',15);
figurep = plot(T,refdot(T)*180/pi,'-b',T,(Y(:,2)+refdot(T))*180/pi,'-r');grid onlegend(p,'Yrdot','Ydot',4);xlabel('time (s) \rightarrow','FontSize',12);ylabel('dY/dt (deg/s) \rightarrow','FontSize',12);title('dY/dt vs t','FontSize',15);figure
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
47/59
- 5 -
p =
plot(T,Ksreal*RD*log(sec(ktheta*(ref(T))))/ktheta+Bsreal*RD*tan(ktheta*(ref(T))).*r
efdot(T),...'-
b',T,Ksreal*RD*log(sec(ktheta*(Y(:,1)+ref(T))))/ktheta+Bsreal*RD*tan(ktheta*(ref(T)
)).*Y(:,2),'-r');grid onlegend(p,'Ffar','Ffa',4);xlabel('time (s) \rightarrow','FontSize',12);ylabel('Ffa (kg) \rightarrow','FontSize',12);title('Ffa vs t','FontSize',15);figurep = plot(T,Ksreal*ones(size(T)),'-b',T,Y(:,3),'-r');grid onlegend(p,'Ksreal','Kshat',4);xlabel('time (s) \rightarrow','FontSize',12);ylabel('Ks (kg/mm) \rightarrow','FontSize',12);title('Ks vs t','FontSize',15);
figurep = plot(T,Bsreal*ones(size(T)),'-b',T,Y(:,4),'-r');grid onlegend(p,'Bsreal','Bshat',4);xlabel('time (s) \rightarrow','FontSize',12);ylabel('Bs (kgs/m) \rightarrow','FontSize',12);title('Bs vs t','FontSize',15);figurep = plot(T,Y(:,5),'-b',T,Y(:,6),'-r',T,Y(:,7),'-y',T,Y(:,8),'-k');grid onlegend(p,'P11','P12','P21','P22',1);xlabel('time (s) \rightarrow','FontSize',12);ylabel('P \rightarrow','FontSize',12);title('P(Gain Matrix) vs t','FontSize',15);figurep = plot(T,RD*(log(sec(ktheta*(Y(:,1)+ref(T)))))/(ktheta) ,'-
b',T,RD*tan(ktheta*(Y(:,1)+ref(T))).*(Y(:,2)+refdot(T)),'-r');grid onlegend(p,'W1','W2',1);xlabel('time (s) \rightarrow','FontSize',12);ylabel('W \rightarrow','FontSize',12);title('W (Signal Matrix) vs t','FontSize',15);clear all;
function dy = mysystem(t,y)global Ksreal Bsreal ktheta RDK_bs = 100;
dy = zeros(8,1);xr = sint(t);xrdot = cos(t);xrdot2 = -sin(t);dtdg = ktheta;theta_val = ktheta*(y(1)+sin(t));f1_val = .3906e-2*cos(theta_val)*(-
.1275e21*sin(theta_val)+.2294e21*cos(theta_val)+.4584e18)/(.6243e20*cos(theta_val)^
2+.3581e18*cos(theta_val)-.8091e20*sin(theta_val)*cos(theta_val)+.1168e21);f2_val =-
.8896e18*cos(theta_val)*(25.*sin(theta_val)+4.*cos(theta_val))/(.6243e20*cos(theta_
val)^2+.3581e18*cos(theta_val)-.8091e20*sin(theta_val)*cos(theta_val)+.1168e21);
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
48/59
- 6 -
f3_val =.4671e19*dtdg*(25.*sin(theta_val)+4.*cos(theta_val))/cos(theta_val)/(-
.6243e20*cos(theta_val)^2-
.3581e18*cos(theta_val)+.8091e20*sin(theta_val)*cos(theta_val)-.1168e21);Kshat = y(3);Bshat = y(4);W = [RD*log(sec(theta_val))/(ktheta) RD*tan(theta_val)*(y(2)+xrdot)];P = [y(5) y(6);
y(7) y(8)];u = (-y(2)-y(1)-K_bs*(y(1)+y(2))-f2_val*Kshat*RD*log(sec(theta_val))/ktheta -
(f2_val*Bshat*RD*tan(theta_val)+f3_val)*(y(2)+xrdot)-xrdot2)/f1_val;dy(1) = y(2); %z(gamma-gammaref) zdot(gammadot-gammadotref) Kshat Bshat P(1,1)
P(1,2) P(2,1) P(2,2)dy(2) = f1_val*u+f2_val*Ksreal*RD*log(sec(theta_val))/ktheta +
(f2_val*Bsreal*RD*tan(theta_val)+f3_val)*(y(2)+xrdot)-xrdot2;dy(3) = -
(P(1,1)*RD*log(sec(theta_val))/(ktheta)+P(1,2)*RD*tan(theta_val)*(y(2)+xrdot))*(W*[
Kshat Bshat]'-(Ksreal*W(1)+Bsreal*W(2)));dy(4) = -
(P(2,1)*RD*log(sec(theta_val))/(ktheta)+P(2,2)*RD*tan(theta_val)*(y(2)+xrdot))*(W*[Kshat Bshat]'-(Ksreal*W(1)+Bsreal*W(2)));dy(5) = -(P(1,1)*W(1)+P(1,2)*W(2))*(W(1)*P(1,1)+W(2)*P(2,1));dy(6) = -(P(1,1)*W(1)+P(1,2)*W(2))*(W(1)*P(1,2)+W(2)*P(2,2));dy(7) = -(P(2,1)*W(1)+P(2,2)*W(2))*(W(1)*P(1,1)+W(2)*P(2,1));dy(8) = -(P(2,1)*W(1)+P(2,2)*W(2))*(W(1)*P(1,2)+W(2)*P(2,2));
A.4 MATLAB code for Final Controller with parameter and state estimation, noise,
reference output tracking and Virtual Reality Simulation. (Known Coefficient of
Friction)function Actual_Backstepping_Controllerclc;
clear all;close all;global Ksreal Bsreal ktheta RDktheta = 0.5;RD = 24.5;sgn =1;Ksreal = 5;Bsreal = 0.1;Kshat0 = 4;Bshat0 = 0.01;P0 = [0.02 0.01;
0.03 0.04];ref = @(T) sin(T);refdot = @(T) cos(T);n2 = @(T) 0.2*sin(20*T);ny = @(T) sin(20*T);y0 = [0.5 -0.5 Kshat0 Bshat0 P0(1,1) P0(1,2) P0(2,1) P0(2,2) 0.5]; %z(gamma-
gammaref) zdot(gammadot-gammadotref) Kshat Bshat P(1,1) P(1,2) P(2,1) P(2,2)[T Y] = ode45(@mysystem,[0,10],y0); %z(gamma-gammaref) zdot(gammadot-gammadotref)
Kshat Bshat P(1,1) P(1,2) P(2,1) P(2,2)
figure;p = plot(T,ref(T)*180/pi,'-b',T,(Y(:,1)+ref(T))*180/pi,'-
.r',T,(Y(:,9)+ref(T))*180/pi,'--k');grid onlegend(p,'Yr','Y','Yhat',4);xlabel('time (s) \rightarrow','FontSize',12);
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
49/59
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
50/59
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
51/59
- 9 -
dy(5) = -(P(1,1)*W_e(1)+P(1,2)*W_e(2))*(W_e(1)*P(1,1)+W_e(2)*P(2,1));dy(6) = -(P(1,1)*W_e(1)+P(1,2)*W_e(2))*(W_e(1)*P(1,2)+W_e(2)*P(2,2));dy(7) = -(P(2,1)*W_e(1)+P(2,2)*W_e(2))*(W_e(1)*P(1,1)+W_e(2)*P(2,1));dy(8) = -(P(2,1)*W_e(1)+P(2,2)*W_e(2))*(W_e(1)*P(1,2)+W_e(2)*P(2,2));dy(9) = y(2)+n2;
A.5 MATLAB code for Basic Controller with parameter estimation using linearized
model for asymptotically stabilizing origin (Unknown Coefficient of Friction)
function Basic_Controller_u_unknownclc;clear all;close all;global Ksreal Bsreal ktheta RD ureal K_bsK_bs = 1000;ktheta = 0.5;RD = 24.5;
ureal = 0.14;Ksreal = 20;Bsreal = 30;u0 = 0.5;ubar = 0.16;Kshat0 = 3;Bshat0 = 4;a1hat0 = u0-ubar;a2hat0 = a1hat0*Kshat0;a3hat0 = a1hat0*Bshat0;P0 = [0.1:0.1:2.5];y0 = [0.25 0 a1hat0 Kshat0 a2hat0 Bshat0 a3hat0 P0]; %gamma gammadot a1hat Kshat
a2hat Bshat a3hat P11->P15, P21->P25, P31->P35, P41->P45, P51->P55[T Y] = ode45(@mysystem,linspace(0,10),y0); %gamma gammadot a1hat Kshat a2hat Bshat
a3hat P11->P15, P21->P25, P31->P35, P41->P45, P51->P55figure;plot(T,Y(:,1)*180/pi,'-');grid onxlabel('time (s) \rightarrow','FontSize',12);ylabel('Y (deg)\rightarrow','FontSize',12);title('Y vs t','FontSize',15);figureplot(T,Y(:,2)*180/pi,'-r');grid onxlabel('time (s) \rightarrow','FontSize',12);ylabel('dY/dt (deg/s) \rightarrow','FontSize',12);title('dY/dt vs t','FontSize',15);
figureplot(T,Ksreal*RD*log(sec(ktheta*(Y(:,1))))/ktheta+Bsreal*RD*tan(ktheta*(Y(:,1))).*Y(:,2),'-r');grid onxlabel('time (s) \rightarrow','FontSize',12);ylabel('Ffa (kg) \rightarrow','FontSize',12);title('Ffa vs t','FontSize',15);figurep = plot(T,Ksreal*ones(size(T)),'-b',T,Y(:,4),'--r');grid onlegend(p,'Ksreal','Kshat',4);xlabel('time (s) \rightarrow','FontSize',12);ylabel('Ks (kg/mm) \rightarrow','FontSize',12);title('Ks vs t','FontSize',15);
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
52/59
- 10 -
figurep = plot(T,Bsreal*ones(size(T)),'-b',T,Y(:,6),'--r');grid onlegend(p,'Bsreal','Bshat',4);xlabel('time (s) \rightarrow','FontSize',12);ylabel('Bs (kgs/m) \rightarrow','FontSize',12);title('Bs vs t','FontSize',15);u = Y(:,3)+ubar;figurep = plot(T,ureal*ones(size(T)),'-b',T,u,'--r');grid onlegend(p,'ureal','uhat',4);xlabel('time (s) \rightarrow','FontSize',12);ylabel('\mu \rightarrow','FontSize',12);title('\mu vs t','FontSize',15);dtdg = ktheta;Kshat = Y(:,4);Bshat = Y(:,6);
theta_val = ktheta*Y(:,1);f1_val =.7812e-
2*cos(theta_val).*(.3528e16*u.^3.*cos(theta_val)+.1411e18*u.^2.*cos(theta_val)-
.4584e16*u.^2+.8750e16*u.*cos(theta_val)-.6374e17*cos(theta_val)-
.5222e16*u.^2.*sin(theta_val)+.2048e18*u.*sin(theta_val))./(.5513e16*u.^3.*cos(thet
a_val).^2+.2204e18*u.^2.*cos(theta_val).^2-.7162e16*u.^2.*cos(theta_val)-
.5978e17+.1367e17*cos(theta_val).^2.*u-
.3981e17*cos(theta_val).^2+.2602e18*u.*sin(theta_val).*cos(theta_val)-
.8160e16*u.^2.*sin(theta_val).*cos(theta_val));f2_val =-8.*cos(theta_val).*(.6356e15*u.^2.*cos(theta_val)-.1525e16*sin(theta_val)-
.1525e16*u.*cos(theta_val)+.6356e15*u.*sin(theta_val))./(.5513e16*u.^3.*cos(theta_v
al).^2+.2204e18*u.^2.*cos(theta_val).^2-.7162e16*u.^2.*cos(theta_val)-
.5978e17+.1367e17*cos(theta_val).^2.*u-
.3981e17*cos(theta_val).^2+.2602e18*u.*sin(theta_val).*cos(theta_val)-
.8160e16*u.^2.*sin(theta_val).*cos(theta_val));f3_val
=.5978e17*dtdg*(sin(theta_val)+u.*cos(theta_val))./cos(theta_val)./(.5513e16*u.^3.*
cos(theta_val).^2+.2204e18*u.^2.*cos(theta_val).^2-.7162e16*u.^2.*cos(theta_val)-
.5978e17+.1367e17*cos(theta_val).^2.*u-
.3981e17*cos(theta_val).^2+.2602e18*u.*sin(theta_val).*cos(theta_val)-
.8160e16*u.^2.*sin(theta_val).*cos(theta_val));f11 =.1562e-1*cos(theta_val).*(.2293e9*cos(theta_val)+.4584e6-
.1275e9*sin(theta_val))./(.2497e9*cos(theta_val).^2+.4670e9+.1432e7*cos(theta_val)-
.3236e9*sin(theta_val).*cos(theta_val));f12 =-4.882*cos(theta_val).*(.3153e15*cos(theta_val).^3-.3155e15*cos(theta_val)-
.8563e13*cos(theta_val).^2+.7925e15*sin(theta_val).*cos(theta_val).^2+.8563e13+.685
1e12*sin(theta_val).*cos(theta_val)-
.1186e16*sin(theta_val))./(.4239e17*cos(theta_val).^4-.3379e18*cos(theta_val).^2-
.7153e15*cos(theta_val).^3+.1616e18*cos(theta_val).^3.*sin(theta_val)-.2181e18-
.1338e16*cos(theta_val)+.3023e18*sin(theta_val).*cos(theta_val)+.9271e15*sin(theta_
val).*cos(theta_val).^2);f21 =-
.3558e7*cos(theta_val).*(4.*cos(theta_val)+25.*sin(theta_val))./(.2497e9*cos(theta_
val).^2+.4670e9+.1432e7*cos(theta_val)-.3236e9*sin(theta_val).*cos(theta_val)); f22 =-500.*cos(theta_val).*(.3237e15*cos(theta_val).^3-
.4609e15*cos(theta_val)+.2731e12*cos(theta_val).^2-
.1016e15*sin(theta_val).*cos(theta_val).^2+.3711e14*sin(theta_val)+.3299e13*sin(the
ta_val).*cos(theta_val))./(.4239e17*cos(theta_val).^4-.3379e18*cos(theta_val).^2-
.7153e15*cos(theta_val).^3+.1616e18*cos(theta_val).^3.*sin(theta_val)-.2181e18-
.1338e16*cos(theta_val)+.3023e18*sin(theta_val).*cos(theta_val)+.9271e15*sin(theta_
val).*cos(theta_val).^2);
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
53/59
- 11 -
f31 =-
.1868e8*dtdg*(4.*cos(theta_val)+25.*sin(theta_val))./cos(theta_val)./(.2497e9*cos(t
heta_val).^2+.4670e9+.1432e7*cos(theta_val)-
.3236e9*sin(theta_val).*cos(theta_val));f32 =-.4670e9*dtdg*(.1657e10*cos(theta_val).^2-.2479e10+.1432e7*cos(theta_val)-
.6595e9*sin(theta_val).*cos(theta_val)+.1790e8*sin(theta_val))./(.4239e17*cos(theta
_val).^4-.3379e18*cos(theta_val).^2-
.7153e15*cos(theta_val).^3+.1616e18*cos(theta_val).^3.*sin(theta_val)-.2181e18-
.1338e16*cos(theta_val)+.3023e18*sin(theta_val).*cos(theta_val)+.9271e15*sin(theta_
val).*cos(theta_val).^2);U = (-Y(:,2)-Y(:,1)-K_bs*(Y(:,1)+Y(:,2))-
f2_val.*Kshat*RD.*log(sec(theta_val))./(ktheta)-
(f2_val.*Bshat*RD.*tan(theta_val)+f3_val).*Y(:,2))./f1_val;W = [f12.*U+f32.*Y(:,2), f21*RD.*log(sec(theta_val))./(ktheta),
f22*RD.*log(sec(theta_val))./(ktheta), f21*RD.*tan(theta_val).*Y(:,2),
f22*RD.*tan(theta_val).*Y(:,2)];figurep = plot(T,W(:,1),'-b',T,W(:,2),'--r',T,W(:,3),'-.y',T,W(:,4),':g',T,W(:,5),'-
.ok');grid onlegend(p,'W1','W2','W3','W4','W5',1);xlabel('time (s) \rightarrow','FontSize',12);ylabel('W \rightarrow','FontSize',12);title('W (Signal Matrix) vs t','FontSize',15);clear all;
function dy = mysystem(t,y)global Ksreal Bsreal ktheta RD ureal K_bsdy = zeros(8,1);dtdg = ktheta;u = y(3)+0.16;
theta_val = ktheta*y(1);f1_val =.7812e-2*cos(theta_val)*(.3528e16*u^3*cos(theta_val)+.1411e18*u^2*cos(theta_val)-
.4584e16*u^2+.8750e16*u*cos(theta_val)-.6374e17*cos(theta_val)-
.5222e16*u^2*sin(theta_val)+.2048e18*u*sin(theta_val))/(.5513e16*u^3*cos(theta_val)
^2+.2204e18*u^2*cos(theta_val)^2-.7162e16*u^2*cos(theta_val)-
.5978e17+.1367e17*cos(theta_val)^2*u-
.3981e17*cos(theta_val)^2+.2602e18*u*sin(theta_val)*cos(theta_val)-
.8160e16*u^2*sin(theta_val)*cos(theta_val));f2_val =-8.*cos(theta_val)*(.6356e15*u^2*cos(theta_val)-.1525e16*sin(theta_val)-
.1525e16*u*cos(theta_val)+.6356e15*u*sin(theta_val))/(.5513e16*u^3*cos(theta_val)^2
+.2204e18*u^2*cos(theta_val)^2-.7162e16*u^2*cos(theta_val)-
.5978e17+.1367e17*cos(theta_val)^2*u-
.3981e17*cos(theta_val)^2+.2602e18*u*sin(theta_val)*cos(theta_val)-
.8160e16*u^2*sin(theta_val)*cos(theta_val));f3_val
=.5978e17*dtdg*(sin(theta_val)+u*cos(theta_val))/cos(theta_val)/(.5513e16*u^3*cos(t
heta_val)^2+.2204e18*u^2*cos(theta_val)^2-.7162e16*u^2*cos(theta_val)-
.5978e17+.1367e17*cos(theta_val)^2*u-
.3981e17*cos(theta_val)^2+.2602e18*u*sin(theta_val)*cos(theta_val)-
.8160e16*u^2*sin(theta_val)*cos(theta_val));f11 =.1562e-1*cos(theta_val)*(.2293e9*cos(theta_val)+.4584e6-
.1275e9*sin(theta_val))/(.2497e9*cos(theta_val)^2+.4670e9+.1432e7*cos(theta_val)-
.3236e9*sin(theta_val)*cos(theta_val));f12 =-4.882*cos(theta_val)*(.3153e15*cos(theta_val)^3-.3155e15*cos(theta_val)-
.8563e13*cos(theta_val)^2+.7925e15*sin(theta_val)*cos(theta_val)^2+.8563e13+.6851e1
2*sin(theta_val)*cos(theta_val)-
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
54/59
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
55/59
- 13 -
dy(2) =
f1_val*U+f2_val*(Ksreal*RD*log(sec(theta_val))/(ktheta)+Bsreal*RD*tan(theta_val)*y(
2))+f3_val*y(2);ahat = [y(3:7)];ahatdot = -P*W'*(W*ahat-dy(2)-f31*y(2)-f11*U);for i=1:1:5
dy(i+2) = ahatdot(i);endPdot = P*W'*W*P;k = 8;for i=1:1:5
for j=1:1:5dy(k) = Pdot(i,j);k = k+1;
endend
A.6 MATLAB code for Tracking Controller with parameter estimation andreference output tracking (Unknown Coefficient of Friction)function Tracking_Controller_u_unknownclc;clear all;close all;global Ksreal Bsreal ktheta RD ureal K_bsK_bs = 10;ktheta = 0.5;RD = 24.5;ureal = 0.14;Ksreal = 5;Bsreal = 0.1;u0 = 0.4;ubar = 0.16;Kshat0 = 4;Bshat0 = 0.01;a1hat0 = u0-ubar;a2hat0 = a1hat0*Kshat0;a3hat0 = a1hat0*Bshat0;P0 = [0.001:0.001:0.025];ref = @(T) sin(T);refdot = @(T) cos(T);y0 = [0.5 -0.5 a1hat0 Kshat0 a2hat0 Bshat0 a3hat0 P0]; %gamma gammadot a1hat Kshat
a2hat Bshat a3hat P11->P15, P21->P25, P31->P35, P41->P45, P51->P55[T Y] = ode45(@mysystem,[0,10],y0);
figure;
p = plot(T,ref(T)*180/pi,'-b',T,(Y(:,1)+ref(T))*180/pi,'--r');grid onlegend(p,'Yr','Y',4);xlabel('time (s) \rightarrow','FontSize',12);ylabel('Y (deg)\rightarrow','FontSize',12);title('Y vs t','FontSize',15);figurep = plot(T,refdot(T)*180/pi,'-b',T,(Y(:,2)+refdot(T))*180/pi,'--r');grid onlegend(p,'Yrdot','Ydot',4);xlabel('time (s) \rightarrow','FontSize',12);ylabel('dY/dt (deg/s) \rightarrow','FontSize',12);title('dY/dt vs t','FontSize',15);figure
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
56/59
- 14 -
p =
plot(T,Ksreal*RD*log(sec(ktheta*(ref(T))))/ktheta+Bsreal*RD*tan(ktheta*(ref(T))).*r
efdot(T),...'-
b',T,Ksreal*RD*log(sec(ktheta*(Y(:,1)+ref(T))))/ktheta+Bsreal*RD*tan(ktheta*(Y(:,1)
+ref(T))).*(Y(:,2)+refdot(T)),'--r');grid onlegend(p,'Ffar','Ffa',4);xlabel('time (s) \rightarrow','FontSize',12);ylabel('Ffa (kg) \rightarrow','FontSize',12);title('Ffa vs t','FontSize',15);figurep = plot(T,Ksreal*ones(size(T)),'-b',T,Y(:,4),'--r');grid onlegend(p,'Ksreal','Kshat',4);xlabel('time (s) \rightarrow','FontSize',12);ylabel('Ks (kg/mm) \rightarrow','FontSize',12);title('Ks vs t','FontSize',15);
figurep = plot(T,Bsreal*ones(size(T)),'-b',T,Y(:,6),'--r');grid onlegend(p,'Bsreal','Bshat',4);xlabel('time (s) \rightarrow','FontSize',12);ylabel('Bs (kgs/m) \rightarrow','FontSize',12);title('Bs vs t','FontSize',15);u = Y(:,3)+ubar;figurep = plot(T,ureal*ones(size(T)),'-b',T,u,'--r');grid onlegend(p,'ureal','uhat',4);xlabel('time (s) \rightarrow','FontSize',12);ylabel('\mu \rightarrow','FontSize',12);title('\mu vs t','FontSize',15);Y(:,1)=Y(:,1)+ref(T);Y(:,2)=Y(:,2)+refdot(T);dtdg = ktheta;Kshat = Y(:,4);Bshat = Y(:,6);theta_val = ktheta*Y(:,1);f1_val =.7812e-
2*cos(theta_val).*(.3528e16*u.^3.*cos(theta_val)+.1411e18*u.^2.*cos(theta_val)-
.4584e16*u.^2+.8750e16*u.*cos(theta_val)-.6374e17*cos(theta_val)-
.5222e16*u.^2.*sin(theta_val)+.2048e18*u.*sin(theta_val))./(.5513e16*u.^3.*cos(thet
a_val).^2+.2204e18*u.^2.*cos(theta_val).^2-.7162e16*u.^2.*cos(theta_val)-
.5978e17+.1367e17*cos(theta_val).^2.*u-
.3981e17*cos(theta_val).^2+.2602e18*u.*sin(theta_val).*cos(theta_val)-
.8160e16*u.^2.*sin(theta_val).*cos(theta_val));f2_val =-8.*cos(theta_val).*(.6356e15*u.^2.*cos(theta_val)-.1525e16*sin(theta_val)-
.1525e16*u.*cos(theta_val)+.6356e15*u.*sin(theta_val))./(.5513e16*u.^3.*cos(theta_v
al).^2+.2204e18*u.^2.*cos(theta_val).^2-.7162e16*u.^2.*cos(theta_val)-
.5978e17+.1367e17*cos(theta_val).^2.*u-
.3981e17*cos(theta_val).^2+.2602e18*u.*sin(theta_val).*cos(theta_val)-
.8160e16*u.^2.*sin(theta_val).*cos(theta_val));f3_val
=.5978e17*dtdg*(sin(theta_val)+u.*cos(theta_val))./cos(theta_val)./(.5513e16*u.^3.*
cos(theta_val).^2+.2204e18*u.^2.*cos(theta_val).^2-.7162e16*u.^2.*cos(theta_val)-
.5978e17+.1367e17*cos(theta_val).^2.*u-
.3981e17*cos(theta_val).^2+.2602e18*u.*sin(theta_val).*cos(theta_val)-
.8160e16*u.^2.*sin(theta_val).*cos(theta_val));
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
57/59
- 15 -
f11 =.1562e-1*cos(theta_val).*(.2293e9*cos(theta_val)+.4584e6-
.1275e9*sin(theta_val))./(.2497e9*cos(theta_val).^2+.4670e9+.1432e7*cos(theta_val)-
.3236e9*sin(theta_val).*cos(theta_val));f12 =-4.882*cos(theta_val).*(.3153e15*cos(theta_val).^3-.3155e15*cos(theta_val)-
.8563e13*cos(theta_val).^2+.7925e15*sin(theta_val).*cos(theta_val).^2+.8563e13+.685
1e12*sin(theta_val).*cos(theta_val)-
.1186e16*sin(theta_val))./(.4239e17*cos(theta_val).^4-.3379e18*cos(theta_val).^2-
.7153e15*cos(theta_val).^3+.1616e18*cos(theta_val).^3.*sin(theta_val)-.2181e18-
.1338e16*cos(theta_val)+.3023e18*sin(theta_val).*cos(theta_val)+.9271e15*sin(theta_
val).*cos(theta_val).^2);f21 =-
.3558e7*cos(theta_val).*(4.*cos(theta_val)+25.*sin(theta_val))./(.2497e9*cos(theta_
val).^2+.4670e9+.1432e7*cos(theta_val)-.3236e9*sin(theta_val).*cos(theta_val)); f22 =-500.*cos(theta_val).*(.3237e15*cos(theta_val).^3-
.4609e15*cos(theta_val)+.2731e12*cos(theta_val).^2-
.1016e15*sin(theta_val).*cos(theta_val).^2+.3711e14*sin(theta_val)+.3299e13*sin(the
ta_val).*cos(theta_val))./(.4239e17*cos(theta_val).^4-.3379e18*cos(theta_val).^2-
.7153e15*cos(theta_val).^3+.1616e18*cos(theta_val).^3.*sin(theta_val)-.2181e18-
.1338e16*cos(theta_val)+.3023e18*sin(theta_val).*cos(theta_val)+.9271e15*sin(theta_val).*cos(theta_val).^2);f31 =-
.1868e8*dtdg*(4.*cos(theta_val)+25.*sin(theta_val))./cos(theta_val)./(.2497e9*cos(t
heta_val).^2+.4670e9+.1432e7*cos(theta_val)-
.3236e9*sin(theta_val).*cos(theta_val));f32 =-.4670e9*dtdg*(.1657e10*cos(theta_val).^2-.2479e10+.1432e7*cos(theta_val)-
.6595e9*sin(theta_val).*cos(theta_val)+.1790e8*sin(theta_val))./(.4239e17*cos(theta
_val).^4-.3379e18*cos(theta_val).^2-
.7153e15*cos(theta_val).^3+.1616e18*cos(theta_val).^3.*sin(theta_val)-.2181e18-
.1338e16*cos(theta_val)+.3023e18*sin(theta_val).*cos(theta_val)+.9271e15*sin(theta_
val).*cos(theta_val).^2);U = (-Y(:,2)-Y(:,1)-K_bs*(Y(:,1)+Y(:,2))-
f2_val.*Kshat*RD.*log(sec(theta_val))./(ktheta)-
(f2_val.*Bshat*RD.*tan(theta_val)+f3_val).*Y(:,2))./f1_val;W = [f12.*U+f32.*Y(:,2), f21*RD.*log(sec(theta_val))./(ktheta),
f22*RD.*log(sec(theta_val))./(ktheta), f21*RD.*tan(theta_val).*Y(:,2),
f22*RD.*tan(theta_val).*Y(:,2)];figurep = plot(T,W(:,1),'-b',T,W(:,2),'--r',T,W(:,3),'-.y',T,W(:,4),':g',T,W(:,5),'-
.ok');grid onlegend(p,'W1','W2','W3','W4','W5',1);xlabel('time (s) \rightarrow','FontSize',12);ylabel('W \rightarrow','FontSize',12);title('W (Signal Matrix) vs t','FontSize',15);clear all;
function dy = mysystem(t,y)global Ksreal Bsreal ktheta RD ureal K_bsdy = zeros(8,1);dtdg = ktheta;u = y(3)+0.16;xr = sin(t);xrdot = cos(t);xrdot2 = -sin(t);dtdg = ktheta;theta_val = ktheta*(y(1)+sin(t));f1_val =.7812e-
2*cos(theta_val)*(.3528e16*u^3*cos(theta_val)+.1411e18*u^2*cos(theta_val)-
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
58/59
- 16 -
.4584e16*u^2+.8750e16*u*cos(theta_val)-.6374e17*cos(theta_val)-
.5222e16*u^2*sin(theta_val)+.2048e18*u*sin(theta_val))/(.5513e16*u^3*cos(theta_val)
^2+.2204e18*u^2*cos(theta_val)^2-.7162e16*u^2*cos(theta_val)-
.5978e17+.1367e17*cos(theta_val)^2*u-
.3981e17*cos(theta_val)^2+.2602e18*u*sin(theta_val)*cos(theta_val)-
.8160e16*u^2*sin(theta_val)*cos(theta_val));f2_val =-8.*cos(theta_val)*(.6356e15*u^2*cos(theta_val)-.1525e16*sin(theta_val)-
.1525e16*u*cos(theta_val)+.6356e15*u*sin(theta_val))/(.5513e16*u^3*cos(theta_val)^2
+.2204e18*u^2*cos(theta_val)^2-.7162e16*u^2*cos(theta_val)-
.5978e17+.1367e17*cos(theta_val)^2*u-
.3981e17*cos(theta_val)^2+.2602e18*u*sin(theta_val)*cos(theta_val)-
.8160e16*u^2*sin(theta_val)*cos(theta_val));f3_val
=.5978e17*dtdg*(sin(theta_val)+u*cos(theta_val))/cos(theta_val)/(.5513e16*u^3*cos(t
heta_val)^2+.2204e18*u^2*cos(theta_val)^2-.7162e16*u^2*cos(theta_val)-
.5978e17+.1367e17*cos(theta_val)^2*u-
.3981e17*cos(theta_val)^2+.2602e18*u*sin(theta_val)*cos(theta_val)-
.8160e16*u^2*sin(theta_val)*cos(theta_val));
f11 =.1562e-1*cos(theta_val)*(.2293e9*cos(theta_val)+.4584e6-.1275e9*sin(theta_val))/(.2497e9*cos(theta_val)^2+.4670e9+.1432e7*cos(theta_val)-
.3236e9*sin(theta_val)*cos(theta_val));f12 =-4.882*cos(theta_val)*(.3153e15*cos(theta_val)^3-.3155e15*cos(theta_val)-
.8563e13*cos(theta_val)^2+.7925e15*sin(theta_val)*cos(theta_val)^2+.8563e13+.6851e1
2*sin(theta_val)*cos(theta_val)-
.1186e16*sin(theta_val))/(.4239e17*cos(theta_val)^4-.3379e18*cos(theta_val)^2-
.7153e15*cos(theta_val)^3+.1616e18*cos(theta_val)^3*sin(theta_val)-.2181e18-
.1338e16*cos(theta_val)+.3023e18*sin(theta_val)*cos(theta_val)+.9271e15*sin(theta_v
al)*cos(theta_val)^2);f21 =-
.3558e7*cos(theta_val)*(4.*cos(theta_val)+25.*sin(theta_val))/(.2497e9*cos(theta_va
l)^2+.4670e9+.1432e7*cos(theta_val)-.3236e9*sin(theta_val)*cos(theta_val));f22 =-500.*cos(theta_val)*(.3237e15*cos(theta_val)^3-
.4609e15*cos(theta_val)+.2731e12*cos(theta_val)^2-
.1016e15*sin(theta_val)*cos(theta_val)^2+.3711e14*sin(theta_val)+.3299e13*sin(theta
_val)*cos(theta_val))/(.4239e17*cos(theta_val)^4-.3379e18*cos(theta_val)^2-
.7153e15*cos(theta_val)^3+.1616e18*cos(theta_val)^3*sin(theta_val)-.2181e18-
.1338e16*cos(theta_val)+.3023e18*sin(theta_val)*cos(theta_val)+.9271e15*sin(theta_v
al)*cos(theta_val)^2);f31 =-
.1868e8*dtdg*(4.*cos(theta_val)+25.*sin(theta_val))/cos(theta_val)/(.2497e9*cos(the
ta_val)^2+.4670e9+.1432e7*cos(theta_val)-.3236e9*sin(theta_val)*cos(theta_val)); f32 =-.4670e9*dtdg*(.1657e10*cos(theta_val)^2-.2479e10+.1432e7*cos(theta_val)-
.6595e9*sin(theta_val)*cos(theta_val)+.1790e8*sin(theta_val))/(.4239e17*cos(theta_v
al)^4-.3379e18*cos(theta_val)^2-
.7153e15*cos(theta_val)^3+.1616e18*cos(theta_val)^3*sin(theta_val)-.2181e18-
.1338e16*cos(theta_val)+.3023e18*sin(theta_val)*cos(theta_val)+.9271e15*sin(theta_val)*cos(theta_val)^2);Kshat = y(4);Bshat = y(6);U = (-y(2)-y(1)-K_bs*(y(1)+y(2))-f2_val*Kshat*RD*log(sec(theta_val))/(ktheta)-
(f2_val*Bshat*RD*tan(theta_val)+f3_val)*(y(2)+xrdot)-xrdot2)/f1_val;W = [f12*U+f32*(y(2)+xrdot), f21*RD*log(sec(theta_val))/(ktheta),
f22*RD*log(sec(theta_val))/(ktheta), f21*RD*tan(theta_val)*(y(2)+xrdot),
f22*RD*tan(theta_val)*(y(2)+xrdot)];P = [y(8) y(9) y(10) y(11) y(12);
y(13) y(14) y(15) y(16) y(17);y(18) y(19) y(20) y(21) y(22);y(23) y(24) y(25) y(26) y(27);y(28) y(29) y(30) y(31) y(32);];
8/14/2019 Gearshift Mechanism Nonlinear Torque Control
59/59
u = ureal;f1_val =.7812e-
2*cos(theta_val)*(.3528e16*u^3*cos(theta_val)+.1411e18*u^2*cos(theta_val)-
.4584e16*u^2+.8750e16*u*cos(theta_val)-.6374e17*cos(theta_val)-
.5222e16*u^2*sin(theta_val)+.2048e18*u*sin(theta_val))/(.5513e16*u^3*cos(theta_val)
^2+.2204e18*u^2*cos(theta_val)^2-.7162e16*u^2*cos(theta_val)-
.5978e17+.1367e17*cos(theta_val)^2*u-
.3981e17*cos(theta_val)^2+.2602e18*u*sin(theta_val)*cos(theta_val)-
.8160e16*u^2*sin(theta_val)*cos(theta_val));f2_val =-8.*cos(theta_val)*(.6356e15*u^2*cos(theta_val)-.1525e16*sin(theta_val)-
.1525e16*u*cos(theta_val)+.6356e15*u*sin(theta_val))/(.5513e16*u^3*cos(theta_val)^2
+.2204e18*u^2*cos(theta_val)^2-.7162e16*u^2*cos(theta_val)-
.5978e17+.1367e17*cos(theta_val)^2*u-
.3981e17*cos(theta_val)^2+.2602e18*u*sin(theta_val)*cos(theta_val)-
.8160e16*u^2*sin(theta_val)*cos(theta_val));f3_val
=.5978e17*dtdg*(sin(theta_val)+u*cos(theta_val))/cos(theta_val)/(.5513e16*u^3*cos(t
heta_val)^2+.2204e18*u^2*cos(theta_val)^2-.7162e16*u^2*cos(theta_val)-
.5978e17+.1367e17*cos(theta_val)^2*u-
.3981e17*cos(theta_val)^2+.2602e18*u*sin(theta_val)*cos(theta_val)-
.8160e16*u^2*sin(theta_val)*cos(theta_val));dy(1) = y(2); %z(gamma-gammaref) zdot(gammadot-gammadotref) a1hat Kshat a2hat Bshat
a3hat P11->P15, P21->P25, P31->P35, P41->P45, P51->P55dy(2) = f1_val*u+f2_val*Ksreal*RD*log(sec(theta_val))/ktheta +
(f2_val*Bsreal*RD*tan(theta_val)+f3_val)*(y(2)+xrdot)-xrdot2;ahat = [y(3:7)];ahatdot = -P*W'*(W*ahat-(dy(2)+xrdot2)-f11-f31*(y(2)+xrdot));for i=1:1:5
dy(i+2) = ahatdot(i);endPdot = P*W'*W*P;k = 8;for i=1:1:5
for j=1:1:5dy(k) = Pdot(i,j);k = k+1;
endend