Simulink Control Design 3.0
Linearization of a Conveyor Model (Requires SimMechanics)
Contents
This demonstration introduces the use of the operating point search and snapshot features along with the linearization of a SimMechanics™ model. (Requires SimMechanics)
Operating Condition Search
Open the model
open_system('scdmechconveyor');
SimMechanics visualization is forced to new visualization because of mech_fo rce_visoption in MATLAB path.
The steady state operating point can now be found using the operating specification object initialized using the simulated operating point. For the steady state operating point search, the Analysis Type for the SimMechanics machine must be set to be in Trimming mode. See the SimMechanics documentation for details on this feature.
set_param('scdmechconveyor/Mechanical Environment','AnalysisType','Trimming' ) opspec = operspec('scdmechconveyor');
For SimMechanics models, the operating condition search in some cases can converge to a steady state condition more quickly using a nonlinear least squares algorithm. This algorithm is available if the Optimization Toolbox™ is licensed. An iterative report of the search can also be displayed by using the LINOPTIONS command.
opt = linoptions('OptimizerType','lsqnonlin','DisplayReport','none'); opt.OptimizationOptions.MaxFunEvals = 2000;
To ensure that the algebraic constraints in the SimMechanics model are met, the trim output port must be specified to be zero.
opspec.Outputs.y = zeros(8,1); opspec.Outputs.Known = ones(8,1);
The steady state operating point can now be found using the FINDOP command.
[op,opreport] = findop('scdmechconveyor',opspec,opt);
Display the final report
opreport
Operating Report for the Model scdmechconveyor.
(Time-Varying Components Evaluated at time t=0)
Operating point specifications were successfully met.
States:
----------
(1.) scdmechconveyor/Position Controller/H_inf Controller
x: -1.08 dx: 0 (0)
x: -7.67e-012 dx: 1.37e-012 (0)
x: 0.199 dx: 6.63e-014 (0)
x: 0.199 dx: 8.76e-015 (0)
x: 0.0743 dx: 1.44e-013 (0)
(2.) scdmechconveyor/Position Controller/Loopshaping Weight
x: 2.59e-007 dx: 5.47e-014 (0)
x: 2.59e-007 dx: 5.77e-015 (0)
x: 9.66e-008 dx: -3.83e-014 (0)
(3.) scdmechconveyor/Position Controller/Prefilter
x: 0.0103 dx: 2.44e-013 (0)
(4.) scdmechconveyor/Position Controller/inv(W)
x: -2.59e-007 dx: -5.47e-014 (0)
x: -2.59e-007 dx: -5.77e-015 (0)
x: -9.66e-008 dx: 1.07e-013 (0)
(5.) Prismatic.P1.Position
x: 0.103 dx: -7.99e-021 (0)
(6.) Prismatic.P1.Velocity
x: -7.99e-021 dx: -5.03e-013 (0)
(7.) Revolute.R1.Position
x: -0.881 dx: 1.59e-021 (0)
(8.) Revolute.R1.Velocity
x: 1.59e-021 dx: 4.61e-012 (0)
(9.) Revolute1.R1.Position
x: 0.83 dx: -8.91e-021 (0)
(10.) Revolute1.R1.Velocity
x: -8.91e-021 dx: -4.26e-012 (0)
(11.) Revolute3.R1.Position
x: -0.172 dx: 2.73e-020 (0)
(12.) Revolute3.R1.Velocity
x: 2.73e-020 dx: 8.04e-013 (0)
(13.) Revolute5.R1.Position
x: 0.00175 dx: -1.53e-021 (0)
(14.) Revolute5.R1.Velocity
x: -1.53e-021 dx: 1.04e-013 (0)
Inputs: None
----------
Outputs:
----------
(1.) scdmechconveyor/MSB Trimming Out
y: -2.31e-013 (0)
y: 1.41e-013 (0)
y: -9.13e-013 (0)
y: 1.61e-013 (0)
y: -7.99e-021 (0)
y: 1.83e-021 (0)
y: 4.74e-021 (0)
y: 4.57e-021 (0)
Before linearization of the model can be completed, the Analysis Type for the SimMechanics model needs to be restored.
set_param('scdmechconveyor/Mechanical Environment','AnalysisType','Forward d ynamics')
Linearize the Model
In this model the open loop plant model between the conveyor position and the torque command can be found using the following input and outputs:
io(1) = linio('scdmechconveyor/Joint Sensor',1,'out','on'); io(2) = linio('scdmechconveyor/Position Controller',1,'in');
Linearize the model.
sys = linearize('scdmechconveyor',op,io);
View the linearized model and corresponding Bode plot.
sysm = zpk(sys) bodemag(sysm)
Zero/pole/gain from input "Torque" to output "Joint Sensor":
-2.0818
-------------------
(s-3.481) (s+3.481)
Close the model.
bdclose('scdmechconveyor')
Store