SPACAR User Manual

SPACAR User Manual
SPACAR User Manual
dr. ir. R. G. K. M. Aarts, dr. ir. J. P. Meijaard and prof. dr. ir. J. B. Jonker
2009 Edition, March 1, 2009
Report No. WA-1180
Table of contents
Preface
iii
1 The SPACAR program
1.1 Introduction . . . . . . . . . . . . . . . . .
1.2 SPACAR & MATLAB . . . . . . . . . . .
1.3 SPAVISUAL . . . . . . . . . . . . . . . .
1.4 SPASIM and SIMULINK . . . . . . . . . .
1.5 Perturbation method and modal techniques .
.
.
.
.
.
2 Keywords
2.1 Introduction . . . . . . . . . . . . . . . . . .
2.2 Kinematics . . . . . . . . . . . . . . . . . .
2.3 Dynamics . . . . . . . . . . . . . . . . . . .
2.4 Inverse dynamics (setpoint generation) . . . .
2.4.1 Trajectory generation . . . . . . . . .
2.4.2 Nominal inputs and reference outputs
2.5 Linearization . . . . . . . . . . . . . . . . .
2.6 Non-linear simulation of manipulator control
2.7 Visualization and animation . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
3 Examples
3.1 Planar sliding bar . . . . . . . . . . . . . . . . .
3.2 Planar slider–crank mechanism . . . . . . . . . .
3.3 Cardan-joint mechanism . . . . . . . . . . . . .
3.4 Planar four-bar mechanism . . . . . . . . . . . .
3.5 Rotating mass–spring system . . . . . . . . . . .
3.6 Cantilever beam in Euler buckling . . . . . . . .
3.7 Cantilever beam subject to concentrated end force
3.8 Short beam . . . . . . . . . . . . . . . . . . . .
3.9 Lateral buckling of cantilever beam . . . . . . .
3.10 State-variable and output equations . . . . . . . .
i
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
1
1
1
10
10
12
.
.
.
.
.
.
.
.
.
15
15
16
24
31
31
36
38
42
44
.
.
.
.
.
.
.
.
.
.
47
47
49
57
60
63
66
68
71
73
76
ii
Table of contents
3.11
3.12
3.13
3.14
Rigid spatial manipulator mechanism . .
Flexible spatial manipulator mechanism .
Chord-driven underactuated robotic finger
Tricycle . . . . . . . . . . . . . . . . . .
A SPACAR installation
B SPACAR error messages
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
79
89
90
93
99
101
C MATLAB tutorial
103
C.1 Basic MATLAB graphics commands . . . . . . . . . . . . . . . . . . . . . . . 103
C.2 Quitting and saving the workspace . . . . . . . . . . . . . . . . . . . . . . . . 105
References
107
Preface
This is the 2009 edition of the manual that describes the use of the SPACAR-package in a MATLAB / SIMULINK environment. This software is being developed at the Laboratory of Mechanical
Automation of the Department of Engineering Technology, University of Twente, and is partly
based on work carried out at the Department of Engineering Mechanics, Delft University of
Technology.
This manual accompanies the 2009 UT-release of SPACAR. With respect to the previous editions
of this manual new keywords have been included reflecting changes in the software. In particular, systems with non-holonomic constraints resulting from the rolling contact of wheels can
now be modelled. As before, the SPAVISUAL manual is integrated. The examples are updated
to show the use of SPAVISUAL.
The references to sections and examples in the lecture notes [1] are updated for the 2005 edition
of these lecture notes. They may be only approximate for other editions.
The visualisation tool SPAVISUAL has been implemented by Jan Bennik, who also provided the
description of the keywords and the examples for the part of the manual related to this tool.
Corrections of errors, suggestions for improvements and other comments are welcome.
March 1, 2009, dr. ir. R. G. K. M. Aarts (Email: [email protected]), dr. ir. J. P.
Meijaard and prof. dr. ir. J. B. Jonker.
iii
iv
Preface
1
The SPACAR program
1.1
Introduction
The computer program SPACAR is based on the non-linear finite element theory for multi-degree
of freedom mechanisms as described in Jonker’s lecture notes on the Dynamics of Machines
and Mechanisms [1]. The program is capable of analysing the dynamics of planar and spatial
mechanisms and manipulators with flexible links and treats the general case of coupled large
displacement motion and small elastic deformation. The motion can be simulated by solving the
complete set of non-linear equations of motion or by using the so-called perturbation method.
The computational efficiency of the latter method can be improved further by applying modal
techniques.
In this chapter an outline of the SPACAR package for use with MATLAB and SIMULINK is given
in the next sections. For instance, for the design mechanical systems involving automatic controls (such as robotic manipulators), interfaces with MATLAB [2] are provided for open-loop
system analyses, Section 1.2. Open-loop and closed-loop simulations can be carried out with
blocks from a SIMULINK library, Section 1.4. A special visualization tool, SPAVISUAL, is described in Section 1.3. Additional tools are available for using the perturbation method and
the modal techniques in SIMULINK (Section 1.5). Installation notes for SPACAR are given in
Appendix A.
A graphical user interface (GUI) for generating input files for spatial systems is under development and will be available in near future. People interested in rigid planar mechanisms may
consider the use of the commercially available package SAM by ARTAS [4]. It has a nice graphical interface for the definition of mechanisms and it provides more elements than SPACAR.
1.2
SPACAR & MATLAB
The SPACAR program system for use in the MATLAB environment contains five modules, which
obtain their input from format-free user-supplied data. In the following a short description of
every module will be given. The functional connections between the modules are illustrated in
Fig. 1.1.
1
2
Chapter 1. The SPACAR program
mechanism
connectivity
configuration
DOFs q =
(xm , em )
KIN
dynamic
properties
forces
(f m , σ m )
trajectory path
velocity profile
(xpo , ẋpo )
mode 1
DYN
mode 2
INVDYN
mode 3
LINEAR
mode 4
mode 7
STATIO
LINEAR
mode 8
mode 9
Figure 1.1. Functional relations between modules in
available in the MATLAB environment.
KIN
SPACAR .
DOFs ( q, q̇)

m
m
joint variables (em
0 , ė , σ 0 )
nominal inputs (u0 )

reference outputs (y 0 )
State space matrices
Linearized equation
Eigen frequencies
Buckling loads
State space matrices
The indicated modes are
is the kinematics module that analyses the configuration of the mechanism. The kinematic
properties of the motion are specified by the geometric transfer functions. The following
steps are provided by the KIN-module:
1. Definition of the mechanism connectivity, the configuration and the degrees of freedom (DOFs), q = (x(m) , e(m) ).
2. System preparation.
3. Calculation of the geometric transfer functions.
DYN
is the dynamics module that generates the equations of motion and performs numerical
integration in the forward dynamic analysis (in the so-called mode=1 of SPACAR). Furthermore, it generates and solves the equations for the kinetostatic analysis.
is the inverse manipulator dynamics module that performs the inverse kinematics and
dynamics (mode=2) and generates the setpoints for the simulation of manipulator motion
with closed-loop control in SIMULINK (see Sect. 1.4). The system inputs, represented by
the nominal input vector u0 , are to be varied by the control system actuators. The system
outputs, represented by the reference output vector y 0 , consist of the coordinates to be
monitored by control sensors. Coordinates that are not measured may be added to check
the performance of the manipulator in the simulation.
INVDYN
computes stationary solutions of autonomous systems. Stationary solutions are solutions in which the vector of dynamic degrees of freedom q d has a constant value. This
can represent a static equilibrium configuration or a state of steady motion.
STATIO
is a forward dynamics stage for the generation of linearized equations and state space
matrices. It can be used in different modes as described below.
LINEAR
Section 1.2. SPACAR & MATLAB
3
In mode=4 the LINEAR module is an extension of the forward dynamic analysis (mode=1)
where coefficient matrices of the linearized equations are calculated as functions of the set of
degrees of freedom q. If there are only holonomic deformations in a system, the linearized
equations are generated in the form:
(x)T
M̄ 0 δq̈ + [C 0 + D 0 ] δ q̇ + [K 0 + N 0 + G0 ] δq = DF 0
(e)T
δf − DF 0
δσ a ,
(1.1)
where M̄ 0 is the reduced mass matrix, C 0 the velocity sensitivity matrix, D 0 the damping matrix, K 0 the structural stiffness matrix, and N 0 and G0 are the dynamic and geometric stiffness
matrices respectively. External and internal driving forces are represented by the vectors δf
and δσ a , respectively. In addition, if input and output vectors δu and δy are defined also the
linearized state equations and output equations are computed (see mode=9).
In mode=3 locally linearized models are generated about a predefined nominal trajectory where
the output data (setpoints) from the inverse dynamics module (i.e. a previous mode=2 run) are
used. In addition to the coefficient matrices, a complete state space system is generated and
written to a so-called ltv file (see Sect. 1.5). In the case of a flexible mechanism additional
degrees of freedom describing the elastic behaviour of the mechanism have to be included in
the dynamic models (both mode=2 and 3). At this stage in the so-called “rigidified” model,
these flexibilities are prescribed zero, i.e. εm
i ≡ 0.
In mode=7 eigenvalues (frequencies) and corresponding eigenvectors of the state space matrix A are computed for a static equilibrium configuration or a state of steady motion. The
associated frequency equation of the undamped system is given by
dd
dd
dd
det −ωi2 M̄ 0 + K dd
= 0,
0 + N 0 + G0
(1.2)
where the quantities ωi are the natural frequencies of the system.
In mode=8 a linear buckling analysis is carried out for a static equilibrium configuration or a
state of steady motion. Critical load parameters λi are determined by solving the eigenvalue
problem:
dd
det(K dd
0 + λi G0 ) = 0,
(1.3)
where the load multipliers satisfy
f i = λi f 0 .
(1.4)
dd
Here, K dd
0 is the structural stiffness matrix and G0 is the geometric stiffness matrix due to the
reference load f 0 giving rise to the reference stresses σ 0 . f i represents the bucking load that
corresponds with λi . In addition, directional nodal compliances are computed.
In mode=9 linearized equations for control system analysis are computed for a static equilibrium configuration or a state of steady motion and are generated in the form:
h
dd
i
h
i
dd
dd
dd
dd
d
d
M̄ 0 δq̈ d + C dd
0 + D 0 δ q̇ + K 0 + N 0 + G0 δq = B 0 δu,
where
h
(x)T
B 0 = Dqd F 0
is the input matrix and
h
(e)T
| − Dqd F 0
dr
dr
dr
dr
| − K dr
| − M̄ 0 | − C dr
0 + N 0 + G0
0 + D0
, δq̈ rT , δ q̇ rT , δq rT
δu = δf (c,m)T , δσ (m,c)T
a
iT
(1.5)
i
(1.6)
(1.7)
4
Chapter 1. The SPACAR program
is the input vector. The vectors δq̈ rT , δ q̇ rT , δq rT represent the prescribed (input) accelerations,
velocities and displacements respectively. The linearized equations can be transformed into the
linearized state space form:
δ ż = Aδz + Bδu,
δy = Cδz + Dδu,
(1.8)
where A is the state matrix, B the input matrix, C the output matrix and D the feed through
matrix. The state vector δz is defined by δz = [δq dT , δ q̇ dT ]T , where δq d is the vector of
dynamic degrees of freedom. The matrices B, C and D depend on the chosen input vector δu
and the output vector δy. Details of the linearization are discussed in Chapter 12 of the lecture
notes.
Systems with non-holonomic deformations
For systems with non-holonomic deformations arising from wheel elements, the above description has to be modified in several respects. Only mode=0, mode=1, mode=4, mode=7 and
mode=9 are supported. The state vector consists of the coordinates describing the configuration, q k , and the velocity coordinates, q̇ d . The configuration coordinates are split in coordinates
whose derivatives are velocity coordinates and coordinates that have no corresponding velocity
coordinates; the latter are called kinematic coordinates. The dynamic equations consist of two
parts, the kinematic differential equations defining the derivatives of the configuration coordinates and the equations of motion defining the time derivatives of the velocity coordinates.
The linearized equations have the form
"
I O
O M̄ 0
#"
#
"
−B k0
−Ak0
δ q̇ k
d +
K 0 + N 0 + G0 C 0 + D 0
δq̈
#"
#
"
#
0
δq k
, (1.9)
(e)T
(x)T
d =
δ q̇
DF 0 δf − DF 0 δσ a
where Ak0 and B k0 are kinematic matrices. For ordinary systems, B k0 is a zero matrix and
Ak0 is an identity matrix. For mode=7, a stationary solution is first obtained with the module
STATIO and the eigenvalues are obtained by solving the characteristic equation
"
#
Iλ − B k0
−Ak0
= 0.
det
K 0 + N 0 + G0 M̄ 0 λ + C 0 + D 0
(1.10)
For mode=9, the linearized state equations are obtained as in equation (1.8), with the difference
that the variations in the states are now δz = [δq kT , δ q̇ dT ]T .
Definition of a mechanism model
A model of a mechanism must be defined in an input file of file type (or file name extension)
dat. This input file consists of a number of keywords with essential and optional parameters.
The input file can be generated with any text editor.
In Chapter 2 the meaning of the keywords and their parameters is discussed in detail. In the
examples in Chapter 3 complete input files are presented.
Section 1.2. SPACAR & MATLAB
5
Running SPACAR in the MATLAB environment
Once the mechanism is defined and this information is saved to a dat input file, SPACAR can
be activated with the MATLAB command
>> spacar(mode,’filename’)
Here, mode indicates the type of computation as shown in Fig. 1.1. filename is the name
of the input file, without the extension .dat. The filename is limited to 20 characters from
the set “0”–“9”, “a”–“z”, “A”–“Z” and “ ”, so it can not include drive or path specifications.
The linearization with mode=3 needs data from a previous inverse dynamics computation. To
that end the specified filename is truncated with at least one character at the right until a
valid output data file is found. So e.g. spacar(3,’testlin’) can use data from an earlier
spacar(2,’test’) computation. If no data file can be found in this way the linearization
is aborted.
During the computation a plot of the mechanism is shown in a separate window. While the
simulation is running an Abort button is activated in the plot area. Pressing this button will
terminate the simulation (possibly after some delay). To speed up the computation, the plot can
be disabled by specifying the mode with a minus sign, e.g. mode=-2 for an inverse dynamics
computation without a continually updated plot. The plotting utility spadraw can also be used
after the simulation to visualize the results, see page 9.
During the computations the results are stored in one or more data files and in MATLAB arrays.
A log file is always created when SPACAR starts processing the input dat file. This log file
contains an analysis of the input and possible errors and warnings. It is described in more detail
on page 8. Some errors in the input file do not lead to an early termination of the SPACAR
computation, but nevertheless give unusable results. Therefore it is advisable to check the log
file for unexpected messages.
All other data files are so-called SPACAR binary data files (SBF), which implies that these are
in a binary format and cannot be easily read by a user. Therefore, utilities are provided to read
and modify data in these files, see page 9. Depending on the mode up to three binary output
files may be created.
For all modes a SPACAR binary data file with filename identical to the input file and extension
sbd is written. The contents of this file are also stored in MATLAB arrays, that are of course
immediately available in the MATLAB workspace e.g. to be visualized with the standard MATLAB graphics commands, such as plot (see e.g. Chapter 3 and Appendix C). The following
variables are created or overwritten:
mode
SPACAR mode number
ndof
number of DOFs including rheonomic ones
nddof number of dynamic DOFs
nkdof number of configuration coordinates including rheonomic ones
nkddof number of configuration coordinates
nx
number of coordinates
ne
number of deformation parameters
nxp
number of fixed, calculable, input, dynamic and
kinematic coordinates
nep
number of fixed, calculable, input, dynamic and
kinematic deformation parameters
lnp
location matrix for the nodes
*1
6
Chapter 1. The SPACAR program
le
ln
it
rxyz
time
x
xd
xdd
fx
fxgrav
fxtot
e
ed
edd
sig
dec
dxc
de
dx
d2e
d2x
xcompl
location matrix for the elements
connection matrix for the nodes in the elements
list of element types
initial orientations of elements
time column vector
coordinates (nodal displacements)
nodal velocities
nodal accelerations
prescribed nodal forces/moments
gravity nodal forces/moments
reaction forces/moments
generalized deformations
velocities of generalized deformations
accelerations of generalized deformations
generalized stress resultants
first order geometric transfer function for the deformations DF c(e)
first order geometric transfer function for the coordinates DF c(x)
first order geometric transfer function for the deformations DF (e)
first order geometric transfer function for the coordinates DF (x)
second order geometric transfer function for the deformations D2 F (e)
second order geometric transfer function for the coordinates D2 F (x)
location vector for directional nodal compliances
*1
*2
*2
*2
*3
*3
*3
*3
*3
*3
*4
Notes:
∗1 The two location matrices provide information to find the location of a specific quantity in
the data matrices:
lnp
le
location matrix for the nodes. The matrix element lnp(i,j) denotes
the location of the jth coordinate (j=1..4) of node i.
location matrix for the elements. The matrix element le(i,j) denotes
the location of the jth generalized deformation (j=1..6) of element i.
The locations of undefined or unused coordinates and deformations equal zero.
For example, the x- and y-coordinates of node 7 can be shown as function of time in a
graph by typing
>> plot(time,x(:,lnp(7,1:2)))
and the first generalized stresses in elements 1, 2 and 3 can be plotted by typing
>> plot(time,sig(:,le(1:3,1)))
Obviously, storage in the x, xd, xdd, fx, e, ed, edd and sig matrices is like x(t,k)
where t is the time step and k ranges from 1 to nx for x, xd, xdd and fx, fxtot and
from 1 to ne for e, ed, edd and sig, respectively.
Section 1.2. SPACAR & MATLAB
7
∗2 The variables ln, it and rxyz are mainly intended for internal use in the drawing tool
spadraw. More user-friendly information is available in the log file, page 8.
∗3 The (large) variables dec, dxc, de, dx, d2e and d2x are only created if the parameters
of the LEVELLOG are set accordingly, Sect. 2.2.
∗4 After a linearization run (mode=8) directional nodal compliances (inverse stiffnesses) are
computed. Using the location matrix, xcompl(lnp(i,j)) gives this quantity for the
jth coordinate (j=1..4) of node i.
After a linearization run (mode=3, 4, 7, 8 or 9) the coefficient matrices are stored in a SPACAR
binary matrix file with extension sbm. Besides nnom (see infra) and time, the accompanying
MATLAB matrices are:
m0
reduced mass matrix M 0
*5
b0
input matrix B 0
*5, *6
c0
velocity sensitivity matrix C 0
*5
d0
damping matrix D 0
*5
k0
structural stiffness matrix K 0
*5
n0
geometric stiffness matrix N 0
*5
g0
geometric stiffness matrix G0
*5
ak0
kinematic matrix Ak0
*5
bk0
kinematic matrix B k0
*5
Notes:
∗5 Storage of the time-varying matrices is in a row for each time step, so in m0(t,k) index t
is the time step and k ranges from 1 to ndof×ndof. To restore the matrix structure at
some time step type e.g. reshape(m0(t,:),ndof,ndof)’.
∗6 Only available for mode=4 and mode=9.
In mode=2, 3, 4 and 9 a so-called ltv file is created. The contents of this file varies and is
not automatically imported to the MATLAB workspace. From a mode=2 run the following data
are available (the names identitify the data used in the file; data marked with “*” are available
at each time step):
NNOM
number of (actuator) inputs
NY
number of outputs
T
time
*
U0
nominal input for the desired motion
*
Y0
reference output of the desired motion
*
In the addition the linearization runs yield additional setpoints, state space matrices and other
data in the ltv file (not all data are always present):
NNOM
number of (actuator) inputs
NX
number of states (2×ndof)
NU
number of inputs (length of U0)
NY
number of outputs (length of Y0)
NRBM
number of rigid body DOFs
NYS
number of outputs with 2nd order expression
8
Chapter 1. The SPACAR program
NYSI
index array for outputs with 2nd order expression
DFT
direct feedthrough flag (D6=0)
X0
initial state vector
T
time
*
A
state space system matrix
*
B
state space input matrix
*
C
state space output matrix
*
D
state space direct feedthrough matrix
*
G
second order output tensor
*
M0
mass matrix M 0
*
C0B
combined damping matrix C 0 + D 0
*
K0B
combined stiffness matrix K 0 + N 0 + G0
*
SIG0
generalized stress resultants
*
The getss tool can be used to read the state space matrices from the ltv file, see page 9.
Other utilities are available to use parts of these data in a SIMULINK environment, e.g. to read
setpoints or to simulate a linear time-varying (LTV) system (see Sect. 1.4).
The log file
The log file contains an analysis of the input and possible errors and warnings that are encountered. The error and warning messages are explained in more detail in Appendix B. The other
output can be separated into a number of blocks.
The first lines indicate the version and release date of the software and a copyright note.
Next the lines from the input file read by the KIN module are shown (not showing comments
present in the input file), see also Sect. 2.2. From the analysis is written:
• The elements used in this model. The deformations of all elements are shown with the
internal numbers according to the le array and the classification of each deformation:
O = fixed, C = calculable and M = DOF.
• The nodal point information with the internal numbers of the coordinates according to the
lnp array and the classification as above.
• A list showing the degrees of freedom, in which dynamic degrees of freedom are indicated.
• The condition number of the part of the difference matrix that has to be inverted, which
shows how well the degrees of freedom have been chosen.
The DYN module reads the next data block and processed input lines are shown. From the
analysis we get
• The numbers NEO, NEMM, NEM and NEC indicating the numbers of deformations in each
class as explained in the lecture notes [1].
• The numbers NXO, NXC, NXMM and NXM indicating the numbers of position coordinates
in each class as explained in the lecture notes [1].
• The stiffness, damping and mass of the elements.
Section 1.2. SPACAR & MATLAB
9
• The nodal point forces, mass and gyroscopic terms.
• The total mass of the system.
The zeroth, first, second and third order transfer functions are shown next, each for the position
parameters and deformation parameters, respectively. The amount of output can be controlled
by the keyword OUTLEVEL in the input file.
Next for a forward analysis (mode=1 and mode=4) the name of the integrator and accuracy
settings are shown. Finally a list with all time steps and the number of internal iterations are
given. For an inverse dynamics analysis the trajectories and input/output definitions (see also
Sect. 2.4) are read and analysed. In case of mode=3 the name of the data file of the previous
mode=2 is shown. In case of mode=7 the eigenvalues (frequencies) and normalized eigenvectors of the state system matrix are shown. In case of mode=8 load multipliers and normalized
buckling modes are presented. In addition the vector of directional nodal compliances is shown.
SPACAR binary data files
Some utilities are available to show, check, load or replace the data in SPACAR binary data files
(SBF). These are files with extensions sbd, sbm and ltv.
checksbf checks and shows the contents of a SPACAR binary data file. The output for each
variable is the name (“Id”), the type (1 for integer, 2 for real, 3 for text) and the size
(number of rows and columns). First the “header” variables are shown with their values.
Long vectors may be truncated. Between TDEF and TDAT the time-varying data are
given. The number of time steps is equal to the number of rows specified for TDEF.
getfrsbf extracts a variable from a SPACAR binary data file. The “Id” must be specified and
for time-varying data the time step as well.
repinsbf replaces the value of a variable in a SPACAR binary data file. The “Id” must be
specified and for time-varying data the time step as well.
loadsbd loads all data from a SPACAR binary data (sbd) file into MATLAB’s workspace.
loadsbm loads all data from a SPACAR binary matrix data (sbm) file into MATLAB’s
workspace.
getss loads the state space matrices at one time instant from a SPACAR ltv file into a state
space system in MATLAB’s workspace.
combsbd combines data from two or more SPACAR binary data (sbd) files into a single output
file. The specified output file is overwritten without a warning.
spadraw is the plotting utility used internally by SPACAR. It can also be used to visualize
results after a simulation has been completed.
For all utilities additional online help is available by typing help command at the MATLAB
prompt.
10
Chapter 1. The SPACAR program
Limitations
The SPACAR package has some built-in limitations on the size of the manipulators that can be
analysed. Table 1.1 shows the limits for the so-called “Student version” that can be downloaded
as describes in Appendix A. In case your requirements are larger, you need to contact the
authors. The licence for the freely downloadable software is time limited.
Maximum number of coordinates/deformations
Maximum number of DOFs
Maximum number of elements/nodal points
Maximum number of inputs
Maximum number of outputs
175
20
50
12
25
Table 1.1. Built-in limitations of the “Student version” of the SPACAR package.
1.3
SPAVISUAL
SPAVISUAL is the visualization tool for SPACAR . It can visualize deformation, vibration and
buckling modes. SPAVISUAL shows beams, trusses, and hinges in 2-D as well as in 3-D. It
works with default settings which can be adjusted by the user. The only input of SPAVISUAL
is a filename. This file has to be a .dat file which has been analysed with SPACAR. This is
necessary because SPAVISUAL needs the .sbd files for the deformation modes and also the
.sbm files for the vibration and the buckling modes. There are some keywords that can adjust
the default settings. These keywords are listed in section 2.7.
SPAVISUAL is a stand-alone function in MATLAB . To run SPAVISUAL the user has to type the
next command.
>> spavisual(’filename’)
Here filename refers to the .dat-file that is executed by SPACAR.
1.4
SPASIM and SIMULINK
The behaviour of a manipulator mechanism with e.g. closed-loop control can be simulated
using SIMULINK. The closed-loop simulation is defined as the problem of computing the actual
trajectory of e.g. the manipulator tip with controlled actuation of the motion. Tracking errors
with respect to a nominal prescribed trajectory can be calculated.
Figure 1.2 shows an overview of a typical simulation scheme. The simulation is characterized
by the inverse dynamics stage, based on a rigid link model and a forward dynamic stage. At
the forward dynamics stage the tracking behaviour of the manipulator system is studied. In
the case of flexible manipulators additional generalized coordinates (εm
i ) describing the elastic
behaviour of the manipulator links can be used in the dynamic system.
The block diagram in Fig. 1.3 shows a typical closed-loop simulation in more detail. Blocks are
used from the SPACAR SIMULINK library spacar_lib that is part of the SPACAR package.
These blocks are front-ends to so-called S-functions in SIMULINK [3]. The following blocks
are provided:
Section 1.4. SPASIM and SIMULINK
11
Rigid or rigidified link model
prescribed
trajectory
Flexible link model
hp
µ
actual
trajectory
xp0
xp
read
setpoints
INVDYN
analyses
simulation
y
read coeff. M 0 ,C 0 ,K 0 control
parameters
matrices
LINEAR
MATLAB
u0
y0
−
SIMULINK
simulation
Figure 1.2. Typical overview with MATLAB analyses and a SIMULINK simulation.
Read
Unom
u0
Read
Yref
y0
read setpoints &
coeff. matrices
Read
M0
+
+
−
control
system
δu u actuator
model
+
SPASIM
ėm
σ e,m mechanism m
e
model
sensor
model
y
S-function
control
parameters
e.g. M-function
Figure 1.3. Block diagram of a typical closed-loop simulation in SIMULINK. The left
blocks read setpoints and coefficient matrices stored in data files during previous SPACAR
analyses (Fig. 1.1).
1. SPASIM: the non-linear open-loop model of the manipulator with its actuators and sensors. It operates in a way comparable to the forward dynamics mode in SPACAR as discussed for the MATLAB interface in Sect. 1.2. The mechanism is defined in an input data
file of file type dat. The filename of the input file must be specified. An output
log file is written. Note that in a SIMULINK simulation the integration is determined
by the SIMULINK environment, e.g. the kind of solver, the step size and tolerances. The
degrees of freedom of the mechanism and their first time derivatives are the “states” of
the SPACAR S-function. The dimensions of the input and output vectors are determined
from the input file and should match the requirements of the other SIMULINK blocks they
are connected to.
2. LTV: simulation of a linear time-varying system as defined in an ltv file, see Sect. 1.5.
12
Chapter 1. The SPACAR program
3. Setpoint U0: reads the nominal input from an ltv file with setpoints generated e.g.
with mode=2 or mode=3. The filename must be specified. The setpoints are interpolated between the specified time steps. The interpolation method can be chosen from:
Stepwise, Linear (default) and Spline. The block has no input and the dimension of the
output vector equals the number of nominal inputs found in the file.
4. Setpoint Sigma0: reads σ 0 from an ltv file generated with e.g. mode=3, see
Sect. 1.5.
5. Reference Y0: reads the reference output from an ltv data file with setpoints. The
filename must be specified. Interpolation is as above. This block has no input and the
dimension of the output vector equals the number of reference outputs found in the file.
6. Times M0: reads the square reduced mass matrix M 0 from an ltv file generated with
e.g. mode=3. The output of the block equals the input of the block is multiplied with the
mass matrix. The filename must be specified. In the case not the full dimension of
M 0 in the ltv is used, the reduced dimension has to be specified. All elements of M 0
are interpolated linearly (default) or stepwise. The dimension of the output vector equals
the dimension of the input vector.
In the block diagram in Fig. 1.3 the output vector y of the SPASIM block is compared with
the reference output vector y 0 . The difference of these vectors is the input of the control system. The state matrices can be used to develop and tune a controller of any type (e.g. linear, non-linear, discrete, continuous) by means of the available software tools in MATLAB and
SIMULINK . The output of the controller δu is added to the nominal input vector u0 to actuate
the mechanism. An example is discussed in Sect. 3.11.
When using blocks from the SPACAR SIMULINK library spacar_lib note the following:
• Using any of the LTV, Setpoint U0, Setpoint Sigma0, Reference Y0 and
Times M0 blocks at times beyond the last time step found in the data file may lead to
unexpected results.
• In the current version of the software all spasim blocks in a block diagram should
refer to the same input filename. Analogously, all LTV, Setpoint U0, Setpoint
Sigma0, Reference Y0 and Times M0 must use the same ltv file.
1.5
Perturbation method and modal techniques
For systems with a larger number of degrees of freedom the required computer time for a
SPASIM simulation may be unacceptable, in particular when high eigenfrequencies play a role.
Then the perturbation method may provide a numerically efficient solution strategy.
Consider e.g. the motion of the flexible manipulator depicted in Fig. 1.2. In the case the flexibility is taken into account, the generalized coordinates or degrees of freedom can be written
as
"
#
em
q= m ,
ε
(1.11)
Section 1.5. Perturbation method and modal techniques
13
where em represent the large relative displacements and rotations and εm are the flexible deformation parameters. Due to the flexibility the actual trajectory motion will deviate from the
prescribed motion. If the deviations are small compared with the large scale motion, then the
(small) vibrational motion of the manipulator can be modelled as a first-order perturbation δq
of the nominal rigid link motion q 0 by writing for the degrees of freedom
q = q 0 + δq.
(1.12)
The perturbation method involves two steps:
1. Compute nominal rigid link motion q 0 from the non-linear equations of motion with all
flexible deformation parameters εm ≡ 0. This analysis will also provide the nominal
input u0 of the manipulator necessary to carry out the nominal motion and the generalized stress resultants (Langrange multipliers) σ εm
0 of the rigidified deformations, i.e. the
flexible deformations that are prescribed as zero.
2. Compute the vibrational motion δq from linearized equations of motion
M̄ 0 δq̈ + C̄ 0 δ q̇ + K̄ 0 δq = σ 0 ,
(1.13)
where M̄ 0 is the reduced mass matrix, C̄ 0 includes the velocity sensitivity and damping
matrices and all stiffness matrices are combined into K̄ 0 . The right-hand side equals
"
#
δu
,
σ0 =
σ εm
0
(1.14)
where δu = u − u0 is the actual control action u minus the nominal input u0 . The previously computed generalized stress resultants σ εm
0 are now applied as internal excitation
forces.
To solve the linearized equations of motion (1.13) these are expressed as a linear time varying
(LTV) system. A SPACAR mode=3 run generates time-varying state space matrices that are well
suited for this purpose. Then a typical SPACAR analysis and linearized simulation procedure is
as follows:
• Use e.g. an inverse dynamics run (mode=2) to define the nominal motion for the rigidified
manipulator. Inputs and outputs of the system may be specified.
• Next the system is linearized with a mode=3 call. The system is analysed along the
nominal path computed previously. The elastic deformations are defined with INPUTE
commands. Inputs and outputs must be specified.
• Finally the linearized simulation can be run with a SIMULINK model of which a typical
example is shown in Fig. 1.4. In comparison with the non-linear simulation of Fig. 1.3 the
spasim block is replaced by an LTV block that uses the linearized equations of motion.
Note that now only the differences compared to the nominal motion are computed. Only
the difference δu of the manipulator’s input compared to the nominal input is needed. In
addition, the generalized stress resultants σ εm
0 are part of the input of the LTV block.
14
Chapter 1. The SPACAR program
u0
u
+
y0
+
-
controller
+
y
+
δu
σ εm
0
LTV
Figure 1.4. Block diagram of a typical closed-loop simulation in
perturbation method.
δy
SIMULINK
based on the
In addition to the above outlined standard implementation some further extensions are provided.
It is possible to include the effect of proportional controller gain, i.e. a proportional control
matrix K p , into the stiffness matrix K̄ 0 . Of course, in that case this part of the control action
should no longer be included in the controller in the block scheme.
This approach offers advantages when subsequently a modal analysis is applied to the linear
time varying state space system. Such an analysis discriminates quasi-static behaviour of the
system, low-frequency vibrational modes and high-frequency vibrational modes. Mostly the
latter do not significantly affect the output of the system while they can have a detrimental
effect on the computational efficiency, even for a linearized system. With a modal analysis it is
possible to eliminate these high-frequency modes.
A more profound description of the latter two techniques is currently outside the scope of this
manual.
2
Keywords
2.1
Introduction
In this chapter the user is informed about the creation of correct input data for the software
package SPACAR. The input must have a specific form. Behind a number of permitted keywords
the user supplies a list of arguments. The arguments behind a keyword are well defined. Each
module of SPACAR, except mode=4 of LINEAR, has its own list of available keywords. They
form blocks that are separated by the following pair of keywords:
END
HALT
The final closure of the input is effected by:
END
END
The first block contains the kinematic data. The input of the mechanism model (by means of
keywords) is treated in the “Kinematics” section 2.2. A second block of input is reserved for the
dynamics module. The keywords for this block are presented in the “Dynamics” section 2.3.
The solution of inverse dynamics problems demands additional input for the trajectory description and for the definition of the input and output vectors u0 and y 0 . Trajectory keywords and
system keywords are treated in the “Inverse dynamics” section 2.4. The keywords for the linearization of mode=3, mode=4 and mode=9 are given in the “Linearization” section 2.5. At
the end of the file custom settings for SPAVISUAL can be added. The keywords for SPAVISUAL
are presented in section 2.7. The simulation of mechanisms using SIMULINK is controlled by
the keywords described in the “Simulation” section 2.6.
Some general remarks:
• Keywords and arguments can be separated by one or more spaces, tabs or line breaks.
• Lines must not contain more than 160 characters.
15
16
Chapter 2. Keywords
• Any text in a line following a #, % or ; is treated as a comment.
• All input is case insensitive.
• Data read from the input file are echoed in the log file, after the comments have been
removed and all text is transformed into upper case (capitals).
• Angles are always specified in radians.
• For some commands, such as XF and STARTDE, not all arguments have to be specified.
Default values are zero unless otherwise specified.
2.2
Kinematics
A kinematic mechanism model can be built up with finite elements by letting them have nodal
points in common. The nodal coordinates of the finite elements are described by position and
orientation coordinates. Therefore, two types of nodes are distinguished: position or transx
lational nodes, denoted by ~p for node p, and orientation or rotational nodes denoted by p.
The nodes, nodal coordinates, and deformation parameters for the truss, beam, planar bearing,
hinge, pinbody (rigid beam) planar belt (gear) element and wheel elements are summarized in
Table 2.1.
Usually, the convention is made that node p of an element is assigned to the lower number of
the element nodes, and that node q is assigned to the higher node number. The interconnections
between the elements are accomplished by indicating common nodes between the elements.
For instance, with a pin-joint connection only the translational nodes are shared. In case of a
hinge-joint connection only the rotational nodes are shared whereas translational coordinates
can either be shared or unshared. When elements are rigidly connected to each other, both the
translational and rotational nodes are shared, see Fig. 2.1. It can be observed from Table 2.1
that a truss element and a hinge element do not have common nodal types and therefore cannot
be connected to each other.
pin-joint
hinge-joint
rigid-joint
Figure 2.1. Joint connections between finite elements.
In the first block of the kinematics module either two-dimensional (planar) or three-dimensional
(spatial) elements can be specified. In the second block the initial configuration of the mechanism is specified. In the third block the coordinates and generalized deformations are divided
into four groups, depending on the boundary conditions:
1.
2.
3.
4.
fixed prescribed coordinates (supports)
dependent, calculable deformations
prescribed, time-dependent coordinates
dynamic degrees of freedom
Section 2.2. Kinematics
17
end node p
x
~
end node q
x
~
generalized
deformations
planar beam
xp
φp
xq
φq
ε1 , ε2 , ε3
PLTRUSS
planar truss
xp
–
xq
–
ε1
PLTOR
planar hinge
–
φp
–
φq
ε1
PLBEAR
planar bearing
xp
φp
xq
φq
ε1 , ε2 , ε3
PLPINBOD
planar pinbody
xp
φp
xq
–
ε1 , ε2
PLRBEAM
planar rigid beam
xp
φp
xq
–
ε1 , ε2
PLWHEEL
planar wheel
xp
φp
–
φq
ε̇1 , ε̇2
PLBELT
planar belt (gear)
xp
φp
xq
φq
ε1
BEAM
spatial beam
xp
λp
xq
λq
ε1 , ε2 , ε3 , ε4 , ε5 , ε6
TRUSS
spatial truss
xp
–
xq
–
ε1
HINGE
spatial hinge
–
λp
–
λq
ε1 , ε2 , ε3
spatial pinbody
xp
λp
xq
–
ε1 , ε2 , ε3
RBEAM
spatial rigid beam
xp
λp
xq
–
ε1 , ε2 , ε3
WHEEL
spatial disk wheel
xp
λp
xq
–
ε1 , ε2 , ε3 , ε4 , ε̇5 , ε̇6
TWHEEL
spatial torus wheel xp
λp
xq
–
ε1 , ε2 , ε3 , ε4 , ε̇5 , ε̇6
keyword
type
PLBEAM
PINBODY
Table 2.1. Nodes, nodal coordinates and deformation parameters for the planar and spatial
truss, beam, bearing, hinge, pinbody, belt (gear) and wheel elements.
For the keywords in the third block it is important to remark that there are no keywords to fix
a deformation or to release a coordinate. These are the default settings. So a deformation is
fixed unless a RLSE, INPUTE or DYNE keyword specifies otherwise. Similarly, a coordinate is
calculable unless a FIX, INPUTX or DYNX keyword specifies otherwise.
For systems with non-holonomic deformations, dependent coordinates or deformations can be
specified as generalized configuration coordinates by the keywords KINX and KINE; these are
called the kinematic generalized coordinates and the corresponding velocities are not dynamic
degrees of freedom.
With the keywords of the fourth optional block, the calculation of some non-linear terms in the
expressions for the deformations of planar or spatial beams can be suppressed and geometric
properties for PINBODY elements and their cognates (rigid beam, planar pinbody, planar rigid
beam) can be specified.
The keyword in the fifth section is not really a kinematic keyword as it sets the level of output
from the program.
18
Chapter 2. Keywords
KEYWORDS KINEMATICS
1
PLBEAM
PLTRUSS
PLTOR
PLBEAR
PLPINBOD
PLRBEAM
PLWHEEL
PLBELT
BEAM
TRUSS
HINGE
PINBODY
RBEAM
WHEEL
TWHEEL
Planar beam element
Planar truss element
Planar hinge element
Planar bearing element (not supported !!)
Planar pinbody element
Planar rigid beam element
Planar wheel element
Planar belt (gear) element
Beam element
Truss element
Hinge element
Spatial pinbody element
Spatial rigid beam element
Spatial disk wheel element
Spatial torus wheel element
X
Specification of the initial Cartesian nodal positions
FIX
RLSE
INPUTX
INPUTE
DYNX
DYNE
KINX
KINE
Support coordinates x0
Calculable deformations ec
Prescribed DOF xm
Prescribed DOF em
Dynamic DOF xm
Dynamic DOF em
Configuration coordinate xk
Configuration coordinate ek
LDEFORM
Suppresses the calculation of non-linear elastic strains
of a beam element, due to possibly large curvatures
and twists of the elastic line.
Defines the orientations of the generalized deformations for the PINBODY elements and cognates.
Defines the undeformed reference distances for the
PINBODY elements and cognates.
2
3
4
ORPINBOD
DRPINBOD
5
OUTLEVEL
Sets the level of output generated in the log file and
in the SPACAR binary data (sbd) file.
The parameters for these keywords are listed below. {∗i} refers to note i listed at the end of the
keywords.
Section 2.2. Kinematics
PLBEAM
PLTRUSS
PLTOR
PLPINBOD
PLRBEAM
PLWHEEL
PLBELT
BEAM
[
[
TRUSS
HINGE
1
2
3
4
5
1
2
3
1
2
3
1
2
3
4
1
2
3
4
1
2
3
4
5
6–7
1
2
3
4
5
6
7
1
2
3
4
5
6–8
6/9
1
2
3
1
2
3
4–6
19
element number
first position node
first orientation node
second position node
second orientation node
element number
first position node
second position node
element number
first orientation node
second orientation node
element number
first position node
first orientation node
second position node
element number
first position node
first orientation node
second position node
element number
position node
first orientation node, yaw angle
second orientation node, spin angle
wheel radius
initial direction of the spin axis, i.e. the y ′ -axis
element number
first position node
first orientation node
second position node
second orientation node
first pulley/base circle radius
second pulley/base circle radius
element number
first position node
first orientation node
second position node
second orientation node
initial direction of the principal y ′ -axis of the beam crosssection ] {∗1}
torsion–elongation coupling parameter ft ] {∗1}
element number
first position node
second position node
element number
first orientation node
second orientation node
initial direction of the x′ -axis of rotation {∗2}
20
Chapter 2. Keywords
[
1
2
3
4
5–7
[
1
2
3
4
5–7
[
1
2
3
4
5–7
1
2
3
4
5
6
7–9
1
2
3
4
PINBODY
RBEAM
WHEEL
TWHEEL
X
element number
first position node
first orientation node
second position node
initial direction of the principal y ′ -axis of the beam crosssection ] {∗3}
element number
first position node
first orientation node
second position node
initial direction of the principal y ′ -axis of the beam crosssection ] {∗1}
element number
first position node
first orientation node
second position node
initial direction of the spin axis, i.e. the z ′ -axis
element number
first position node
first orientation node
second position node
wheel radius in equatorial plane
transverse wheel radius
initial direction of the spin axis, i.e. the z ′ -axis
position node number
x1 -coordinate
x2 -coordinate
x3 -coordinate ] {∗4}
Section 2.2. Kinematics
FIX
[
RLSE
[
INPUTX
[
INPUTE
[
DYNX
[
DYNE
[
KINX
[
KINE
[
1
2–
1
2–
1
2–
1
2–
1
2–
1
2–
1
2–
1
2–
LDEFORM
ORPINBOD
1
1
DRPINBOD
2–10
1
2
3
[
4
[
1
2
OUTLEVEL
NOTES:
21
node number
coordinate number (1, 2, 3 or 4) ] {∗5}
element number
deformation mode coordinate number (1,
{∗6}
node number
coordinate number (1, 2, 3 or 4) ] {∗5}
element number
deformation mode coordinate number (1,
{∗6}
node number
coordinate number (1, 2, 3 or 4) ] {∗5}
element number
deformation mode coordinate number (1,
{∗6}
node number
coordinate number (1, 2, 3 or 4) ] {∗5}
element number
deformation mode coordinate number (1,
{∗6}
2, 3, 4, 5 or 6) ]
2, 3, 4, 5 or 6) ]
2, 3, 4, 5 or 6) ]
2, 3, 4, 5 or 6) ]
BEAM element number
PINBODY, RBEAM, PLPINBOD or PLRBEAM element
number
direction vectors {∗7}
PINBODY, RBEAM, PLPINBOD or PLRBEAM element
number
undeformed projection of xq − xp on the first direction vector
undeformed projection of xq − xp on the second direction
vector
undeformed projection of xq − xp on the third direction
vector for spatial elements ]
level of output in log file {∗8}
level of output in the SPACAR binary data (sbd) file] {∗8}
22
Chapter 2. Keywords
∗1 The direction vector lies in the local x′ y ′ -plane of the beam element. If no direction is
specified, the local direction vector is chosen as the standard basis vector that makes the
largest angle with axis of the beam; in case of a draw, the vector with the highest index is
chosen.
The torsion–elongation coupling parameter takes into account the shortening of the beam
due to torsion, such that for a twisted, axially unloaded beam the axial strain is − 12 ft α2 ,
where α is the specific twist of the beam. For thin-walled open cross-sections, ft =
(Iy′ + Iz′ )/A, but it may have a different value, or even be negative, for solid crosssections.
∗2 The local y ′ and z ′ unit vectors are chosen as follows. First, the standard basis vector with
the largest angle with the hinge axis is chosen; in case of a draw, the vector with the
highest index is chosen. Then the local y ′ is chosen in the direction of the cross product
of the local x′ -direction with this basis vector. The local z ′ -direction is chosen so as to
complete an orthogonal right-handed coordinate system.
∗3 If no direction is specified, directions initially aligned with the global coordinate axes are
chosen; otherwise the line connecting the translational nodes is chosen as the local x′ direction and the specified vector is in the local x′ y ′ -plane. The directions used are made
orthonormal. The directions can also be specified with the keyword ORPINBOD.
∗4 The specification of the initial positions with the keyword X is only required for non-zero
position-coordinates. The initial orientations cannot be chosen freely.
∗5 If the keywords INPUTX, DYNX, FIX and KINX are used without an explicit specification
of the coordinate, all (independent) coordinates will be marked as degrees of freedom or
supports. This means that x1 , x2 (and x3 ) are marked for position nodes and β or λ1 , λ2
and λ3 for orientation nodes. If more than one coordinate is specified, each of the specified coordinates is chosen as a degree of freedom or a support.
∗6 If the keywords INPUTE, DYNE, RLSE and KINE are used without an explicit specification
of the deformation mode coordinate, all deformation mode coordinates will be marked as
degrees of freedom or released. If more than one deformation mode coordinate is specified, each of the specified coordinates is chosen as a degree of freedom or as released.
∗7 There are four distinct cases, two for the planar elements and two for the spatial elements.
For the planar elements, if two numbers are specified, this is the direction of the local
x′ -axis and an orthogonal y ′ -direction is found by rotating by a right angle in the positive
direction and the directions are normalized; if four numbers are specified, these are taken
as the direction vectors in the local x′ - and y ′ -directions as they are. For the spatial
elements, if six numbers are specified, these are taken as the direction of the x′ -axis and
a direction in the local x′ y ′ -plane, which are made orthonormal and completed by a local
z ′ -axis; if nine numbers are specified, these are taken as the three direction vectors as they
are.
Section 2.2. Kinematics
23
∗8 Both parameters for the output level are integers of which the values are the sum of the
desired outputs. A value of 0 implies the least output; an output level of −1 means maximum output; to obtain multiple outputs, the specified values for the parameters should be
added.
For the first parameter for the log file are defined:
0 Default: All “normal” output.
1 Additional output of the first order geometric transfer functions in de and dx.
2 Additional output of the second order geometric transfer functions in d2e and
d2x for mode=4, 7, 8 and 9.
4 Additional output of the third order geometric transfer functions in d3e and d3x
for mode=4, 7, 8 and 9.
8 Additional output of the derivative of the global deformation function for
mode=4, 7, 8 and 9.
For the second parameter (SPACAR binary data (sbd) file) are defined:
0 Default for all modes except mode=7, 8 and 9: All “normal” output.
1 Default for mode=7, 8 and 9: Additional output of the first order geometric
transfer functions in de and dx.
2 Additional output of the second order geometric transfer functions in d2e and
d2x.
3 Additional output of the first and second order geometric transfer functions (a
combination of 1 and 2).
24
2.3
Chapter 2. Keywords
Dynamics
With the keywords of the dynamics module the following blocks of information can be supplied.
Blocks 1 and 2 are optional. If deformable elements have been defined in the kinematics,
block 3 has to be filled, lest the stiffness and damping are zero. If the motion is not prescribed
by trajectories, block 4 has to be used to define the input motion. Finally with the keywords
from the 5th block miscellaneous settings can be adjusted.
KEYWORDS DYNAMICS
1
2
XM
EM
XGYRO
MEE
Inertia specification of lumped masses
Inertia specification of distributed element masses
Inertia specification of gyrostat
User-defined mass put into M (e,e)
XF
External force specification of the mechanism in
nodes
Specification of MATLAB M-file for user functions
with input for forces and stresses
USERSIG
3
ESTIFF
ESIG
EDAMP
Specification of elastic constants
Specification of preloaded state
Specification of viscous damping coefficients
TIMESTEP
INPUTX
INPUTE
STARTDX
STARTDE
USERINP
Duration and number of time steps
Specification of simple time functions for the
prescribed degrees of freedom
Specification of initial values for the dynamic degrees
of freedom
Specification of MATLAB M-file for user functions
with input for the degrees of freedom
GRAVITY
INTEGRAT
ERROR
ITERSTEP
Specification of the gravitational acceleration vector
Selection of integrator
Specification of error tolerances for the integrator
Specification of number of iterations and steps and
error tolerance for static calculations in modes 7, 8
and 9
4
5
Section 2.3. Dynamics
25
The parameters required with these keywords are listed below. {∗i} refers to note i listed at the
end of the keywords.
1
2
XM
[
3
4
5
6
7
1
2
3
[
4
[
5
[
6
EM
1
2
3
4
XGYRO
MEE
[
XF
[
USERSIG
5
6
1
2
3
4
3/5
1
2
3-5
1
node number
concentrated mass for position nodes;
rotational inertia I for planar orientation nodes;
for spatial orientation nodes, the inertia components
Jxx {∗1}
Jxy {∗1}
Jxz {∗1}
Jyy {∗1}
Jyz {∗1}
Jzz {∗1}
element number
mass per unit of length
rotational inertia Jx′ x′ per unit of length for spatial beam;
{∗2}
rotational inertia J per unit of length for planar beam; {∗2}
angle over which the belt is initially wound over the first
pulley for a planar belt ]
rotational inertia Jy′ y′ per unit of length for spatial beam;
{∗2}
angle over which the belt is initially wound over the second
pulley for a planar belt ]
rotational inertia Jz′ z′ per unit of length for spatial beam ]
{∗2}
rotational inertia Jy′ z′ per unit of length for spatial beam ]
{∗2}
node
number

Ω1 
 components of absolute angular rotor velocity (free
Ω2 rotor motion) or components of constant angular rotor

Ω3  velocity relative to the carrier body (prescribed rotor
motion)
rotor inertia J
type of rotor motion (0: free, 1: prescribed)
first element number
deformation coordinate of first element
second element number
deformation coordinate of second element ]
entry in the mass matrix M (e,e) {∗3}
node number
forces dual with the 1st nodal coordinate
forces dual with the 2nd , 3rd and 4th nodal coordinate ]
Name of the MATLAB M-file with user functions with forces
and stresses {∗4}
26
Chapter 2. Keywords
1
2
ESTIFF
[
3
[
4
[
[
[
5
6
7
1
2–
1
2
[
3
[
4
[
5
ESIG
EDAMP
element number
EA for beam, truss and belt elements
S1 = St for hinge elements
S1 , first stiffness coefficient for pinbody and cognates
GIt for spatial beam
EI for planar beam
S2 , second stiffness coefficient for pinbody and cognates ]
{∗5}
EIy′ for spatial beam
EI/(GAk) for planar beam
S3 , third stiffness coefficient for pinbody and cognates ]
{∗5}
EIz′ for spatial beam ] {∗5}
EIy′ /(GAkz′ ) for spatial beam ] {∗5}
EIz′ /(GAky′ ) for spatial beam ] {∗5}
element number
preloaded generalized stresses {∗5}
element number
Ed A, longitudinal damping for beam, truss and belt elements
Sd1 , torsional damping for hinge elements
Sd1 , first damping coefficient for pinbody and cognates
Gd It , torsional damping for beam elements
Ed I, bending damping for planar beams
Sd2 , second damping coefficient for pinbody and cognates ]
{∗5}
Ed Iy′ , bending damping in y ′ -direction for spatial beams
Sd3 , third damping coefficient for pinbody and cognates ]
{∗5}
Ed Iz′ , bending damping in z ′ -direction for spatial beam ]
{∗5}
Section 2.3. Dynamics
1
2
1
2
3
4
5
1
2
TIMESTEP
INPUTX
INPUTE
3
4
5
1
2
3
4
1
2
3
4
1
STARTDX
STARTDE
USERINP
GRAVITY
[
INTEGRAT
ERROR
ITERSTEP
27
1
2
3
1
2
1
2
1
2
3
length of time period
number of time steps
node number (position or orientation node) {∗6}
coordinate number (1, 2, 3 or 4)
start value {∗7}
start rate
acceleration (constant)
element number {∗8}
deformation mode coordinate number (1, 2, 3, 4, 5 or 6)
{∗9}
start value {∗10}
start rate
acceleration (constant)
node number
coordinate number (1, 2, 3 or 4)
start value {∗7}
start rate
element number
deformation mode coordinate number (1, 2, 3, 4, 5 or 6)
start value {∗10}
start rate
Name of the MATLAB M-file with user defined input functions {∗11}
x-component of the acceleration of gravity
y-component of the acceleration of gravity
z-component of the acceleration of gravity ]
Specify integrator type {∗12}
Step size or initial step size
Absolute error for the integrator
Relative error for the integrator {∗13}
maximal number of iterations in calculating a stationary solution (default value 10)
number of load steps (default value 4)
error tolerance (default value 5.0E–7)
NOTES:
∗1 The inertia components are related to the global coordinate system (x, y, z) in the initial
configuration. The tensor components are needed, so Jxy , etc., represent the negative of
the products of inertia.
∗2 The distributed moments of inertia are lumped to the orientation nodes of the beam elements.
They represent the mass moments of inertia of the cross-section of the beam, so Jx′ y′ and
Jx′ z′ are zero.
28
Chapter 2. Keywords
∗3 The keyword MEE is used to add a fixed mass coupled to deformation mode coordinates.
If all five numbers are specified, the mass is placed as a coupling between the two deformation mode coordinates; if three numbers are specified, the mass is placed on the
diagonal.
∗4 The (required) parameter of the USERSIG keyword is the name of a MATLAB M-file without
the extension .m and with a maximum filename length of 8 characters. The calling syntax
of the M-script is
function [time,sig,f]=pushsig(t,ne,le,e,ep,nx,lnp,x,xp);
The input parameters are the time t and a list of variables that store the instantaneous
values of the same quantities as are represented by the corresponding variables in the
SPACAR binary data, see the overview on page 5. The script should return (again) time
t, user defined stresses sig and user defined nodal forces fx. Either sig or fx or both
may be empty in the case no stresses and/or forces are prescribed. Otherwise each row in
sig and/or fx should define one stress value or force component at the specified time t.
Three columns should be provided with
1. The element number (e) or the node number (x).
2. The deformation mode number (e) or the coordinate number (x).
3. The current value of the stress or force component.
Two more columns can be provided, which specify the diagonal elements of the stiffness
and damping matrices, respectively, coresponding to the stress or force component.
∗5 Unspecified values for the stiffness and damping are assumed to be zero by default. The
meaning of the variables is: E, elasticity modulus (Young’s modulus); G = E/(2 +
2ν), shear modulus; ν, Poisson’s ratio; Ed , damping modulus in Kelvin–Voigt model;
Gd , shear damping modulus in Kelvin–Voigt model; A, cross-sectional area; I (Iy′ , Iz′ ),
second area moment (about y ′ -axis and z ′ -axis); It , Saint-Venant’s torsion constant; k (ky′
and kz′ ), shear correction factor (in y ′ -direction and z ′ -direction). The shear correction
factors are about 0.85; a table of values for various cross-sections can be found in [5].
The generalized stresses are calculated according to the Kelvin–Voigt model as follows.
All first stresses are calculated as σ1 = S1 ε1 + Sd1 ε̇1 + σ0 , where S1 = EA/l0 and
Sd1 = Ed A/l0 for the truss and beam elements, where l0 is the undeformed length of
the element, and the first stiffness and damping coefficients as defined in the input for
the other types of elements. σ0 is the preload defined by the keyword ESIG. For hinge
and pinbody elements, the other stresses are calculated in an analogous way. For a planar
beam element, the bending stresses are calculated as
"
#
"
S2
σ2
4 + Φ −2 + Φ
=
σ3
1 + Φ −2 + Φ 4 + Φ
#"
#
"
Sd2
ε2
4 + Φ −2 + Φ
+
ε3
1 + Φ −2 + Φ 4 + Φ
#"
ε̇2
ε̇3
#
,
where S2 = EI/l03 , Φ = 12EI/(GAkl02 ) and Sd2 = Ed I/l03 . For a spatial beam element,
the torsional stress is calculated as σ2 = S2 ε2 + Sd2 ε̇2 , where S2 = GIt /l03 and Sd2 =
Section 2.3. Dynamics
29
Gd It /l03 . For bending along the local y ′ - and z ′ -axes, the stresses are, analogous to the
planar case,
"
#
"
#"
ε̇3
ε̇4
#
#
"
#"
ε̇5
ε̇6
#
#
"
#"
Sd3
ε3
4 + Φz −2 + Φz
+
ε4
1 + Φz −2 + Φz 4 + Φz
#
"
#"
Sd4
ε5
4 + Φy −2 + Φy
+
ε6
1 + Φy −2 + Φy 4 + Φy
S3
4 + Φz −2 + Φz
σ3
=
σ4
1 + Φz −2 + Φz 4 + Φz
and
"
S4
4 + Φy −2 + Φy
σ5
=
σ6
1 + Φy −2 + Φy 4 + Φy
,
where S3 = EIy′ /l03 , Φz = 12EIy′ /(GAkz′ l02 ), Sd3 = Ed Iy′ /l03 , S4 = EIz′ /l03 , Φy =
12EIz′ /(GAky′ l02 ), and Sd4 = Ed Iz′ /l03 . To all stress components, a preload can be
added by the key word ESIG.
∗6 In a mode=7, 8 or 9 run a (deformed) mechanism configuration is computed which corresponds with the specified nodal position.
∗7 The default position start value for INPUTX and STARTDX is the value specified by the
kinematic keyword X, which has a default zero.
∗8 Stiffness and damping properties of the corresponding element are not used for the dynamic
computations.
In a mode=7, 8 or 9 run a (deformed) mechanism configuration is computed which
corresponds with the specified element deformation.
∗9 Rotational deformations are defined in radians.
∗10 Note that the keyword X defines an initial configuration in which the deformations are zero.
(An exception is an element for which the keyword DRPINBOD has been used.) A start
value defined with INPUTE or STARTDE defines a deformation with respect to the initial
configuration.
∗11 The (required) parameter of the USERINP keyword is the name of a MATLAB M-file without the extension .m and with a maximum filename length of 8 characters. The calling
syntax of the M-script is
function [t,e,x]=mymotion(t,is);
The input parameters are the time t and time step number is. The script should return
(again) time t, prescribed deformations e and prescribed coordinates x. Either e or x
may be empty in the case no deformations or coordinates are prescribed. Otherwise each
row in e and/or x should define one deformation or coordinate at the specified time t.
Five columns should be provided with
1. The element number (e) or the node number (x).
2. The deformation mode number (e) or the coordinate number (x).
3. The current value of the deformation (e) or coordinate (x).
4. The current rate of the deformation (ė) or velocity (ẋ).
30
Chapter 2. Keywords
5. The current acceleration of the deformation (ë) or coordinate (ẍ).
The user has to assure the correctness of the derivatives. SPACAR does not carry out any
checks, but the results depend heavily on these derivatives.
∗12 Available integrator types are:
0 Default: Shampine–Gordon.
130 Explicit third-order Runge–Kutta, fixed step size.
135 Explicit third-order Runge–Kutta, variable step size.
140 Explicit fourth-order Runge–Kutta, fixed step size.
155 Explicit fifth-order Runge–Kutta, variable step size.
220 Explicit Runge-Kutta for second-order systems, second-order accurate, fixed
step size.
225 Explicit Runge–Kutta for second-order systems, second-order accurate, variable
step size.
310 Semi-implicit Runge–Kutta–Rosenberg, first-order accurate, fixed step size.
320 Semi-implicit Runge–Kutta–Rosenberg, second-order accurate, fixed step size.
330 Semi-implicit Runge–Kutta–Rosenberg, third-order accurate, fixed step size.
410 Singly diagonally implicit Runge–Kutta (implicit Euler), first-order accurate,
fixed step size.
420 Singly diagonally implicit Runge–Kutta, second-order accurate, fixed step size.
430 Singly diagonally implicit Runge–Kutta, third-order accurate, fixed step size.
Change this only if you know what you are doing.
∗13 The error tolerances are used for integration methods with a variable step size in the integrators of type 0, 135, 155 and 255. For the integrators of type 410, 420 and 430, the
absolute tolerance is used as the tolerance for the modified Newton–Raphson iteration.
Section 2.4. Inverse dynamics (setpoint generation)
2.4
31
Inverse dynamics (setpoint generation)
For clarity the keywords for the inverse dynamics including the generation of setpoints are discussed in two subsections. In the input file keywords from both subsections must be combined
into one part, so there should be no END/HALT pair in between.
2.4.1 Trajectory generation
There are three essential keyword blocks:
KEYWORDS TRAJECTORY GENERATION
1
TRAJECT
Trajectory header; the given trajectory number is
valid for all keywords before the next TRAJECT.
TROT
TRANS
Definition of the actual trajectory:
the number and type of DOFs determine which keywords and
how many of them have to be specified:
TROT, TRANS, and TRCIRL for nodes and
TRE for elements (maximum of 6).
2
TRCIRL
TRE
3
USERTRAJ
Trajectory defined by a user function.
TRTIME
Definition of trajectory time and number of time
steps.
and there are two blocks of optional keywords:
1
2
TREPMAX
TRVMAX
TRFRONT
Specification of velocity profile: rise time
and maximum velocity.
Specification of acceleration front for each velocity
profile.
TRM
TRF
Specification of extra masses and
forces on the end-effector.
32
Chapter 2. Keywords
The trajectories can be constructed in two ways: with a user function or with built-in profiles.
The latter are defined below and are of course limited to (combinations of) the built-in profiles.
On the other hand, practically any input can be generated with user functions. This feature
is activated by defining exactly one TRAJECT with the USERTRAJ keyword. The (required)
parameter is the name of an MATLAB M-script that is to be called. With TRTIME the total
trajectory time and the number of time steps must be specified. The calling syntax of the Mscript is exactly equal to that of the M-script for the USERINP keyword, see page 29.
Alternatively, one can use the built-in trajectory profiles. The next scheme shows in more
detail the combination possibilities of the setpoint generation keywords. Essential keywords
are accompanied by a number of optional keywords placed between brackets. Other optional
keywords than those mentioned are not allowed for that specific essential keyword.
TRAJECT
TRE
TROT
[TREPMAX TRFRONT]
[TRVMAX TRM TRFRONT]
TRANS
TRCIRL
[TRVMAX TRM TRF TRFRONT]
[TRVMAX TRM TRF TRFRONT]
TRTIME
-
The way to follow through the scheme is almost fully dictated by the number and type of degrees
of freedom. Each trajectory is defined for the same DOF and therefore runs through the same
branch of the scheme. Only TRANS and TRCIRL may be changed into one another after each
trajectory.
Section 2.4. Inverse dynamics (setpoint generation)
33
At this stage it is useful to mention the way in which degrees of freedom are declared:
Position and orientation coordinates are declared as DOF by input-command
INPUTX node-number component-number
Deformation mode coordinates are declared as DOF by input-command
INPUTE element-number component-number
(INPUTX and INPUTE are “kinematic keywords”, Sect. 2.2).
So, degrees of freedom are declared separately. For generation of setpoints in relative coordinates (such as joint angles), each INPUTE in the kinematics input prepares one TRE in the
setpoint generation input (only the first relative coordinate per element is allowed as input for
the setpoint generation). For the positions and orientations the situation is more complex because a trajectory in two or three dimensions is defined on node level, not on coordinate level.
The keywords TROT, TRANS and TRCIRL prescribe the motion of one node:
keyword
TROT
TRANS
TRCIRL
description
rotation about a
fixed axis in space
translation along a
straight line
translation along a
circle segment
node type and type number
2-D orientation
1
3-D orientation
4
2-D position
2
3-D position
3
2-D position
2
3-D position
3
DOF
φ
φ, h1 , h2 , h3
x1 , x2
x1 , x2 , x3
x1 , x2
x1 , x2 , x3
For the administration of trajectories two numbers are of main importance: the trajectory
number and the node or element number. The trajectory number has to be given once after
TRAJECT, node numbers or element numbers follow immediately after all other keywords. In
this way information about the path, the velocity profile and additional loads can be grouped
and worked up by node/element number. Taking as starting point the type of DOF the picture
becomes:
DOF
ELEMENT
e1
NODE
xi
PATH
TRE
TROT
TRANS
TRCIRL
VELOCITY PROFILE
LOADS
TREPMAX
TRFRONT
TRVMAX
TRFRONT TRM
TRVMAX
TRFRONT TRM TRF
TRVMAX
TRFRONT TRM TRF
34
Chapter 2. Keywords
The parameters required with these keywords are listed below. {∗i} refers to note i listed at the
end of the keywords.
TRAJECT
1
trajectory number
TROT
1
2
3
4
5
1
2
3
4
1
2-3
4-5
2-4
5-7
1
2
1
node number (orientation node)
total angle in rad
h1 -coordinate of fixed rotation axis
h2 -coordinate
h3 -coordinate ]
node number (position node)
x1 -coordinate of end position
x2 -coordinate
x3 -coordinate ]
node number (position node)
2D: c1 and c2 coordinates of circle centre point {∗1}
2D: b1 and b2 coordinates of circle end point {∗1}
3D: c1 , c2 and c3 coordinates of circle centre point {∗1}
3D: b1 , b2 and b3 coordinates of circle end point {∗1}
element number
total displacement (relative angle or elongation)
name of M-script {∗2}
1
2
3
total time for the trajectory
number of time steps
number of intermediate time steps ] {∗3}
1
2
3
1
2
3
1
2
element number
rise time (period of acceleration)
extreme velocity ] {∗4}
node number (position or orientation node)
rise time (period of acceleration)
extreme value of the velocity ] {∗4}
node or element number
acceleration front type {∗5}
1
2
3
4
5
6
7
1
2
3
4
node number (position or orientation node)
extra mass (m, I or Jxx )
Jxy
Jxz
Jyy
Jyz
Jzz ] {∗6}
node number (position node)
f1 -coordinate of external force
f2 -coordinate
f3 -coordinate ]
[
TRANS
[
TRCIRL
TRE
USERTRAJ
TRTIME
[
TREPMAX
[
TRVMAX
[
TRFRONT
TRM
[
TRF
[
Section 2.4. Inverse dynamics (setpoint generation)
35
NOTES:
∗1 The positions of the parameters of keyword TRCIRL are different in 2-D and in 3-D cases.
Places 2–5 are used for 2-D, places 2–7 for 3-D. Note that the “endpoint” of the circle
cannot be taken literally, as it is over-determined. The second point defines a line through
the centre on which the circle ends.
∗2 See the note for the USERINP keyword on page 29.
∗3 The keyword TRTIME has an optional third argument that influences the meaning of the
second argument:
2 arguments
3 arguments
1 total trajectory time
total trajectory time
2 number of time steps number of time steps for an extended analysis
3
number of time steps within the previous step
For three arguments the total number of time steps is a multiplication of the last two
arguments. In intermediate points a standard analysis is done.
∗4 The keywords TRVMAX and TREPMAX have an optional third argument to express the extreme velocity (creation of a zero-acceleration period). If no extreme is given it can be
calculated from the total time and path length. The second argument contains the risetime. The period of deceleration is calculated from the (a) total time, (b) rise time, (c)
total path length, (d) extreme velocity. In this way the velocity profile is fully determined.
For asymmetrical velocity profiles the rise time can be calculated too. To indicate the
symmetry of the profile the second argument is given a dummy argument: a non-positive
value.
The default velocity profile is: symmetrical without constant velocity period.
∗5 The keyword TRFRONT has a second argument for the type of acceleration and deceleration
function of time. There are three types of fronts:
0 – constant acceleration
1 – sine function (half period)
2 – quadratic sine function (half period)
The default velocity front has a constant acceleration (type 0).
∗6 The keyword TRM has only for 3-D orientation nodes a real list of parameters. For 2-D
orientation and position nodes one mass parameter is sufficient. In the 3-D case six values
determine the symmetric rotational inertia matrix:
Jxx Jxy Jxz
Jyy Jyz
Jzz
123
45
6
36
Chapter 2. Keywords
2.4.2 Nominal inputs (u0 ) and reference outputs (y 0 )
The nominal input vector u0 and the reference output vector y 0 are defined in the following
blocks. These blocks are optional, but omitting one or both blocks means that no input and/or
output vectors are defined and hence no setpoints for that input and/or output vector are generated and written to the ltv file.
KEYWORDS NOMINAL INPUT VECTOR u0 (mode=2)
1
Specification of actuator elements.
Specification of actuated nodes.
NOMS
NOMF
KEYWORDS REFERENCE OUTPUT VECTOR y 0 (mode=2)
2
REFE
REFEP
REFEDP
REFX
REFXP
REFXDP
Specification of the deformation parameters to be
sensed.
The same, first time derivative.
The same, second time derivative.
Specification of the nodal coordinates to be sensed.
The same, first time derivative.
The same, second time derivative.
The parameters for these keywords are listed below. {∗i} refers to note i listed at the end of the
keywords.
NOMS
NOMF
REFE
REFEP
REFEDP
REFX
REFXP
REFXDP
1
2
3
1
2
3
nominal input number {∗1}
element number
deformation parameter number (1, 2, 3, 4, 5 or 6)
nominal input number {∗1}
node number
coordinate number (1, 2, 3, or 4)
1
2
3
1
2
3
reference output number {∗1, 2}
element number
deformation parameter number (1, 2, 3, 4, 5 or 6)
reference output number {∗1, 2}
node number
coordinate number (1, 2, 3, or 4)
NOTES:
∗1 The nominal input numbers and reference output numbers are the positions of the specified
input or output in the input and output vectors, respectively.
Section 2.4. Inverse dynamics (setpoint generation)
37
∗2 The keywords REFES and REFXS that are defined for the linearization module (Sect. 2.5)
are accepted as well and do not give errors. Their meaning and usage is identical to the
normal keywords REFE and REFX, respectively.
38
2.5
Chapter 2. Keywords
Linearization
As mentioned in Sect. 1.2 the module LINEAR is a forward dynamics stage for the generation of
linearized equations of motion and state space matrices that can be used in two different modes.
mode=4 is basically an extension of the forward dynamic analysis of mode=1. No further
keywords are required to obtain the coefficient matrices of the linearized equations as functions
of the set of dynamic degrees of freedom q d . These matrices are stored in a SPACAR binary
matrix data file with extension sbm. This file can be loaded with the utility loadsbm. If
input and output vectors δu and δy are defined, also the linearized state equations and output
equations are computed (see mode=9).
Linearization in mode=3 is around a predefined nominal trajectory and takes place after that
trajectory has been generated in an inverse dynamics run (mode=2). The set of DOFs used
in the inverse dynamics computation represent the actuator joint coordinates em . In case of a
flexible manipulator mechanism additional DOFs εm
i ≡ 0 describing the elastic behaviour of
the mechanism links should be included in the dynamic model (both in mode=2 and mode=3).
Clearly, the mechanisms used in both runs have to be closely related. If the manipulation task is
prescribed in terms of relative DOFs (TRE) the list of keywords is identical with those used in
the inverse dynamics run (mode=2). If the manipulation task is prescribed as a motion of some
nodal points (triads) (TROT, TRANS, TRCIRL) then the corresponding RLSE command of the
actuators should be replaced by INPUTE commands in the kinematic block. In the software
some checks are carried out to verify that data from the inverse dynamics run can be reasonably
used during the linearization.
The nominal input vector u0 and the reference output vector y 0 are again defined in the following blocks. These blocks are optional, but as before omitting one or both blocks means
that no input and/or output vectors are defined and hence no state space matrices can be generated and written to the ltv file. The keywords are similar to the input and output keywords
in Sect. 2.4.2. In the output ltv file of a mode=3 run the setpoints of the input and output
vector are stored in the same way as for a mode=2 run. In addition the state space matrices
for the linearized equations of motion (Sect. 1.5) are generated. Obviously, the input matrix
B and output matrix C depend on the chosen input and output vectors. In a usual state space
system the output vector is computed from a linear expression. In the case a larger accuracy is
required, SPACAR can be instructed to use a second order expression. This feature is available
for all deformation parameters and coordinates (not for the time derivatives) with the keywords
REFES and REFXS. The use of these keywords will generate elements in the output reference
vector that are the same as the elements from REFE and REFX, respectively. Also the associated
row in the output matrix C is the same, but in addition a tensor denoted G in the ltv file is
computed with the second order geometric transfer function.
Linearization in mode=7, 8 and 9 is around a pre-computed static equilibrium configuration,
or a state of steady motion. In addition in mode=9 the state space matrix A, the input matrices
B 0 and B, the output matrix C and the feedthrough matrix D are calculated. Obviously, the
matrices B 0 , B, C and D depend on the chosen input and output vectors δu and δy respectively. These vectors are again defined in the blocks on page 40. These blocks are optional, but
as before omitting one or both blocks means that no input and/or output vectors are defined and
hence no state space matrices can be generated and written to the ltv-file.
Section 2.5. Linearization
39
KEYWORDS NOMINAL INPUT VECTOR u0 (mode=3)
1
Specification of actuator elements.
Specification of actuated nodes.
NOMS
NOMF
KEYWORDS REFERENCE OUTPUT VECTOR y 0 (mode=3)
2
REFE
REFES
REFEP
REFEDP
REFX
REFXS
REFXP
REFXDP
Specification of the deformation parameters to be
sensed.
The same, with second order expression.
The same, first time derivative.
The same, second time derivative (see note).
Specification of the nodal coordinates to be sensed.
The same, with second order expression.
The same, first time derivative.
The same, second time derivative (see note).
Note: Specifying second derivatives in the output vector implies an algebraic coupling between
input and output, i.e. a non-zero state space matrix D. This is currently not implemented and
the keywords REFEDP and REFXDP are ignored for the linearization.
The parameters for these keywords are listed below. {∗i} refers to note i listed at the end of the
keywords.
NOMS
NOMF
REFE
REFES
REFEP
REFEDP
REFX
REFXS
REFXP
REFXDP
1
2
3
1
2
3
nominal input number {∗1}
element number
deformation parameter number (1, 2, 3, 4, 5 or 6)
nominal input number {∗1}
node number
coordinate number (1, 2, 3, or 4)
1
2
3
reference output number {∗1}
element number
deformation parameter number (1, 2, 3, 4, 5 or 6)
1
2
3
reference output number {∗1}
node number
coordinate number (1, 2, 3, or 4)
NOTES:
∗1 The nominal input numbers and output numbers are the positions of the specified input or
output in the input and output vectors, respectively.
40
Chapter 2. Keywords
KEYWORDS INPUT VECTOR δu (mode=4,9)
1
INPUTS
INPUTF
INE
INEP
INEDP
INX
INXP
INXDP
Specification of input stresses.
Specification of input forces.
Specification of input deformation parameters.
The same, first time derivative.
The same, second time derivative.
Specification of input nodal coordinates.
The same, first time derivative.
The same, second time derivative.
KEYWORDS OUTPUT VECTOR δy (mode=4,9)
2
OUTS
OUTF
OUTE
OUTEP
OUTEDP
OUTX
OUTXP
OUTXDP
Specification of output stresses.
Specification of output forces.
Specification of output deformation parameters.
The same, first time derivative.
The same, second time derivative.
Specification of output nodal coordinates.
The same, first time derivative.
The same, second time derivative (see note).
The parameters for these keywords are listed below. {∗i} refers to note i listed at the end of the
keywords.
INPUTS
{∗2}

INE 

INEP {∗3}

INEDP
INPUTF
{∗4}

INX 

INXP {∗5}

INXDP
OUTS {∗6}

OUTE 

OUTEP {∗7}

OUTEDP
OUTF {∗8}

OUTX 

OUTXP {∗9}

OUTXDP
1
2
3
1
2
3
1
2
3
1
2
3
input number {∗1}
element number
deformation parameter number
(1, 2, 3, 4, 5 or 6)
input number {∗1}
node number
coordinate number (1, 2, 3, or 4)
output number {∗1}
element number
deformation parameter number
(1, 2, 3, 4, 5 or 6)
output number {∗1}
node number
coordinate number (1, 2, 3, or 4)
Section 2.5. Linearization
41
NOTES:
∗1 The input numbers and output numbers are the positions of the specified inputs or outputs
in the input and output vectors, respectively.
∗2 Associated with dynamic DOFs e(m,d) or dependent coordinates e(c) .
∗3 Associated with prescribed deformations e(m,r) . For INE, only holonomic deformations are
allowed.
∗4 Associated with calculable coordinates x(c) or dynamic DOFs x(m,d) .
∗5 Associated with prescribed nodal coordinates x(m,r) .
∗6 Can be associated with prescribed deformations e(o) or e(m,r) , but can also be associated
with the free types, in which case the output stress is calculated from the constitutive
equations and, possibly, from the input stress.
∗7 Associated with calculable deformations e(c) or dynamic DOFs e(m,d) or prescibed deformations e(m,r) .
∗8 Associated with prescribed nodal coordinates x(o) or x(m,r) .
∗9 Associated with calculable coordinates x(c) or dynamic DOFs x(m,d) or prescribed coordinates x(m,r) .
42
2.6
Chapter 2. Keywords
Non-linear simulation of manipulator control
To simulate the behaviour of a manipulator with a control system the SPACAR program is also
accessible as an “S-function” block SPASIM from SIMULINK. SIMULINK treats this block like a
non-linear state-space system which has a state vector z, an input vector u and an output vector
y. Each of these vectors has a well-defined meaning in the SPACAR block: the states correspond
to the degrees of freedom and their first time derivatives. The input and output are coupled to
actuators and coordinates as specified by keywords in the SPACAR input data file (see below).
In the SIMULINK graphical user interface the input and output vectors must be coupled to other
blocks, e.g. the control system. The states are used internally in SIMULINK and are usually not
available to the user. That implies that any coordinate or deformation parameter that is used for
control purposes or is monitored in a graph must be included in the output vector y (block 2).
KEYWORDS INPUT VECTOR u (SPASIM)
1
INPUTS
INPUTF
Specification of actuator elements.
Specification of actuated nodes.
KEYWORDS OUTPUT VECTOR y (SPASIM)
2
OUTE
OUTEP
OUTEDP
OUTX
OUTXP
OUTXDP
Specification of the deformation parameters to be
sensed.
The same, first time derivative.
The same, second time derivative.
Specification of the nodal coordinates to be sensed.
The same, first time derivative.
The same, second time derivative.
Section 2.6. Non-linear simulation of manipulator control
43
The parameters for these keywords are listed below. {∗i} refers to note i listed at the end of the
keywords.
INPUTS
INPUTF
OUTE
OUTEP
OUTEDP
OUTX
OUTXP
OUTXDP
1
2
3
1
2
3
input number {∗1}
element number
deformation parameter number (1, 2, 3, 4, 5 or 6)
input number {∗1}
node number
coordinate number (1, 2, 3, or 4)
1
2
3
1
2
3
output number {∗1}
element number
deformation parameter number (1, 2, 3, 4, 5 or 6)
output number {∗1}
node number
coordinate number (1, 2, 3, or 4)
NOTES:
∗1 The input numbers and output numbers are the positions of the specified input or output
in the input and output vectors, respectively. They need not be identical to the nominal
input vector and reference output vector specified during the generation of setpoints (see
Sect. 2.4.2 and/or Sect. 2.5), but for a quite straightforward comparison it is convenient
to use, at least partially, the same numbering scheme.
44
2.7
Chapter 2. Keywords
Visualization and animation
To adjust the default settings of SPAVISUAL the user can type VISUALIZATION after the last
two END commands in the .dat file. All commands after the command VISUALIZATION are
read by SPAVISUAL as an adjustment on the default settings.
Adjusts the height and the width of a beam element.
Adjusts the radius and the length of the hinge element.
Sets the visualization of the truss element on or off.
Adjusts the transparency of the elements.
Selects the vibration modes.
Selects the buckling modes.
Sets the amplitude of the vibration or buckling modes.
Sets recordmovie on or off, the movie is saved as an .avi file
in the workspace.
MOVIENAME
Sets the name of the recorded movie.
UNDEFORMED
Sets the visualization of the undeformed mechanism on or off.
VIBREND
Sets the period of the sine function for the vibration mode.
STEPLINE
Sets the size of the line elements that are used to draw the
elements.
STEPVIBRATION Sets the number of steps in the vibration visualization.
LIGHT
Sets the light on or off.
JOINTS
Sets the joints on or off.
TRAJECTVIS
Sets the trajectory on or off.
TRAJECTNODE
Selects the node for the trajectory.
BEAMVIS
HINGEVIS
TRUSSVIS
TRANSPARENCY
VIBRATIONMODE
BUCKLINGMODE
ENLARGEFACTOR
RECORDMOVIE
Section 2.7. Visualization and animation
45
The parameters for these keywords are listed below.
KEYWORD
DESCRIPTION
BEAMVIS {∗1}
size of all beam elements in the local y’ direction
size of all beam elements in the local z’ direction
element number
size of the element for the local y’ direction
size of the element for the local z’ direction
element number
length of the hinge
radius of the hinge
sets the visualization of the truss elements on (1) or off (0)
adjusts the transparency between (0) and (1)
switch between the 10 lowest vibration modes {∗2}
switch between the 10 buckling modes {∗2}
amplitude of the vibration or buckling modes
sets record movie on (1) or off (0)
filename for the recorded movie
sets the visualization of the initial
(un-deformed) mechanism configuration on (1) or off (0)
sets the period of the sin function for the
vibration mode
sets the size of the line elements that are used
to draw the elements
sets the number of intermediate steps in the vibration
visualization
sets the light source on (1) or off (0)
sets the joints on (1) or off (0)
sets the trajectory on (1) or off (0)
selects the node for the trajectory
1
2
BEAMVIS {∗1}
1
2
3
HINGEVIS
1
2
3
TRUSSVIS
1
TRANSPARENCY
1
VIBRATIONMODE 1
BUCKLINGMODE
1
ENLARGEFACTOR 1
RECORDMOVIE
1
MOVIENAME
1
UNDEFORMED
1
VIBREND
1
STEPLINE
1
STEPVIBRATION 1
LIGHT
JOINTS
TRAJECTVIS
TRAJETCNODE
1
1
1
1
DEFAULT
SETTINGS
0.006
0.006
0.006
0.006
0.003
0.009
on
1
1
1
1
off
filename
on
2π {∗3}
0.2
π
10
{∗3}
off
on
off
1
Notes
∗1 The BEAMVIS command has two variations. The one with only two parameters adjusts
all beam elements. The variant with three parameters can be used to adjust only a single
beam element.
∗2 Only the lowest vibration and buckling modes are available with a maximum of 10 modes.
∗3 Only numerical values are allowed, no symbols or functions.
46
Chapter 2. Keywords
3
Examples
The data files used to run the examples in this chapter can be downloaded from the SPACAR
web site, see Appendix A.
3.1
Planar sliding bar
In example 4.3.1 of the lecture notes [1] the sliding bar of Fig. 3.1 is described. A rigid bar pq
of length 2 m is suspended from two sliders. The bar is driven by the condition xp − vt = 0,
where v =| v | is the constant horizontal velocity component
of point p. Thus ẋp = v and
√
p
q
q
ẍ = 0. We want to compute ẏ and ÿ for 0 ≤ t ≤ 2 3 s and v = 1 m/s. q
√
The position y q can be computed easily from the symbolic expression y q = 4 − ( 3 − xp )2 ,
so
q
y =
q
√
4 − ( 3 − t)2 .
y
q
β
p
β = 30o
1
v
x
√
3
Figure 3.1. Sliding bar.
47
48
Chapter 3. Examples
Differentiating once and twice with respect to the time t yields
√
4
− 3+t
q
,
ÿ q = .
ẏ = − q
q
√
√
√
1 + 2 3t − t2
1 + 2 3t − t2
−1 − 2 3t + t2
The mechanism has one degree of freedom and there is only one element. This is the planar
truss element denoted by 1 that connects nodal points 1 and 2 in the following SPACAR input
file (slider.dat):
PLTRUSS
1
1
2
X
X
1
2
0.
0.
1.7321 1.
FIX
FIX
1
2
2
1
INPUTX
1
1
INPUTX
1
1
TIMESTEP
3.4641
END
HALT
0.
1.
0.
100
END
END
Both symbolic and numeric results are shown in Figs. 3.2 and 3.3 with the Matlab commands
>> t=time;
2
0
1.5
−0.5
−1
1
−1.5
2
(d/dt) y(2) [m/s ]
0
−2
2
(d/dt) y(2) [m/s]
0.5
−2.5
−0.5
−3
−1
−3.5
−1.5
−2
−4
0
0.5
1
1.5
2
2.5
3
3.5
time [s]
Figure 3.2. Vertical velocity ẏ q of the sliding bar.
−4.5
0
0.5
1
1.5
2
2.5
3
3.5
time [s]
Figure 3.3. Acceleration ÿ q of the sliding bar.
Section 3.2. Planar slider–crank mechanism
49
>> plot(t,[xd(:,lnp(2,2)) ...
-(-3ˆ(1/2)+t)./(1+2*3ˆ(1/2)*t-t.ˆ2).ˆ(1/2)])
>> grid
>> xlabel(’time [s]’)
>> ylabel(’(d/dt) y(2) [m/s]’)
>> figure
>> plot(t,[xdd(:,lnp(2,2)) ...
4./(-1-2*3ˆ(1/2)*t+t.ˆ2)./(1+2*3ˆ(1/2)*t-t.ˆ2).ˆ(1/2)])
>> grid
>> xlabel(’time [s]’)
>> ylabel(’(d/dt)ˆ2 y(2) [m/sˆ2]’)
Obviously, in both graphs the symbolic and numeric results are practically identical, which
illustrates the good agreement between both solutions.
Note that in this example no masses are defined. There are no dynamic degrees of freedom
either, so effectively only a kinematic problem is solved.
3.2
Planar slider–crank mechanism
The slider–crank mechanism is frequently applied as a subsystem in the design of a mechanism.
It finds its applications in combustion engines, compressors and regulators. Figure 3.4 presents
a slider–crank mechanism for which three dynamics computations have to be carried out. In
the first problem (case 1, see also example 5.7.2 in the lecture notes [1]), the crank and the
connecting rod are assumed to be rigid. In the second computation (case 2), the connecting rod
is shorter but still somewhat longer than the crank. In case 3, the flexibility of the connecting
rod with the dimensions of case 1 is taken into account; see also example 8.3.1 in the lecture
notes [1].
Case 1
First of all, the nodal coordinates must be specified. In the initial configuration, the crank and
the connecting rod are horizontal. The crank length is 0.15 m, the length of the connecting rod
y
x x
~3, 4 , 5
B
1m
2m
ω0
x
x
~1, 2
~6, 7
A
x
C
Figure 3.4. Planar slider–crank mechanism.
50
Chapter 3. Examples
is 0.30 m. For the dynamic analysis the following parameters are needed. The connecting rod
has a circular cross-section with diameter d = 6 mm. The mass density is ρ = 7.87 · 103 kg/m3
and the Young’s modulus is E = 2.1 · 1011 N/m2 . Consequently, the mass per unit length is
0.2225 kg/m and its total mass ms = 0.06675 kg. The mass of the sliding block or plunger C
is given by mC = 21 ms = 0.033375 kg. The crank is driven at a constant angular velocity
ω0 = 150 rad/s. The total simulation should comprise two crank rotations. Node B must be
defined as a single translational node and a double rotational node, since the rotations of the
slider and the crank are not the same. The mass of the crank is taken as zero.
An input file (crank.dat) describing this case is:
PLBEAM
PLBEAM
1
2
X
X
X
1
3
6
FIX
FIX
INPUTX
1
6
2
1
3
2
5
3
6
0.00
0.15
0.45
4
7
0.
0.
0.
2
1
END
HALT
XM
EM
6
2
INPUTX 2
TIMESTEP
0.033375
0.2225
1
0.
0.1
150.
100
0.
END
END
The initial configuration of case 1 is depicted in Fig. 3.5. The horizontal position, velocity and
acceleration of the sliding block as function of time are given in Figs. 3.6–3.8. The driving
moment in node 2 versus time is shown in Fig. 3.9 and the supporting forces acting on the
sliding block are presented in Fig. 3.10.
The MATLAB commands used to plot these results are:
>>
>>
>>
>>
>>
>>
>>
>>
>>
plot(time,x(:,lnp(6,1)))
grid
xlabel(’time [s]’)
ylabel(’x(6) [m]’)
plot(time,xd(:,lnp(6,1)))
grid
xlabel(’time [s]’)
ylabel(’(d/dt) x(6) [m/s]’)
Section 3.2. Planar slider–crank mechanism
51
0.5
0.2
0.45
0.15
0.4
0.1
0.35
1
0
1
3
2
6
x(6) [m]
0.05
0.3
0.25
-0.05
0.2
-0.1
0.15
-0.15
0.1
-0.2
0
0.05
0.1
0.15
0.2
0.25
0.3
0.35
0.4
0
0.01
0.02
0.03
0.04
0.45
Figure 3.5. Case 1: Initial configuration of the
slider–crank mechanism.
0.05
time [s]
0.06
0.07
0.08
0.09
0.1
Figure 3.6. Case 1: Horizontal position of the
sliding block.
30
3000
2000
20
1000
0
(d/dt)2 x(6) [m/s2]
(d/dt) x(6) [m/s]
10
0
−10
−1000
−2000
−3000
−4000
−20
−5000
−30
0
0.01
0.02
0.03
0.04
0.05
time [s]
0.06
0.07
0.08
0.09
0.1
Figure 3.7. Case 1: Horizontal velocity of the
sliding block.
−6000
0
0.01
0.02
0.03
0.04
0.05
time [s]
0.06
0.07
0.08
0.09
0.1
Figure 3.8. Case 1: Horizontal acceleration of the
sliding block.
40
100
80
30
60
20
40
Fx(6), Fy(6) [N]
M(2) [Nm]
10
0
−10
20
0
−20
−40
−20
−60
−30
−40
−80
0
0.01
0.02
0.03
0.04
0.05
time [s]
0.06
0.07
0.08
0.09
0.1
Figure 3.9. Case 1: Driving moment in rotational
node 2.
−100
0
0.01
0.02
0.03
0.04
0.05
time [s]
0.06
0.07
0.08
0.09
0.1
Figure 3.10. Case 1: Supporting forces on the
sliding block.
52
Chapter 3. Examples
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
plot(time,xdd(:,lnp(6,1)))
grid
xlabel(’time [s]’)
ylabel(’(d/dt)ˆ2 x(6) [m/sˆ2]’)
plot(time,fxtot(:,lnp(2,1)))
grid
xlabel(’time [s]’)
ylabel(’M(2) [Nm]’)
plot(time,fxtot(:,lnp(6,1:2)))
grid
xlabel(’time [s]’)
ylabel(’Fx(6), Fy(6) [N]’)
Case 2
The input file of case 1 (page 50) is modified to account for the shortened connecting rod. Only
the initial position of node 6 in the second block of the kinematic definition has to be changed:
X
6
0.35
0.
The initial configuration of case 2 is depicted in Fig. 3.11. The horizontal position, velocity and
acceleration of the sliding block as a function of time are given in Figs. 3.12–3.14. The driving
moment in node 2 versus time is shown in Fig. 3.15 and the supporting forces acting on the
sliding block are presented in Fig. 3.16.
The MATLAB commands used to plot these results are the same as in case 1 (page 50).
Case 3
To take the flexibility of the connecting rod into account with a reasonable accuracy the planar
beam element used for this rod (see Fig. 3.4) is split into two parts. One translational node
and one rotational node are inserted and the numbers of the nodes in the sliding block C are
changed. The bending stiffness of the connecting rod is computed using the moment of inertia
I = πd4 /64. The input file (crankfl.dat) is now:
Section 3.2. Planar slider–crank mechanism
53
0.4
0.15
0.35
0.1
0.3
0.05
1
0
1
3
2
6
x(6) [m]
0.25
0.2
0.15
-0.05
0.1
-0.1
0.05
0
-0.15
0
0.05
0.1
0.15
0.2
0.25
0.3
30
6000
20
4000
10
2000
0
−2000
−20
−4000
0.01
0.02
0.03
0.04
0.05
time [s]
0.06
0.07
0.08
0.09
0.1
−6000
40
200
30
150
20
100
10
50
0
−50
−20
−100
−30
−150
0.01
0.02
0.03
0.04
0.05
time [s]
0.06
0.07
0.08
0.04
0.09
0.1
Figure 3.15. Case 2: Driving moment in rotational node 2.
0.05
time [s]
0.06
0.07
0.08
0.09
0.1
0
0.01
0.02
0.03
0.04
0.05
time [s]
0.06
0.07
0.08
0.09
0.1
0
−10
0
0.03
Figure 3.14. Case 2: Horizontal acceleration of
the sliding block.
Fx(6), Fy(6) [N]
M(2) [Nm]
Figure 3.13. Case 2: Horizontal velocity of the
sliding block.
−40
0.02
0
−10
0
0.01
Figure 3.12. Case 2: Horizontal position of the
sliding block.
(d/dt)2 x(6) [m/s2]
(d/dt) x(6) [m/s]
Figure 3.11. Case 2: Initial configuration of the
slider–crank mechanism.
−30
0
0.35
−200
0
0.01
0.02
0.03
0.04
0.05
time [s]
0.06
0.07
0.08
0.09
0.1
Figure 3.16. Case 2: Supporting forces on the
sliding block.
54
Chapter 3. Examples
PLBEAM
PLBEAM
PLBEAM
1
2
3
X
X
X
X
1
3
6
8
FIX
FIX
INPUTX
DYNE
DYNE
1
8
2
2
3
1
3
6
2
5
7
3
6
8
4
7
9
0.000
0.150
0.300
0.450
2
1
2
2
0.000
0.000
0.000
0.000
3
3
END
HALT
XM
EM
EM
8
2
3
0.033375
0.2225
0.2225
ESTIFF
ESTIFF
2
3
0.000000
0.000000
INPUTX
TIMESTEP
STARTDE
STARTDE
STARTDE
STARTDE
2
1
0.000000
0.100000
100
2
0.000000
3
0.000000
2
0.000000
3
0.000000
2
2
3
3
13.359623
13.359623
150.000000
0.000000
0.000000
0.000000
0.000000
0.000000
END
END
The second-order contributions of the bending deformations on the elongation (Eq. (6.4.22) in
the lecture notes) are taken into account.
The initial configuration of case 3 is depicted in Fig. 3.17. The horizontal acceleration of the
sliding block as function of time is given in Fig. 3.18. The bending of the slider, given by
(2)
(3)
v = 21 (ε3 + ε2 ), as function of the crank angle φ2 , is presented in Fig. 3.19.
The MATLAB commands used to plot these results are:
>>
>>
>>
>>
>>
plot(time,xdd(:,lnp(8,1)))
grid
xlabel(’time [s]’)
ylabel(’(d/dt)ˆ2 x(8) [m/sˆ2]’)
Section 3.2. Planar slider–crank mechanism
55
3000
0.2
2000
0.15
1000
0.1
1
0
1
3
2
6
3
8
(d/dt)2 x(8) [m/s2]
0
0.05
−1000
−2000
-0.05
−3000
-0.1
−4000
−5000
-0.15
−6000
-0.2
0
0.05
0.1
0.15
0.2
0.25
0.3
0.35
0.4
Figure 3.17. Case 3: Initial configuration of the
slider–crank mechanism.
0.01
0.02
0.03
0.04
0.05
time [s]
0.06
0.07
0.08
0.09
0.1
Figure 3.18. Case 3: Horizontal acceleration of
the sliding block.
−3
5
0
0.45
−5
x 10
2
x 10
0
4
−2
3
x(8)−x0(6) [m]
v=(eps(2,3)+eps(3,2))/2 [m]
−4
2
1
0
−6
−8
−10
−1
−12
−2
−14
−3
−4
−16
0
2
4
6
8
phi(2) [rad]
10
12
14
16
Figure 3.19. Case 3: Bending of the flexible connecting rod (elements 2 and 3).
>>
>>
>>
>>
−18
0
0.01
0.02
0.03
0.04
0.05
time [s]
0.06
0.07
0.08
0.09
0.1
Figure 3.20. Case 3: Difference in the horizontal
position of the sliding block compared to case 1.
plot(x(:,lnp(2,1)),(e(:,le(2,3))+e(:,le(3,2)))/2)
grid
xlabel(’phi(2) [rad]’)
ylabel(’v=(eps(2,3)+eps(3,2))/2 [m]’)
Figure 3.20 shows the (small) vibration of the sliding block due to the bending by comparing
its position with the rigid simulation of case 1 (Fig. 3.6).
56
Chapter 3. Examples
Nodal points for the planar slider-crank mechanism
node 1 node 2 node 3 node 4,5,7 node 6 node 8 node 9
node type
T
R
T
R
T
T
R
x-coordinate
0
0.15
0.45
0.30
y-coordinate
0
0
0
0
BC-type x
1
2
2
2
BC-type y
1
2
1
2
BC-type φ
3
2
2
φ0
0
ω0 = φ̇
150
ω̇
0
forces/moment
0
0
0
0
0
0
0
mass/inertia
0
0
0
0
0.033
0
0
T=translational, R=rotational, BC=boundary condition
The numbers of the BC-type refers to the numbers of the groups mentioned on page 16.
Elements for the planar slider-crank mechanism
element 1 element 2 element 2a, 3
element type
beam
beam
beam
T-nodes
1, 3
3, 6
3, 8 / 8, 6
R-nodes
2, 4
5, 7
5, 9 / 9, 7
type e1
1
1
1
type e2
1
1
4
(e2 )0
0
(ė2 )0
0
type e3
1
1
4
mass per length
0.2225
0.2225
0.2225
EA
5.65 · 106 5.65 · 106
5.65 · 106
EI
13.4
13.4
13.4
damping
0
0
0
T=translational, R=rotational
Section 3.3. Cardan-joint mechanism
3.3
57
Cardan-joint mechanism
In section 11.1 of the lecture notes [1] a cardan joint is described. Cardan joints, also known
as Hooke’s joints, have been used as a shaft coupling in a wide range of machinery, which
includes locomotive as well as automotive drive lines. A drive line connected by a Cardan joint
may exhibit torsional oscillations due to fluctuating angular velocity ratios inherent in such
systems.
(4)
e1
(1)
e1
(3)
e1
(2)
e1
(a)
(b)
Figure 3.21. Schematic of Cardan joint system.
Figure 3.21a shows a one-degree of freedom shaft system incorporating a Cardan joint. The
Cardan joint is modelled by four spatial hinge elements as shown in Figure 3.21b. The rotating shaft axes having an angular misalignment of β = 45◦ is driven at a constant angular
speed ė(1) = Ωin . The quantities e(1) and e(4) represent the input and output angles of the hinge
elements 1mand 4m
, respectively.
The essential behaviour of the joint can be simulated with the following input file
(cardansimp.dat):
HINGE
HINGE
HINGE
HINGE
1
2
3
4
1
2
3
4
FIX
FIX
INPUTE
RLSE
RLSE
RLSE
1
5
1
2
3
4
1
1
1
1
END
-1.
0.
0.
0.
-1.
0.
0.
0.
-1.
0.707 -0.707 0.
HALT
INPUTE
TIMESTEP
END
2
3
4
5
END
1
1
0.
1.0 100
6.28
0.
58
Chapter 3. Examples
Note that in the initial configuration, the input shaft is rotated by a right angle with respect to
the configuration in Figure 3.21.
However, the visualization of this simulation is quite poor. This can be improved by adding
some beams to the input and output rotational nodes numbers 2 and 4, respectively. The complete input file (cardan.dat) becomes:
HINGE
HINGE
HINGE
HINGE
1
2
3
4
1
2
3
4
2
3
4
5
BEAM
BEAM
BEAM
BEAM
5
6
7
8
6
7
6
11
2
8
4
12
FIX
FIX
FIX
1
5
6
X
X
X
X
X
6
7
9
11
13
0.
1.
1.
-0.707
-0.707
INPUTE
1
1
RLSE
RLSE
RLSE
2
3
4
1
1
1
INPUTE
1
1
TIMESTEP
1.0 100
-1.
0.
0.
0.
-1.
0.
0.
0.
-1.
0.707 -0.707 0.
7
9
11
13
8
10
12
14
0.
0.
0.
0.707
0.707
0.
0.
0.707
0.707
1.
1.
0.707
0.707
0.
0.
0.
0.
0.
0.
0.15
0.
0.15
END
HALT
0.
6.28
0.
END
END
The initial configuration of this mechanism is shown in Fig. 3.22. Figures 3.23, 3.24 and 3.25
(1)
show the zeroth, first and second order geometric transfer functions from input e1 to output
(4)
e1 , respectively. The MATLAB commands to plot these data are:
>> plot(e(:,le(1,1)),e(:,le(1,1)), e(:,le(1,1)),e(:,le(4,1)))
Section 3.3. Cardan-joint mechanism
59
6
5
[rad]
4
e
(1)
4
−0.8
−0.6
3
−0.4
0.1
−0.2
0
−0.1
2
0
0.2
0
1
0.4
0.2
0.6
0.4
0.8
0.6
0
1
0.8
0
1
2
3
4
5
6
e(1) [rad]
1
Figure 3.22. Initial configuration of the cardan
joint.
Figure 3.23. Zeroth order geometric transfer
function for the cardan joint.
0.8
1.4
0.6
1.3
0.4
1.2
0.2
(1)
(1)
1
DF(e1 )
D F(e )
1.5
0
2
1.1
1
−0.2
0.9
−0.4
0.8
−0.6
0.7
0
1
2
3
4
5
6
e(1) [rad]
1
Figure 3.24. First order geometric transfer function for the cardan joint.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
−0.8
0
1
2
3
4
5
6
e(1) [rad]
1
Figure 3.25. Second order geometric transfer
function for the cardan joint.
grid
xlabel(’e_1ˆ{(1)} [rad]’)
ylabel(’e_4ˆ{(1)} [rad]’)
plot(e(:,le(1,1)),ed(:,le(4,1))./ed(:,le(1,1)))
grid
xlabel(’e_1ˆ{(1)} [rad]’)
ylabel(’DF(e_1ˆ{(1)})’)
plot(e(:,le(1,1)),edd(:,le(4,1))./(ed(:,le(1,1)).ˆ2))
grid
xlabel(’e_1ˆ{(1)} [rad]’)
ylabel(’Dˆ2F(e_1ˆ{(1)})’)
60
Chapter 3. Examples
3.4
Planar four-bar mechanism
In examples 5.7.1 and 12.4.1 of the lecture notes [1] the planar four-bar mechanism of Fig. 3.26
is analysed analytically. The mechanism has one degree of freedom. The mechanism is modelled by four rigid truss elements, denoted by 1, 2, 4 and 5, which are joined together at their
nodal points to form a rhombus. As Fig. 3.26 implies, these four bars are set at right angles
y
g
m
~4
4m
5m
3m k
~2
~3
1m
2m
~1
x
Figure 3.26. Four-bar mechanism.
to one another. The diagonal element 3 represents a spring with stiffness k = EA/l0 . A concentrated mass m is attached to node 4. The deformation parameter e3 has been chosen as the
generalized coordinate. The equation of motion is
√
më3 + 2m(ė3 )2 + ke3 = mg .
(3.1)
Using the coefficient matrices from the lecture notes, the linearized equation of motion is
√
√
√
mδë3 + 2 2mė3 δ ė3 + (k − 2mg + 2 2më3 + 5m(ė3 )2 )δe3 = 0 .
(3.2)
These results can also be obtained numerically from a SPACAR analysis. E.g. with numerical
values for m = 1, g = 10 and k = √
1 and initial conditions e3 = 0 and ė3 = 1 the acceleration
is according to Eq. (3.1) ë3 = 10 − 2 = 8.59. A SPACAR input file (fourbar.dat) for this
case is:
PLTRUSS
PLTRUSS
PLTRUSS
PLTRUSS
PLTRUSS
1
2
3
4
5
X
1
1
1
2
2
3
2
3
3
4
4
0.
0.
Section 3.4. Planar four-bar mechanism
X
X
X
2
3
4
FIX
FIX
DYNE
1
4
3
-0.7071
0.7071
0.
61
0.7071
0.7071
1.4142
1
1
END
HALT
XM
XF
ESTIFF
STARTDE
4
4
3
3
1
1.
0.
-10.
1.4142
0.
1.
END
END
In a MATLAB session we get (the literal text of the session is modified somewhat to get a more
compact presentation):
>> spacar(1,’fourbar’)
>> e(le(3,1))
ans = 0
>> ed(le(3,1))
ans = 1
>> edd(le(3,1))
ans = 8.5858
Substituting the numerical values of the parameters into the linearized equation of motion
Eq. (3.2) gives
√
√
√
√
δë3 + 2 2δ ė3 + (1 − 10 2 + 2 2(10 − 2) + 5)δe3 = 0 ,
(3.3)
or
δë3 + 2.83 δ ė3 + 16.14 δe3 = 0 .
(3.4)
The stiffness term is a combination of
K0 = √
k=1
G0 = √2ke3 = 0
N 0 = 2g + ė3 )2 − k/m e3 = 15.14
where the solution of Eq. 3.1
√
ë3 = g − 2(ė3 )2 − k/m e3
has been used. In a MATLAB session we get:
(3.5)
(3.6)
62
Chapter 3. Examples
>> spacar(4,’fourbar’)
>> m0
m0 = 1.0000
>> c0
c0 = 2.8285
>> k0
k0 = 1
>> n0
n0 = 15.1423
>> g0
g0 = 0
Section 3.5. Rotating mass–spring system
3.5
63
Rotating mass–spring system
Figure 3.27. Rotating mass–spring system.
Consider the system shown in Fig. 3.27. A smooth horizontal tube containing masses m1
and m2 connected with springs k1 = EA1 /l1 and k2 = EA2 /l2 is mounted on a rotating
shaft. The shaft rotates at constant angular speed φ̇. The unstretched lengths of the springs are
denoted by l1 and l2 . The equations of motion in terms of the generalized coordinates r1 and
r2 are
"
m1 0
0 m2
#"
#
"
r̈1
m1 φ̇2 r1 − k1 (r1 − l1 ) + k2 (r2 − r1 − l2 )
=
r̈2
m2 φ̇2 r2 − k2 (r2 − r1 − l2 )
#
(3.7)
The stationary solution (r01 , r02 ) is obtained by substituting ṙ1 = ṙ2 = r̈1 = r̈2 = 0
"
k1 + k2 − m1 φ̇2
−k2
−k2
k2 − m2 φ̇2
#"
#
"
#
k l − k2 l2
r01
,
= 11
k2 l2
r02
(3.8)
from which the stationary configuration (r01 , r02 ) is obtained analytically as
r01 =
−(m2 k1 l1 − m2 k2 l2 )φ̇2 + k1 k2 l1
m1 m2 φ̇4 − (k2 m2 + k2 m1 + k1 m2 )φ̇2 + k1 k2
(3.9)
r02 =
−m1 φ̇2 k2 l2 + k1 k2 (l1 + l2 )
m1 m2 φ̇4 − (k2 m2 + k2 m1 + k1 m2 )φ̇2 + k1 k2
(3.10)
This result can also be obtained numerically from a SPACAR analysis. E.g. with the following
numerical values:
l1
l2
m1
m2
=
=
=
=
0.10 m
0.15 m
0.80 kg
0.50 kg
k1
k2
φ̇
= 1.3 kN/m
= 0.7 kN/m
= 10 rad/s
A SPACAR input file (massspring.dat) describing this case is :
64
Chapter 3. Examples
PLBEAM 1 1 2 3 4
PLBEAM 2 3 4 5 6
PLTRUSS 3 1 5
X 1 0.
0.
X 3 0.1 0.
X 5 0.25 0.
FIX 1
INPUTX 2 1
DYNE
1 1
DYNE
3 1
RLSE 2 1
END
HALT
XM 2 1.
XM 3 0.8
XM 5 0.5
ESTIFF 1 130.
ESTIFF 2 105.
INPUTX 2 1 0.0 10.0
END
END
In a MATLAB session we find for the stationary configuration (r01 ) and (r02 ) in agreement with
Eqs. (3.9) and (3.10):
>> spacar(7,’massspring’)
>> x(lnp(3,1))
ans =
0.1184
>> x(lnp(5,1))
ans =
0.2891
The linearized equations of motion in terms of the dynamic degrees of freedom are:
"
m1 0
0 m2
#"
#
"
k + k2 − m1 φ̇2
−k2
δr̈1
+ 1
δr̈2
−k2
k2 − m2 φ̇2
#"
#
" #
0
δr1
=
0
δr2
(3.11)
Section 3.5. Rotating mass–spring system
65
The associated frequency equation is given by:
det
− ωi
2
"
#
"
k + k2 − m1 φ̇2
−k2
m1 0
+ 1
0 m2
−k2
k2 − m2 φ̇2
#!
= 0,
(3.12)
where the quantities ωi are the natural frequencies of the system. In a MATLAB session we
obtain:
>> spacar(7,’massspring’)
>> m0
m0 =
0.8000
0
0
0.5000
>> k0
k0 =
2000
-700
-700
700
>> n0
n0 =
-80.0000
0
-0.0000
-50.0000
The complex eigenvalues and associated eigenvectors can be found in the log file:
Complex eigenvalues and normalised
system matrix
Notation (real : imaginary)
Eigenvalue numbers 1 to 4
( 0.00000E+00 : +/-5.55511E+01)
Eigenvector numbers 1 to 4
(
0.0141650 :
0.0000000)
( -0.0111041 :
0.0000000)
(
0.0000000 :
+/-0.7868804)
(
0.0000000 :
-/+0.6168430)
eigenvectors of the state-space
( 0.00000E+00 : +/-2.47806E+01)
(
(
(
(
0.0177403
0.0362089
0.0000000
0.0000000
:
:
:
:
0.0000000)
0.0000000)
+/-0.4396164)
+/-0.8972801)
From the eigenvalues numbers in this table we find ω1 = 24.78 rad/s and ω2 = 55.55 rad/s.
66
Chapter 3. Examples
3.6
Cantilever beam in Euler buckling
l
F
3 4
1 2
1
2
5 6
Figure 3.28. Cantilever beam loaded axially by a force F at the free end.
Consider a slender cantilever beam or column, with suppressed rotation of the free end, loaded
axially by a force F . The smallest load that produces buckling is called the critical or Euler load
Fcr . For a load equal to or greater than the critical load, the beam is unstable. The bent shape
shown represents the buckling mode. Euler’s theoretical buckling load for the above beam end
conditions is Fth = π 2 EI/l2 , where EI is the flexural rigidity and l the length of the beam.
This result can also be obtained numerically from a SPACAR analysis, e.g. with the following
numerical values, l = 1, EI = 1, F0 = 1. The beam is modelled by two equal planar beam
elements as shown in Figure 3.28. A SPACAR input file (column2.dat) for this case is:
PLBEAM 1 1 2 3 4
PLBEAM 2 3 4 5 6
X 1 0.0 0.0
X 3 0.5 0.0
X 5 1.0 0.0
FIX 1
FIX 2
FIX 6
DYNX
DYNX
DYNX
RLSE
RLSE
3
4
5
1
2
END
HALT
EM 1 1.
EM 2 1.
2
1
2
2 3
2 3
Section 3.6. Cantilever beam in Euler buckling
67
ESTIFF 1 0. 1.
ESTIFF 2 0. 1.
XF 5 -1.0 0.0
END
END
In a MATLAB session we obtain:
>> spacar(8,’column2’)
>> edit column2.log
Load multipliers and normalized buckling modes
Load multiplier no
1 to
3
9.94384680E+00
4.00000000E+01
1.28722820E+02
Buckling mode nro
1 to
3
0.2596610869
-1.0000000000
-0.0519056301
0.8141747968
0.0000000000
0.9932416764
0.5193221738
0.0000000000
-0.1038112603
Hence, we find a load multiplier λ1 = Fcr /F0 = 9.944. Since F0 = 1 we have Fcr /Fth =
9.944/π 2 = 1.0075.
68
3.7
Chapter 3. Examples
Cantilever beam subject to concentrated end force
F
l
1
2
3
4
5
Figure 3.29. Cantilever beam loaded by a concentrated force at the free end.
Consider a slender cantilever beam with a circular cross-section of diameter d = 1 cm and
length l = 10 m. The material properties for this example are EI = 102 Nm2 . The beam
is subdivided into 5 planar finite elements as shown in Fig. 3.29. A point force F of 14 N is
applied along the vertical axis at the free end of the beam. It generates an elastic deformation
as shown in the figure. The deformation is reached in ten steps of loading. For each step the
residual vector converges in 4 Newton–Raphson iterations with an accuracy equal to 0.5E − 6.
A SPACAR input file (plbeam5.dat) for this case is:
PLBEAM
PLBEAM
PLBEAM
PLBEAM
PLBEAM
X 1
X 3
X 5
1
2
3
4
5
1
3
5
7
9
2
4
6
8
10
0.
0.
1.666 0.
3.333 0.
3
5
7
9
11
4
6
8
10
12
Section 3.7. Cantilever beam subject to concentrated end force
X 7 5.
0.
X 9 6.666 0.
X 11 10.00 0.
FIX 1
FIX 2
DYNE
DYNE
DYNE
DYNE
DYNE
1
2
3
4
5
2
2
2
2
2
3
3
3
3
3
1
2
3
4
5
0.0
0.0
0.0
0.0
0.0
END
HALT
EM
EM
EM
EM
EM
1
2
3
4
5
1.
1.
1.
1.
1.
ESTIFF
ESTIFF
ESTIFF
ESTIFF
ESTIFF
102.0
102.0
102.0
102.0
102.0
XF 11 0.0 -14
END
END
In a MATLAB session we get:
>> spacar(8,’plbeam5’)
>> x(lnp(11,1))
ans =
3.6808
(theoretically, 3.8109)
>> x(lnp(11,2))
ans =
-8.4897
(theoretically, -8.4044)
>> xcompl(lnp(11,1))
ans =
69
70
Chapter 3. Examples
0.4859
(undeformed configuration, 0.)
>> xcompl(lnp(11,2))
ans =
0.0633
(undeformed configuration, 3.268)
To show the usefulness of SPAVISUAL the first three free vibration modes (no external loads)
and buckling modes (axially loaded by an end force) are displayed for the cantilever beam of
this example in figures 3.30 to 3.35.
Figure 3.30. First vibration mode for a cantilever
beam with 5 elements, ω1 = 0.355131 rad/s (theoretically, 0.355100 rad/s).
Figure 3.31. First buckling mode for a cantilever
beam with 5 elements, Fcr1 = 2.516776 N (theoretically, 2.516749 N).
Figure 3.32. Second vibration mode for a cantilever beam with 5 elements, ω2 = 2.2266 rad/s
(theoretically, 2.22537 rad/s).
Figure 3.33. Second buckling mode for a cantilever beam with 5 elements, Fcr2 = 22.715 N
(theoretically, 22.651 N).
Figure 3.34. Third vibration mode for a cantilever
beam with 5 elements, ω3 = 6.25198 rad/s (theoretically, 6.23111 rad/s).
Figure 3.35. Third buckling mode for a cantilever
beam with 5 elements, Fcr3 = 64.798 N (theoretically, 62.919 N).
Section 3.8. Short beam
3.8
71
Short beam
l
F
y
h
Figure 3.36. Short Timoshenko beam loaded in shear.
In this example the influence of shear deformation on the behaviour of short beams is studied.
A square plate is loaded in shear in its plane as shown in Figure 3.36. The beam has unit height,
h, length, l, and Young’s modulus, E, and a small unit width, t. With Poisson’s ratio ν = 0.27,
the shear correction value is k = 10(1 + ν)/(12 + 11ν) = 0.8484. The deflection, if shear
deflection is taken into account, is
y=
2(1 + ν)F l
F l3
+
12EI
kEth
(3.13)
with I = th3 /12. So the compliance is
l3
2(1 + ν)l
2(1 + ν)
y
=
+
=1+
= 3.9940.
F
12EI
kEth
k
(3.14)
The moment of inertia per unit of length is J = ρth3 /12.
An input file in which the beam is modelled by two planar beams of equal length (shear2.dat)
in this case is:
PLBEAM 1 1 2 3 4
PLBEAM 2 3 4 5 6
X 1 0.0 0.0
X 3 0.5 0.0
X 5 1.0 0.0
FIX 1
FIX 2
FIX 6
FIX 5 1
RLSE 1
RLSE 2
DYNX 3
72
Chapter 3. Examples
DYNX 4
DYNX 5 2
END
HALT
EM 1 1.0
EM 2 1.0
ESTIFF 1
ESTIFF 2
0.0833333333
0.0833333333
1.0 0.0833333333 0.2495
1.0 0.0833333333 0.2495
ITERSTEP 10 1 0.000000000001
END
END
In a MATLAB session, the compliances and eigenfrequencies can be found as follows
>> spacar(8,’shear2’)
>> xcompl(lnp(5,2))
ans =
3.9940
>> spacar(7,’shear2’)
>> type shear2.log
...
Eigenvalue numbers 5 to 8
( 0.00000E+00 : +/-2.54107E+00)
Eigenvector numbers 5 to 8
(
0.0000000 :
0.0000000)
( -0.1544078 :
0.0000000)
(
0.2825588 :
0.0000000)
(
0.1744141 :
0.0000000)
(
0.0000000 :
0.0000000)
(
0.0000000 : -/+0.3923612)
(
0.0000000 : +/-0.7180016)
(
0.0000000 : +/-0.4431985)
( 0.00000E+00 : +/-7.95645E-01)
(
(
(
(
(
(
(
(
0.0000000
0.4065978
0.2566711
0.6173727
0.0000000
0.0000000
0.0000000
0.0000000
:
:
:
:
:
:
:
:
0.0000000)
0.0000000)
0.0000000)
0.0000000)
0.0000000)
+/-0.3235074)
+/-0.2042190)
+/-0.4912094)
...
The compliance based on thin plate theory is 3.8822 m/N, so the approximation with a short
beam overrates the compliance by about 3%. If the shear flexibility were nor included, the
compliance would be 1.0 m/N.
The lowest numerical eigenfrequency, ω1 = 0.795645 rad/s, compares well with a value from
plate theory, ω1,pl = 0.7987 rad/s. If shear flexibility nor rotational inertia is included, the first
numerical eigenfrequency is 1.6168 rad/s.
Section 3.9. Lateral buckling of cantilever beam
3.9
73
Lateral buckling of cantilever beam
In this example lateral buckling is considered of a cantilever beam with a narrow rectangular
cross-section which is loaded by a transverse force Fkipp at its free end
√ in the direction of the
larger flexural rigidity. The theoretical buckling load is Fth = 4.013 (EISt )/l2 , where EI is
the smaller flexural rigidity, St the torsional rigidity and l the length of the beam. For numerical
analysis, the beam is divided into four equal spatial beam elements in which the second-order
terms in the bending deformations are included in the analysis.
In a MATLAB session we get:
>>spacar(8,’lateral4’)
>>spavisual(’lateral4’)
An input file (lateral4.dat) describing this case is:
BEAM
BEAM
BEAM
BEAM
X
X
X
X
X
1
3
5
7
9
1
2
3
4
1
3
5
7
DYNE
DYNE
DYNE
DYNE
0.00
0.25
0.50
0.75
1.00
1
2
3
4
2
2
2
2
2
4
6
8
3 4
5 6
7 8
9 10
0.00
0.00
0.00
0.00
0.00
0.00
0.00
0.00
0.00
0.00
5
5
5
5
0.
0.
0.
0.
1.
1.
1.
1.
6
6
6
6
FIX 1
FIX 2
OUTLEVEL 0 1
END
HALT
EM
EM
EM
EM
1
2
3
4
1.0
1.0
1.0
1.0
ESTIFF
ESTIFF
ESTIFF
ESTIFF
1
2
3
4
0.0033
0.0033
0.0033
0.0033
0.0
0.0
0.0
0.0
2.0
2.0
2.0
2.0
0.0
0.0
0.0
0.0
1.0
1.0
1.0
1.0
0.
0.
0.
0.
74
Chapter 3. Examples
XF 9 0.0 0.0 -1.0
END
END
VISUALIZATION
BUCKLINGMODE 1
TRANSPERANCY 0.9
BEAMVIS 0.01 0.1
LIGHT 1
STEPLINE 0.01
ENLARGEFACTOR 0.04
The 3D-visualization of this file is presented in figure 3.37. The buckling load found is 5.7619 N,
whereas the theoretical value is 5.6752 N. If the warping is constrained
at the clamped end, the
q
first element is effectively shorter for torsion by a distance b (1 + ν)/24, where b is the height
of the beam, here b = 0.2 m, and ν is Poisson’s ratio, here
q ν = 0. The torsional stiffness of the
first beam element now increases with a factor l/(l − b 2/3) = 1.19517. The input line for the
stiffness of the first beam element now becomes
ESTIFF 1 0.0 2.39034 0.0 1.0
The critical load is now increased to 6.1694 N.
Section 3.9. Lateral buckling of cantilever beam
75
F
Figure 3.37. Cantilever beam lateral buckling (buckling mode 1).
76
Chapter 3. Examples
3.10
State-variable and output equations
k5
7
9
5
y
4
l4
5
b1
m2
k2
3
l3
1
2
x
1
3
2
Figure 3.38. Lever system.
Find the state-space-variable and output equations for the system shown in Fig. 3.38.
The input is the displacement δx7 of the left end of spring k2 = EA2 /l2 ; it affects the mass m2
through spring k5 = EA5 /l5 and the lever, which is modelled by the planar beam elements 3
and 4. The lever has a fixed pivot at node 5 and is assumed to be massless yet rigid. Its angular
orientation is small so that only horizontal motion need be considered. We will select δx2 and
δ ẋ2 as state variables, with δx7 being the input and reaction force δfx 5 as output. With these
definitions the state variable and output equations are then:
"
h
#
"
δ ẋ2
0
1
2 =
δ v̇
−k2 /m2 −b1 /m2
|
i
{z
A
h
δfx 5 = −k2 (1 + l3 /l4 )
|
{z
C
#"
}
#
"
#
i
h
δx2
0
7
δx
+
δ ẋ2
−(k2 /m2 )(l4 /l3 )
|
0
#
"
i δx2
2
} δ ẋ
{z
}
B
h
+ −k2 l3 /l4 (1 + l3 /l4 )
|
{z
D
ih
}
(3.15)
i
δx7 ,
(3.16)
which have the desired form. These results can also be obtained numerically from a SPACAR
analysis. E.g. with numerical values for m2 = 1, b1 = Ed A1 /l1 = 5, k2 = k5 = 1000 and
l4 /l3 = 2. A SPACAR input file (lever.dat) for this case is:
PLTRUSS
PLTRUSS
PLBEAM
PLBEAM
PLTRUSS
1
2
3
4
5
1
2
3
5
7
X 1 0.0 0.0
2
3
4 5 6
6 7 8
9
Section 3.10. State-variable and output equations
X
X
X
X
X
2
3
5
7
9
1.0
2.0
2.0
2.0
3.0
FIX
FIX
FIX
FIX
1
2 2
5
9
DYNX 2
INPUTX
RLSE 1
RLSE 2
RLSE 5
0.0
0.0
2.0
3.0
3.0
1
7 1
1
1
1
END
HALT
XM 2 1.0
ESTIFF 2 1000.
ESTIFF 5 1000.
EDAMP 1 5
END
HALT
INX 1 7 1
OUTF 1 5 1
END
END
In a MATLAB session we get:
>> spacar(9,’lever’)
>> A=getfrsbf(’lever.ltv’, ’A’, 1)
A =
0
-1000
1
-5
>> B=getfrsbf(’lever.ltv’, ’B’, 1)
77
78
Chapter 3. Examples
B =
0
-2000
>> C=getfrsbf(’lever.ltv’, ’C’, 1)
C =
-3000
0
>> D=getfrsbf(’lever.ltv’, ’D’, 1)
D =
-6000
The state-space matrices can also be obtained with the command getss(’lever’). A Bode
diagram (Figure 3.39) can be made by the command
>> bode(getss(’lever’))
Bode Diagram
100
90
80
Magnitude (dB)
70
60
50
40
30
20
10
0
360
Phase (deg)
315
270
225
180
−1
10
0
10
1
10
Frequency (rad/sec)
2
10
Figure 3.39. Bode diagram for the lever system.
3
10
Section 3.11. Rigid spatial manipulator mechanism
3.11
79
Rigid spatial manipulator mechanism
Figure 3.40 gives an example of a simplified manipulator. The prescribed motion of the endeffector C is represented by the coordinates xC , y C and z C as functions of time.
z
v
1.76 m/s
3
4
B
5
y
1, 2
II
0.0
0.2
0.4
1.0
1.2
C
1.4
t
I
x
Figure 3.40. Spatial manipulator mechanism, trajectory and velocity profile of the endeffector.
The end-effector must follow the straight trajectory from point I to point II. Three trajectories
are distinguished: Initially the manipulator is at rest for 0.2 s. Next, during 1.0 s, the motion is carried out according to the velocity profile in Fig. 3.40 with constant acceleration and
deceleration during the first and final 0.2 s. Finally the manipulator is at rest again.
The motion of manipulator is determined by the rotation of three hinges. Hinge 1 enables
rotations about the z-axis, while hinge 2 enables motions perpendicular to the xy-plane. Hinge 3
takes care of motions in the same plane wherein hinge 2 is active. The hinges are driven by
internal actuators. For control purposes we assume that sensors are available that measure the
rotations and the speed of rotation of the hinges.
The manipulator consists of two beams, elements 4 and 5, which are equal in length: l4 =
l5 = 0.7 m. The distributed mass per length is ρ4 = 4 kg/m for element 4 and ρ5 = 2 kg/m for
element 5. The concentrated masses in nodes B and C are 10 kg and 30 kg respectively. The
effect of gravity is accounted for by applying external forces mi g in negative z-direction, where
g = 10 m/s2 .
Inverse dynamics problem
First the inverse dynamics problem is analysed. Figure 3.44 shows the velocity components of
the end-effector that are computed for the trajectory defined in the input file. The position and
acceleration components of the end-effector are shown Fig. 3.43 and Fig. 3.45, respectively.
The following input file (robotinv.dat) is used (SPACAR mode=2):
80
Chapter 3. Examples
HINGE
HINGE
BEAM
HINGE
BEAM
X
X
X
4
5
8
1
2
4
3
5
1
2
4
6
5
2
3
3 5 6
7
7 8 9
0.
0.
0.268 0.
0.536 0.
FIX
FIX
INPUTX
INPUTX
INPUTX
RLSE
RLSE
RLSE
1
4
8
8
8
1
2
3
0 0
0 -1
0 1
0 -1
0 1
1
0
0
0
0
0.
0.6467
0.
5
8
4
5
1
5
8
1
2
3
1
1
1
10.
30.
4.
2.
0.
0.
0.
1.3
0.
1 1 1
2 2 1
3 3 1
1
2
3
1
2
3
1
2
3
8
8
8
8
8
8
1
1
1
1
1
1
1
1
1
1
2
3
1
2
3
END
END
0. -14.
0. -121.
0. -307.
END
HALT
TRAJECT 1
TRANS
8
TRTIME 0.2
TRAJECT 2
TRANS
8
TRVMAX 8
TRFRONT 8
TRTIME 1.0
NOMS
NOMS
NOMS
REFE
1
REFE
2
REFE
3
REFEP 4
REFEP 5
REFEP 6
REFEDP 7
REFEDP 8
REFEDP 9
REFX 10
REFX 11
REFX 12
REFXP 13
REFXP 14
REFXP 15
END
HALT
XM
XM
EM
EM
XF
XF
XF
TRAJECT 3
TRANS
8 0.
TRTIME 0.2 20
0.536 0.
20
0.
0.
0.2
0.
100
0.
1.3
1.76
VISUALIZATION
BEAMVIS 0.01 0.01
HINGEVIS 1 0.01 0.03
HINGEVIS 2 0.01 0.03
HINGEVIS 3 0.01 0.03
LIGHT 1
TRANSPARENCY 0.6
TRAJECT 1
TRAJECTNODE 8
The inverse dynamics analysis yields the stresses that have to be applied at the hinges and
the deformations of the hinges. Fig. 3.42 shows the stresses. Figures 3.46 and 3.47 show
the deformations which are the relative rotations of the hinges, and the first time derivatives,
respectively. Clearly, to accomplish the quite simple trajectory of the end-effector of this non-
Section 3.11. Rigid spatial manipulator mechanism
Figure 3.41.
SPAVISUAL
81
output for the spatial manipulator mechanism.
linear mechanism rather complicated functions for the rotation of the hinges are needed.
Note that the input file defines the inputs and outputs that will be used in a SIMULINK simulation. The nominal inputs are computed to accomplish the deformations of the hinges. The
outputs include the six sensor signals with the rotations and the speeds of rotation of the hinges.
Nine more outputs are defined to obtain extra information on the performance of the manipulator: the acceleration of the rotation of the hinges and position and velocity of the end-effector.
At the end of the file visualization settings for SPAVISUAL are defined. In figure 3.41 the output
of SPAVISUAL is presented.
82
Chapter 3. Examples
600
1.4
500
1.2
400
u0(1), u0(2), u0(3) [N/m]
1
x,y,z(8) [m]
300
200
0.8
0.6
100
0.4
0
0.2
−100
−200
0
0.2
0.4
0.6
0.8
1
1.2
0
1.4
0
0.2
0.4
0.6
time [s]
0.8
1
1.2
1.4
time [s]
Figure 3.42. Stresses to be applied at the hinges
(u0 ).
Figure 3.43.
effector.
2
Position coordinates of the end-
10
8
1.5
6
4
2
(d/dt) x,y,z(8) [m/s ]
0.5
2
0
2
(d/dt) x,y,z(8) [m/s]
1
−2
0
−4
−6
−0.5
−8
−1
0
0.2
0.4
0.6
0.8
1
1.2
1.4
−10
0
0.2
0.4
0.6
time [s]
Figure 3.44. Velocity components of the endeffector.
1.5
3
(d/dt) e1(1),e1(2),e1(3) [rad/s]
4
1
e1(1),e1(2),e1(3) [rad]
1
1.2
1.4
Figure 3.45. Acceleration components of the endeffector.
2
0.5
0
−0.5
−1
0.8
time [s]
2
1
0
−1
0
0.2
0.4
0.6
0.8
1
1.2
1.4
time [s]
Figure 3.46. Deformations (relative rotations) of
hinges 1, 2 and 3.
−2
0
0.2
0.4
0.6
0.8
1
1.2
1.4
time [s]
Figure 3.47. Velocities of deformation of hinges
1, 2 and 3.
Section 3.11. Rigid spatial manipulator mechanism
83
Rotational nodes for the spatial manipulator
node 1 node 2 node 3 node 6 node 7 node 9
type
2
2
2
2
2
2
λ0
2
2
2
2
2
2
λ1
1
2
2
2
2
2
λ2
1
2
2
2
2
2
λ3
1
2
2
2
2
2
forces
0
0
0
0
0
0
I∗∗
0
0
0
0
0
0
Translational nodes for the spatial manipulator
node 4 node 5
node 8
type
1
1
1
x-coordinate
0
0.268
0.536
y-coordinate
0
0
0
z-coordinate
0
0.647
0
BC-type x
1
2
3
x0
0.536
ẋ0
0
BC-type y
1
2
3
y0
0
ẏ0
0
BC-type z
1
2
3
z0
0
ż0
0
force x
0
0
0
force y
0
0
0
force z (∗)
-14
-121
-307
mass
0
10
30
(∗) including the element masses
element type
T-nodes
R-nodes
x local y-axis
y local y-axis
z local z-axis
type e1
type e2
type e3
type e4
type e5
type e6
Elements for the spatial manipulator
element 1 element 2 element 3 element 4
hinge
hinge
hinge
beam
4, 5
1, 2
2, 3
6, 7
3, 6
0
0
0
0
0
-1
-1
1
1
0
0
0
2
2
2
1
1
1
1
1
1
1
1
1
1
1
1
T=translational, R=rotational
element 5
beam
5, 8
7, 9
0
1
0
1
1
1
1
1
1
84
Chapter 3. Examples
Linearization
In one of the next sections the design of a closed-loop controller for this manipulator will be
discussed. This controller depends on parameters derived from the linearized equations of motion. Therefore, a linearization is needed in terms of the DOFs corresponding to the actuator
joints. An input file (robotinvlin.dat) for this analysis (SPACAR mode=3) is:
HINGE
HINGE
BEAM
HINGE
BEAM
X
X
X
4
5
8
1
2
4
3
5
1
2
4
6
5
2
3
3 5 6
7
7 8 9
0.
0.
0.268 0.
0.536 0.
FIX
FIX
INPUTE
INPUTE
INPUTE
0 0
0 -1
0 1
0 -1
0 1
0.
0.6467
0.
1
4
1 1
2 1
3 1
END
HALT
XM
XM
EM
EM
XF
XF
XF
5
8
4
5
1
5
8
10.
30.
4.
2.
0.
0.
0.
1
0
0
0
0
NOMS
NOMS
NOMS
1 1 1
2 2 1
3 3 1
REFE
1
REFE
2
REFE
3
REFEP 4
REFEP 5
REFEP 6
REFEDP 7
REFEDP 8
REFEDP 9
REFX 10
REFX 11
REFX 12
REFXP 13
REFXP 14
REFXP 15
1
2
3
1
2
3
1
2
3
8
8
8
8
8
8
1
1
1
1
1
1
1
1
1
1
2
3
1
2
3
END
END
0. -14.
0. -121.
0. -307.
END
HALT
Note that the setpoints are read from the sbd data file of which the name is the longest substring
of the name of the input file name robotinvlin. The file from the previous inverse dynamics
run robotinv is a likely candidate.
Section 3.11. Rigid spatial manipulator mechanism
85
Open-loop simulation
The behaviour of the manipulator mechanism without feed-back control is simulated using
SIMULINK for the open-loop configuration of Fig. 3.48. Two blocks from the SPACAR library
spacar_lib are used to read the Setpoint U0 and Reference Y0 data, respectively,
from the inverse dynamics run (file name robotinv). In this open-loop configuration the
nominal input is fed directly into the SPASIM block (also available in the library). In the input file robotsim for this block the actual inputs and outputs are identical to the previously
defined inputs and outputs.
HINGE
HINGE
BEAM
HINGE
BEAM
X
X
X
4
5
8
1
2
4
3
5
1
2
4
6
5
2
3
3 5 6
7
7 8 9
0.
0.
0.268 0.
0.536 0.
FIX
FIX
DYNE
DYNE
DYNE
0 0
0 -1
0 1
0 -1
0 1
0.
0.6467
0.
1
4
1 1
2 1
3 1
END
HALT
XM
XM
EM
EM
XF
XF
XF
5
8
4
5
1
5
8
10.
30.
4.
2.
0.
0.
0.
1
0
0
0
0
INPUTS 1
INPUTS 2
INPUTS 3
OUTE
1
OUTE
2
OUTE
3
OUTEP 4
OUTEP 5
OUTEP 6
OUTEDP 7
OUTEDP 8
OUTEDP 9
OUTX 10
OUTX 11
OUTX 12
OUTXP 13
OUTXP 14
OUTXP 15
1
2
3
1
2
3
1
2
3
1
2
3
8
8
8
8
8
8
1
1
1
1
1
1
1
1
1
1
1
1
1
2
3
1
2
3
END
END
0. -14.
0. -121.
0. -307.
END
HALT
The other blocks in the block diagram are standard SIMULINK blocks and are used to export data
to workspace and to display results on the screen. The “Selector” blocks select only specified
components from an input vector. They are e.g. used to select only the first three components of
the output vector (deformations of the hinges) as displaying all components makes the graphs
unreadable.
SIMULINK ’s ode45 solver is used with a relative tolerance of 10−5 , an absolute tolerance of
10−8 and a maximum time step of 0.01 s. With these parameters the simulation of the motion
from t = 0.0 s to t = 1.5 s is completed after 172 time steps. The size of many time steps is
86
Chapter 3. Examples
robotinvlin 3
15
3
15
robotsim
SPASIM
Setpoint U0
unom
3
Selector 3
Selector E
Scope E
y
15
Y To Workspace
Unom To Workspace
15
15
15
Selector 3
Selector Ytip
robotinvlin 15
15
Selector Eref
Reference Y0
Scope dYtip
Selector 3
1.5
Scope Eref
Display Time
t
yref
15
Clock
Time To Workspace
Yref To Workspace
Figure 3.48. Block diagram for an open-loop simulation of the motion of the manipulator
mechanism using SIMULINK.
2
1.4
1.2
1.5
(1)
0.8
0.5
x,y,z(8) [m]
e1(1),e1(2),e1(3) [rad]
1
e1
1
(3)
e1
y (8)
x(8)
0.6
0.4
0
(2)
e1
0.2
−0.5
0
z (8)
−1
0
0.2
0.4
0.6
0.8
1
1.2
1.4
time [s]
Figure 3.49. Deformation of the hinges of spatial
manipulator mechanism in an open-loop simulation.
−0.2
0
0.2
0.4
0.6
0.8
1
1.2
1.4
time [s]
Figure 3.50. Position of the end-effector of spatial manipulator mechanism in an open-loop simulation.
dictated by the specified maximum value.
The results from the simulation are plotted using the MATLAB commands;
>> plot(t,yref(:,1),’r’,t,yref(:,2),’g’,...
t,yref(:,3),’b’,t,y(:,1),’r:’,...
t,y(:,2),’g:’,t,y(:,3),’b:’)
>> plot(t,yref(:,10),’r’,t,yref(:,11),’g’,...
t,yref(:,12),’b’,t,y(:,10),’r:’,...
t,y(:,11),’g:’,t,y(:,12),’b:’)
Figures 3.49 and 3.50 show the deformation of the hinges and the position coordinates of the
end-effector from this simulation. The solid lines are the reference data (yref) and the dotted
lines are from the actual simulation (y). Clearly, small errors during the integration lead to
relatively large position errors at the end of the motion. The error can be decreased by increasing
the integration accuracy, e.g. by enlarging the number of computed setpoints. More reliable
results can be obtained by applying feedback control, as will be discussed next.
Section 3.11. Rigid spatial manipulator mechanism
87
Closed-loop simulation
The block diagram of Fig. 3.48 is extended with a feedback controller as shown in Fig. 3.51.
A feedback signal is computed by a controller that is implemented as a subsystem block and
a multiplication with the reduced mass matrix M 0 . The subsystem assumes that the input is a
vector with both δe and δ ė. These are the differences in joint positions and velocities which are
computed by comparing the actual motion and the nominal output. The output of the subsystem
is
K p δe + K v δ ė
with well chosen matrices K p and K v (see e.g. the lecture notes [1]). This output is multiplied
with the time-dependent 3 × 3 reduced mass matrix M 0 using a block from the spacar_lib
library. Finally the nominal input vector u0 is added as a feedforward signal.
robotinvlin
3
Unom
3
Setpoint U0
unom
3
u
Unom To Workspace
y
15
U To Workspace
Y To Workspace
3
6
6
Omega = 28
beta = 0.85
Kp Kv control
6
3
robotinvlin
times M0
3
3
15
3
15
robotsim
SPASIM
Selector
6
6
Selector E + Ed
Selector
Selector E
3
Scope E
yref
15
1.5
Yref To Workspace
robotinvlin
Reference Y0
15
15
Selector
6
Selector Eref + Edref
6
Selector
Display Time
3
Selector Eref
15
Scope Eref
15
15
Selector
t
3
Selector Ytip
Clock
Time To Workspace
Scope dYtip
Figure 3.51. Block diagram for a closed-loop simulation of the motion of the manipulator
mechanism using SIMULINK. Most signals are vectors and the numbers indicate the size of
the vectors.
The motion is simulated with the same parameters as in the open-loop simulation (see page 85).
In this case the actual size of the variable time step is somewhat smaller and after 183 time
steps the simulation is completed. The differences between the prescribed and actual trajectory
is much smaller in this case as is illustrated in Figs. 3.52 and 3.53. The maximum error of the
tip position is less than 1 mm which is better than 0.1%.
Figs. 3.54 and 3.55 show the feedforward part (u0 ) and feedback part (u − u0 ) of the input
applied to the manipulator, respectively. Clearly, the larger contribution is from the feedforward
part. The size of the feedback part is smaller and relatively large correction are only applied
during limited periods of time. However, as is clear from this example, this feedback is essential
to keep the manipulator on track.
The simulation for 1.5 s now requires 182 time steps, which is only slightly more than in the
open-loop simulation. However, the simulation takes much more time which is caused by the
occurrence of a so-called algebraic loop in the block diagram. The reason for this algebraic
loop is the presence of the joint accelerations in the output vector of the spasim block, as
accelerations depend algebraically on the input torques. These accelerations are only exported
to the workspace and are not used in the feedback loop so there is no real algebraic loop. Unfortunately, SIMULINK has no means to detect this. If you are not interested in the accelerations,
they can easily be removed from the output vector and the simulation speed will increase significantly.
88
Chapter 3. Examples
−4
−3
x 10
1.5
3
x 10
2
(8)
(2)
e1
0.5
−
(2)
e1,ref
0
0
−0.5
(1)
(1)
e1 − e1,ref
−1
x(8) − xref
1
x−xref,y−yref,z−zref(8) [m]
e1(1)−e1ref(1),e1(2)−e1ref(2),e1(3)−e1ref(3) [rad]
1
(8)
z (8) − zref
−1
−2
−3
−4
(8)
y (8) − yref
−1.5
(3)
e1
−2
−2.5
0
0.2
0.4
0.6
0.8
−
(3)
e1,ref
−5
−6
1
1.2
−7
1.4
time [s]
0
0.2
0.4
0.6
0.8
1
1.2
1.4
time [s]
Figure 3.52. Error in the deformation of the
hinges of spatial manipulator mechanism in a
closed-loop simulation.
Figure 3.53. Position error of the end-effector of
spatial manipulator mechanism in a closed-loop
simulation.
40
600
(1)
u(1) − u0
500
30
400
(3)
u0
20
(2)
u0
200
u−u0(1,2,3) [N/m]
u0(1,2,3) [N/m]
300
10
100
0
0
(1)
u0
−100
−200
0
0.2
0.4
−10
0.6
0.8
1
1.2
1.4
time [s]
Figure 3.54. Input applied to the manipulator:
feedforward part (u0 ).
−20
(3)
u(3) − u0
0
0.2
0.4
(2)
u(2) − u0
0.6
0.8
1
1.2
1.4
time [s]
Figure 3.55. Input applied to the manipulator:
feedback part (u − u0 ).
Section 3.12. Flexible spatial manipulator mechanism
3.12
Flexible spatial manipulator mechanism
To be added ...
89
90
Chapter 3. Examples
3.13
Chord-driven underactuated robotic finger
proximal phalanx
first pulley
second pulley
distal phalanx
F
M
third pulley
Figure 3.56. Robotic finger.
In order to illustrate the use of the planar belt/gear element, a model for a chord-driven underactuated robotic finger with two phalanges, as in a thumb, is considered; see Fig. 3.56. The distal
phalanx can rotate with respect to the proximal phalanx and the proximal phalanx can rotate
with respect to the palm, which is assumed to be immobile. A pulley is rigidly connected to
the distal phalanx, centred at its rotation point, which carries a chord that is slung over a second
pulley centred at the rotation point of the proximal phalanx, but free to rotate. The chord is
finally attached to a third pulley, which is driven by a motor. The finger is underactuated, for
it has two degrees of freedom, but a single motor. The degrees of freedom are chosen as the
relative rotation angle between the two phalanges and the rotation angle of the motor pulley.
A force F = 10 N acts near the tip of the finger, which is balanced by a moment M = 1.5 Nm
delivered by the motor. Owing to the choice of the dimensions of the radii of the pulleys and
the lengths of the phalanges, this is an equilibrium position.
y
2
1
3
x
6
M
5
4
F
Figure 3.57. Finite element model for the robotic finger.
The finite element model is shown in Fig. 3.57. The input file, finger.dat, is
PLBEAM
PLTOR
PLBEAM
PLBELT
1
2
3
4
1
4
3
8
2 3 4
5
5 6 7
9 1 10 -0.015 -0.015
Section 3.13. Chord-driven underactuated robotic finger
91
PLBELT 5 1 10 3 5 -0.015 -0.009
PLRBEAM 6 6 7 11
FIX 1 1 2
FIX 8 1 2
DYNX 9 1
DYNE 2 1
X 1 0 0
X 3 0.06 0.0
X 6 0.15 0.0
X 8 0 -0.06
X 11 0.15 -0.015
END
HALT
EM 3 1.0
EM 5 1.0
STARTDX 9 1 0.0 0.0
STARTDE 2 1 0.0 0.0
XF 11 0.0 10.0
XF 9 -1.5
TIMESTEP 0.2 100
END
END
VISUALIZATION
VIBRATIONMODE 1
ENLARGEFACTOR 0.2
By running SPACAR with mode=7, it can be checked that the initial position is indeed an
equilibrium position, but it is unstable. One mode has an eigenvalue equal to zero, and in
the corresponding mode shape, the distal phalanx remains horizontal. The other mode has an
exponentially increasing or decaying motion and is shown in Figure 3.58. (Note that the current
version of SPAVISUAL does not draw the pulleys.) A simulation with an initial perturbation,
specified by
STARTDX 9 1 0.001 0.04
STARTDE 2 1 0.004 0.16
shows this unstable behaviour. Note that the initial perturbation is approximately in the direction
of the eigenvector corresponding to the unstable eigenvalue.
92
Chapter 3. Examples
Figure 3.58. Unstable mode.
Section 3.14. Tricycle
3.14
93
Tricycle
y
x
λ
z
x
Figure 3.59. Tricycle.
A tricycle has two rear wheels on a common axle and a front wheel in a fork that can rotate
about a steering axis with respect to the rear frame. The steering axis can be vertical (λ = 0) or
be inclined; see Fig. 3.59. The input file for the planar version, trike2.dat, is:
PLRBEAM 1 1 2 3
PLWHEEL 2 3 2 4 0.3 0.0 1.0
PLRBEAM 3 1 2 5
PLWHEEL 4 5 2 6 0.3 0.0 1.0
PLRBEAM 5 1 2 7
PLTOR
6 2 8
PLRBEAM 7 7 8 9
PLWHEEL 8 9 8 10 0.25 0.0 1.0
X 1 0.3
0.0
X 3 0.0
0.35
X 5 0.0 -0.35
X 7 1.05 0.0
X 9 1.00 0.0
RLSE 4 2
DYNE 6 1
KINX 1 1 2
KINX 2 1
DYNX 4 1
KINX 6 1
KINX 10 1
END
94
Chapter 3. Examples
HALT
XM 1 80.0
XM 2 5.0
XM 3 2.0
XM 4 0.1
XM 5 2.0
XM 6 0.1
XM 8 0.025
XM 9 1.5
XM 10 0.05
STARTDX 4 1 0.0 10.0
STARTDE 6 1 0.5 0.0
TIMESTEP 1.0 100
END
END
The origin of the coordinate system is initially located at the centre of the rear axle, with the
x-axis pointing in the forward direction and the y-axis pointing to the left. The centre of mass
of the frame is at a distance of 0.3 m in front of the rear axle. The rear wheels, elements 2 and 4,
have a radius of 0.3 m and are connected to the centre of mass of the frame by two rigid beams,
elements 1 and 3. Another rigid beam, element 5, connects the centre of mass of the frame
to the steering head, where the hinge, element 6, makes the connection to the front fork. The
rigid beam 7 represents the rigid connection between the steering head and the the front wheel,
element 8, with radius 0.25 m, which is conncted to the front fork. All wheels can rotate freely
about their spin axis. The frame and the wheels have mass, but the front fork is assumed to be
massless.
The system has two degrees of freedom: the rotation angle of the left rear wheel and the steering
angle are chosen as generalized coordinates. The lateral slip of the right rear wheel is released,
because otherwise the system whould be overconstrained. The other five slips at the wheels
are prescribed as zero to impose the non-holonomic constraints of pure rolling. Five kinematic
coordinates are defined as the two position coordinates and the yaw angle for the rear frame and
the two rotation angles at the other wheels. The moments of inertia at the nodes 4, 6 and 10 are
the moments of inertia about the spin axes of the wheels.
The stationary motion and the linearized equations can be found by running SPACAR with
mode=7. It appears that there are seven eigenvalues equal to zero, with eigenvectors which
correspond to the three rotations of the wheels and the two positions and yaw angle of the rear
frame, and a change in the forward velocity. The other two eigenvalues are real and negative,
corresponding to exponentially decaying motion. A simulation can be made with mode=1.
A three-dimensional model of the same tricycle is (file trike3v.dat)
RBEAM
HINGE
WHEEL
RBEAM
HINGE
WHEEL
RBEAM
HINGE
1
2
3
4
5
6
7
8
1 2
2 4
3 4
1 2
2 7
6 7
1 2
2 10
3
5
6
8
9
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
1.0
Section 3.14. Tricycle
95
RBEAM 9 9 10 11 0.0 1.0 0.0
HINGE 10 10 12
0.0 1.0 0.0
WHEEL 11 11 12 13 0.0 1.0 0.0
HINGE 12 14 2
0.0 0.0 1.0
X 1 0.3 0.0 0.9
X 3 0.0 0.35 0.3
X 5 0.0 0.35 0.0
X 6 0.0 -0.35 0.3
X 8 0.0 -0.35 0.0
X 9 1.05 0.0 0.3
X 11 1.00 0.0 0.25
X 13 1.00 0.0 0.0
FIX 14
RLSE 12 2 3
RLSE 6 6
DYNE 2 1
DYNE 8 1
KINE 5 1
KINE 10 1
KINE 12 1
KINX 1 1
KINX 1 2
END
HALT
GRAVITY 0.0 0.0 -9.81
XM 1 80.0
XM 2 2.0 0.0 0.0 3.0 0.0 5.0
XM 3 2.0
XM 4 0.0 0.0 0.0 0.1 0.0 0.0
XM 6 2.0
XM 7 0.0 0.0 0.0 0.1 0.0 0.0
XM 11 1.5
XM 12 0.025 0.0 0.0 0.05 0.0 0.025
STARTDE 2 1 0.0 10.0
STARTDE 8 1 -0.5 0.0
TIMESTEP 1.0 100
END
END
Note that hinges (elements 2, 5 and 10) are used to connect the wheels to the rigid beams and
an additional hinge, element 12, is introduced in order to make the yaw angle available. With
mode=7, the same eigenvalues are found as for the planar model. If variables are saved from
the run with the planar model, it will be seen that the results of a simulation are very nearly the
same. The three-dimensional model has the advantage that the normal forces at the wheels are
calculated, which are the first components of the stress of the wheel elements (Fig 3.60):
>> plot(time,sig(:,le(3,1)),’k-’,time,sig(:,le(6,1)),’k:’, ...
time,sig(:,le(11,1)),’k--’); grid on
96
Chapter 3. Examples
0
−100
normal force [N]
−200
−300
−400
−500
−600
0
0.1
0.2
0.3
0.4
0.5
time [s]
0.6
0.7
0.8
0.9
1
Figure 3.60. Normal forces at road contact points. The fully drawn line is for the left rear
wheel, the dotted line for the right rear wheel and the dashed line for the front wheel.
>> xlabel(’time [s]’)
>> ylabel(’normal force [N]’)
It is seen that all forces are negative, which means that the normal force is compressive, as it
should be. The normal force in the right rear wheel is initially much higher than the corresponding force at the left rear wheel. Because the wheel planes remain perpendicular to the
road surface, the third components of the stresses are also equal to the normal force at the road.
Lateral forces are in the second components, as well as in the sixth in a scaled version. The
fourth components of the stresses are zero, as they should be. The fifth components represent
scaled longitudinal tyre forces at the contact points.
A model with an inclined steering axis, as shown in Fig. 3.59, is in the input file trike3i.dat,
which differs from trike3v.dat in the definition of the hinge at the steering head, element 8,
and the position of node 9,
...
HINGE
8
2 10
-0.30901699437495
...
X
9
...
0.96 0.0
0.3
0.0
0.95105651629515
Section 3.14. Tricycle
97
0
−100
normal force [N]
−200
−300
−400
−500
−600
0
0.1
0.2
0.3
0.4
0.5
time [s]
0.6
0.7
0.8
0.9
1
Figure 3.61. Normal forces at road contact points. The fully drawn line is for the left rear
wheel, the dotted line for the right rear wheel and the dashed line for the front wheel.
Note that for this case, the normal force in the right rear wheel is initially just compressive
(Figure 3.61), so for a slightly higher speed, the wheel would lose contact with the ground.
This loss of contact cannot directly be included in the model. The front wheel no longer stays
perpendicular to the road surface, so the first and third stress components are no longer equal.
Morreover, the rotation angle of the hinge with element number 12 is not exactly equal to the
yaw angle in this case.
98
Chapter 3. Examples
A
SPACAR installation
Prerequisites
Before installing SPACAR on a computer system it is advisable to check that the system is
suitable of running the software and to have MATLAB installed.
This SPACAR version has been developed and tested with MATLAB 7.0.4 and SIMULINK 6.2
(Release 14SP2). It is expected to work with any modern version of MATLAB/SIMULINK since
R12, but in case of problems we can offer only limited support.
The system requirements depend heavily on the version of MATLAB you are using. Consult the
accompanying Installation Guide or check The Mathworks. You may expect that SPACAR will
run on any Microsoft 32-bit Windows PC on which MATLAB/SIMULINK are running. Only the
base systems of MATLAB and SIMULINK are required to run SPACAR, but additional toolboxes
like the Control System Toolbox may be helpful to develop and analyse control systems.
The installation of SPACAR uses less than 4 MB extra disk space.
The SPACAR files are stored in ZIP-archives or, in Microsoft Windows XP, a compressed folder.
In Windows XP you can easily open such archives, but of course you may chose to use your
favourite unzipper. The ZIP-archives can be downloaded from
http://www.wa.ctw.utwente.nl/Software/SPACAR/.
In addition to the software there is a ZIP-archive with the data files that are used for the examples
in Chapter 3.
Installation
First of all, you should create a subdirectory e.g. \Matlab\Toolbox\Spacar. Next, you
extract the files from the SPACAR software ZIP-archive spacar2007_bin.zip into this
subdirectory. There are three types of files:
• Files with the extension .dll are the actual executables of the SPACAR package. The
original SPACAR-code (not provided) is written in C and FORTRAN 77, compiled and
linked into so-called MEX-modules, that are executables for use within the MATLABenvironment. The following files must exist:
99
100
Appendix A. SPACAR installation
checksbf.dll
loadsbm.dll
spacar.dll
combsbd.dll
ltv.dll
spacntrl.dll
getfrsbf.dll
mrltv.dll
spasim.dll
loadsbd.dll
repinsbf.dll
• Files with extension .m are the MATLAB-files necessary to use the SPACAR program. The
following file must exist:
spadraw.m
Other .m-files provide help text for the MEX-modules. These files are:
checksbf.m
loadsbd.m
repinsbf.m
combsbd.m
loadsbm.m
spacar.m
getfrsbf.m
ltv.m
spacntrl.m
getss.m
mrltv.m
spasim.m
• Files with extension .mdl are SIMULINK models. There is only one file which is actually
a library from which the SPACAR modules for use in SIMULINK can be copied:
spacar_lib.mdl
The (optional) data files from spadata.zip can be extracted in a separate working directory.
The files in the SPACAR subdirectory should be in the MATLAB path when MATLAB is running.
There are two ways to accomplish this:
1. Make sure that the SPACAR subdirectory is the local directory. You can verify this by
typing pwd. If necessary, change your local directory by typing
cd \Matlab\Toolbox\Spacar
or whatever directory you chose to store your files.
2. Another possibility is to change the settings of the MATLAB environment by adding the
SPACAR subdirectory to the MATLAB path. This modification is either temporary or permanent. The path can be modified from the pulldown menu with File|Set Path...,
or by using the MATLAB commands path or addpath.
Now you are ready to run SPACAR in MATLAB and SIMULINK.
B
SPACAR error messages
An analysis with SPACAR in MATLAB or a simulation with SPASIM in SIMULINK can suffer from
errors. These errors can be divided into fatal errors that cause an immediate terminations and
less severe errors which may report unexpected conditions in the log file, while the calculation
continues.
Most fatal error have a clear error message:
• SPACAR requires 2 or 3 input arguments,
SPACAR requires no output argument,
CCONST must be 1 x N or N x 1 vector,
CCONST contains too many parameters,
MODE has an invalid value and
FILENAME contains illegal characters
indicate an incorrect call of SPACAR from MATLAB. The last error can also occur in
SPASIM ( SIMULINK ).
• Wrong number of input arguments,
Flag must be a scalar variable,
Too many output arguments,
Time must be a scalar variable,
State vector of wrong size,
Input vector of wrong sizeand
Not a valid flag number
indicate an incorrect call of SPASIM from SIMULINK and should not occur during normal
operation.
• ERROR opening file ... means that SPACAR can not open the specified file for
output.
• ERROR opening existing file ... means that a file from a previous run is not
found.
• ERROR in subroutine DINVOE is caused by an error in the dynamics input, see
Sect. 2.3.
101
102
Appendix B. SPACAR error messages
• PREPTR: Illegal velocity profile is reported when no valid velocity profile
can be determined.
• Can not determine valid and existing input file names from
... means that no mode=2 output data file with extension sbd matching the current
(mode=3) data file can be found.
• Mechanisms are different,
Configuration mismatch LE and
Configuration mismatch LNP
arise from an error during the comparison between a the configuration used in a (previous)
mode=2 run and the current mode=3 run.
• ERROR in subroutine ORDE0: IFLAG = 2 and
ERROR in subroutine ORDE0: No convergence
indicate problems with the zeroth order iteration. In SPASIM this may be avoided by
setting or decreasing the maximum time step of SIMULINK’s solver.
• ERROR in subroutine SOLDYN is usually caused by a singular mass matrix.
• PRPARE: NUMBER OF NXC NOT EQUAL TO NEO+NEM is caused by an ill-defined
mechanism.
• ERROR in subroutine PRPARE: Too many ... means that the mechanism
that is defined is too large to be handled by the SPACAR version you are using, see Table 1.1 on page 10. Simplify the mechanism or contact the authors.
The messages written to the log file may be self-explanatory, but also a somewhat cryptic
messages “ERROR OR POSSIBLE ERROR CODED: <code> ITEM: <number>” can
occur. The <code> is related to a procedure in the software. Typical examples are:
• INVOERi input for the kinematics (Sect. 2.2).
• SINVOERi input for the inverse dynamics (setpoint generation) (Sect. 2.4).
• LIMVOEi input for the linearization (Sect. 2.5).
• SIMVOEi input for the non-linear simulation of manipulator control (Sect. 2.6).
• PREPTR.. trajectory data processing.
Note that errors in the input file are often reported one line later than the actual error position.
C
MATLAB tutorial
C.1 Basic MATLAB graphics commands
MATLAB provides a variety of functions for displaying data. This section describes some of
these functions. For a complete survey of graphics functions available in MATLAB we refer to
the official MATLAB documentation [2] or to the online help utility.
Elementary plotting functions
The following list summarizes the functions that produce basic line plots of data. These functions differ only in the way they scale the plot axes. Each accepts input in the form of vectors
or matrices and automatically scales the axes to accommodate the input data.
• plot – creates a plot of vectors or columns of matrices.
• loglog – creates a plot using logarithmic scales for both axes.
• semilogx – creates a plot using a logarithmic scale for the x-axis and a linear scale for
the y-axis.
• semilogy – creates a plot using a linear scale for the x-axis and a logarithmic scale for
the y-axis.
You can add titles, axis labels, grid lines, and text to your graph using
• title – adds a title to the graph.
• xlabel – adds a label to the x-axis.
• ylabel – adds a label to the y-axis.
• text – displays a text string at a specified location.
• gtext – places text on the graph using the mouse.
• grid – turns on/off grid lines.
103
104
Appendix C. MATLAB tutorial
Creating a plot
If y is a vector, plot(y) produces a linear graph of the elements of y versus the index of the
elements of y. If you specify two vectors as arguments, plot(x,y) produces a graph of y
versus x.
Line styles, markers, and color
You can pass a character string as an argument to the plot function in order to specify various
line styles, plot symbols, and colors. In the statement
plot(x,y,s)
s is a 1-, 2-, or 3-character string (delineated by single quotes) constructed from the characters
in the following table:
Symbol
y
m
c
r
g
b
w
k
Color
yellow
magenta
cyan
red
green
blue
white
black
Symbol
.
o
x
+
*
:
-.
--
Linestyle
point
circle
x-mark
plus
star
solid
dotted
dashdot
dashed
For example, plot(x,y,’c+’) plots a cyan plus symbol at each data point.
If you do not specify a color, the plot function automatically uses the colors in the above table.
For one line, the default is yellow because this is the most visible color on a black background.
For multiple lines, the plot function cycles through the first six colors in the table.
Adding lines to an existing graph
You can add lines to an existing graph using the hold command. When you set hold to on,
MATLAB does not remove the existing lines; instead it adds the new lines to the current axes. It
may, however, rescale the axes if the new data fall outside the range of the previous data. For
example:
plot(f1)
hold on
plot(f2,’--’)
plot(f3,’-.’)
hold off
These statements produce a graph displaying three plots.
Appendix C. MATLAB tutorial
105
Creating hardcopy of MATLAB figures
You can make a hardcopy of a figure from the figure’s menu (File|Print...) or by pressing
Ctrl+P. Output to several graphics formats can be carried out as well (File|Export...).
Alternatively, MATLAB’s print command can be used at the MATLAB command prompt. E.g.
you can generate PostScript output of the contents the current MATLAB figure window. The
print command sends the output directly to your default printer or writes it to the specified
file, if you supply a filename. You can also specify the type of PostScript file. Supported types
include
• PostScript (-dps)
• Color PostScript (-dpsc)
• Encapsulated PostScript (-deps)
• Encapsulated color PostScript (-depsc)
For example, the statement
print dataplot -deps
saves the contents of the current figure window as Encapsulated PostScript in the file called
dataplot.eps. Depending on your MATLAB installation other graphics formats are supported, try help print.
C.2 Quitting and saving the workspace
To quit MATLAB, type quit or exit. Terminating a MATLAB session deletes the variables in
the workspace. Before quitting, you can save the workspace for later use by typing
save
This command saves all variables in a file on disk named matlab.mat. The next time MATLAB is invoked, you can execute load to restore the workspace from matlab.mat.
You can use save and load with other filenames, or to save only selected variables. The command save temp stores the current variables in the file named temp.mat. The command
save temp X
saves only variable X, while
save temp X,Y,Z
saves X, Y, and Z.
load temp retrieves all the variables from the file named temp.mat.
106
Appendix C. MATLAB tutorial
References
[1] Jonker, J. B., Dynamics of Machines and Mechanisms, A Finite Element Approach,
Lecture notes, Department of Mechanical Engineering, University of Twente, vakcode
113130, October 2001.
[2] The Math Works Inc., Getting Started with MATLAB, version 7, Revised for MATLAB 7.1
(Release 14SP3), September 2005.
[3] The Math Works Inc., SIMULINK — Getting Started, version 6, New for SIMULINK 6.3
(Release 14SP3), September 2005.
[4] SAM, Version 4.2, 5.0 or 5.1, ARTAS - Engineering Software, The Netherlands,
http://www.artas.nl/, 2001–2005.
[5] Cowper, G. R., “The shear coefficient in Timoshenko’s beam theory”, ASME Journal of
Applied Mechanics 33 (1966), pp. 335–340.
107
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertisement