PDF file - Institut für Technische und Numerische Mechanik
PDF file - Institut für Technische und Numerische Mechanik
PDF file - Institut für Technische und Numerische Mechanik
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Neweul-M 2<br />
Symbolic multibody simulation<br />
in Matlab<br />
Wiki of the ITM, University of Stuttgart<br />
Dipl.-Ing. T. Kurz<br />
University of Stuttgart<br />
<strong>Institut</strong>e of Engineering and Computational Mechanics<br />
Prof. Dr.–Ing. Prof. E.h. P. Eberhard<br />
11. November 2011
Introduction<br />
This document is an export of the documentation to the multibody system simulation<br />
environment Neweul-M 2 . The program is a research software developed at<br />
the <strong>Institut</strong>e of Engineering and Computational Mechanics, University of Stuttgart.<br />
The main source of documentation is kept in a Wiki, which allows all users<br />
at the institute to add information or edit existing articles. To make this documentation<br />
available for users not connected to the ITM computer network, all<br />
pages have been exported and collected in this <strong>file</strong>.<br />
For further information about the program you can contact the institute:<br />
<strong>Institut</strong>e for Engineering and Computational Mechanics<br />
Prof. Dr.-Ing. Prof. E.h. P. Eberhard<br />
Pfaffenwaldring 9<br />
70569 Stuttgart<br />
Germany<br />
Tel +49 711 685-66388<br />
Fax +49 711 685-66400<br />
http://www.itm.uni-stuttgart.de/<br />
Or the current supervisor of this software program<br />
Dipl.-Ing. Thomas Kurz<br />
+49 711 / 685 66394<br />
kurz@itm.uni-stuttgart.de<br />
2
Contents<br />
This document has the same structure as our Wiki.<br />
General information Information on how the program can be started, overview<br />
over the <strong>file</strong>s, ...<br />
Getting started A short introduction, where three simple examples are explained<br />
step by step.<br />
List of <strong>file</strong>s An alphabetical list of all <strong>file</strong>s in the main folder.<br />
System definition Commands necessary for the definition of the system.<br />
Equations of motion Function calls to set up the equations of motion.<br />
Simulation and animation Available functions to be applied to the equatios<br />
of motion. This includes possibilities for the simulation and analysis of the<br />
system, as well as optimization. Displaying the results in a convenient way<br />
also belongs to this part.<br />
Exporting the system If you want to use your equations for a specific purpose<br />
outside of Neweul-M 2 , this might be an interesting part for you.<br />
Programming tips Some programming tips on how to achieve a well structured,<br />
readable program code.<br />
FAQs Very short collection of frequently asked questions.<br />
Release notes Short overview of the major changes.<br />
3
Neweulm2 - IT M Wiki<br />
Neweulm2<br />
From ITM Wiki<br />
Contents<br />
1 Simulation of Multibody Systems using Neweul-M²<br />
2 Getting started<br />
2.1 Getting Started: Step-by-Step<br />
2.1.1 Getting Started in German<br />
2.1.2 Graphical Getting started<br />
2.2 Cheat sheet<br />
3 General information<br />
3.1 Compatible Matlab versions<br />
4 Symbolic - Numeric - What?<br />
5 Using Neweul-M² at the ITM<br />
5.1 Ways to use Neweul-M²<br />
5.2 Server version<br />
5.3 Local version<br />
5.4 Starting Matlab<br />
6 Neweul-M² - neweulm2 - SYMBS - NEWEUL<br />
7 Release notes<br />
8 Available Models<br />
9 Structure of the Software<br />
9.1 Graphical User Interface<br />
10 Help<br />
11 Function reference<br />
11.1 Structure of the documentation<br />
11.1.1 Contents of this wiki<br />
11.1.2 Contents of the function help header<br />
11.2 Overview over the wiki documentation<br />
12 Notes for programers<br />
13 See also<br />
13.1 ITM Wiki<br />
13.1.1 Explanation of the functions<br />
13.1.2 Other topics<br />
13.2 ITM Server<br />
13.3 Literature<br />
1 von 16 30.08.2011 17:24
Neweulm2 - IT M Wiki<br />
Simulation of Multibody Systems using Neweul-M²<br />
When analyzing, simulating and optimizing multibody systems, it is often<br />
advantegeous to have the equations of motion in symbolic form. While for small<br />
systems, the derivation of the equations of motion can be done easily by hand, it<br />
can get very hard to do so for more sophisticated systems with several degrees<br />
of freedom. Therefore, the software Neweul-M² is developed at the <strong>Institut</strong>e of<br />
Engineering and Computational Mechanics. It is based on Matlab's Symbolic<br />
Toolbox which allows symbolic algebraic computations within Matlab.<br />
Neweul-M² is able to derive the symbolic equations of motion of tree-structured<br />
holonomic multibody systems automatically, and further, a symbolic<br />
linearization of the equations of motion with respect to an arbitrary symbolic<br />
reference motion is provided, which can be helpful for the analysis and<br />
optimization of vibration problems. For the Matlab-based simulation of<br />
multibody systems, various functions for the numerical evaluation of the<br />
nonlinear and linearised equations of motions and kinematic properties are<br />
provided. In the subsequent sections, the structure and usage of the software is<br />
explained. Further, a small section about multibody system theory is included,<br />
mainly in order to explain the various naming conventions. A comprehensive<br />
explanation of multibody system theory can be fo<strong>und</strong> in the textbook W.<br />
Schiehlen, P. Eberhard: <strong>Technische</strong> Dynamik. Wiesbaden: Teubner, 2004., which<br />
is also listed in #Literature.<br />
Getting started<br />
Getting Started: Step-by-Step<br />
To provide an entry into Neweul-M² as easy as possible, there are several<br />
step-by-step examples, so no previous knowledge is necessary. We recommend to<br />
follow the given order, as the examples are sorted in the order of complexity and<br />
number of features used.<br />
General Preparations: These preparations are necessary, before you can<br />
start with any one of the examples.<br />
Single Pendulum: The most basic example of a single pendulum.<br />
Double Pendulum: Set up a double pendulum with the graphical user<br />
interface to see more options.<br />
Slider Crank: A slider-crank-mechanism is set up to demonstrate algebraic<br />
constraint equations.<br />
Elastic Double Pendulum: Elastic bodies are defined and used to set up this<br />
mechanical system.<br />
Getting Started in German<br />
2 von 16 30.08.2011 17:24
Neweulm2 - IT M Wiki<br />
Allgemeine Vorbereitungen: Vorbereitungen, die vor den Beispielen<br />
notwendig sind.<br />
Einfachpendel: Einfaches Einstiegsbeispiel<br />
Doppelpendel: Doppelpendel, an dem mehr Optionen gezeigt werden.<br />
Schubkurbeltrieb: Ein Schubkurbeltrieb, um algebraische<br />
Nebenbedingungen zu erklären.<br />
Elastisches Doppelpendel: Definition von elastischen Körpern <strong>und</strong><br />
Einbindung davon in ein Mehrkörpersystem.<br />
Graphical Getting started<br />
After the General Preparations mentioned above, you can also type<br />
gettingStarted<br />
to open a window, which gives you a list of available models in the current<br />
examples directory.<br />
When you click Start, the selected model will be set up and all simulations<br />
provided in the respective directory will run subsequently. The nice thing about<br />
this is that the commands called by the GUI are presented, and the contents of<br />
all <strong>file</strong>s to be adjusted to the individual problem are shown as they are evaluated.<br />
Like this you can follow this process, read it later or exit at any given step.<br />
3 von 16 30.08.2011 17:24
Neweulm2 - IT M Wiki<br />
Cheat sheet<br />
If you already know something about the possibilities of Neweul-M² and just<br />
need a very short summary of the main commands and there option, you may<br />
want to look at our cheat sheet (http://www.itm.uni-stuttgart.de/itmwiki/wikidata<br />
/cheatSheet.pdf) .<br />
General information<br />
Compatible Matlab versions<br />
The software is currently being developed <strong>und</strong>er Matlab R2007b and R2010b.<br />
The software has been tested <strong>und</strong>er matlabR2006a, but there is one important<br />
issue. When using Neweul-M² outside of the institute, the <strong>file</strong>s have been<br />
precompiled and are thus unreadable. This precompilation is not<br />
down-compatible. So when you want to use e.g. Matlab version R2006a, please<br />
ask your contact person at the ITM for a suitable version of the software.<br />
If you are using a Matlab of Version R2007b+ and newer, the Symbolic Math<br />
Toolbox is no longer using a Maple kernel. Instead MuPad is used for symbolic<br />
calculations. For such commands, wrapper functions have been introduced,<br />
called mapleSimplify and mapleSubs. Usually it is faster and provides more<br />
options when Maple is called directly instead of using the built-in Matlab<br />
functions. In a recent update, these wrapper functions should be able to<br />
determine the symbolic engine and use the correct commands. Before this it<br />
was necessary to adjust both of these wrapper functions to use the appropriate<br />
code. It is not so easy to determine, which way of calling is faster, because the<br />
speed depends strongly on the size and type of expressions. Therefore the user<br />
could try to use one of the other provided algorithms for special cases. These<br />
functions should be excluded from the precompilation and you can therefore<br />
read and adjust them to your needs.<br />
MuPad reserved some parameter names like beta or I for internal functions.<br />
Please be careful when moving models from one symbolic engine to another. For<br />
more information see Restrictions for Names<br />
Symbolic - Numeric - What?<br />
Neweul-M² calculates the equations of motion symbolically. This means it uses<br />
names like m1 for the parameters and not numbers 5 [kg] to set up the<br />
equations. This has several advantages, allowing the user to read and <strong>und</strong>erstand<br />
the expressions and allowing an explicit formulation. Also you can change values<br />
without recalculating the equations of motion. As not everything can be done<br />
4 von 16 30.08.2011 17:24
Neweulm2 - IT M Wiki<br />
symbolically, the numbers come in at some point in the simulation. But always<br />
when you have two uses (symbolic and numeric) of the same things, there are<br />
some problems. To keep these as small as possible the complete data is stored in<br />
two ways simultaneously:<br />
the symbolic expressions are stored in the structure sys, available in the<br />
workspace.<br />
<strong>file</strong>s containing source code, which will evaluate numerical values.<br />
Even if you only want the <strong>file</strong>s to calculate numerical values, it might be good to<br />
save the system after modeling. When doing so in the menu of the GUI, it will<br />
save the figure and the data structure containing the symbolic expressions. The<br />
advantage is that you can load the data structure, change something and<br />
recreate the <strong>file</strong>s. If you forgot to save before closing or the program crashed,<br />
you can still hope for the autosave. Every few minutes, your system is saved<br />
automatically to examples/sandbox/autosave.mat. In this case you should make a<br />
copy of the autosave <strong>file</strong>s, otherwise they might be overwritten, the next time<br />
you do anything in Neweul-M².<br />
Using Neweul-M² at the ITM<br />
The following part is dedicated to using the software package at the ITM,<br />
University of Stuttgart. Probably they are of no importance when using the<br />
software somewhere else, but these explanations are available internally as a<br />
wiki and externally as a pdf export of the very same text.<br />
Ways to use Neweul-M²<br />
There are two versions available, one running on the server and stored locally.<br />
Who should use which version?<br />
With both versions, you can model a system, run simulations and analysis. Please<br />
answer the following questions:<br />
Do I want to write a new feature?<br />
Do I want to improve the current program?<br />
Do I want to work on a computer without connection to the ITM-Network?<br />
If you answered at least one question with 'yes', then please get a local version<br />
with SVN. Otherwise please use the server-version.<br />
Do NOT copy the <strong>file</strong>s manually to get a local version!!!<br />
This will cause you to miss all updates from this day on. And if you changed<br />
something it is a hell of a job to insert these changes in the current version.<br />
5 von 16 30.08.2011 17:24
Neweulm2 - IT M Wiki<br />
Server version<br />
For most users located at the ITM, the best way to call Neweul-M² is to use the<br />
server version. If you already have a model or just don't need the examples all<br />
you have to do is type<br />
addpathNeweulm2<br />
This is a <strong>file</strong> available in your search path, which will make sure all necessary<br />
<strong>file</strong>s are available. This basically is an abbreviation of the command<br />
addpath(genpath('/home/itm/itmsw/neweulm2/currentVersion/neweulm2/'));<br />
This makes all functions available for you. If you don't want to have to remember<br />
this, you can add this line to the <strong>file</strong> ~/matlab/startup.m which executes at<br />
each start of Matlab.<br />
If you are using the Matlab command restoredefaultpath, you will need to<br />
specify the path again explicitly.<br />
When using the server version you can store the model folders with your input or<br />
simulation data and all the routines can stay on the server. Like this you will not<br />
be able to change anything at the code, but can edit and create models in your<br />
local folder. You can find this version at /home/itm/itmsw/neweulm2<br />
/currentVersion/ (Before renaming /home/itm/itmsw/symbs/symbsServer/). This<br />
folder contains a complete set of all <strong>file</strong>s. The best way to start is to copy the<br />
examples folder to your account or a scratch partition on your PC. Then you can<br />
have a look at prepared examples and adjust them to your needs. You can do this<br />
by opening a shell, changing to the desired folder in your account and enter the<br />
following command:<br />
cp -r /home/itm/itmsw/neweulm2/currentVersion/examples/ .<br />
By this you will get a few examples, both for input <strong>file</strong>s and for the graphic user<br />
interface (GUI). In the folder sandbox/ you will find a <strong>file</strong> called Readme.txt<br />
giving you an explanation on how to get started. To start the GUI, please call the<br />
<strong>file</strong> link_neweulm2.m in Matlab, which you find in the sandbox/ folder.<br />
Local version<br />
If you want to change the routines of Neweul-M² or extend the functionality, e.g.<br />
for your research paper, you need a local copy. For this please follow the<br />
following steps:<br />
1.) Please contact your system administrator in order to get the necessary<br />
6 von 16 30.08.2011 17:24
Neweulm2 - IT M Wiki<br />
permissions.<br />
2.) Open a shell (also called Console) and change to the folder, where you want<br />
Neweul-M² in and type the following command. This will create a new folder<br />
called "neweulm2_local" containing all <strong>file</strong>s. Then you are ready to go. In this<br />
newly created folder you will find a <strong>file</strong> called "Readme.txt" containing<br />
information on how to start Neweul-M² from Matlab.<br />
git clone itmgit@itmserver1.itm.uni-stuttgart.de:neweulm2.git<br />
If you are asked for a password of itmgit, probably something went wrong with<br />
step one.<br />
At the beginning of each modeling with commands it has to be ensured that the<br />
routines of Neweul-M² are available by adding the necessary path. If you<br />
received a copy of Neweul-M² and did not change too much in the directory<br />
structure, you can also use the <strong>file</strong><br />
addpathNeweulm2<br />
This is usually located at examples/addpathNeweulm2 and should cover most<br />
cases of where your neweulm2/ directory is located. Otherwise, please type help<br />
addpathNeweulm2 for information on how to specify the path manually.<br />
An explanation on how to use GIT can be fo<strong>und</strong> here: Git - Distributed Version<br />
Control. To use a GIT-command, open a shell and change to the directory, where<br />
your local copy is located. The most important command, which should be called<br />
from time to time is<br />
git pull<br />
which will update your local copy with the <strong>file</strong>s from the server. If you changed<br />
some <strong>file</strong>s, which were changed on the server as well, GIT will tell you that and<br />
ask you to resolve these conflicts.<br />
If you programmed some new functions or made other improvements you want<br />
to share with the other users please contact Thomas Kurz.<br />
Starting Matlab<br />
Neweul-M² is running <strong>und</strong>er Matlab. At the institute there are several versions of<br />
Matlab available, which can be seen, when opening a Command Shell, typing<br />
'matlab' and hitting the [Tab] Key twice. The program should run without<br />
problems in all versions starting with 'matlabR20', while there are some known<br />
problems in lower versions up to '7.2'. If unsure which version to use, just call<br />
7 von 16 30.08.2011 17:24
Neweulm2 - IT M Wiki<br />
matlab which usually opens the newest version.<br />
Neweul-M² - neweulm2 - SYMBS -<br />
NEWEUL<br />
The multibody program described here, started <strong>und</strong>er the name SYMBS. After<br />
it appeared to be quite promissing it has been renamed to Neweul-M². This<br />
name is meant to <strong>und</strong>erline that this program is successor of the FORTRAN<br />
Code called NEWEUL. Because of this, some misleading names may occur. The<br />
M² is a tribute to its two used math programs MATLAB and Maple. As the<br />
name Neweul-M² contains non-standard characters its function call is<br />
neweulm2, which is also used for the wiki pages here.<br />
For HTML pages: The sign ² has the ASCII-Code &# 178; without the space.<br />
For LaTeX documents: it is most convenient to add this line to the Master<br />
document<br />
\newcommand{\neweulm}{\mbox{Neweul-M$^2$}}<br />
Then the correct name is achieved by typing \neweulm{} in the document,<br />
where the brackets {} are necessary to ensure the correct spacing.<br />
Release notes<br />
Some information on important new features can be fo<strong>und</strong> here: neweulm2 -<br />
Release notes<br />
At each version you will find a <strong>file</strong>, which is called VersionLog<strong>file</strong>.txt or<br />
previously symbs_CVS_Log<strong>file</strong>.txt, which contains a more detailed decription of<br />
the changes.<br />
Available Models<br />
To get started with the program there are some easy models available:<br />
Double Pendulum (directory: double_pendulum)<br />
Slider Crank (directory: slider_crank)<br />
Elastic Pendulum (directory: elasticPendulum)<br />
Half-car model (directory: car_half)<br />
An inverse modeled slider crank (directory: slider_crank_inverse)<br />
8 von 16 30.08.2011 17:24
Neweulm2 - IT M Wiki<br />
An example to demonstrate different force elements (directory:<br />
testForceElements)<br />
The first three models are very good to get to know the software. You can<br />
observe which <strong>file</strong>s are in use, how to define different modeling elements, how<br />
to set up equations and how to start simulations. The other three models have a<br />
slightly different aim and are not as clearly documented as the first three. The<br />
half-car is a fairly realistic model especially containing state dependent<br />
parameters to model nonlinear springs. The inverse modeled slider crank has<br />
the main goal to investigate different modeling techniques for systems with<br />
constraint equations on a model with distinct singular configurations. The last<br />
model-directory offers different models to investigate the behavior of force<br />
elements. All of these models are also used for automated testing, which should<br />
help to detect errors in the software.<br />
When during a student research paper or some other non-confidential project a<br />
model is created it will be put in the following folder<br />
/home/itm/itmsw/neweulm2/models/<br />
The goal of this is to make more complex models available for the rest of the<br />
users. Also this is meant as a kind of knowledge base, e.g. if you want to know<br />
how to use flexible bodies, gradients or some other feature, you find some<br />
examples there.<br />
To upload a model into this folder, you should make sure that it is running<br />
<strong>und</strong>er the current version. There is no guarantee that they are up to date, so<br />
some adjustments may be necessary before they run properly. Please insert a<br />
README.txt in each model folder with a short description of the model, which<br />
also contains the name of the printed research paper. Depending on the size and<br />
mode of creation this folder should contain:<br />
sysDef.m<br />
setUserVar.m (if numeric values were not set in sysDef.m)<br />
defineGraphics.m<br />
The folder userFunctions/ with all necessary functions for time- and statedependent<br />
parameters.<br />
Any <strong>file</strong> to run a simulation tested by you, e.g. runTimeInt.m<br />
Optionally a .mat and .fig <strong>file</strong> of the saved system. Please check the size of<br />
it before copying it there and maybe remove all results from the structure.<br />
It should not contain<br />
Badly commented <strong>file</strong>s<br />
Files which produce errors even <strong>und</strong>er the then current version.<br />
9 von 16 30.08.2011 17:24
Neweulm2 - IT M Wiki<br />
Analysis results<br />
Structure of the Software<br />
The software consists of two main parts, one for the definition of the system and<br />
the derivation of the equations of motion, the other one provides functions for<br />
the numerical analysis, simulation and optimization of multibody systems. All<br />
<strong>file</strong>s building the software are stored in a directory called neweulm2, the modelspecific<br />
data is stored to a separate model directory. It contains all <strong>file</strong>s being<br />
necessary for the system's definition and performing simulations. The user is<br />
welcome to edit these <strong>file</strong>s to his needs. In detail, these are<br />
File / Directory<br />
Contents of each model folder<br />
Directory containing functions for numerical evaluation<br />
of the equations of motion and kinematic values. The<br />
sysFunctions/<br />
contents of this folder are written and removed<br />
automatically as necessary.<br />
Directory containing functions for numerical evaluation<br />
of userdefined variables. The <strong>file</strong>s in this folder are<br />
userFunctions/ created automatically and adjusted if necessary.<br />
However, they are not deleted and the user is asked to<br />
adjust those <strong>file</strong>s to his needs.<br />
Definition of graphical representation of bodies, see<br />
defineGraphics.m<br />
Neweulm2_-_Simulation_and_Animation#Animation<br />
Script for initializing parameter optimizations, see<br />
initOpt.m<br />
Neweulm2 - Simulation and Animation<br />
Reference solution used for automated testing, of no<br />
referenceSolution.mat<br />
interest to common user and not necessary<br />
Script to run a kinematic analysis, where you prescribe<br />
a function for all independent generalized coordinates,<br />
runKian.m<br />
see Neweulm2_-<br />
_Simulation_and_Animation#kinematicAnalysis<br />
Script to perform a modal analysis of the linearized<br />
system, if available the symbolic linearization is used,<br />
runModalAnalysis.m<br />
otherwise a numerical linearization is attempted, see<br />
Neweulm2_-_Simulation_and_Animation#modalAnalysis<br />
Script to set options and run a time integration, see<br />
runTimeInt.m<br />
Neweulm2_-_Simulation_and_Animation#timeInt<br />
setUserVar.m<br />
(optional)<br />
Definition of values of constant user-defined variables,<br />
can be done in sysDef.m instead<br />
10 von 16 30.08.2011 17:24
Neweulm2 - IT M Wiki<br />
startSysDef.m<br />
sys.fig (optional)<br />
sys.mat (optional)<br />
sysDef.m<br />
Script for system definition, derivation of equations of<br />
motion and initialization of the animation window.<br />
This is the <strong>file</strong> to start with as a new user<br />
Graphical representation of system for animation<br />
Stored system data structure<br />
Complete system definition, see Neweulm2 - System<br />
Definition<br />
Before running simulations, the system has to be defined and the equations of<br />
motion have to be derived. All necessary steps for this are summarized in the<br />
script startSysDef. In older versions, these tasks had been split up in two <strong>file</strong>s.<br />
But the functionality of the <strong>file</strong> initSys.m has been included in startSysDef.m. In<br />
detail, these are<br />
Call<br />
Action<br />
addpathNeweulm2 Initialization of software environment<br />
Definition of multibody system, see neweulm2_-<br />
sysDef<br />
_System_Definition<br />
Derivation of nonlinear equations of motion, see<br />
calcEqMotNonLin<br />
calcEqMotNonLin<br />
Calculation of reaction forces, optional, see<br />
calcForcesReaction Neweulm2_-<br />
_Equations_of_Motion#calcForcesReaction<br />
Generation of matlab-functions for numerical<br />
writeMbsNonLin evaluation of nonlinear equations of motion (stored in<br />
sysFunctions/), see writeMbsNonLin<br />
Linearisation of equations of motion, optional, see<br />
calcEqMotLin<br />
calcEqMotLin<br />
Generation of matlab-functions for numerical<br />
writeMbsLin<br />
evaluation of linearised equations of motion, optional,<br />
see writeMbsLin<br />
Assignment of numerical values to constant<br />
setUserVar<br />
parameters, if not done directly in sysDef.m<br />
createAnimationWindow Initialize or recreate the animation window<br />
Specify graphic representations for modeling<br />
defineGraphics<br />
elements like bodies or force elements<br />
Storing model data structure in sys.mat<br />
11 von 16 30.08.2011 17:24
Neweulm2 - IT M Wiki<br />
After these steps the system will be fully defined and ready for simulations.<br />
Neweul-M² offers many possibilities to perform simulations and analysis of the<br />
system, see neweulm2 - Simulation and Animation.<br />
Graphical User Interface<br />
A graphic user interface (GUI) can be fo<strong>und</strong> in neweulm2/gui/ and has been<br />
created with the Matlab GUI layout editor guide. It is created not independently<br />
but as a front-end to the existing version, which is controlled by input <strong>file</strong>s.<br />
Therefore, it calls the same functions for the actual modeling and simulation.<br />
There are different ways to start it. If you've just started Matlab the best is to<br />
move to the folder examples/sandbox/ and run the <strong>file</strong> link_neweulm2.m.<br />
This will then set up the Matlab path so the <strong>file</strong> neweulm2.m and<br />
startneweulm2.m in the folder neweulm2/gui/ are fo<strong>und</strong>. There is a small<br />
difference between these two <strong>file</strong>s.<br />
When you call startneweulm2.m, the workspace is cleared, figures are closed<br />
and the gui is started. This means you are ready to go, but your workspace is<br />
empty. When running link_neweulm2.m also this startneweulm2 is called. If<br />
still this is not convenient for you, you can call the function<br />
writeneweulm2link.m after starting the GUI. This will create a <strong>file</strong> also called<br />
link_neweulm2.m, but this time with the absolute path stored inside, therefore<br />
making it possible to start the GUI from any given folder. Many of the input <strong>file</strong>s<br />
can be created from the GUI <strong>und</strong>er the menu entry Export System to ensure<br />
compatibility in both ways.<br />
When you call neweulm2 directly the workspace as well as all figures are kept<br />
and only the GUI is started. Therefore, this presents the easiest way to switch<br />
from input <strong>file</strong>s to the GUI. You simply run the input <strong>file</strong>s, type neweulm2 and<br />
then you can work on the current model. Also, you can type Neweul-M²<br />
commands or close the GUI at any time and continue working solely with<br />
commands. With the only exception that, if you select Exit from the File menu,<br />
then the workspace will be cleared. In order to keep the model you should select<br />
Close Menu or click on the little cross in the upper right corner.<br />
Another way of switching the way to control Neweul-M² is to save your model as<br />
a .mat <strong>file</strong> and load it in the other mode. Sometimes it happens that strange<br />
errors occur when some elements like bodies are deleted in the GUI. If that is<br />
the case, simply open Export System from the File menu and create the Input<br />
<strong>file</strong>s. This will create one <strong>file</strong> containing all definitions which can be used to<br />
easily rebuild your model from scratch.<br />
Help<br />
There are a few possibilities on how to get help on neweulm2, before asking<br />
12 von 16 30.08.2011 17:24
Neweulm2 - IT M Wiki<br />
someone, see #See also.<br />
ZB-149: This was the first documentation of Symbs and marks the first<br />
appearance.<br />
Readme.txt: In each version of Symbs contains a Readme.txt which<br />
explains the most important things.<br />
VersionLog<strong>file</strong>.txt or formerly symbs_CVS_Log<strong>file</strong>.txt: This is a log-<strong>file</strong> of<br />
all <strong>file</strong>s that changed during the evolution of Symbs/Neweul-M². If you're<br />
not sure which version you run, check this <strong>file</strong>.<br />
Online help in the GUI: In each window of the GUI you will find a button<br />
labeled [?] which will display a help if there is one available. These help<br />
messages are stored in the folder neweulm2/gui/Definition/ in a <strong>file</strong> called<br />
neweulm2HelpMsgs.m.<br />
This wiki: This is the most extensive ressource on Neweul-M². From time to<br />
time I export the contents of this wiki to a pdf-<strong>file</strong>, which can be fo<strong>und</strong><br />
<strong>und</strong>er<br />
/home/itm/itmsw/neweulm2/currentVersion/NeweulM2_Manual.pdf<br />
If you already know something about the possibilities of Neweul-M² and just<br />
need a very short summary of the main commands and the their options,<br />
you may want to look at our cheat sheet (http://www.itm.uni-stuttgart.de<br />
/itmwiki/wikidata/cheatSheet.pdf) .<br />
If you think there are some important things missing or could be explained<br />
better in any of the still updated help channels, please help! Edit the entries in<br />
this wiki, edit/change/create any help you think you can improve and send it to<br />
the current supervisor of Neweul-M²!<br />
There will be other users after you and probably they will encounter the<br />
same problems if you don't fix them!<br />
Function reference<br />
Structure of the documentation<br />
Experience showed that a wiki is a great vehicle to keep the documentation of a<br />
software project up to date. This bases on the fact that many people can update<br />
and extend it. Still every single <strong>file</strong>, function and subfunction is to receive a<br />
header containing information which can be accessed via Matlab's help<br />
command or the F1 key. It is not helpful for anyone to store documentation<br />
red<strong>und</strong>antly, because then usually one source will be out of date.<br />
13 von 16 30.08.2011 17:24
Neweulm2 - IT M Wiki<br />
Contents of this wiki<br />
A wiki provides an easy overview over available functions, the structure of the<br />
software and comments on how to start. This makes it the place e.g. for the<br />
step-by-step tutorials. In a wiki, pictures, formated text and formulae can be<br />
easily displayed, which is very useful, e.g. for the detailed explanation of applied<br />
forces. So the wiki shall provide the following contents:<br />
overview over the software and implemented features<br />
step-by-step introduction<br />
current changes and new features<br />
references to how the theory works or where you can get further<br />
information<br />
detailed explanations of topics too long or too complicated for the help<br />
section in a function<br />
Contents of the function help header<br />
As it is contained right inside the actual function, a short description of its<br />
purpose and functionality have to be contained. This is also the easiest location<br />
to keep information about in- and output arguments up to date. Therefore, these<br />
things together with all possible options are to be documented there. Each<br />
function's help message shall provide the following contents:<br />
Syntax of the function call<br />
what are available options and how to choose them<br />
what are the data types going in and coming out of the function<br />
standard values if you don't specify options<br />
contained subfunctions and links to related functions<br />
general information like the system data structure, <strong>file</strong> creation, ...<br />
Overview over the wiki documentation<br />
A more detailed description of the different functions can be fo<strong>und</strong> here:<br />
neweulm2 - System Definition<br />
neweulm2 - Equations of Motion<br />
neweulm2 - Simulation and Animation<br />
neweulm2 - Exporting<br />
Or a neweulm2 - List of <strong>file</strong>s is available to search in the other direction, by <strong>file</strong><br />
name.<br />
There is a list of Frequently Asked Questions neweulm2 - FAQ. However, they<br />
are not intended to get into the software but to help when you started<br />
14 von 16 30.08.2011 17:24
Neweulm2 - IT M Wiki<br />
successfully and are now facing some problems.<br />
Notes for programers<br />
If you want to contribute to Neweul-M², please feel free to do so. On the<br />
following page you can find a few hints on how you can make your program fit<br />
to all the rest. neweulm2 - Programming tips<br />
See also<br />
ITM Wiki<br />
Explanation of the functions<br />
Function reference: Search by topic<br />
neweulm2 - System Definition<br />
neweulm2 - Equations of Motion<br />
neweulm2 - Simulation and Animation<br />
neweulm2 - Exporting<br />
neweulm2 - List of <strong>file</strong>s: Search by <strong>file</strong>name<br />
Other topics<br />
Neweulm2 - Getting Started: Step by step explanations for simple examples.<br />
neweulm2 - FAQ: Frequently asked questions and some tips that just don't<br />
fit in other categories.<br />
Neweulm2 - Release notes: Short summary of every change.<br />
ITM Server<br />
<strong>PDF</strong> Export of these Wiki pages:<br />
/home/itm/itmsw/neweulm2/currentVersion/info/Neweulm2_Manual.pdf<br />
STUD-344: Untersuchungen zur Auslegung <strong>und</strong> Realisierung eines<br />
Parallelkinematik-Prüfstands, 2010.<br />
/home/itm/institut/studdipl/STUD/STUD_344_FelixGeibel/stud_344.pdf<br />
STUD-338: Erweiterung von Neweul-M² um die Berechnung von<br />
Reaktionskräften, 2010.<br />
/home/itm/institut/studdipl/STUD/STUD_338_BernhardFeistle/stud_338.pdf<br />
STUD-323: Programmvergleich für die Simulation elastischer<br />
15 von 16 30.08.2011 17:24
Neweulm2 - IT M Wiki<br />
Mehrkörpersysteme, 2010.<br />
/home/itm/institut/studdipl/STUD/STUD_323_BernhardZeumer/stud_323.pdf<br />
STUD-309: Kosimulation von Tankfahrzeugen mit Neweul-M² <strong>und</strong> Pasimodo,<br />
2009.<br />
/home/itm/institut/studdipl/STUD/STUD_309_FrankSandner/stud_309.pdf<br />
STUD-292: Implementierung flexibler Mehrkörpersysteme in<br />
MATLAB/SIMULINK auf Basis von Neweul-M², 2008.<br />
/home/itm/institut/studdipl/STUD/STUD_292_MarkusBurkhardt<br />
/stud_292.pdf<br />
DIPL-122: Entwicklung eines Optimierungsmoduls mit Sensitivitätsanalyse<br />
für die symbolische Mehrkörpersimulationsumgebung SYMBS, 2007.<br />
/home/itm/institut/studdipl/DIPL/DIPL_122_ThomasKurz/dipl_122.pdf<br />
STUD-263: Erstellung einer symbolischen<br />
Mehrkörpersimulationsumgebung in MATLAB mit graphischer<br />
Benutzeroberfläche <strong>und</strong> verschiedenen Schnittstellen, 2007.<br />
/home/itm/institut/studdipl/STUD/STUD_263_MarkusLutz/stud_263.pdf<br />
ZB-149: SYMBS eine Matlab-Umgebung zur Simulation von<br />
Mehrkörpersystemen, 2007.<br />
/home/itm/institut/studdipl/ZB/ZB_149_Henninger/symbs_doku.pdf<br />
Literature<br />
W. Schiehlen, P. Eberhard: <strong>Technische</strong> Dynamik. Wiesbaden: Teubner,<br />
2004.<br />
Retrieved from "http://www.itm.uni-stuttgart.de/itmwiki/index.php/Neweulm2"<br />
This page was last modified 11:15, 26 August 2011.<br />
16 von 16 30.08.2011 17:24
Neweulm2 - Getting Started Preparations - IT M Wiki<br />
Neweulm2 - Getting Started<br />
Preparations<br />
From ITM Wiki<br />
If you are using the server version at the ITM, please enter the following<br />
commands in the console:<br />
cp -r /home/itm/itmsw/neweulm2/currentVersion/examples/ $HOME/<br />
cd $HOME/examples/<br />
matlab &<br />
This will copy the examples folder from the server to your home directory,<br />
change to this folder and start matlab. If you are using Neweul-M² outside of the<br />
ITM or a local version, please start matlab and move to the directory where your<br />
copy of the software is stored and go into the directory called examples. From<br />
now on, all commands should be entered directly in the Matlab command<br />
window.<br />
An initialization of the search path is necessary by typing:<br />
addpathNeweulm2<br />
This command usually finds all necessary <strong>file</strong>s by itself. You will only get a<br />
response if there has been any problem. When setting up a model and<br />
performing some simulations, the software has to store some <strong>file</strong>s. Therefore it<br />
is very convenient to create separate folders for each model you want to keep. If<br />
you only want to try some things, e.g. like the getting started examples, you<br />
could use the sandbox folder instead. So if you want to continue with the<br />
Getting-Started, we recommend to change to the sandbox folder.<br />
cd sandbox<br />
The next time you want to use Neweul-M², you just have to change to the correct<br />
folder (e.g. cd $HOME/examples/sandbox) again and start Matlab by yourself<br />
and call addpathNeweulm2.<br />
Here is a link to a list of all Getting Started Examples.<br />
Retrieved from "http://www.itm.uni-stuttgart.de/itmwiki/index.php/Neweulm2_-<br />
_Getting_Started_Preparations"<br />
1 von 2 01.09.2011 15:24
Neweulm2 - Getting Started Preparations - IT M Wiki<br />
This page was last modified 10:57, 18 August 2011.<br />
2 von 2 01.09.2011 15:24
Neweulm2 - Getting Started SinglePendulum - IT M Wiki<br />
Neweulm2 - Getting Started<br />
SinglePendulum<br />
From ITM Wiki<br />
Contents<br />
1 Single pendulum<br />
1.1 System definition<br />
1.2 Setting up the equations of motion<br />
1.3 Time integration<br />
1.4 Display and interpretation of results<br />
1.5 Additional information and help<br />
1.6 Commands learned in this example<br />
1.7 Links<br />
Single pendulum<br />
Please make sure that you performed the General Preparations before starting<br />
with this example.<br />
In the first example we will show you how to use the Matlab command window to<br />
generate a pendulum model with a minimum number of parameters in<br />
Neweul-M². The commands can be typed directly within the command window of<br />
matlab so that we can get the desired results.<br />
System definition<br />
With the command 'newSys' you define a new multibody system.<br />
newSys<br />
The system, which shall be set up is shown in the following sketch<br />
1 von 7 01.09.2011 15:25
Neweulm2 - Getting Started SinglePendulum - IT M Wiki<br />
Figure 1 Sketch Single Pendulum<br />
The following command 'newUserVarKonst' defines constants used in the<br />
system such as the length of the pendulum 'L' and the mass of the pendulum<br />
body 'm1'. These constants get numerical values assigned at this point, 0.5 for<br />
'L' and 0.6 for 'm1', even though these numerical values will be used in later<br />
steps. The symbolic parameters can be accessed in the equations of motion.<br />
newUserVarKonst('L',0.5,'m1',0.6)<br />
As the software cannot associate the variable names to a physical meaning like a<br />
length or mass, the numbers are without units. Therefore the user should decide<br />
on a set of units, e.g. SI-Units like m, kg, s, which then should be used<br />
consistently to avoid problems. To create a new generalized coordinate we use<br />
the command 'newGenCoord'. In this example this would be the pendulum<br />
angle 'alp'.<br />
newGenCoord('alp')<br />
After these preparatory steps the system can be specified. This starts by<br />
defining a body, which can be adjusted by many parameters. In this example, we<br />
only need three parameters for this body:<br />
2 von 7 01.09.2011 15:25
Neweulm2 - Getting Started SinglePendulum - IT M Wiki<br />
1.<br />
2.<br />
3.<br />
the rotation aro<strong>und</strong> the y-axis relative to the inertial reference frame with<br />
the generalized coordinate 'alp': 'RelRot','[0;alp;0]'<br />
the relative position of the center of gravity: 'CgPos','[0;0;-L]'<br />
the mass of the body: 'Mass','m1'.<br />
newBody('RelRot','[0;alp;0]', 'CgPos','[0;0;-L]','Mass','m1')<br />
Setting up the equations of motion<br />
Now, as the single pendulum has already been defined completely, we can<br />
generate the nonlinear equations of motion using the command<br />
'calcEqMotNonLin'. The data is then stored in the global structure 'sys' and<br />
can be accessed there.<br />
calcEqMotNonLin<br />
To write <strong>file</strong>s for the numerical evaluation of these nonlinear equations of<br />
motion, the function 'writeMbsNonLin' is called.<br />
writeMbsNonLin<br />
To perform the simulation, numerical values are necessary. To show how this<br />
can be done at the current state, we change the pendulum length 'L' to 0.8 by<br />
the command<br />
sys.userVar.data.L = 0.8;<br />
The last command was only used to demonstrate how to change a parameter<br />
value. Of course, the value could be set correctly right at the definition of the<br />
variable.<br />
Time integration<br />
Now we can perform the time integration. Therefore the initial condition 'y0 =<br />
0.5' has to be set. Now we can start the time integration with the command<br />
'timeInt(y0)'. All optional parameters are kept to their default values.<br />
y0 = 0.5;<br />
result1 = timeInt(y0)<br />
The results are stored in the data structure 'result1'. We can then start another<br />
time integration with other initial conditions such as 'y0_2 = 3.05'. The new<br />
3 von 7 01.09.2011 15:25
Neweulm2 - Getting Started SinglePendulum - IT M Wiki<br />
results are saved in the data structure 'result2'.<br />
y0_2 = 3.05;<br />
result2 = timeInt(y0_2)<br />
Display and interpretation of results<br />
The results can be displayed using the following command:<br />
plot(result1.x,result1.y(1,:),'b',result2.x,result2.y(1,:),'r')<br />
Fig. 1 time diagram pendulum angle<br />
We can see in the spartan illustration above (Fig. 1) the system states with two<br />
different lines, which correspond to the two different initial conditions.<br />
We can see different frequencies and realize an increasing nonlinearity for large<br />
values of the initial angle of the pendulum.<br />
Additional information and help<br />
Neweul-M² offers several other possibilities and options. For example we can call<br />
the help function related to 'newSys' using the command 'help newSys'. Then<br />
information about this function and possible parameters is displayed.<br />
4 von 7 01.09.2011 15:25
Neweulm2 - Getting Started SinglePendulum - IT M Wiki<br />
help newSys<br />
By typing the command 'sys.eqm.qa' we can display the elements of the applied<br />
forces. This is a cell array, referenced by curly braces {}, which contains one<br />
vector for each body. In our case, we have only one entry, which consists of the<br />
three elements for the translation and three elements for the rotation, resulting<br />
in a 6x1 vector.<br />
sys.eqm.qa{1}<br />
If we were to start a time integration without specifying where to store the<br />
results<br />
timeInt(y0)<br />
They are stored at the default location sys.results.timeInt. This is very useful, as<br />
we could plot the generalized coordinate by typing<br />
plotStandardResults<br />
The advantage of this is that we don't have to worry about storage location or<br />
dimensions, as this is done automatically. If you stored the results at the default<br />
location, and you want to see an animation, you only need to type<br />
createAnimationWindow<br />
which will create an animation window and start the animation with the<br />
command<br />
animTimeInt<br />
In order to store this model, you only need to save the system data structure<br />
save pendulum.mat sys<br />
You can easily load the model, e.g. after a restart, by typing<br />
load pendulum.mat<br />
We are now at the end of the first demonstrative example. The following system<br />
5 von 7 01.09.2011 15:25
Neweulm2 - Getting Started SinglePendulum - IT M Wiki<br />
will be more complicated and we will use the graphical user interface (GUI). The<br />
purpose of the first example was to introduce you to how to use the command<br />
window to build and simulate a simple model.<br />
Commands learned in this example<br />
The following commands were used and shortly explained in this example:<br />
Command Type Purpose<br />
addpathNeweulm2 Neweul-M² Adjust the search path of Matlab<br />
animTimeInt<br />
Neweul-M² Animate a result<br />
calcEqMotNonLin<br />
Set up symbolic nonlinear equations of<br />
Neweul-M²<br />
motion<br />
createAnimationWindow Neweul-M² Create a new animation window<br />
newBody<br />
Neweul-M² Define rigid or elastic body<br />
newGenCoord<br />
Neweul-M² Define generalized coordinate<br />
newSys<br />
Define a new multibody system, clears the<br />
Neweul-M²<br />
data structure sys<br />
newUserVarKonst Neweul-M² Define a constant symbolic parameter<br />
plotStandardResults<br />
Provide plots of interesting curves from<br />
Neweul-M²<br />
results<br />
timeInt<br />
Perform numerical time integration of the<br />
Neweul-M²<br />
system<br />
writeMbsNonLin<br />
Write <strong>file</strong>s of the nonlinear equations of<br />
Neweul-M²<br />
motion for numerical evaluation<br />
help Matlab Show help information<br />
load Matlab Load data from a .mat <strong>file</strong><br />
plot Matlab Manually plot given data<br />
save Matlab Save variables to a .mat <strong>file</strong><br />
Links<br />
Restart this example<br />
Next example: Double Pendulum<br />
Back to the Neweul-M² Page<br />
List of all examples.<br />
Retrieved from "http://www.itm.uni-stuttgart.de/itmwiki/index.php/Neweulm2_-<br />
_Getting_Started_SinglePendulum"<br />
6 von 7 01.09.2011 15:25
Neweulm2 - Getting Started SinglePendulum - IT M Wiki<br />
This page was last modified 11:33, 31 August 2011.<br />
7 von 7 01.09.2011 15:25
Neweulm2 - Getting Started DoublePendulum - IT M Wiki<br />
Neweulm2 - Getting Started<br />
DoublePendulum<br />
From ITM Wiki<br />
Contents<br />
1 Double pendulum<br />
1.1 System definition (GUI)<br />
1.2 Setting up the equations of motion (GUI)<br />
1.3 Time integration and plot of states<br />
1.4 Graphic objects for the animation<br />
1.5 Linearization of the equations of motion<br />
1.6 Saving<br />
1.7 Commands learned in this example<br />
1.8 Links<br />
Double pendulum<br />
In this second example we will build a more complicated model of a double pendulum. The<br />
graphical user interface (GUI) of Neweul-M² will be used. If you skipped the first example,<br />
you might want to have a look at the Preparation section first. This mainly consists of moving<br />
to a suitable folder and setting the path variable as explained above. The path is usually set<br />
by calling<br />
addpathNeweulm2<br />
To discard all existing data and close all figures, type<br />
clear all<br />
close all<br />
To start the GUI we have to type the command<br />
neweulm2<br />
System definition (GUI)<br />
To build a new system, please click in the menu 'File' on 'New System', see Fig. 1. A new<br />
window will be displayed, where we can input several options such as the name of the<br />
system, its identification and the gravity vector. A new data structure will be generated to<br />
store the model variables.<br />
1 von 15 01.09.2011 15:25
Neweulm2 - Getting Started DoublePendulum - IT M Wiki<br />
Fig. 1 Modeling a new system with Neweul-M²<br />
You will be asked to generate a new directory to store the model, click on 'Create New'.<br />
Now we can see in the GUI additional menus like, 'Model', 'Equations of Motion', 'Post<br />
Processing' and the help '?'. The animation window in Fig. 2 will be displayed and we can<br />
see the inertial frame of reference 'ISYS'.<br />
Fig. 2 Main menu and animation window<br />
The system, which shall be set up is shown in the following sketch<br />
2 von 15 01.09.2011 15:25
Neweulm2 - Getting Started DoublePendulum - IT M Wiki<br />
Fig. 3 Sketch Double Pendulum<br />
Now we want to model the bodies of the double pendulum. For this purpose we open the<br />
menu 'Model', select 'Bodies' and click on 'Create New'. A new body will be generated and<br />
we can input its properties. For most of the parameters we will keep the default values. The<br />
first pendulum body rotates with the angle 'alp' aro<strong>und</strong> the y-axis relative to the inertial<br />
frame of reference. It has the mass 'm1' and the moment of inertia 'I22' aro<strong>und</strong> the y-axis.<br />
The pendulum center of gravity of this body is translated by '-L1' in the z-axis direction<br />
relative to the body fixed reference frame 'mass1', see Fig. 4.<br />
3 von 15 01.09.2011 15:25
Neweulm2 - Getting Started DoublePendulum - IT M Wiki<br />
Fig. 4 Body model<br />
By clicking on the button 'Parameters' you will have the possibility to define new symbolic<br />
parameters like the first body mass 'm1' with the value 0.6. However, it is more comfortable<br />
to simply click the OK button and accept the warning window. Then automatically the<br />
Parameters window will open, then showing a list of all parameters to be defined, see Fig. 5.<br />
Please define all variables now. The length of the pendulum 'L1' has the value 0.5 and the<br />
moment of inertia 'I22' has the value 1. The angle 'alp' is defined as a generalized coordinate.<br />
The generalized coordinate 'bet' for the second body can be defined now or when creating<br />
the second body.<br />
4 von 15 01.09.2011 15:25
Neweulm2 - Getting Started DoublePendulum - IT M Wiki<br />
Fig. 5 Definition of new parameters<br />
Parameter Value Type<br />
m1 0.6 constant<br />
L1 0.5 constant<br />
L2 0.8 constant<br />
I22 1 constant<br />
alp - generalized coordinate<br />
bet - generalized coordinate<br />
Now all constants and generalized coordinates are defined and we can close both windows by<br />
clicking the 'OK' button, which finishes the definition of mass1.<br />
Now we want to add a second pendulum body using the same inertial properties like the first<br />
body. A new generalized coordinate 'bet' has to be defined for the second degree of freedom.<br />
The second body rotates with the angle 'bet' aro<strong>und</strong> the y-axis relative to the body fixed<br />
frame of reference 'mass1_cg', see Fig. 6. This refers to the selection of the Reference<br />
System at the top right of this window.<br />
5 von 15 01.09.2011 15:25
Neweulm2 - Getting Started DoublePendulum - IT M Wiki<br />
Fig. 6 Second pendulum body<br />
Let us have a short look at the naming of the coordinate systems. In Fig. 7, we can see the<br />
first pendulum called mass1, being a rigid body. Each rigid body consists of at least two<br />
coordinate systems. The so called primary system, having the same ID as the body itself,<br />
here mass1 is located at the top and in our model can only rotate with respect to the inertial<br />
frame ISYS. The primary system is usually one of the support points of the body as shown<br />
here. For each rigid body, the center of gravity has to be specified, which is denoted by<br />
having an ID like the body with a trailing _cg. Its position and orientation can be<br />
conveniently defined in the primary system. If necessary, additional coordinate systems can<br />
be defined, e.g. to attach force elements or other bodies.<br />
6 von 15 01.09.2011 15:25
Neweulm2 - Getting Started DoublePendulum - IT M Wiki<br />
Fig. 7 Sketch of a rigid body with coordinate systems<br />
Setting up the equations of motion (GUI)<br />
At this point we have already built our model and we can close the window by clicking on<br />
'OK'. The model is now ready and we can generate the nonlinear equations of motion. For<br />
this purpose we should select 'Nonlinear Equations of Motion' in the menu 'Equations of<br />
Motion', see Fig. 8. In the Matlab window we can see some information about the<br />
progressing calculation.<br />
Fig. 8 Calculation of the nonlinear equations of motion<br />
7 von 15 01.09.2011 15:25
Neweulm2 - Getting Started DoublePendulum - IT M Wiki<br />
Time integration and plot of states<br />
The Simulation can now be performed by selecting 'Time Integration' in the menu<br />
'Simulation'. We have to define the initial conditions. The first generalized coordinate 'alp'<br />
has the value 0.3 and the second one 'bet' is set to 0.5. There are several options such as<br />
error tolerances and integration algorithms. In this example all options are set to their<br />
default settings, see Fig. 9. We can now start the time integration by clicking 'OK'.<br />
Fig. 9 Time Integration window<br />
Figure 10 displays the animation window, where we can see moving frames of reference.<br />
However we can not see graphical objects, which will be added in the following steps.<br />
8 von 15 01.09.2011 15:25
Neweulm2 - Getting Started DoublePendulum - IT M Wiki<br />
Fig. 10 Animation window<br />
We can display the trajectories within the menu 'Post Processing', selecting the item<br />
Simulation Results. There is also the possibility to display the system states by selecting<br />
States and clicking on the button 'Plot'. We can see in Fig. 11 the time characteristic with<br />
four different lines, which represent both degrees of freedom and their derivatives. In the<br />
following steps, we are going to perform other analyses.<br />
9 von 15 01.09.2011 15:25
Neweulm2 - Getting Started DoublePendulum - IT M Wiki<br />
Fig. 11 Time Diagram States<br />
Graphic objects for the animation<br />
Now we can add some graphical objects. For this purpose we should open the menu 'Model'<br />
and select 'Graphic Objects'. A window will be displayed, where we can see different types<br />
of graphical objects. At each center of gravity one sphere shall be attached and each<br />
pendulum shall be represented by a line connecting the two coordinate systems of each<br />
body.<br />
In the 'Properties' frame, select the 'Type' as Sphere. To assign a graphical object to a body<br />
we should select a frame of reference, in the current example 'mass1_cg'. Set the Radius to<br />
0.05 and click on the Apply button, see Fig. 12. We can repeat the same procedure for the<br />
second pendulum body by selecting the body fixed frame 'mass2_cg'. The added objects are<br />
immediately displayed in the animation window.<br />
10 von 15 01.09.2011 15:25
Neweulm2 - Getting Started DoublePendulum - IT M Wiki<br />
Fig. 12 Create a sphere<br />
We also have the possibility to add dynamic lines, which can represent for example springs<br />
or dampers, or in this case the connection of the two coordinate systems of each body. Please<br />
select the 'Type' to be Line and then click the radio button labeled Dynamic/Spline. As you<br />
can see this user interface changes the labels of the fields according to the graphic object to<br />
be created. As this line shall connect the coordinate systems mass1 and mass1_cg, both ids<br />
have to be written in the field List of coordinate systems. You can select them in the<br />
drop-down-box and click 'Add frame' or write them in manually. When entering them it<br />
doesn't matter if you insert a comma, semicolon or simply spaces. After clicking Apply you<br />
can repeat this for the second body as well, see Fig. 13.<br />
11 von 15 01.09.2011 15:25
Neweulm2 - Getting Started DoublePendulum - IT M Wiki<br />
Fig. 13 Create a sphere<br />
The whole assembly is displayed in Fig. 14.<br />
12 von 15 01.09.2011 15:25
Neweulm2 - Getting Started DoublePendulum - IT M Wiki<br />
Fig. 14 Double Pendulum<br />
Linearization of the equations of motion<br />
To linearize the system we should select 'Linear Equations of Motion' in the menu<br />
'Equations of Motion'. Consequently the linear equations of motion are generated. We<br />
would like to perform a modal analysis. For this purpose we click on 'Modal Analysis' in the<br />
menu 'Simulation'. A new window will appears, where we can input several settings such as<br />
scale factor and transparency of mode shapes. To confirm the settings please click on 'OK'.<br />
Two windows are displayed, where we can recognize the first mode shape with a frequency<br />
of 0.25 Hz, the antisymmetrical mode has a higher frequency of 0.34 Hz, see Fig. 15.<br />
13 von 15 01.09.2011 15:25
Neweulm2 - Getting Started DoublePendulum - IT M Wiki<br />
Fig. 15 Mode shapes<br />
We can have a look at the elements of the equations of motion, which are all stored <strong>und</strong>er<br />
'sys.eqm', but depending on what options have been chosen, these entries may be different.<br />
These options can be accessed via 'Post Processing', 'System Information', 'Parameter<br />
Settings'. The symbolic expressions for the linearized equations of motion can be fo<strong>und</strong><br />
<strong>und</strong>er sys.lin.eqm. However, in order to find, e.g. the stiffness matrix Q there, you would<br />
have to use the just described graphical user interface to set the parameter formulation to<br />
minimal before setting up the linear equations of motion.<br />
Saving<br />
In the next example kinematic loops and force elements are going to be added. The model<br />
should be stored <strong>und</strong>er the name 'Doppelpendel' by selecting 'Save System' in the menu<br />
'File'.<br />
Commands learned in this example<br />
The following commands were used and shortly explained in this example:<br />
Command Type Purpose<br />
addGraphics<br />
Attach a graphical representation to a coordinate<br />
Neweul-M²<br />
system<br />
addpathNeweulm2 Neweul-M² Adjust the search path of Matlab<br />
14 von 15 01.09.2011 15:25
Neweulm2 - Getting Started DoublePendulum - IT M Wiki<br />
animTimeInt<br />
Neweul-M² Animate a result<br />
calcEqMotLin<br />
Symbolically linearize the previously calculated<br />
Neweul-M²<br />
nonlinear equations of motion<br />
calcEqMotNonLin Neweul-M² Set up symbolic nonlinear equations of motion<br />
createAnimationWindow Neweul-M² Create a new animation window<br />
drawLine<br />
Draw a line, connecting two coordinate systems in the<br />
Neweul-M²<br />
animation window<br />
drawSphere<br />
Neweul-M² Draw a sphere in the animation window<br />
newBody<br />
Neweul-M² Define rigid or elastic body<br />
newGenCoord<br />
Neweul-M² Define generalized coordinate<br />
newSys<br />
Define a new multibody system, clears the data<br />
Neweul-M²<br />
structure sys<br />
newUserVarKonst Neweul-M² Define a constant symbolic parameter<br />
plotStandardResults Neweul-M² Provide plots of interesting curves from results<br />
timeInt<br />
Neweul-M² Perform numerical time integration of the system<br />
writeMbsLin<br />
Write <strong>file</strong>s of the linear equations of motion for<br />
Neweul-M²<br />
numerical evaluation<br />
writeMbsNonLin<br />
Write <strong>file</strong>s of the nonlinear equations of motion for<br />
Neweul-M²<br />
numerical evaluation<br />
load Matlab Load data from a .mat <strong>file</strong><br />
save Matlab Save variables to a .mat <strong>file</strong><br />
Links<br />
Restart this example<br />
Next example: Slider Crank<br />
Back to the Neweul-M² Page<br />
List of all examples.<br />
Retrieved from "http://www.itm.uni-stuttgart.de/itmwiki/index.php/Neweulm2_-<br />
_Getting_Started_DoublePendulum"<br />
This page was last modified 11:34, 31 August 2011.<br />
15 von 15 01.09.2011 15:25
Neweulm2 - Getting Started SliderCrank - IT M Wiki<br />
Neweulm2 - Getting Started<br />
SliderCrank<br />
From ITM Wiki<br />
Contents<br />
1 Slider crank<br />
1.1 Load system<br />
1.2 System definition: force element, loop<br />
1.3 Time integration with kinematic loop<br />
1.4 Static Equilibrium<br />
1.5 Commands learned in this example<br />
1.6 Links<br />
Slider crank<br />
In this third example we are going to add a kinematic loop to the double pendulum<br />
above. This means that the ordinary differential equations of motion will be<br />
changed to algebraic differential equations. We will show you also how to add a<br />
force element and how to calculate the static equilibrium. If you skipped the<br />
previous example, you might want to have a look at the Preparation section first.<br />
This mainly consists of moving to a suitable folder and setting the path variable as<br />
explained above.<br />
Load system<br />
For this purpose let’s call the GUI and from the menu 'File' select 'Load System'.<br />
The previous example (double pendulum) should be opened.<br />
System definition: force element, loop<br />
To add a force element we should select from the menu 'Model' the entry 'Force<br />
Elements', see Fig. 1.<br />
1 von 9 01.09.2011 15:26
Neweulm2 - Getting Started SliderCrank - IT M Wiki<br />
Fig. 1 Force Element<br />
By clicking on the button 'Create New' a new window is opened where force<br />
elements can be defined, see Fig. 2. We can see here several types of elements. In<br />
this example we will use a componentwise spring-damper-combination. For this<br />
purpose click on 'SpringDampCmp' The torsional spring acts in the second axis<br />
and has the stiffness 'k1' with the value 4, the damping constant 'd1' with the<br />
value 0 and the nominal length 'alpha0' equal to 1. These parameters have to be<br />
defined as shown before. Now we should select the coordinate systems where this<br />
force element acts. In this example it’s 'mass1_cg' and 'mass2'. Click on 'OK' to<br />
end the procedure.<br />
2 von 9 01.09.2011 15:26
Neweulm2 - Getting Started SliderCrank - IT M Wiki<br />
Fig. 2 Definition of Force Element<br />
The second modification is to add a kinematic loop. The mass 'm2' should move<br />
along a straight line. Let’s go to the menu 'Model' and select 'Kinematic Loops'.<br />
We can see several options. By selecting 'New Loop' we can generate a constraint<br />
between the coordinate systems 'ISYS' and 'masse2_cg', see Fig. 3. The<br />
constrained degree of freedom is the z-component.<br />
3 von 9 01.09.2011 15:26
Neweulm2 - Getting Started SliderCrank - IT M Wiki<br />
Fig. 3 Kinematic Loop<br />
To calculate the equations of motion, click on 'Nonlinear Equations of Motion'<br />
in the menu 'Equations of Motion'.<br />
Time integration with kinematic loop<br />
Now we can start the simulation by selecting 'Time Integration' in the menu<br />
'Simulation'. We have to select the dependent degree of freedom, since after<br />
adding a kinematic loop the degrees of freedom are no more independent. In this<br />
case let’s select 'alp' as independent degree of freedom, see Fig. 4. By clicking on<br />
'OK' we confirm the selection.<br />
4 von 9 01.09.2011 15:26
Neweulm2 - Getting Started SliderCrank - IT M Wiki<br />
Fig. 4 Dependent generalized coordinates<br />
To perform the time integration we should select an integrator, which is<br />
appropriate for differential algebraic equations. Let’s select 'ode15 s', see Fig. 5.<br />
Now we have to define the initial conditions. The first degree of freedom 'alp' is<br />
set to 0.8, the second 'bet' is set to -0.8. The provided initial conditions are<br />
automatically used to numerically calculate consistent initial conditions. This is<br />
necessary so the initial conditions fulfill all constraint equations. We can start the<br />
simulation by clicking on 'OK'. The animation is displayed and we can observe that<br />
the coordinate system 'mass2_cg' is moving along a straight line with the<br />
condition: z = 0.<br />
5 von 9 01.09.2011 15:26
Neweulm2 - Getting Started SliderCrank - IT M Wiki<br />
Fig. 5 Integration with kinematic loop<br />
At this point we can change some model parameters such as the spring stiffness<br />
'k1' and integrate again. We can see an oscillation with a higher frequency.<br />
Static Equilibrium<br />
To calculate the static equilibrium we should select 'Static Equilibrium' in the<br />
menu 'Simulation', see Fig. 6.<br />
6 von 9 01.09.2011 15:26
Neweulm2 - Getting Started SliderCrank - IT M Wiki<br />
Fig. 6 Static Equilibrium<br />
To perform the calculation we have to define a start value for the degree of<br />
freedom 'alp', see Fig. 7. The initial value should be near to the static equilibrium,<br />
so that the calculation does not require a high numerical expense.<br />
Fig. 7 Start value for static equilibrium<br />
By clicking on 'Static Equilibrium' the static equilibrium is calculated. The<br />
graphics is updated automatically or when changing a value.<br />
7 von 9 01.09.2011 15:26
Neweulm2 - Getting Started SliderCrank - IT M Wiki<br />
This example demonstrated how to create force elements, kinematic loops,<br />
calculate and display the static equilibrium.<br />
Commands learned in this example<br />
The following commands were used and shortly explained in this example, even<br />
though they were called via the graphic user interface:<br />
Command Type Purpose<br />
addpathNeweulm2 Neweul-M² Adjust the search path of Matlab<br />
animTimeInt<br />
Neweul-M² Animate a result<br />
calcEqMotNonLin<br />
Set up symbolic nonlinear equations of<br />
Neweul-M²<br />
motion<br />
createAnimationWindow Neweul-M² Create a new animation window<br />
declareDependent<br />
Declare one or more generalized coordinates<br />
Neweul-M²<br />
to be considered dependent<br />
newBody<br />
Neweul-M² Define rigid or elastic body<br />
newForceElem<br />
Define an applied force, e.g. a springdamper<br />
combination<br />
Neweul-M²<br />
newGenCoord<br />
Neweul-M² Define generalized coordinate<br />
newLoop<br />
Define a new algebraic constraint, e.g. a<br />
Neweul-M²<br />
kinematic loop<br />
newSys<br />
Define a new multibody system, clears the<br />
Neweul-M²<br />
data structure sys<br />
newUserVarKonst Neweul-M² Define a constant symbolic parameter<br />
staticEquilibrium<br />
Calculate a static equilibrium position<br />
Neweul-M²<br />
numerically<br />
timeInt<br />
Perform numerical time integration of the<br />
Neweul-M²<br />
system<br />
writeMbsNonLin<br />
Write <strong>file</strong>s of the nonlinear equations of<br />
Neweul-M²<br />
motion for numerical evaluation<br />
load Matlab Load data from a .mat <strong>file</strong><br />
save Matlab Save variables to a .mat <strong>file</strong><br />
Links<br />
Restart this example<br />
Next example: Elastic Pendulum<br />
Back to the Neweul-M² Page<br />
List of all examples.<br />
8 von 9 01.09.2011 15:26
Neweulm2 - Getting Started SliderCrank - IT M Wiki<br />
Retrieved from "http://www.itm.uni-stuttgart.de/itmwiki/index.php/Neweulm2_-<br />
_Getting_Started_SliderCrank"<br />
This page was last modified 11:34, 31 August 2011.<br />
9 von 9 01.09.2011 15:26
Neweulm2 - Getting Started ElasticDoublePendulum - IT M Wiki<br />
Neweulm2 - Getting Started ElasticDoublePendulum<br />
From ITM Wiki<br />
Contents<br />
1 Double pendulum with flexible bodies<br />
1.1 System definition (GUI)<br />
1.2 Setting up the equations of motion (GUI)<br />
1.3 Time integration and plot of states<br />
1.4 Analyzing the results<br />
1.4.1 Commands learned in this example<br />
1.5 Links<br />
Double pendulum with flexible bodies<br />
In this example we build a double pendulum made up of two flexible beams, which will be animated by a shock. Therefore we use the<br />
graphical user interface (GUI) of Neweul-M² again. The first step is to start Matlab again. If you skipped the first example, set the path<br />
variable as explained in the General Preparations, as a default:<br />
addpathNeweulm2<br />
To start the GUI we have to type the command<br />
neweulm2<br />
System definition (GUI)<br />
At first a new system will be defined, now called 'beam pendulum'. Therefore you should take the same steps that have already been<br />
explained in the second example (Double Pendulum). Be aware that the gravity vector keeps its standard entries (0,0,-g). Because we<br />
build two bodies, we have to create two generalized coordinates. So, we select the menu item 'Model', then 'Parameters'.<br />
Fig. 1 Defining parameters<br />
In the following window please name the first generalized coordinate 'alpha1', then select 'Generalized Coordinate'. After creating<br />
this parameter by clicking Apply, please create another generalized coordinate called beta1. Please note that we selected the names<br />
on purpose, as a variable named beta would cause errors in MuPad, as this is a preoccupied function name.<br />
1 von 10 01.09.2011 15:26
Neweulm2 - Getting Started ElasticDoublePendulum - IT M Wiki<br />
Fig. 2 Generalized coordinates<br />
In the next step we are going to define the two bodies of our pendulum. For this, select in the menu item 'Model' the entry called<br />
'Bodies' and there 'Create New', like it's done in the second example (#Double pendulum). For using flexible Bodies we first select<br />
'Flexible' in the 'Body type' properties. Besides, the identifier is defined as 'P_1' and named 'Pendulum 1'. Moreover, you should<br />
keep the reference system 'ISYS'. Now press 'Create' to define a flexible body.<br />
Fig. 3 Picking the flexible body<br />
A new window will pop up, in which the flexible body will be created. We use a 'Beam (Bernoulli)' as body. Then we divide it into 15<br />
elements with 'Number of elements'. In the window on the right hand, you can see the longitudinal axis of the beam. As expected,<br />
the body is separated into 15 parts. Now we have to implement some values concerning the geometry. Use for 'Width (y)' a value of<br />
0.04 and for 'Height (z)' a value of 0.02 (dimensions in meter). In the menu 'Set DOFs for elastic deformation' select only z and<br />
rot y. Furthermore, we have to select, which nodal coordinate systems shall be available in the multibody system. We need the node on<br />
the right end of the beam in order to be able to use it as an interface, e.g. to attach another body or evaluate its trajectory. These nodes<br />
will be written to the elastic body description, e.g. the SID <strong>file</strong>, at the end. So, scroll down in the 'Node number' list, select the last<br />
entry (number 16) and click on 'add'. The added node will become bold in the overview window on the right. Alternatively, you can<br />
select the appropriate nodes by simply clicking on them in the overview window. Here we additionally select the nodes 4, 7, 10 and 13.<br />
However, they are not meant to attach anything to them, but just to have them for the animation. Please keep in mind that the<br />
orientation of the body's length will always point in direction of the positive x-axis, as you can see in the overview window. Therefore, we<br />
will have to rotate the body later, because it should be hanging down in direction of the negative z-axis by initial condition. Finally,<br />
click 'Next' to continue.<br />
2 von 10 01.09.2011 15:26
Neweulm2 - Getting Started ElasticDoublePendulum - IT M Wiki<br />
Parameter Value<br />
Number of Elements 15<br />
Beam Length 1<br />
Width (y) 0.04<br />
Height (z) 0.02<br />
Young's Modulus 70e9<br />
Possion's ratio 0.3<br />
Density 2750<br />
Fig. 4 Creating the flexible body<br />
In the following, we calculate the eigenmodes in the 'Model_Reduction' window. Therefore you should keep the method 'Modal<br />
Reduction' and simply start the calculation by clicking on 'Calculate modes'. As a result, you will see the eigenfrequencies listed<br />
below the 'Calculate modes' button. By selecting the different eigenfrequencies the appropriate eigenform will show up in the<br />
window on the left. Now, select the first and second eigenfrequency and click on 'keep' to store them for our model. The modal<br />
reduction is finished. To save the properties of our flexible body, insert 'pendulum' in the box 'Save SID to'. To apply the settings<br />
click on 'Create & Exit'.<br />
3 von 10 01.09.2011 15:26
Neweulm2 - Getting Started ElasticDoublePendulum - IT M Wiki<br />
Fig. 5 Calculating the eigenfrequencies and eigenforms<br />
Now we define the orientation of our beam by rotating it about the y-axis by 'pi/2+alpha1', in order that it hangs down as indicated in<br />
a previous passage. We apply our changes with 'OK'.<br />
4 von 10 01.09.2011 15:26
Neweulm2 - Getting Started ElasticDoublePendulum - IT M Wiki<br />
Fig. 6 Creating the flexible body<br />
The next step is to create the second body for our double pendulum. Therefore, we have to click again on 'Model', then 'Bodies' and<br />
finally 'Create New'. Please select once more the 'Flexible' option and name the second body 'P_2' and 'Pendulum 2'. As 'Reference<br />
System' it is important to use the node with the highest index of body P1 'P_1_6'. As rotation about the y-axis we use the generalized<br />
coordinate 'beta1'. Because we are using two identical bodies for our pendulum, we can simply use the same model we created before.<br />
Thus, please type in terms of the 'Flexible body properties' either pendulum.SID_FEM or use 'Search' to select the appropriate<br />
<strong>file</strong>. To apply your entries click on 'OK'.<br />
5 von 10 01.09.2011 15:26
Neweulm2 - Getting Started ElasticDoublePendulum - IT M Wiki<br />
Fig. 7 Setting up the second body<br />
The elastic beams have been created in the GUI and thus contain information for their graphical representation. The next job is to<br />
animate our newly created system. We shock the lower end of the second body figuratively with a hammer. Thus, we need to insert the<br />
appropriate force element. Under 'Model' choose the entry 'Force Elements' and open the window shown in Figure 8 with 'Create<br />
New'. We identify our force element with 'Shock'. By using 'General' as type, we have the possibility to set up our own individual<br />
animation in the box 'Force Law', in this example:<br />
1/(0.001*sqrt(2*pi))*exp(-(t-0.005)^2/(2*0.001^2))<br />
In addition, we click on 'x' for the direction of our hammer animation. Now set up 'P_2_6' as 'CoordinateSystem 2' to realize the lower<br />
end as point of impact. Apply with 'OK'.<br />
6 von 10 01.09.2011 15:26
Neweulm2 - Getting Started ElasticDoublePendulum - IT M Wiki<br />
Fig. 8 Insert the force element<br />
Setting up the equations of motion (GUI)<br />
Now we have to calculate the equations of motion for the simulation. Therefore, choose in terms of 'Equations of Motion' the menu<br />
item 'Nonlinear Equations of Motion'. Matlab will begin to calculate the necessary equations.<br />
Fig. 10 Calculation of the equations of motion<br />
Time integration and plot of states<br />
Finally, to simulate our model, we click on 'Simulation' and then the option 'Time Integration'. All values are kept as standard<br />
except the 'Final Time' which will be changed to 3 seconds to save some calculation time. Our initial conditions alpha and beta stay<br />
zero in order that the motion will only be caused by the force element. After clicking on 'OK' it takes some seconds for the time<br />
7 von 10 01.09.2011 15:26
Neweulm2 - Getting Started ElasticDoublePendulum - IT M Wiki<br />
integration (red bar) to be finished. We accept the question if we want to start the simulation. Now we should see an animation window<br />
that is comparable to figure 34.<br />
Fig. 11 Time integration<br />
Fig. 12 Simulation<br />
Analyzing the results<br />
Finally, we interpret our results of the simulation. Thus, we go to 'Post Processing' and click on 'Simulation Results'. Now the<br />
window of figure 35 will show up and by clicking on 'Play' we can see our simulation in real time again. In order to do a more precise<br />
analysis, we keep the check box 'All Trajectories' <strong>und</strong>er 'Create plots from the result' selected. Now we can get an output of all of<br />
our paths of motion by simply clicking on 'Plot'.<br />
8 von 10 01.09.2011 15:26
Neweulm2 - Getting Started ElasticDoublePendulum - IT M Wiki<br />
Fig. 13 Analysis of our results<br />
With the created plots you can get a broad overview of the behavior of our double pendulum and its motions in x-,y- and z-direction. It<br />
makes e.g. sense that our y-coordinate is always zero, because we only got a motion in the xz-level. A great part of the action is of<br />
course happening in the x-direction, where the shock is placed. To <strong>und</strong>erstand the plot of the x-coordinate it is important to know, that<br />
you can only see 3 of 6 trajectories that are listed in the legend. The reason is that we got different named points which are actually<br />
located at the same place. E.g. P_1 and P_1_1 are located on the same spot as well as P_1_2, P_2 and P_2_1. By zooming in the<br />
trajectories you can easily observe the typical oscillation of the structure which is the result of the specific force law we used.<br />
Fig. 14 Trajectories<br />
This example demonstrated how to use the knowledge provided by the previous examples on flexible bodies. We are at the end of this<br />
introduction. 'Neweul-M2' has other options and tools. The help menu and the user guide are available for further information. Have<br />
fun!<br />
Commands learned in this example<br />
The following commands were used and shortly explained in this example:<br />
9 von 10 01.09.2011 15:26
Neweulm2 - Getting Started ElasticDoublePendulum - IT M Wiki<br />
Command Type Purpose<br />
addpathNeweulm2 Neweul-M² Adjust the search path of Matlab<br />
animTimeInt<br />
Neweul-M² Animate a result<br />
calcEqMotNonLin Neweul-M² Set up symbolic nonlinear equations of motion<br />
createAnimationWindow Neweul-M² Create a new animation window<br />
drawLine<br />
Neweul-M² Draw a line, connecting two coordinate systems in the animation window<br />
newBody<br />
Neweul-M² Define rigid or elastic body<br />
newGenCoord<br />
Neweul-M² Define generalized coordinate<br />
newSys<br />
Neweul-M² Define a new multibody system, clears the data structure sys<br />
plotStandardResults Neweul-M² Provide plots of interesting curves from results<br />
timeInt<br />
Neweul-M² Perform numerical time integration of the system<br />
writeMbsNonLin Neweul-M² Write <strong>file</strong>s of the nonlinear equations of motion for numerical evaluation<br />
load Matlab Load data from a .mat <strong>file</strong><br />
save Matlab Save variables to a .mat <strong>file</strong><br />
Links<br />
Restart this example<br />
Back to the Neweul-M² Page<br />
List of all examples<br />
Retrieved from "http://www.itm.uni-stuttgart.de/itmwiki/index.php/Neweulm2_-_Getting_Started_ElasticDoublePendulum"<br />
This page was last modified 12:06, 1 September 2011.<br />
10 von 10 01.09.2011 15:26
Neweulm2 - List of <strong>file</strong>s - IT M Wiki<br />
Neweulm2 - List of <strong>file</strong>s<br />
From ITM Wiki<br />
Here a complete list of <strong>file</strong>s from the top folder neweulm2 is given.<br />
Contents<br />
1 Folder neweulm2/<br />
2 Folder neweulm2/algorithms/<br />
3 Folder neweulm2/animation/<br />
4 Folder neweulm2/cRoutines/<br />
5 Folder neweulm2/gui/<br />
6 Folder neweulm2/modules/<br />
7 Folder neweulm2/routines/<br />
Folder neweulm2/<br />
The <strong>file</strong>s in this folder are those usually called by the user, except the animation<br />
part, which has its own subfolder.<br />
calcEqMotLin.m<br />
Filename Field of use Description<br />
calcEqMotNonLin.m<br />
calcMov.m<br />
calcNomLength.m<br />
neweulm2 -<br />
Equations of<br />
Motion<br />
neweulm2 -<br />
Equations of<br />
Motion<br />
neweulm2 -<br />
Simulation<br />
and<br />
Animation<br />
neweulm2 -<br />
Simulation<br />
and<br />
Animation<br />
Calculate the linearized<br />
equations of motion<br />
Calculate the nonlinear<br />
equations of motion<br />
Set up functions for kinematic<br />
analysis<br />
Calculate nominal lengths of all<br />
force elements from given<br />
positions<br />
1 von 14 30.08.2011 17:46
Neweulm2 - List of <strong>file</strong>s - IT M Wiki<br />
neweulm2 -<br />
calcNumericalLinearization.m Equations of<br />
Motion<br />
neweulm2 -<br />
declareDependent.m<br />
System<br />
Definition<br />
exportEqMot.m<br />
freqResponse.m<br />
kinematicAnalysis.m<br />
modalAnalysis.m<br />
modifyBody.m<br />
newBody.m<br />
newForceElem.m<br />
newGenCoord.m<br />
newKsys.m<br />
newLoop.m<br />
neweulm2 -<br />
Exporting<br />
neweulm2 -<br />
Simulation<br />
and<br />
Animation<br />
neweulm2 -<br />
Simulation<br />
and<br />
Animation<br />
neweulm2 -<br />
Simulation<br />
and<br />
Animation<br />
neweulm2 -<br />
System<br />
Definition<br />
neweulm2 -<br />
System<br />
Definition<br />
neweulm2 -<br />
System<br />
Definition<br />
neweulm2 -<br />
System<br />
Definition<br />
neweulm2 -<br />
System<br />
Definition<br />
neweulm2 -<br />
System<br />
Definition<br />
Calculate matrices of the<br />
linearized system numerically<br />
Declare which generalized<br />
coordinates are dependent from<br />
kinematic loops<br />
Export e.g. the equations of<br />
motion after replacing all<br />
parameters by numerical values<br />
to an m-<strong>file</strong>.<br />
Calculate the frequency<br />
response<br />
Perform kinematic analysis,<br />
prescribing functions for<br />
generalized coordinates<br />
Perform modal analysis<br />
Modifies certain settings at an<br />
existing body<br />
Create a new body<br />
Create a new force element<br />
Define one or more new<br />
generalized coordinates<br />
Create a new coordinate system<br />
Create a new kinematic loop<br />
2 von 14 30.08.2011 17:46
Neweulm2 - List of <strong>file</strong>s - IT M Wiki<br />
newSys.m<br />
newSysIn.m<br />
newSysOut.m<br />
newTimeData.m<br />
newUserVarKonst.m<br />
newUserVarTvar.m<br />
newUserVarYvar.m<br />
newVolume.m<br />
optiEvalFreqRes.m<br />
printSystemInformation.m<br />
runSensAn.m<br />
runSysOpt.m<br />
neweulm2 -<br />
System<br />
Definition<br />
neweulm2 -<br />
System<br />
Definition<br />
neweulm2 -<br />
System<br />
Definition<br />
neweulm2 -<br />
System<br />
Definition<br />
neweulm2 -<br />
System<br />
Definition<br />
neweulm2 -<br />
System<br />
Definition<br />
neweulm2 -<br />
System<br />
Definition<br />
neweulm2 -<br />
System<br />
Definition<br />
neweulm2 -<br />
Simulation<br />
and<br />
Animation<br />
neweulm2 -<br />
Simulation<br />
and<br />
Animation<br />
neweulm2 -<br />
Simulation<br />
and<br />
Animation<br />
neweulm2 -<br />
Simulation<br />
and<br />
Animation<br />
Create new multibody system<br />
Create a new system input<br />
Create a new system output<br />
Use a lookup table for a time<br />
dependent parameter<br />
Define one or more new constant<br />
parameters<br />
Define one or more new time<br />
dependent parameters<br />
Define one or more new state<br />
dependent parameters<br />
Defines a volume element for<br />
pressure forces<br />
Perform a parameter<br />
optimization, based on the<br />
frequency response<br />
Print some system information,<br />
very useful for debugging or<br />
<strong>und</strong>erstanding a system<br />
Perform a sensitivity analysis<br />
Perform a parameter<br />
optimization<br />
3 von 14 30.08.2011 17:46
Neweulm2 - List of <strong>file</strong>s - IT M Wiki<br />
scriptCalcEqMotNonLin.m<br />
scriptWriteMbsNonLin.m<br />
setfun.m<br />
staticEquilibrium.m<br />
writeMbsLin.m<br />
writeMbsNonLin.m<br />
neweulm2 -<br />
Equations of<br />
Motion<br />
neweulm2 -<br />
Equations of<br />
Motion<br />
neweulm2 -<br />
Simulation<br />
and<br />
Animation<br />
neweulm2 -<br />
Simulation<br />
and<br />
Animation<br />
neweulm2 -<br />
Equations of<br />
Motion<br />
neweulm2 -<br />
Equations of<br />
Motion<br />
This <strong>file</strong> can be edited by the<br />
user to adjust the software to<br />
individual needs. Is called from<br />
calcEqMotNonLin.m<br />
This <strong>file</strong> can be edited by the<br />
user to adjust the software to<br />
individual needs. Is called from<br />
writeMbsNonLin.m<br />
Define functions for kinematic<br />
analysis<br />
Numerically calculate the static<br />
equilibrium<br />
Write <strong>file</strong>s for the linearized<br />
equations of motion<br />
Write <strong>file</strong>s for the nonlinear<br />
equations of motion<br />
Folder neweulm2/algorithms/<br />
These functions are independent of the functionality of Neweul-M² and could be<br />
used as stand-alone functions.<br />
Filename Field of use Description<br />
any2str.m<br />
cell2sym.m<br />
convertString.m<br />
csgn.m<br />
Auxiliary<br />
function<br />
Auxiliary<br />
function<br />
Auxiliary<br />
function<br />
Auxiliary<br />
function<br />
Returns a string, no matter which input<br />
format. Is also widely used in the GUI<br />
Create a symbolic vector of a given cell<br />
array containing parameter names<br />
Very useful function to append strings to<br />
every entry of e.g. a cell array<br />
Complex sign function, is introduced for<br />
compatibility with Maple<br />
4 von 14 30.08.2011 17:46
Neweulm2 - List of <strong>file</strong>s - IT M Wiki<br />
deval_wrap.m<br />
expandTimeVars.m<br />
fastinterp1.m<br />
findSyms.m<br />
finiteDifferences.m<br />
getTxtContent.m<br />
iszero.m<br />
jacobianMatrix.m<br />
kardan2rotmat.m<br />
mapleSimplify.m<br />
mapleSubs.m<br />
rotmat2kardan.m<br />
neweulm2 -<br />
Extension of deval to accept different<br />
Simulation and<br />
integration algorithms<br />
Animation<br />
neweulm2 -<br />
Equations of<br />
Motion<br />
Do a taylor series for time dependent<br />
parameters<br />
neweulm2 -<br />
Function to interpolate between set points,<br />
Simulation and<br />
e.g. for newTimeData.m<br />
Animation<br />
neweulm2 -<br />
Equations of<br />
Motion<br />
Find symbolic expressions, return them as<br />
cell array not in one string as the built-in<br />
function<br />
neweulm2 -<br />
Calculate the gradient with the finite<br />
Simulation and<br />
differences method<br />
Animation<br />
Auxiliary<br />
function<br />
Auxiliary<br />
function<br />
neweulm2 -<br />
Equations of<br />
Motion<br />
neweulm2 -<br />
Equations of<br />
Motion<br />
neweulm2 -<br />
Equations of<br />
Motion<br />
neweulm2 -<br />
Equations of<br />
Motion<br />
neweulm2 -<br />
Equations of<br />
Motion<br />
Get string of a text field, convert it to<br />
correct type and if impossible insert<br />
default value<br />
As the Symbolic Math Toolbox behaves<br />
different using Maple or Mupad handling<br />
elements equal to zero, this function<br />
unifies the search for zero entries. Handles<br />
numeric and symbolic zeros.<br />
Calculate jacobian matrix<br />
Calculate rotation matrix from given<br />
kardan angles<br />
Simplify an expression. Is a wrapper<br />
function to simplify or maple to improve<br />
available options, performance and<br />
compatibility<br />
Substitute parameters in a symbolic<br />
expression, wrapper function to improve<br />
available options, performance and<br />
compatibility<br />
Calculate kardan angles from a given<br />
rotation matrix<br />
5 von 14 30.08.2011 17:46
Neweulm2 - List of <strong>file</strong>s - IT M Wiki<br />
signum.m<br />
sym2mcode.m<br />
vec2skew.m<br />
writeStructure.m<br />
neweulm2 -<br />
Equations of<br />
Motion<br />
neweulm2 -<br />
Equations of<br />
Motion<br />
neweulm2 -<br />
Equations of<br />
Motion<br />
neweulm2 -<br />
Equations of<br />
Motion<br />
Maple name of the sign function, for<br />
compatibility<br />
Create m-<strong>file</strong> code from a symbolic<br />
expression<br />
Create a skew symmetric matrix from a<br />
vector, representing the cross product<br />
Print a complete structure to the standard<br />
out or a <strong>file</strong> including all substructures<br />
Folder neweulm2/animation/<br />
Commands for the animation of results.<br />
addGraphics.m<br />
Filename Field of use Description<br />
animFreqResponse.m<br />
animModeShape.m<br />
animTimeInt.m<br />
cad2mat.m<br />
colorStr2RGB.m<br />
createAnimationWindow.m<br />
neweulm2 -<br />
Simulation and<br />
Animation<br />
neweulm2 -<br />
Simulation and<br />
Animation<br />
neweulm2 -<br />
Simulation and<br />
Animation<br />
neweulm2 -<br />
Simulation and<br />
Animation<br />
Auxiliary<br />
function<br />
Auxiliary<br />
function<br />
neweulm2 -<br />
Simulation and<br />
Animation<br />
Attach a geometric shape to<br />
frame<br />
Animate a frequency response<br />
Animate one mode shape<br />
Perform and animation, can<br />
create .avi-<strong>file</strong>s<br />
Read CAD data and convert it to a<br />
matrix for the animation<br />
Convert between the string and<br />
numeric representations of<br />
Matlab standard colors<br />
Initialize graphics and recreate<br />
any previously created graphic<br />
objects<br />
6 von 14 30.08.2011 17:46
Neweulm2 - List of <strong>file</strong>s - IT M Wiki<br />
drawArrow3d.m<br />
drawCube.m<br />
drawElasticBeam.m<br />
drawLine.m<br />
drawMesh.m<br />
drawRotBody.m<br />
drawSphere.m<br />
drawSpring.m<br />
drawSTL.m<br />
drawSys.m<br />
fitCanvas.m<br />
freqResPlot.m<br />
initGraphics.m<br />
Auxiliary<br />
function<br />
neweulm2 -<br />
Simulation and<br />
Animation<br />
neweulm2 -<br />
Simulation and<br />
Animation<br />
neweulm2 -<br />
Simulation and<br />
Animation<br />
neweulm2 -<br />
Simulation and<br />
Animation<br />
neweulm2 -<br />
Simulation and<br />
Animation<br />
neweulm2 -<br />
Simulation and<br />
Animation<br />
neweulm2 -<br />
Simulation and<br />
Animation<br />
neweulm2 -<br />
Simulation and<br />
Animation<br />
neweulm2 -<br />
Simulation and<br />
Animation<br />
neweulm2 -<br />
Simulation and<br />
Animation<br />
neweulm2 -<br />
Simulation and<br />
Animation<br />
neweulm2 -<br />
Simulation and<br />
Animation<br />
Draw an arrow shaped object<br />
Draw a cuboid<br />
This function uses a crosssection<br />
along a line element as a<br />
representation for elastic bodies<br />
Draw a line connecting two<br />
coordinate systems<br />
When mesh information of an<br />
elastic body exists, draw it or<br />
update its settings<br />
Draw a rotational body, this is<br />
rotational symmetric with respect<br />
to the z-axis<br />
Draw a sphere<br />
Draw an elastic spring between<br />
two coordinate systems<br />
Read an .STL <strong>file</strong> from a CAD<br />
software and create a<br />
corresponding object in the<br />
animation window<br />
Draw coordinate systems of the<br />
system<br />
Adjust the visible area of the<br />
animation window<br />
Plot the frequency response curve<br />
Create animation figure<br />
7 von 14 30.08.2011 17:46
Neweulm2 - List of <strong>file</strong>s - IT M Wiki<br />
ksysplot<br />
plotStandardResults.m<br />
plotTimeSteps.m<br />
plotTrajectories.m<br />
setVisibility<br />
showModeShape.m<br />
transformGraphics.m<br />
updateGeo.m<br />
writeAnimGeo.m<br />
writeGeo2NFF.m<br />
writeStrFile.m<br />
Auxiliary<br />
function<br />
neweulm2 -<br />
Simulation and<br />
Animation<br />
neweulm2 -<br />
Simulation and<br />
Animation<br />
neweulm2 -<br />
Simulation and<br />
Animation<br />
neweulm2 -<br />
Simulation and<br />
Animation<br />
neweulm2 -<br />
Simulation and<br />
Animation<br />
neweulm2 -<br />
Simulation and<br />
Animation<br />
neweulm2 -<br />
Simulation and<br />
Animation<br />
neweulm2 -<br />
Exporting<br />
neweulm2 -<br />
Exporting<br />
neweulm2 -<br />
Exporting<br />
Plot representations for all<br />
coordinate systems<br />
Create plots of the most common<br />
results<br />
Plot configurations at different<br />
time steps into one figure<br />
Plot the trajectory of one or more<br />
coordinate systems<br />
Set the visibility of groups of<br />
objects<br />
Display a mode shape<br />
Perform static transformations<br />
like translations or rotations of<br />
graphic objects<br />
Update the positions in the<br />
animation window<br />
Export the objects in the<br />
animation window so the software<br />
anim can read it<br />
Write .nff <strong>file</strong>s describing the<br />
objects in the animation window,<br />
can be used e.g. for Pasimodo<br />
Create .str <strong>file</strong> for an animation<br />
with anim from simulation result<br />
Folder neweulm2/cRoutines/<br />
Routines for the export to C-language.<br />
Filename Field of use Description<br />
mcode2c.m<br />
neweulm2 -<br />
Exporting<br />
Convert m-<strong>file</strong> code to executable<br />
C-Syntax<br />
8 von 14 30.08.2011 17:46
Neweulm2 - List of <strong>file</strong>s - IT M Wiki<br />
writeSfunction.m neweulm2 -<br />
Exporting<br />
Export system to Simulink S-function<br />
Folder neweulm2/gui/<br />
This folder contains all <strong>file</strong>s providing the graphical user interface (GUI).<br />
Therefore these <strong>file</strong>s are called by clicking on the respective buttons instead of<br />
typing their names. Therefore they provide help buttons, labeled with a question<br />
mark ?. However, there are some very few <strong>file</strong>s, which are to be called by the<br />
user:<br />
Filename<br />
routines/neweulm2HelpMsgs.m GUI<br />
startneweulm2.m<br />
figures/general/neweulm2.m<br />
routines/writeNeweullink.m<br />
Field<br />
of use<br />
GUI<br />
GUI<br />
GUI<br />
Description<br />
File containing the help messages,<br />
can be extended by the user<br />
Initialize and start the graphic user<br />
interface, clearing the workspace<br />
Initialize and start the graphic user<br />
interface, keeping the current model<br />
Create a <strong>file</strong> which can be moved to<br />
any location which will start the<br />
Neweul-M² GUI<br />
Folder neweulm2/modules/<br />
This folder contains optional parts of Neweul-M². They usually have their own<br />
documentation coming along with them.<br />
Folder neweulm2/routines/<br />
This folder contains <strong>file</strong>s, which are essential to the software but usually called<br />
from other functions. Therefore they are stored in this folder not to confuse the<br />
user.<br />
Filename Field of use Description<br />
absoluteKinematics.m<br />
neweulm2 -<br />
Equations of Motion<br />
calculate absolute<br />
kinematic values from<br />
precalculated relative<br />
9 von 14 30.08.2011 17:46
Neweulm2 - List of <strong>file</strong>s - IT M Wiki<br />
calcCon.m<br />
calcFlexForces.m<br />
calcForcesFelem.m<br />
calcForcesReaction.m<br />
calcInitConditions.m<br />
calcKin.m<br />
calcKinAbs.m<br />
check4GenCoord.m<br />
computeHomega.m<br />
coriolisSum.m<br />
createInertia.m<br />
elastMassMatrix.m<br />
neweulm2 -<br />
Equations of Motion<br />
neweulm2 -<br />
Equations of Motion<br />
neweulm2 - System<br />
Definition<br />
neweulm2 - System<br />
Definition<br />
neweulm2 -<br />
Simulation and<br />
Animation<br />
neweulm2 -<br />
Equations of Motion<br />
neweulm2 -<br />
Equations of Motion<br />
neweulm2 - System<br />
Definition<br />
neweulm2 -<br />
Equations of Motion<br />
neweulm2 -<br />
Equations of Motion<br />
neweulm2 -<br />
Equations of Motion<br />
neweulm2 -<br />
Equations of Motion<br />
ones<br />
Calculate constraint<br />
equations<br />
Calculate the forces in<br />
and caused by elastic<br />
bodies<br />
Calculate the applied<br />
forces of force elements<br />
Calculate the reaction<br />
forces and torques<br />
between bodies<br />
Calculate consistent<br />
initial conditions for<br />
systems with kinematic<br />
loops<br />
Call the correct function<br />
for the kinematics<br />
calculation<br />
Calculate the kinematics<br />
using absolute<br />
kinematics, which is<br />
much slower than<br />
relative kinematics<br />
Check if all generalized<br />
coordinates have been<br />
defined<br />
Evaluate the terms<br />
collected in the h_omega<br />
vector of elastic bodies<br />
using abbreviations<br />
Evaluate the generalized<br />
coriolis forces for elastic<br />
bodies using<br />
abbreviations<br />
Evaluate the inertia<br />
tensor for elastic bodies<br />
using abbreviations<br />
Evaluate the mass matrix<br />
for elastic bodies using<br />
abbreviations<br />
10 von 14 30.08.2011 17:46
Neweulm2 - List of <strong>file</strong>s - IT M Wiki<br />
findFramePath.m<br />
getAbsoluteKinematics.m<br />
getKinematics.m<br />
getNumOfCell.m<br />
getVersionNeweulm2.m<br />
Ksys2Ksys.m<br />
leftSideDivide.m<br />
load_neweulm2_System.m<br />
Matrices_grad.m<br />
NE2minimal.m<br />
newAbbreviation<br />
neweulm2 -<br />
Equations of Motion<br />
neweulm2 -<br />
Equations of Motion<br />
neweulm2 -<br />
Equations of Motion<br />
neweulm2 -<br />
Equations of Motion<br />
Auxiliary function<br />
neweulm2 -<br />
Equations of Motion<br />
Auxiliary function<br />
neweulm2 - System<br />
Definition<br />
neweulm2 -<br />
Simulation and<br />
Animation<br />
neweulm2 -<br />
Simulation and<br />
Animation<br />
neweulm2 - System<br />
Definition<br />
Determine shortest<br />
connection between two<br />
coordinate systems, for<br />
getKinematics<br />
When the user needs<br />
absolute kinematic<br />
values, e.g. for system<br />
outputs, but they haven't<br />
been calculated yet in<br />
calcKin.m, this function<br />
provides them<br />
Determine other<br />
kinematic values, not<br />
provided by<br />
getAbsoluteKinematics,<br />
e.g. because they're<br />
relative values for<br />
calcCon.m<br />
Determine sizes of cell<br />
arrays and its elements<br />
File in which the version<br />
information of<br />
Neweul-M² is stored<br />
Calculate all relative<br />
kinematic values<br />
between two coordinate<br />
systems<br />
File to solve a system of<br />
equations consisting of a<br />
matrix and a tensor<br />
Load a saved system and<br />
do all adjustments<br />
Calculate matrices for<br />
semianalytical gradient<br />
calculation<br />
Calculate the equations<br />
in minimal form from the<br />
Newton-Euler-equations<br />
Define a new<br />
abbreviation for an<br />
11 von 14 30.08.2011 17:46
Neweulm2 - List of <strong>file</strong>s - IT M Wiki<br />
OptiCalcInitCon.m<br />
OptiEval_adj_sep.m<br />
OptiEval_dir_tog.m<br />
relativeKinematics.m<br />
recursiveKinematics.m<br />
save_neweulm2_System.m<br />
setVersionNeweulm2.m<br />
SID2matlab.m<br />
symStruct2num.m<br />
tensorMultiplication.m<br />
tensorTranspose.m<br />
neweulm2 -<br />
Simulation and<br />
Animation<br />
neweulm2 -<br />
Simulation and<br />
Animation<br />
neweulm2 -<br />
Simulation and<br />
Animation<br />
neweulm2 -<br />
Equations of Motion<br />
neweulm2 -<br />
Equations of Motion<br />
neweulm2 - System<br />
Definition<br />
Auxiliary function<br />
Extension<br />
neweulm2 -<br />
Exporting<br />
Auxiliary function<br />
Auxiliary function<br />
elastic body<br />
Calculate initial<br />
conditions for<br />
optimization<br />
Evaluate function<br />
criterion and gradient<br />
with adjoint variable<br />
method and separate<br />
integration.<br />
Evaluate function<br />
criterion and gradient<br />
with direct method and<br />
integration of bothe<br />
ODEs together.<br />
calculate relative<br />
kinematic values<br />
calculate relative<br />
kinematic values for the<br />
recursive algorithm<br />
Save a modeled system<br />
File which is used to<br />
update<br />
getVersionNeweulm2.m,<br />
only works at the ITM<br />
Read SID<strong>file</strong> with flexible<br />
data<br />
Replace all symbolic<br />
expressions by their<br />
numerical values, if<br />
possible, list of<br />
exceptions can be<br />
specified.<br />
Multiply a third order<br />
tensor with a first order<br />
tensor, necessary for<br />
elastic bodies<br />
Transpose a third order<br />
tensor, necessary for<br />
elastic bodies<br />
12 von 14 30.08.2011 17:46
Neweulm2 - List of <strong>file</strong>s - IT M Wiki<br />
timeInt.m<br />
twoSideDivide.m<br />
updateN2DataStructure.m<br />
updateYVarTemplate.m<br />
writeFinalCond.m<br />
writeGenCoordDef.m<br />
writeHelpvarDef.m<br />
writeMbsNonLinRecur<br />
neweulm2 -<br />
Simulation and<br />
Animation<br />
Perform a time<br />
integration<br />
For a transformation of a<br />
Auxiliary function tensor with a matrix<br />
from two sides<br />
Called from<br />
calcEqMotNonLin.m,<br />
this function ensures<br />
all settings are up to<br />
date, even when<br />
running older models<br />
Adjusts <strong>file</strong>s to calculate<br />
state dependent<br />
Auxiliary function parameters to changes in<br />
the order of generalized<br />
coordinates<br />
neweulm2 -<br />
Simulation and<br />
Animation<br />
neweulm2 -<br />
Equations of Motion<br />
neweulm2 -<br />
Equations of Motion<br />
neweulm2 -<br />
Equations of Motion<br />
writeMbsNonLinRecurMinimal neweulm2 -<br />
Equations of Motion<br />
writeMultiplication<br />
neweulm2 -<br />
Equations of Motion<br />
Write <strong>file</strong>s for final<br />
conditions in a time<br />
integration or some<br />
display during<br />
integration<br />
Initialize generalized<br />
coordinates in<br />
automatically created<br />
functions<br />
Initialize parameters in<br />
automatically created<br />
functions<br />
Write <strong>file</strong>s for the<br />
recursive algorithm<br />
Write <strong>file</strong>s for the<br />
recursive algorithm<br />
using minimal<br />
formulation<br />
Create the code to<br />
evaluate the<br />
multiplication of vectors<br />
and matrices<br />
13 von 14 30.08.2011 17:46
Neweulm2 - List of <strong>file</strong>s - IT M Wiki<br />
writeOptiAdjoint.m<br />
writeOptiDirect.m<br />
writeSetValDef.m<br />
writeSysDef.m<br />
write_psi.m<br />
neweulm2 -<br />
Simulation and<br />
Animation<br />
neweulm2 -<br />
Simulation and<br />
Animation<br />
neweulm2 -<br />
Equations of Motion<br />
neweulm2 -<br />
Exporting<br />
neweulm2 -<br />
Simulation and<br />
Animation<br />
Write <strong>file</strong>s for a<br />
sensitivity analysis with<br />
the adjoint variable<br />
method<br />
Write <strong>file</strong>s for a<br />
sensitivity analysis with<br />
the direct method<br />
Initialize set values of<br />
generalized coordinates<br />
in automatically created<br />
functions for linear<br />
equations<br />
Export the currently<br />
loaded model to an input<br />
<strong>file</strong> for the command line<br />
version<br />
Write <strong>file</strong> for the<br />
evaluation of the function<br />
criterion for optimization<br />
or sensitivity analysis<br />
Retrieved from "http://www.itm.uni-stuttgart.de/itmwiki/index.php/Neweulm2_-<br />
_List_of_<strong>file</strong>s"<br />
This page was last modified 14:37, 30 August 2011.<br />
14 von 14 30.08.2011 17:46
Neweulm2 - System Definition - IT M Wiki<br />
Neweulm2 - System Definition<br />
From ITM Wiki<br />
Contents<br />
1 System Definition<br />
2 Restrictions for Names<br />
3 Available functions for System Definition<br />
3.1 newSys<br />
3.2 newGenCoord<br />
3.3 newUserVarKonst<br />
3.4 newUserVarTvar<br />
3.5 newUserVarYvar<br />
3.6 newBody<br />
3.7 newKsys<br />
3.8 newForceElem<br />
3.8.1 ATTENTION! Possible Source of Errors!<br />
3.9 newLoop<br />
3.10 modifyBody<br />
3.11 declareDependent<br />
3.12 newSysIn<br />
3.13 newSysOut<br />
3.14 newTimeData<br />
3.15 newVolume<br />
4 Loading and Saving<br />
4.1 load_neweulm2_System<br />
4.2 save_neweulm2_System<br />
5 See also<br />
5.1 ITM Wiki<br />
System Definition<br />
In the following, the functions used to define a multibody system in Neweul-M²<br />
are explained. The system is defined in the <strong>file</strong> sysDef.m. The following<br />
commands for the system definition are available:<br />
1 von 25 30.08.2011 17:46
Neweulm2 - System Definition - IT M Wiki<br />
Command<br />
Description<br />
newSys<br />
generate data structure for system<br />
newUserVarKonst declare constant userdefined variable<br />
newUserVarTvar declare time-variant userdefined variable<br />
newUserVarYvar declare state-dependent userdefined variable<br />
newBody define body<br />
newKsys<br />
define coordinate system<br />
newForceElem define force element<br />
newLoop<br />
define a kinematic loop<br />
kinematic loops create dependencies between coordinates,<br />
declareDependent<br />
with this function you can declare which are dependent<br />
newSysIn define system input<br />
newSysOut define system output<br />
newTimeData use time dependent data as lookup table<br />
newVolume create volume element for pressure forces<br />
In the subsequent sections, these commands and their options are described in<br />
detail. In general, all options are optionally, i.e. they must not be passed<br />
necessarily. In case an option is not passed, a default value is used instead.<br />
Further, all options except numerical values have to be passed as strings.<br />
Restrictions for Names<br />
Basically you can use all names Matlab considers valid for your system<br />
parameters, e.g. no leading numbers. There are restrictions to variable names,<br />
as some names are assigned a special meaning. Also parameters with these<br />
names or extensions are created automatically assuming that they do not collide<br />
with names given by the user.<br />
The Parameter 'g' is reserved for the gravitational constant.<br />
Names ending on '_s' are reserved for set values for the generalized<br />
coordinates in case of a linearization of the equations of motion.<br />
Time derivatives of set values and of time dependent parameters are<br />
denoted with a leading 'D' or 'D2' respectively.<br />
Internally used parameters as loop parameters or state vectors are denoted<br />
with a trailing <strong>und</strong>erscore '_'.<br />
The well loved parameters 'i' and 'j' are used by Matlab to denote the<br />
complex unit. Their use could therefore cause strange errors or results.<br />
From the version R2007b+ on the Symbolic Math Toolbox uses MuPad instead of<br />
2 von 25 30.08.2011 17:46
Neweulm2 - System Definition - IT M Wiki<br />
the Maple kernel used before. This new symbolic engine has some reserved<br />
names of its own, which may cause strange errors if used in the definitions:<br />
E, I, D, O<br />
beta, zeta, theta, psi, gamma<br />
Ci, Si, Ei<br />
If your variable names match none of the above there should be no problems.<br />
The routines to create new parameters issue warnings if one of these naming<br />
conventions is violated, but they create the parameter anyway. Ignoring these<br />
conventions may cause strange errors or strange results, which is even worse.<br />
When creating modeling elements like bodies or force elements you can usually<br />
enter an ID and a Name for this object. As all data is stored in the structure sys<br />
the data concerning this element is stored <strong>und</strong>er a substructure named as the<br />
ID. Therefore each ID has to fulfill the criteria Matlab requires for valid field<br />
names. This includes e.g. no leading numbers, no spaces. To be able to store a<br />
readable name or a short description, the Name field was introduced. This is<br />
stored as a string and therefore offers a wide range of available characters.<br />
Available functions for System<br />
Definition<br />
newSys<br />
Initialize new multibody system.<br />
Syntax<br />
newSys('option1','value1')<br />
Selection of some options<br />
Option Description Default Value<br />
Id Identifier of system 'MBS'<br />
Name Name of system 'Multibody System'<br />
Gravity Gravity vector '[0; 0; -g]'<br />
Description<br />
Execution of the command newSys generates a data structure sys which<br />
contains all data concerning the multibody system. Further the inertial system<br />
ISYS is generated which serves as reference system for further coordinate<br />
systems. The constant user-defined variable g is defined which serves as<br />
3 von 25 30.08.2011 17:46
Neweulm2 - System Definition - IT M Wiki<br />
gravitational constant.<br />
Data Structure<br />
The data structure sys has the following entries:<br />
Entry<br />
id<br />
name<br />
numUserVar<br />
userVar<br />
abbreviations<br />
gravity<br />
dof<br />
genCoords<br />
vectors<br />
numksys<br />
ksys<br />
numbodies<br />
Meaning<br />
Identifier of system<br />
Name of system<br />
number of user-defined variables<br />
substructure with user-defined variables and their values<br />
substructure for automatically created abbreviations<br />
gravity vector<br />
degrees of freedom<br />
list of generalized coordinates<br />
substructure with vectors of different things, e.g. elastic<br />
generalized coordinates, input, output, ...<br />
number of coordinate systems<br />
substructure with data of coordinate systems<br />
number of bodies<br />
numelastbodies number of elastic bodies<br />
body<br />
substructure with body data<br />
numfelem number of force elements<br />
felem<br />
substructure with data of force elements<br />
in<br />
substructure with three categories of system input channels<br />
out<br />
substructure with two categories of system output channels<br />
numloops number of kinematic loops<br />
loop<br />
substructure with kinematic loops<br />
numelements number of other modeling elements<br />
element<br />
substructure with other modeling elements, e.g. pressure<br />
volumes<br />
eqc<br />
substructure containing the constraint equations for<br />
kinematic loops<br />
eqm<br />
nonlinear equations of motion<br />
lin<br />
linearized equations of motion<br />
par<br />
substructure with parameters for this system's simulation and<br />
animation<br />
graphics substructure with graphical visualization<br />
results simulation results<br />
4 von 25 30.08.2011 17:46
Neweulm2 - System Definition - IT M Wiki<br />
tmp<br />
userData<br />
temporal data<br />
user data<br />
Example<br />
newSys;<br />
newSys('Id','mySystem','Name','This is my favourite system');<br />
newGenCoord<br />
Declaration of a new generalized coordinate.<br />
Syntax<br />
newGenCoord('VarName1','VarName2');<br />
Data Structure<br />
All generalized coordinates are stored <strong>und</strong>er sys.genCoords. Their classification<br />
is visible <strong>und</strong>er sys.vectors.genCoords.<br />
Example<br />
newGenCoord('alpha1','x3','y5');<br />
newUserVarKonst<br />
Declaration of constant user-defined variables.<br />
Syntax<br />
newUserVarKonst('VarName1',Value1,'VarName2',Value2,...);<br />
newUserVarKonst('VarName1','VarName2',...);<br />
newUserVarKonst('VarName1',Value1,'VarName2','VarName3',...);<br />
Description<br />
In the equations of motion of a multibody system, different types of variables<br />
occur. Basically we distinguish between the so-called generalized coordinates<br />
which describe the motion of the system, and the user-defined variables which<br />
represent the system parameters like geometry, masses etc. Within the<br />
user-defined variables, we further distinguish between constant, time-varying<br />
and state dependent variables. The command newUserVarKonst is used for the<br />
declaration of constant user-defined variables. For available parameter names<br />
see #Restrictions for Names. Each valid expression 'VarName1' is considered as<br />
a new parameter and initialized as such. If such a parameter is followed by a<br />
numerical value, Value1, this value is assigned to the previous parameter, here<br />
5 von 25 30.08.2011 17:46
Neweulm2 - System Definition - IT M Wiki<br />
'VarName1'. Also a mixture is possible, where only for some of the given new<br />
parameters numerical values are given. If nothing is specified, the values are<br />
initialized to zero.<br />
The numerical values can be specified at this point in the simulation. Initially,<br />
the numerical values have been defined in the <strong>file</strong> setUserVar.m. The point and<br />
time of specification does not affect the setting up of equations. The time of<br />
assignment only has to fulfill two criteria: The parameter must have been<br />
defined before, and it has to be done, before some tasks require numerical<br />
values. Usually the first task to require values is either the creation of an<br />
animation window or a time integration.<br />
Data Structure<br />
The IDs of all constant user-defined variables are stored in sys.userVar.konst.<br />
The numerical values which are necessary for simulations are assigned to<br />
sys.userVar.data.(VarNamei).<br />
Example<br />
newUserVarKonst('m1','L2','omega');<br />
newUserVarKonst('m1',6,'L2','omega',5);<br />
newUserVarTvar<br />
Declaration of time-dependent user-defined variables.<br />
Syntax<br />
newUserVarTvar('VarName1','Expression1', 'VarName2','Expression2'...);<br />
Description<br />
newUserVarTvar('VAR','EXP') introduces the time-dependent variable VAR<br />
and its first and second time-derivative DVAR and D2VAR to the system. For<br />
running simulations, the numerical value of the variable and the first and second<br />
derivative w.r.t. time have to be defined as function of time in the m-<strong>file</strong><br />
functions f_VAR.m, f_DVAR.m and f_D2VAR.m which are located in the<br />
directory userFunctions/ in the model directory. EXP can be a symbolic<br />
expression, which is necessary for the calculation of gradients. When calling<br />
newUserVarTvar with an EXP being an empty string, template functions are<br />
generated which have to be edited by the user. Already defined functions are<br />
not overwritten. If EXP contains a symbolic expression it is used to calculate the<br />
derivatives and is stored in the created functions. If EXP is a symbolic<br />
expression, existing <strong>file</strong>s in userFunctions/ are overwritten during creation of<br />
the parameter. The symbolic expression in the structure sys is used solely for<br />
the calculation of gradients and the creation of the <strong>file</strong>s in userFunctions/. In<br />
all other symbolic expressions and functions for numerical evaluation the<br />
parameter VAR and the corresponding <strong>file</strong>s are used.<br />
6 von 25 30.08.2011 17:46
Neweulm2 - System Definition - IT M Wiki<br />
Data Structure<br />
The variable and its first and second time-derivative are added to the list<br />
sys.userVar.tvar. The corresponding function handles or symbolic expressions<br />
are stored in sys.userVar.data<br />
Example<br />
newUserVarTvar('u1',);<br />
newUserVarTvar('u1','sin(3*t)');<br />
newUserVarYvar<br />
Syntax<br />
newUserVarYvar(VarName1,Expression1,Varname2,Expression2);<br />
Description<br />
With this command, for each Varname* a new variable is created, which may<br />
depend on the current state and the time t. As these parameters may depend on<br />
the time t, the first and second time derivatives called DVarname* and<br />
D2Varname* are created as well. For each of them, a template function for the<br />
numerical evaluation is created. If a cooresponding symbolic expression<br />
Expression* is given, this is entered in the template functions.<br />
ATTENTION! These parameters offer many possibilities, but the<br />
program cannot check whether all necessary information has been<br />
specified in the <strong>file</strong>s. Therefore if the user forgets to provide<br />
information, they also offer many possibilities to create mistakes!<br />
This parameter type serves two main purposes. First it allows the user to define<br />
nonlinear force laws. For this instead of a constant stiffness or damping<br />
parameter, such a state dependent parameter is used. In the template function<br />
the user usually has to call the functions providing positions and velocities of<br />
coordinate systems. From these, relative position and velocity vectors may be<br />
calculated, necessary for the evaluation of the stiffness or damping for a given<br />
state.<br />
The second main use is to define state dependent excitations, like a street-bump<br />
for a car model, which will be used as an example in the following explanations.<br />
For a constant speed of the car such a bump could be modeled with time<br />
dependent parameters. But if the car may have varying velocity and the bump<br />
shall be at a given position in space, state dependent parameters are necessary.<br />
The problem here is that for every coordinate system, the jacobian matrices of<br />
rotation and translation are calculated. As right now this feature is only fully<br />
supported in the use as translational excitations, I will focus now on the jacobian<br />
of the translation. The jacobian matrix of the translation is the derivative of the<br />
position vector r with respect to the generalized coordinates y. If then a state<br />
7 von 25 30.08.2011 17:46
Neweulm2 - System Definition - IT M Wiki<br />
dependent parameter is used to define such a position vector, the derivatives<br />
with respect to all generalized coordinates are necessary. As the number of<br />
generalized coordinates may change after the definition of such a parameter,<br />
the user cannot define all these derivatives. Therefore an intermediate step is<br />
introduced. The position of each coordinate system except ISYS is defined in its<br />
reference system. And usually the derivatives with respect to the local<br />
coordinate directions of the reference system are quite easy to provide.<br />
Therefore these derivatives have to be given by the user, and they are used with<br />
the chain rule of derivatives to calculate the derivatives with respect to all<br />
generalized coordinates. These derivatives with respect to the coordinate<br />
directions are denoted as Varname_D*_, where * is a placeholder for a number<br />
from 1 to 3, denoting the index of the axis. For their evaluation the function of<br />
Varname is automaticlly called with a flag, denoting to return the derivative.<br />
Data Structure<br />
The entries in the data structure are similar to those from time-dependent<br />
parameters.<br />
Example<br />
newUserVarYvar('u2','abs(x)');<br />
newBody<br />
Definition of a new body.<br />
Syntax<br />
newBody('parameter1','value1','parameter2','value2',...);<br />
Option<br />
Description<br />
Default<br />
Value<br />
Id Identifier of body 'BODY_XX'<br />
Name Name of body<br />
'Body<br />
Number XX'<br />
Type Type of body, 'rigid' or 'flex' 'rigid'<br />
RefSys<br />
reference coordinate system, from which the body<br />
is defined<br />
'ISYS'<br />
RelPos<br />
relative position vector to primary system,<br />
described in refSys, from refSys<br />
[0 0 0]'<br />
RelRot<br />
relative rotation angles of primary system,<br />
described in refSys, from refSys<br />
[0 0 0]'<br />
8 von 25 30.08.2011 17:46
Neweulm2 - System Definition - IT M Wiki<br />
CgPos<br />
relative position of center of gravity, described in<br />
the primary system, only for rigid bodies<br />
[0 0 0]'<br />
CgRot<br />
rel. rotation of coordinate system in center of<br />
gravity, described in the primary system, only for [0 0 0]'<br />
rigid bodies<br />
Mass mass 1<br />
Inertia inertia tensor w.r.t. center of gravity eye(3)<br />
SID<strong>file</strong><br />
specification of the .SID_FEM <strong>file</strong> containing<br />
information of the elastic body. Instead of this a<br />
.mat <strong>file</strong> or directly the resulting data structure can<br />
be passed.<br />
JointSys<br />
For elastic bodies with a floating frame of<br />
reference, the frame, which is connected to the<br />
previous (parent) body can be specfied<br />
Specifies which frame is used to describe the<br />
RelRotFrame orientations, either the Joint System 'JointSys', or<br />
the frame of reference 'JointRef'<br />
Description<br />
newBody adds a body to the multibody system. The body is represented by a<br />
coordinate system BODY_XX which is named like the body itself, and a<br />
coordinate system BODY_XX_cg describing the position of the center of gravity.<br />
The position and orientation of the system BODY_XX_cg is defined by the<br />
options CgPos and CgRot. All rotation angles are expected to be Kardan angles,<br />
i.e. rotation angles aro<strong>und</strong> the current x-, y- and z-axis. The degrees of freedom<br />
of the body are defined by the choice of the relative position and the relative<br />
rotation. If there are unknown variables used for the definition of the position<br />
and orientation of the body, i.e. variables which are not declared as user-defined<br />
by the commands newUserVarKonst or newUserVarTvar, the corresponding<br />
motions are expected to be a degree of freedom of the body, and the variables<br />
are treated as generalized coordinates. On the other hand, all directions of<br />
motion for which numeric values or user-defined variables are used are<br />
constrained.<br />
Data Structure<br />
For each body a substructure named by the body ID is generated at sys.body<br />
with the following entries:<br />
Entry<br />
id<br />
Identifier of body<br />
Meaning<br />
9 von 25 30.08.2011 17:46
Neweulm2 - System Definition - IT M Wiki<br />
name Name of body<br />
idx Index of body<br />
type either a 'rigid' or 'elastic' body<br />
data containing additional information, e.g. elastic information<br />
refsys reference coordinate system<br />
r_rel relative position vector<br />
phi_rel relative rotation angles<br />
r_cg rel. position of center of gravity<br />
phi_cg rel. rotation of coordinate system in center of gravity<br />
m mass<br />
I<br />
inertia tensor w.r.t. center of gravity, described in the frame in the<br />
center of gravity!<br />
M body mass matrix, described in the frame in the center of gravity!<br />
ksys coordinate systems belonging to the body<br />
geo graphical representation<br />
logical, whether this elastic body has been reduced symmetrically or<br />
oblique<br />
not<br />
elastIdx index counting only elastic bodies<br />
Example<br />
newGenCoord('a1');<br />
newBody('RelRot','[a1; 0; 0]', 'CgPos','[0; 0; -2]', 'Mass','3');<br />
newKsys<br />
Definition of new coordinate system.<br />
Syntax<br />
newKsys('Parameter1','Value1','Parameter2','Value2',...);<br />
Option Description Default Value<br />
Id Identifier of coordinate system 'KSYS_XX'<br />
Name Name of coordinate system<br />
'Coordinate system<br />
Number XX'<br />
Type<br />
Type of coordinate system, empty means regular<br />
frame, other options are 'nodal', 'JointSys' or<br />
'JointRef'<br />
' '<br />
10 von 25 30.08.2011 17:46
Neweulm2 - System Definition - IT M Wiki<br />
RefSys reference coordinate system<br />
RelPos relative position vector<br />
RelRot relative rotation angles<br />
'ISYS'<br />
[0 0 0]'<br />
[0 0 0]'<br />
Description<br />
newKsys adds a new coordinate system to the multibody system. This can be<br />
used either as reference system for other bodies or coordinate systems, for the<br />
definition of force application points or for kinematic output of specific points<br />
during simulation. The coordinate system belongs to the same body as its<br />
reference system. Generalized coordinates can be used for its definition, but<br />
should be handled carefully, as a coordinate system doesn't have a mass<br />
property. This could easily cause a singular mass matrix.<br />
Data Structure<br />
Entry<br />
Meaning<br />
id Identifier of coordinate system<br />
name Name of coordinate system<br />
idx Index of coordinate system<br />
children coordinate systems which use this system as reference system<br />
body body to which the coordinate system belongs<br />
type specify type of coordinate system<br />
refsys reference system<br />
relkin relative symbolic kinematics<br />
absolute symbolic kinematics, corresponding values to functions in<br />
symkin numkin for more information see neweulm2 - Equations of<br />
Motion#calcKin<br />
numkin handles of functions for the numerical evaluation of kinematics<br />
calckin<br />
symbolic kinematics, used for the calculation, only necessary values<br />
exist<br />
geo graphical representation<br />
Example<br />
newKsys('RelPos',[0.1; 0.2; 0.3]');<br />
newForceElem<br />
Definition of a new force element.<br />
11 von 25 30.08.2011 17:46
Neweulm2 - System Definition - IT M Wiki<br />
Syntax<br />
newForceElem('Parameter1','Value1','Parameter2','Value2',...);<br />
Option Description Default Value<br />
Id Identifier of force element 'FELEM_XX'<br />
Name Name of force element<br />
'Forceelement Number<br />
XX'<br />
Type Type of force element 'SpringDampCmp'<br />
Ksys1 Coordinate system 1 'ISYS'<br />
Ksys2 Coordinate system 2 'ISYS'<br />
DirDef<br />
Coordinate system for the definition of<br />
force directions<br />
Ksys1<br />
FAP1<br />
force application point for side 1 of force<br />
element<br />
Ksys1<br />
FAP2<br />
force application point for side 2 of force<br />
element<br />
Ksys2<br />
ForceLaw Force Law for general force element [0 0 0 0 0 0]'<br />
Stiffness<br />
stiffness coefficients for SpringDampCmp<br />
element<br />
[0 0 0 0 0 0]'<br />
Damping<br />
damping coefficients for SpringDampCmp<br />
[0 0 0 0 0 0]'<br />
element<br />
NomLength Nominal length of Spring<br />
[0 0 0 0 0 0]'<br />
NomForce<br />
Force applied in the case of the nominal<br />
length of Spring<br />
[0 0 0 0 0 0]'<br />
Description<br />
newForceElem adds a force element to the multibody system which acts<br />
between the two points described by the coordinate systems Ksys1 and Ksys2.<br />
The reference system, i.e. the system which defines the directions of the force<br />
components, is defined by the DirDef option (default is Ksys1).<br />
SpingDampCmp* - types<br />
For a force element of type SpingDampCmp/SpingDampCmpRotmat<br />
/SpingDampCmp_Lin the stiffness- and damping coefficients can be passed as<br />
matrix or vector alternatively. When passing stiffness- and damping matrices,<br />
the force and moment is calculated by<br />
where and are the relative position and orientation between the two<br />
12 von 25 30.08.2011 17:46
Neweulm2 - System Definition - IT M Wiki<br />
coordinate systems. In case that the coefficients are passed as vectors, the force<br />
and moment is calculated as<br />
The direction of force and moment is defined to be positive for Ksys1 and<br />
negative for Ksys2.<br />
If the nominal length shall be used it is defined as follows. For each coordinate<br />
direction of the relative position and orientation vectors, displayed in the DirDef<br />
frame a nominal length and can be given. This 6x1 vector is then<br />
subtracted from the actual relative vectors before calculating the applied forces<br />
and torques.<br />
The nominal forces and torques and are those forces being applied when<br />
the relative vector is identical to the vector of nominal lengths. This is an<br />
important feature especially for state-dependent stiffness parameters.<br />
Rotations<br />
There is an almost infinite number of halfway reasonable formulations for the<br />
angular values corresponding to the torque vector. However, there is hardly any<br />
really correct version of this problem. The reason for this is that the generalized<br />
force law stated above uses a matrix vector notation, which itself is a linear<br />
description. Rotational effects, however, are nonlinear and would require a<br />
different formulation for large displacements. But then, for large relative<br />
rotation angles, the triplet of rotation angles does not have vector properties.<br />
Therefore there are currently three possibilities implemented:<br />
SpringDampCmp: This is the standard force element. Here the relative<br />
rotation angles between the two coordinate systems are calculated and used<br />
directly, which corresponds to being interpreted as small and having vector<br />
properties.<br />
SpringDampCmpRotMat: This once was the standard type. Here the<br />
relative rotation matrices between the respective two coordinate systems<br />
and the Dirdef system are set up. Therefore this type considers some<br />
nonlinearities and usually creates longer expressions.<br />
SpringDampCmp_Lin: This uses the rotational Jacobian matrices together<br />
with the rotation angles, which results in a formulation ranging between<br />
the other two.<br />
One rather simple workaro<strong>und</strong>, which also makes the model easier to<br />
13 von 25 30.08.2011 17:46
Neweulm2 - System Definition - IT M Wiki<br />
<strong>und</strong>erstand is to split up rotational springs or dampers. In planar cases, the<br />
order of rotation does not have any influence. If you therefore create three<br />
different force elements, one for each direction, there are usually no problems.<br />
For a force element of type SpingDampPtp the stiffness- and damping<br />
coefficients are scalar values. This type of force element represents a springdamper<br />
combination acting only on behalf of the distance between the to<br />
application points, always in direction of their connection. A nominal length l 0<br />
and corresponding nominal force F 0 are available as well, being both scalar<br />
values. With being the relative position vector and its derivative w.r.t time<br />
the normalized position vector is<br />
Then the force is calculated as<br />
For this type no Moments are calculated, the DirDef option is unnecessary and<br />
therefore set to ISYS. The other options and directions are similar to<br />
SpringDampCmp.<br />
For the force element of type General, force and moment are defined by a<br />
general, arbitrary force law which is passed by the ForceLaw option. Decided<br />
by the given size of the vector, it is interpreted to be a six element vector<br />
containing forces and moments like a SpringDampCmp element. Or if a scalar<br />
value is given, it will act in the connection of the two frames like a<br />
SpringDampPtp element. This type of force element can be used to implement<br />
force excitations. To define a force excitation on coordinate system 'myKsys1'<br />
first a time dependent parameter, e.g. u1 has to be defined. Depending on the<br />
direction of the applied force the DirDef has to be entered correctly. Then the<br />
following command can be used:<br />
newForceElem('Id','myExcit', 'Name','my Excitation', ...<br />
'Type','General', 'Ksys1','ISYS', 'Ksys2','myKsys1', ...<br />
'DirDef','ISYS', 'FAP','myKsys1', 'ForceLaw','[u1;0;0;0;0;0]');<br />
With this, the force is applied positive at coordinate system ksys1 and negative<br />
at coordinate system ksys2. Now the force vector is completely defined and then<br />
is applied at the force application point, which usually is one of the two involved<br />
coordinate systems.<br />
The force application point is defined by the FAP1 and FAP2 options. There<br />
was only one force application point, which is perfectly reasonable if the force<br />
acts in the direction of the relative position vector. In the case of a<br />
SpringDampPtp force element this is always the case, because it is made to be<br />
like that. For the other force elements this does not hold true and posed some<br />
problems if only one force application point is considered. To <strong>und</strong>erstand this,<br />
14 von 25 30.08.2011 17:46
Neweulm2 - System Definition - IT M Wiki<br />
let's have a look at what the force application point is actually used for.<br />
If a force is applied at a body in a way that its line of action does not pass<br />
through the center of gravity, it will cause a moment. Let's consider a<br />
SpringDampCmp force element which connects two bodies. If its two coordinate<br />
systems have a distance only in one coordinate direction, in which the force<br />
element will produce a force, everything works fine. If this displacement is, e.g.<br />
because of the choice of DirDef, to be separated in two coordinate directions<br />
with a stiffness parameter each, the trouble begins as soon as these two<br />
parameters are different. If the stiffness parameters are different, the force will<br />
no longer point into the direction of the relative position vector between the two<br />
coordinate systems. Then it makes a difference which of the two coordinate<br />
systems involved is used to calculate the moment, as they are no longer<br />
connected by the line of action of the force. But the two coordinate systems have<br />
to be on two different bodies for the force to appear in the equations of motion.<br />
Therefore for each of the involved bodies its respective coordinate system should<br />
be considered as the force application point. On the other hand, one should be<br />
aware that such a force element may result in an unwanted moment with<br />
respect to the center of gravity. But it is reasonable and in some case necessary<br />
to use two different force application points. This effect could be easily avoided<br />
by defining both force application points on the same coordinate system.<br />
ATTENTION! Possible Source of Errors!<br />
When using rotational springs there is a possibility of producing unchecked<br />
errors. As long as possible, relative rotation angles between two coordinate<br />
systems are set up using the relative angles of all coordinate systems in<br />
between. However, in some spatial cases this is not possible. Then the relative<br />
rotation angles will be extracted out of the relative rotation matrix. As soon as a<br />
rotation matrix is involved, expressions like asin(sin(alpha)) will appear by<br />
starting with the angle alpha, setting up the rotation matrix, causing a<br />
sin(alpha) and attempting the inverse function. However, sometimes the<br />
symbolic engine is unable to identify all of these expressions. The problem is,<br />
that basically asin(sin(alpha)) should be the same as alpha. However the range of<br />
possible values is different. The parameter alpha can take any real numbered<br />
value, asin(sin(alpha)) however is restricted to [-pi/2; pi/2]. This may cause some<br />
really strange errors as they are very difficult to spot. The best way to avoid<br />
them is to make sure that rotational springs and similar force elements always<br />
use angles inside the interval [-pi/2; pi/2], where there is no difference.<br />
Data Structure<br />
For each force element an entry in sys.felem with the ID of the force element is<br />
created. The data structure of a force element has the following entries:<br />
15 von 25 30.08.2011 17:46
Neweulm2 - System Definition - IT M Wiki<br />
Entry<br />
Meaning<br />
id Identifier of force element<br />
name Name of force element<br />
idx Index<br />
type Type of force element<br />
ksys1 Coordinate system 1<br />
ksys2 coordinate system 2<br />
dirdef Coordinate system for the definition of force directions<br />
fap force application point<br />
flaw Force Law for general force element<br />
k<br />
stiffness coefficients for SpringDampCmp/SprinDampPtp element<br />
c<br />
damping coefficients for SpringDampCmp/SprinDampPtp element<br />
nomlength nominal length<br />
nomforce nominal force, applied at nominal length<br />
Example<br />
newForceElem('Type','SpringDampPtp', 'Ksys1','ISYS', 'Ksys2','KSYS_1', ...<br />
'Stiffness',5, 'Damping',0.2, 'NomLength',0.3);<br />
newLoop<br />
Syntax<br />
newLoop('Id','VAR1', 'Name','VAR2', 'Ksys1','VAR3', 'Ksys2','VAR4',<br />
'Constraints', VAR5);<br />
Description<br />
This command creates a new kinematic loop, which is closed between ksys1 and<br />
ksys2. The constrained directions are defined by Constraints, with respect to the<br />
coordinate system denoted as DirDef. As a kinematic loop creates a dependency<br />
between generalized coordinates this command should be followed by a call of<br />
declareDependent later. A simple check if the constraint equations are<br />
dependent is contained, but it cannot find all possible dependencies. Therefore<br />
the user has to provide the kinematic loops in a way which guarantees their<br />
independency. This is necessary because the jacobian matrix of the constraint<br />
equations is contained in the equations of motion.<br />
Option Description Default Value<br />
Id Identifier of the kinematic loop 'LOOP_1'<br />
16 von 25 30.08.2011 17:46
Neweulm2 - System Definition - IT M Wiki<br />
Name Name of this kinematic loop<br />
'Loop Number<br />
1'<br />
Ksys1 Coordinate system 1 'ISYS'<br />
Ksys2 Coordinate system 2 'ISYS'<br />
DirDef Coordinate system defining the directions Ksys1<br />
Vector (1x6) of which degrees of freedom are<br />
Constraints<br />
constrained<br />
[0 0 0 0 0 0]<br />
Data Structure<br />
Entry<br />
Content<br />
id Loop id<br />
name Loop name<br />
ksys1 First coordinate system of this loop<br />
ksys2 Second coordinate system of this loop<br />
dirdef Coordinate system defining the directions<br />
con Vector of constraint directions<br />
c_3 Vector of constraint equations on position level<br />
Cell array which notes, at which position in the constraint vector<br />
numofeqc<br />
these constraints are located<br />
Example<br />
newLoop('Id','Loop1', 'Name','kinematic Loop 1', ...<br />
'Ksys1','ISYS', 'Ksys2','P1_cg', 'Constraints', [0 1 0 0 0 1]);<br />
modifyBody<br />
Syntax<br />
modifyBody(bodyID,varargin);<br />
Description<br />
Adjust properties of a body. For simple changes one could do without this<br />
function. However, it even allows to change the data of an elastic body and then<br />
only performs the necessary recalculations.<br />
Data Structure<br />
Example<br />
17 von 25 30.08.2011 17:46
Neweulm2 - System Definition - IT M Wiki<br />
modifyBody('BODY1','SID',elbodyData);<br />
declareDependent<br />
Syntax<br />
declareDependent('VAR1');<br />
Description<br />
Kinematic loops are created by adding algebraic equations to the set of<br />
differential equations. By this the generalized coordinates are dependent. Use<br />
this function to declare which coordinates, here VAR1, are to be considered<br />
dependent.<br />
Data Structure<br />
Example<br />
declareDependent('delta');<br />
newSysIn<br />
Definition of system input channels.<br />
Syntax<br />
newSysIn('Parameter1','Value1','Parameter2','Value2',...);<br />
Option<br />
Description<br />
Default<br />
Value<br />
Id Identifier of input channel 'SYSIN_XX'<br />
Name Name of system input channel<br />
'Input Number<br />
XX'<br />
Var<br />
Time-dependent variable which serves as input<br />
channel<br />
--<br />
Group<br />
Select in which of the three groups 'control',<br />
'disturbance' or 'addtional' this input belongs<br />
'control'<br />
Same as 'Group', except, that you can specify new<br />
newGroup<br />
input groups<br />
Description<br />
For the investigation of the transfer behavior of a linearized system it is<br />
necessary to define at least one input channel and one output channel. Every<br />
18 von 25 30.08.2011 17:46
Neweulm2 - System Definition - IT M Wiki<br />
time-dependent user-defined variable can serve as input channel.<br />
It is a priori not known from a given time dependent parameter u(t) if the<br />
parameter u itself or one of its first two time derivatives Du or D2u appears in<br />
the equations of motion. Therefore calcEqMotNonLin.m as a default checks for<br />
all occurences and includes all fo<strong>und</strong> derivatives in the input vector. You can<br />
check this vector in sys.vectors.in and if something went wrong, suppress this<br />
automatic selection in calcEqMotNonLin by an option. Please see<br />
'calcEqMotNonLin' for more information. Then all three values are kept, looking<br />
like<br />
[u; Du; D2u; v; Dv; D2v; ...]<br />
This would cause the input matrix, usually called B to be larger than some<br />
people would expect.<br />
Tip: You might want to have a look at the <strong>file</strong> eqm_lin_ssinout.m which<br />
automatically calculates the ABCD-matrices.<br />
The idea of the input groups is the following. When several inputs are defined, it<br />
may be useful to distinguish between them. Possible applications could be to<br />
distinguish between control inputs and disturbances in control design. Or when<br />
a controlled system shall be optimized with respect to the transfer function it<br />
would be easier to have this distinction. For each group a vector denoting the<br />
order exists <strong>und</strong>er 'sys.vectors.in'. If all inputs should be collected in one big<br />
vector, this will always be in the order 'control', 'disturbance', 'additional'.<br />
Data Structure<br />
For each system input channel an entry in the corresponding entry 'control',<br />
'disturbance', 'additional' <strong>und</strong>er sys.in is generated. The substructure has the<br />
following entries:<br />
Entry<br />
Meaning<br />
id Identifier of input channel<br />
name Name of system input channel<br />
idx Index of input channel<br />
var Time-dependent variable which serves as input channel<br />
Example<br />
newUserVarTvar('u1','sin(3*t)');<br />
newSysIn('Id','myInput','Name','This is just an example','Var','u1');<br />
newSysOut<br />
19 von 25 30.08.2011 17:46
Neweulm2 - System Definition - IT M Wiki<br />
Definition of system out channels.<br />
Syntax<br />
newSysOut('Parameter1','Value1','Parameter2','Value2',...);<br />
Option Description Default Value<br />
Id Identifier of output channel 'SYSOUT_XX'<br />
Name Name of system output channel<br />
'Output Number<br />
XX'<br />
Var Variable which serves as output channel --<br />
Type<br />
Specification of the type, if none given, the<br />
function tries to determine it<br />
being<br />
determined<br />
Group Which of the two groups 'control' or 'additional' 'control'<br />
Same as 'Group', except, that you can specify new<br />
newGroup<br />
output groups<br />
Description<br />
For the investigation of the transfer behavior of a linearized system it is<br />
necessary to define at least one input channel and one output channel. There are<br />
several different types of system outputs:<br />
kinematic values, e.g. the y-component of the absolute velocity vector of<br />
coordinate system 'ksys1' can be defined as system output by sysOut.var =<br />
'ksys1.v(2)'. Then type should be set to kinematic.<br />
generalized coordinates or their first time derivative, e.g. alpha, this is<br />
denoted by type genCoord.<br />
applied forces can be used as system outputs, described in the respective<br />
DirDef system. felem1(2) would denote the force in y-direction of force<br />
element felem1. The torque aro<strong>und</strong> the z-axis would be felem1(6), whereas<br />
felem1 denotes the norm of the force vector without torques.<br />
reaction forces are available as system outputs, also described in the local<br />
coordinate system of the parent coordinate<br />
volume elements can be used to return the calculated pressure p or change<br />
of pressure dp, e.g. element1.dp.<br />
the user can specify a symbolic expression directly with the type userDef.<br />
to get combinations of other system outputs, e.g. the difference between to<br />
kinematic values, the type combination can be used. Then a symbolic<br />
expression using the IDs of the other outputs is expected, e.g. outID1-<br />
outID2.<br />
Data Structure<br />
For each system output channel an entry <strong>und</strong>er the respective entry 'control' or<br />
20 von 25 30.08.2011 17:46
Neweulm2 - System Definition - IT M Wiki<br />
'additiona' in sys.out is generated. The substructure has the following entries:<br />
Entry<br />
Meaning<br />
id Identifier of output channel<br />
name Name of system output channel<br />
idx Index of output channel<br />
type<br />
Type of output, one of the following: 'kinematic', 'appliedForce',<br />
'reactionForce', 'genCoord', 'userDef'<br />
var<br />
generalized coordinate, kinematic variable, ... which serves as output<br />
channel<br />
sym symbolic expression, to be determined by the software<br />
data Additional information for this output, depending on its type<br />
Example<br />
newSysOut('Id','myExample','Name','This is my favorite output', ...<br />
'Var','BODY1_cg.r(1)', 'Type','kinematic');<br />
newTimeData<br />
Use precalculated time dependent data as a lookup table and interpolate<br />
between these set values.<br />
Syntax<br />
newTimeData('Parameter1','Value1','Parameter2','Value2',...);<br />
Description<br />
Stores the data <strong>und</strong>er sys.element and creates a function template for its<br />
evaluation. All of this can be adjusted by the user. This provides reproducible<br />
results, even when using stochastic excitations or allows the use of measured<br />
data.<br />
Data Structure<br />
Data is stored <strong>und</strong>er sys.element<br />
Example<br />
newTimeData('Id','mySine','x',linspace(0,20),'y',sin(linspace(0,20)));<br />
newVolume<br />
21 von 25 30.08.2011 17:46
Neweulm2 - System Definition - IT M Wiki<br />
Definition of a volume element for pressure forces.<br />
Syntax<br />
newVolume('Parameter1','Value1','Parameter2','Value2',...);<br />
Option Description Default Value<br />
Id Identifier of the volume element. 'ELEMENT_XX'<br />
Name Name of the element.<br />
'Element<br />
Number XX'<br />
Type Type of element. 'Volume'<br />
Coordinate systems marking the outer planes of the<br />
KsysSurf<br />
volume.<br />
' '<br />
DirDef<br />
Coordinate systems which define the force<br />
directions, in contrast to the force element, each ' '<br />
coordinate system can have its own DirDef system.<br />
RefArea Reference areas, belonging to neighboring masses. ' '<br />
Vdamp Damping of volume element in x,y and z direction [0 0 0]<br />
Vinf Inverse volume of the complete element 0<br />
pin Static pressure difference 0<br />
p0<br />
Static nominal pressure to define the working point<br />
of the pressure change calculation in [Pa]<br />
101300<br />
Parameter for the gas law, called 'Heat capacity<br />
kappa ratio' or 'adiabatic index or ratio of specific heats' or 1.4<br />
'Isentropenexponent' (in german)<br />
Description<br />
newVolume adds a volume element to the multibody system. It is defined by the<br />
coordinate systems in KsysSurf, which are the outer planes of the volume<br />
element. The areas belonging to the neighboring masses are defined in<br />
RefArea, wherein a negative sign means a volume reduction when the<br />
corresponding mass moving in positive direction. The pressure force at each<br />
mass is calculated as<br />
with<br />
Data Structure<br />
22 von 25 30.08.2011 17:46
Neweulm2 - System Definition - IT M Wiki<br />
Entry<br />
Meaning<br />
id Identifier of the volume element.<br />
name Name of the element.<br />
idx Index of the element.<br />
type Type of element.<br />
ksyssurf Coordinate systems marking the outer planes of the volume.<br />
Coordinate systems which define the force directions, in contrast to<br />
dirdef the force element, each coordinate system can have its own DirDef<br />
system.<br />
refarea Reference areas, belonging to neighboring masses.<br />
vdamp Damping of volume element in x,y and z direction<br />
vinf Inverse volume of the complete element<br />
pin Static pressure difference<br />
p0<br />
Static nominal pressure to define the working point of the pressure<br />
change calculation in [Pa]<br />
kappa<br />
Parameter for the gas law, called 'Heat capacity ratio' or 'adiabatic<br />
index or ratio of specific heats' or 'Isentropenexponent' (in german)<br />
dp Dynamic pressure change<br />
DV Dynamic volume change<br />
Example<br />
Loading and Saving<br />
You can simply save the system data structure sys to a .mat <strong>file</strong>.<br />
save myModel.mat sys<br />
This can then be loaded<br />
load myModel.mat<br />
and a corresponding animation window recreated by<br />
createAnimationWindow<br />
23 von 25 30.08.2011 17:46
Neweulm2 - System Definition - IT M Wiki<br />
load_neweulm2_System<br />
Syntax<br />
load_neweulm2_System(<strong>file</strong>name, <strong>file</strong>path, CallMode_);<br />
Description<br />
As a difference to simply saving the system data structure, the figure and<br />
settings of the graphical user interface (if available) are stored. Then the<br />
animation window will look exactly the same and not just almost.<br />
All of these arguments are optional. A <strong>file</strong>name and its path (<strong>file</strong>path) can be<br />
passed to the function. If they are ommitted the standard dialog to select a <strong>file</strong><br />
for loading is opened. The parameter CallMode_ can be used if the function shall<br />
be called from the command line. As a default the structure gui and the<br />
user-interface neweulm2 are adjusted. For more information type help<br />
load_neweulm2_System. This function was created to be called from the GUI, but<br />
is also available for the batch mode.<br />
Example<br />
load_neweulm2_System;<br />
load_neweulm2_System('mysystem.mat');<br />
save_neweulm2_System<br />
Syntax<br />
save_neweulm2_System(<strong>file</strong>name,<strong>file</strong>path,IncludeResults_);<br />
Description<br />
All of these arguments are optional. This function allows the user to save a<br />
system and its corresponding figure if available. The <strong>file</strong> will be called <strong>file</strong>name<br />
and located in the folder <strong>file</strong>path. With the boolean parameter IncludeResults_<br />
the user can decide if simulation results shall be included in the saved <strong>file</strong>. If the<br />
<strong>file</strong>name is not specified, the standard dialog box to save <strong>file</strong>s will be opened<br />
where the user can enter a <strong>file</strong>name. This function was created to be called from<br />
the GUI, but is also available for the batch mode.<br />
Example<br />
save_neweulm2_System;<br />
See also<br />
24 von 25 30.08.2011 17:46
Neweulm2 - System Definition - IT M Wiki<br />
ITM Wiki<br />
neweulm2<br />
neweulm2#Function reference<br />
neweulm2 - Equations of Motion<br />
neweulm2 - Simulation and Animation<br />
neweulm2 - Exporting<br />
Retrieved from "http://www.itm.uni-stuttgart.de/itmwiki/index.php/Neweulm2_-<br />
_System_Definition"<br />
This page was last modified 14:51, 30 August 2011.<br />
25 von 25 30.08.2011 17:46
Neweulm2 - Equations of Motion - IT M Wiki<br />
Neweulm2 - Equations of Motion<br />
From ITM Wiki<br />
Contents<br />
1 Options and general explanations<br />
1.1 Options stored <strong>und</strong>er sys.par<br />
1.2 General explanations<br />
2 Setting up the Equations of Motion<br />
2.1 Nonlinear Equations of Motion<br />
2.1.1 calcEqMotNonLin<br />
2.2 Linearized Equations of Motion<br />
2.2.1 calcEqMotLin<br />
2.2.2 calcNumericalLinearization<br />
2.2.2.1 Syntax<br />
2.3 Functions for Numerical Evaluation<br />
2.3.1 writeMbsNonLin<br />
2.3.2 writeMbsLin<br />
2.4 Auxiliary functions<br />
2.4.1 scriptCalcEqMotNonLin<br />
2.4.2 scriptWriteMbsNonLin<br />
2.4.3 NE2minimal<br />
2.4.4 calcCon<br />
2.4.5 calcForcesFelem<br />
2.4.6 calcForcesReaction<br />
2.4.7 kardan2rotmat<br />
2.4.8 rotmat2kardan<br />
2.4.9 relativeKinematics<br />
2.4.10 absoluteKinematics<br />
2.4.11 getabsoluteKinematics<br />
2.4.12 mapleSimplify<br />
2.4.13 mapleSubs<br />
2.4.14 writeStructure<br />
3 See also<br />
3.1 ITM Wiki<br />
Options and general explanations<br />
Neweul-M² calculates the equations of motion symbolically depending on the<br />
1 von 19 30.08.2011 17:47
Neweulm2 - Equations of Motion - IT M Wiki<br />
parameters defined by the user. This results in a readable form which can be<br />
checked by hand, although this is a very complex task for larger systems. Another<br />
advantage is that these expressions can be easily exported to other programs,<br />
programming languages and applications.<br />
Options stored <strong>und</strong>er sys.par<br />
The behavior of the software is controlled with entries <strong>und</strong>er sys.par. An up to date<br />
information about those options can be obtained by calling one of the following to<br />
commands:<br />
SystemParameters % GUI version<br />
printSystemInformation('par',true) % command line version<br />
Field<br />
Content<br />
sys.par.version Information about which version of Neweul-M² has been used<br />
General settings to control the behavior of the software,<br />
sys.par.codegen<br />
simplifications, ...<br />
sys.par.eqm Settings on how the equations of motion shall be set up<br />
sys.par.timeInt (Optional) Contains settings for the time integration<br />
sys.par.kian (Optional) Contains settings for the kinematic analysis<br />
sys.par.opt (Optional) Contains settings for the optimization<br />
Field<br />
Content<br />
Use code optimization or not. This<br />
optimization searches for expressions<br />
used several times and introduces<br />
sys.par.codegen.optimize<br />
abbreviations, which sometimes make's<br />
the code run faster and the <strong>file</strong>s<br />
smaller.<br />
Values in the range from 0 to 10<br />
specify how often the 'simplify'<br />
command is used. Even numbers also<br />
use the 'combine' command, which is<br />
sys.par.codegen.simplify especially useful for trigonometric<br />
expressions. It is NOT recommended to<br />
set this value to zero, as then some<br />
functions don't work properly, if they<br />
require some simplification.<br />
Possibilities<br />
(Standard<br />
selection<br />
comes first)<br />
false / true<br />
6 / 0 - 10<br />
2 von 19 30.08.2011 17:47
Neweulm2 - Equations of Motion - IT M Wiki<br />
Field<br />
Content<br />
Possibilities<br />
(Standard<br />
selection comes<br />
first)<br />
Select if the mass matrix shall<br />
be inverted numerically or<br />
sys.par.eqm.massMatrixInverse<br />
'num' / 'sym'<br />
symbolically. Symbolically works<br />
only for small systems<br />
Select whether constraint<br />
equations are used on position<br />
level (3), velocity level (2),<br />
sys.par.eqm.index<br />
acceleration level (1), or none at<br />
all (0). This specifies the<br />
maximum value in the system. If<br />
no constraints are present, the<br />
value doesn't matter<br />
1 / 2 / 3 / 0<br />
sys.par.eqm.equationType<br />
sys.par.eqm.formulation<br />
sys.par.eqm.angles<br />
If no constraint equations are<br />
present, the equations of motion<br />
are ordinary differential<br />
equations ('ode'). As soon as<br />
constraint equations are<br />
introduced, this parameter can<br />
be used to select an explicit or<br />
partial explicit formulation as<br />
well. The setting 'ode_automatic'<br />
uses coordinate partitioning as<br />
done with 'ode', but numerically<br />
selects a good linear<br />
combination of independent<br />
coordinates.<br />
Select whether the<br />
premultiplication of the Newton-<br />
Euler-Equations shall be done<br />
numerically or the minimal form<br />
with a symbolic<br />
premultiplication shall be used.<br />
This parameter will be used to<br />
select the recursive mode as<br />
soon as it's implemented.<br />
Select the angular formulation.<br />
The software has been using<br />
solely Kardan-angles (x-y-z) but<br />
now Euler-angles (z-x-z) are<br />
'explicit_Mconst'<br />
/ 'partialexplicit' /<br />
'ode' /<br />
'ode_automatic'<br />
'newtonEuler' /<br />
'minimal' /<br />
'recursive'<br />
'kardan' / 'euler' /<br />
'quaternion'<br />
3 von 19 30.08.2011 17:47
Neweulm2 - Equations of Motion - IT M Wiki<br />
sys.par.eqm.kinematics<br />
sys.par.eqm.frameOfReference<br />
sys.par.eqm.massSymmetric<br />
sys.par.eqm.abbreviations<br />
implemented as well. It is<br />
planned to provide quaternions<br />
as well.<br />
Use relative or absolute<br />
kinematics<br />
Currently this parameter is<br />
linked to the kinematics, but it<br />
might be implemented<br />
independently. For relative<br />
kinematics described in the<br />
floating frame of reference of<br />
each body is used, while<br />
absolute kinematics describes<br />
all values in the inertial frame<br />
ISYS. Currently if kinematics is<br />
the master setting, this one is<br />
adjusted accordingly.<br />
Specification whether the mass<br />
matrix is symmetric or not,<br />
usually this is not to be changed<br />
by the user, but determined<br />
automatically<br />
Specify how many abbreviations<br />
are introduced into the system.<br />
A value of 0 means no<br />
abbreviations at all. A value of 1<br />
denotes the usage of scalar<br />
abbreviations for kinematic<br />
expressions of nodes of elastic<br />
bodies, which mainly improves<br />
readability and offers some<br />
speed advantage. A value of 2<br />
denotes the usage of many<br />
abbreviations for all elastic<br />
bodies. This is slower in the<br />
evaluation, however the<br />
possibility to change elastic<br />
bodies without a complete<br />
recomputation is available.<br />
Therefore this setting is quite<br />
interesting for an optimization<br />
of elastic bodies.<br />
'rel' / 'abs'<br />
'body' / 'ISYS'<br />
true / false<br />
1 / 0 / 2<br />
4 von 19 30.08.2011 17:47
Neweulm2 - Equations of Motion - IT M Wiki<br />
General explanations<br />
Currently there are different calculation modes available.<br />
Different ways to set up the kinematics<br />
Absolute kinematics<br />
Relative kinematics<br />
Formulations of the equations of motion<br />
Minimal formulation:<br />
Semi-symbolic formulation:<br />
Let's have a look at the kinematics first. When dealing with rigid body multibody<br />
systems, usually all expressions are set up in the inertial frame ISYS. Jacobian<br />
matrices and other values are calculated by symbolic derivatives. This is algorithm is<br />
the same as performed manually. As the information of elastic bodies is described in<br />
the respective frame of reference of each body, the equations of motion are<br />
completely set up in this frame of reference. Therefore each block row, describing<br />
the motion of one body before multiplying with the global jacobian matrix is<br />
described in a different frame of reference. The values of the jacobian matrices and<br />
other values are only calculated by symbolic derivatives, where it cannot be avoided.<br />
All other operations are performed by multiplications due to relative kinematics.<br />
This replaces costly symbolic derivatives by simple multiplications.<br />
The formulations are distinguished in the following way. For the minimal<br />
formulation, the local equations of motion of all bodies are stacked and<br />
premultiplied with the transposed global jacobian matrix symbolically. This reduces<br />
the equations to the minimal number of equations. In the other formulation this<br />
multiplication is performed numerically. In the case of a small number of bodies<br />
with many degrees of freedom, so especially for flexible multibody systems. However<br />
if only a small number of modes is used together with a rather high number of rigid<br />
bodies a minimal formulation can be preferable.<br />
In the previous section, it was said that the equations of all bodies are stacked to<br />
obtain the Newton-Euler equations. This is a suitable procedure, when setting up the<br />
equations manually. However, here the calculations are much faster to use cell<br />
arrays. The equations could thus be written as<br />
One main time-saver is that otherwise the mass matrix and the Jacobian matrix<br />
are only sparsely populated. Their multiplication is therefore much faster when done<br />
in such a summation instead of composing the full matrices. In order to obtain the<br />
expressions from the Newton-Euler equations, you can use, e.g. the following<br />
5 von 19 30.08.2011 17:47
Neweulm2 - Equations of Motion - IT M Wiki<br />
commands<br />
qa = vertcat(sys.eqm.qa{:})<br />
Jg = vertcat(sys.eqm.Jg{:})<br />
Mq = blkdiag(sys.eqm.Mq{:})<br />
To calculate linear equations of motion the nonlinear equations of motion have to be<br />
calculated first, as they are linearized.<br />
If you calculated the equations of motion and want to have a look at them, you can<br />
find them here:<br />
nonlinear equations of motion in sys.eqm<br />
linearized equations of motion in sys.lin.eqm, with the set values for each<br />
coordinate specified in sys.lin.ref.<br />
Setting up the Equations of Motion<br />
In the following, the functions used to set up the equations of motion of a previously<br />
defined multibody system in Neweul-M² are explained. The system is defined in the<br />
<strong>file</strong> sysDef.m.<br />
Command<br />
calcEqMotNonLin<br />
calcEqMotLin<br />
writeMbsNonLin<br />
writeMbsLin<br />
Description<br />
Set up the symbolic nonlinear equations of motion<br />
Linearize the symbolic equations of motion<br />
Write <strong>file</strong>s for the numerical evaluation of kinematics and<br />
the nonlinear equations of motion<br />
Write <strong>file</strong>s for the numerical evaluation of the linear<br />
equations of motion<br />
Script called from calcEqMotNonLin to customize the<br />
scriptCalcEqMotNonLin<br />
software to your needs<br />
Script called from writeMbsNonLin to customize the<br />
scriptWriteMbsNonLin<br />
software to your needs<br />
Auxiliary <strong>file</strong>s<br />
Command<br />
NE2minimal<br />
calcKin<br />
calcCon<br />
Description<br />
Transform the Newton-Euler-Equations to minimal form or<br />
simply remove all abbreviations<br />
Calculate the kinematics, distinguish there if relative or<br />
absolute kinematics<br />
Calculate constraint equations from kinematic loops<br />
6 von 19 30.08.2011 17:47
Neweulm2 - Equations of Motion - IT M Wiki<br />
calcForcesFelem<br />
calcForcesReaction<br />
relativeKinematics<br />
absoluteKinematics<br />
Calculate applied forces of force elements<br />
Calculate the reaction forces in the system<br />
Calculate the relative kinematic values<br />
Calculate the absolute kinematic values from existing<br />
relative values<br />
As only the required absolute kinematic values are<br />
getAbsoluteKinematics calculated, this function provides a means to calculate<br />
additional values<br />
In the subsequent sections, these commands and their options are described in<br />
detail. In general, all parameters are optional. In case an option is not passed, a<br />
default value is used instead. Further, all options except numerical values have to be<br />
passed as strings.<br />
Nonlinear Equations of Motion<br />
calcEqMotNonLin<br />
Syntax<br />
calcEqMotNonLin('Option1','Value1','Option2','Value2');<br />
Description<br />
This function is the key part of Neweul-M², here the biggest piece of work is done.<br />
Calculates kinematics, kinetics and from them the nonlinear equations of motion. All<br />
input arguments are optional, all fieldnames and options given by<br />
printSystemInformation('par',true) and the following are possible:<br />
Option<br />
Description<br />
When setting up the input vector, include all<br />
possible time derivatives or search and use only<br />
minimalInputVect<br />
necessary values resulting in the minimal input<br />
vector<br />
Calculate only the kinematics, without setting up<br />
OnlyKinematics<br />
the equations of motion<br />
The calculation of kinematics can be started at a<br />
StartFrame<br />
specific coordinate system<br />
Logical if the workspace shall be saved at<br />
intermediate steps. This feature is solely for<br />
useIntermediateSave<br />
debugging and finding problems in large systems,<br />
which do not run smoothly.<br />
Default<br />
Value<br />
true<br />
false<br />
'ISYS'<br />
false<br />
7 von 19 30.08.2011 17:47
Neweulm2 - Equations of Motion - IT M Wiki<br />
This <strong>file</strong> contains several subfunctions which have been separate <strong>file</strong>s in the past,<br />
which are mentioned in the help text.<br />
Data Structure<br />
The equations of motion are stored in sys.eqm.<br />
Important called functions<br />
calcKin to calculate the kinematics<br />
calcCon to calculate everything necessary for kinematic loops<br />
calcForcesFelem to calculate all forces from force elements like springs and<br />
dampers<br />
NE2minimal to transform the Newton-Euler-Equations to minimal form or to<br />
simply remove any abbreviations<br />
Linearized Equations of Motion<br />
To calculate linear equations of motion the nonlinear equations of motion have to be<br />
calculated first, as they are linearized. For this partial derivatives with respect to the<br />
generalized coordinates and velocities are calculated and evaluated at the set values.<br />
Depending on the formulation of the nonlinear equations of motion the results of<br />
this function may look different. If the nonlinear equations of motion exist in<br />
minimal form the linearized mass, stiffness and damping matrices can be directly<br />
calculated. Otherwise the parts of the linearized equations of motion are calculated<br />
separately and combined numerically, similar as done with the nonlinear equations.<br />
calcEqMotLin<br />
Syntax<br />
calcEqMotLin;<br />
calcEqMotLin('Option1','Value1');<br />
Description<br />
Linearizes the nonlinear equations of motion aro<strong>und</strong> given set values.<br />
Option<br />
Description<br />
Use minimal form or the Newton-Euler<br />
equations and then multiply the Jacobian<br />
Formulation<br />
matrix numerically. See #Options stored <strong>und</strong>er<br />
sys.par for more information<br />
Logical, if true all set values are set to<br />
numerical zeros instead of the standard<br />
NumericalSetValues<br />
symbolic constants. If false, set values remain<br />
unchanged<br />
Default<br />
Value<br />
'newtonEuler'<br />
false<br />
8 von 19 30.08.2011 17:47
Neweulm2 - Equations of Motion - IT M Wiki<br />
RelCalcValues<br />
Simplify<br />
SymbolicSetValues<br />
Calculate minimal form when using relative<br />
kinematics, for absolute kinematics this is true<br />
anyway<br />
If a logical value is passed, simplification can be<br />
switched on and off. Otherwise the value is<br />
passed as an option to the simplify command.<br />
Logical, if true all set values are set to<br />
symbolical parameters, e.g. for alpha to<br />
alpha_s. If false, set values remain unchanged<br />
false<br />
true<br />
false<br />
The set values are specified in the data structure in sys.lin.ref. Let's consider a<br />
generalized coordinate 'alpha', which as a default is linearized aro<strong>und</strong> the set values<br />
'alpha_s', 'Dalpha_s' and 'D2alpha_s'. As a standard, these set values are created<br />
automatically as constant parameters. In order to linearize aro<strong>und</strong> a time dependent<br />
configuration or trajectory, e.g. 'sin(t)', the following command is necessary after<br />
the definition of the generalized coordinate<br />
newUserVarTvar('alpha_s','sin(t)');<br />
The time derivatives are dependent and therefore updated automatically. If<br />
numerical set values shall be used instead, the user can either use the flag<br />
mentioned above to set all to zero, or has to enter commands similar to the following<br />
sys.lin.ref.alpha_s = 0.1;<br />
sys.lin.ref.Dalpha_s = 0;<br />
sys.lin.ref.D2alpha_s = 0;<br />
Data Structure<br />
The linearized equations of motion are stored in sys.lin.<br />
calcNumericalLinearization<br />
For some complex systems the symbolic linearization may take very long time.<br />
However, sometimes a linearization for one specific configuration is sufficient. Then<br />
the function calcNumericalLinearization can be useful. This function provides<br />
commands to linearize the equations of motion numerically using the finite<br />
differences method.<br />
Syntax<br />
[A,B,C,D] = calcNumericalLinearization;<br />
[A,B,C,D] = calcNumericalLinearization(0,zeros(sys.dof,1));<br />
This function accepts specifications for the configuration which shall be used as set<br />
values. The return values are similar to those of eqm_lin_ssinout.<br />
9 von 19 30.08.2011 17:47
Neweulm2 - Equations of Motion - IT M Wiki<br />
Functions for Numerical Evaluation<br />
writeMbsNonLin<br />
Syntax<br />
writeMbsNonLin;<br />
writeMbsNonLin('Option1','Value1');<br />
Description<br />
Creates functions for the evaluation of all kinematic values as position and velocity<br />
vectors, expressions of the nonlinear equations of motion, ... .<br />
Option Description Default Value<br />
Write <strong>file</strong>s only for position vectors and rotation<br />
OnlyPositions false<br />
matrices. Enables an animation window<br />
Write <strong>file</strong>s for position vectors and rotation<br />
FramesList matrices only for these given coordinate<br />
systems<br />
fieldnames(sys.ksys)<br />
For systems with kinematic loops, there are some choices on which formulation of<br />
the equations of motion is used. The index of the equations of motion is explained at<br />
#calcCon. But there are also the following different formulations available:<br />
explicit, constant mass matrix<br />
partial-explicit<br />
ODE formulation through separation of coordinates, see<br />
KurzBurkhardtEberhard11 (http://www.itm.uni-stuttgart.de/itmwiki<br />
/ITM_Literatur_pdf/KurzBurkhardtEberhard11.pdf) for more information.<br />
The equations of motion should be solvable with a standard integration algorithm<br />
and thus being in the form Msys * Dx = f(t,x). As many integration algorithms<br />
require this system 'mass' matrix Msys to be constant, we are restricted to that.<br />
Therefore the following DAE formulations are available:<br />
Name<br />
Equations of motion:<br />
State<br />
vector<br />
explicit:<br />
10 von 19 30.08.2011 17:47
Neweulm2 - Equations of Motion - IT M Wiki<br />
partial<br />
explicit:<br />
writeMbsLin<br />
Syntax<br />
writeMbsLin;<br />
Description<br />
Creates functions for the evaluation of the matrices of the linearized equations of<br />
motion.<br />
Auxiliary functions<br />
scriptCalcEqMotNonLin<br />
Syntax<br />
scriptCalcEqMotNonLin;<br />
Description<br />
At some point in the development of the software, the question surfaced on how to<br />
make the program as versatile as possible, while focusing on the key features. This<br />
script and the script [#scriptWriteMbsNonLin] are the answer to that question.<br />
The main function to set up the equations of motion is called calcEqMotNonLin,<br />
being called after every modeling. Therefore if any user wants to include his own<br />
software module, it should be somehow called from that <strong>file</strong>, making it available for<br />
all his models. As this <strong>file</strong> is one of the key parts, we do not want to disclose its<br />
contents and workings. The solution is that after some reading of options, checking<br />
the system, setting up the kinematics and performing some other small tasks, the<br />
<strong>file</strong> scriptCalcEqMotNonLin is called. In this script every user can insert his own<br />
function calls to custom made <strong>file</strong>s at the necessary step in the progress chain. The<br />
user could also alter anything in this <strong>file</strong> to adjust the usual order and way of calling<br />
the functions, even though it is strongly recommended not to do this.<br />
If you are interested in writing your own module to connect it to Neweul-M², the<br />
preferred location is the modules folder. If you want to store data in the system data<br />
structure, you could do this <strong>und</strong>er sys.elements, which is very flexible and all<br />
evaluations are distinguished by a type property. Thus if you specify your own type,<br />
you could easily store all data there.<br />
Data Structure<br />
The results are stored in sys.eqm or returned directly, depending on the requested<br />
11 von 19 30.08.2011 17:47
Neweulm2 - Equations of Motion - IT M Wiki<br />
evaluations.<br />
scriptWriteMbsNonLin<br />
Syntax<br />
scriptWriteMbsNonLin;<br />
Description<br />
Similar to scriptCalcEqMotNonLin, this script is called from writeMbsNonLin,<br />
which is the main function to write <strong>file</strong>s after the equations have been set up. Please<br />
feel free to insert your own calls.<br />
Data Structure<br />
No entry<br />
NE2minimal<br />
Syntax<br />
result = NE2minimal(varargin);<br />
Description<br />
This functio started as a nice way to obtain the minimal formulation if the Newton-<br />
Euler-Equations have already been set up. As the expressions of the equations of<br />
motion may contain non-scalar abbreviations, which then alter the dimensions visible<br />
for the user, this function provides additional functionality. It can remove all<br />
abbreviations, which is partly necessary for the minimal form and completely<br />
necessary for the symbolic linearization of the equations of motion. However, this<br />
function can also provide the expressions of the Newton-Euler-Equations as symbolic<br />
matrices and not as cell arrays as stored <strong>und</strong>er sys.eqm. For any options on how to<br />
call the function to obtain the result you need, please have a look at the help<br />
message of this <strong>file</strong>.<br />
Data Structure<br />
The results are stored in sys.eqm or returned directly, depending on the requested<br />
evaluations.<br />
calcCon<br />
Syntax<br />
calcCon(y,Dy,D2y);<br />
Description<br />
Calculates the constraint equations for kinematic loops. The subfunction 'comcon'<br />
checks for red<strong>und</strong>ant constraint equations and tries to assure their independency. It<br />
does not cover all cases, so the user has some responsibility to define independent<br />
constraints. The subfunction 'con2loop' assigns the constraint equations to the loops.<br />
12 von 19 30.08.2011 17:47
Neweulm2 - Equations of Motion - IT M Wiki<br />
There is a parameter <strong>und</strong>er sys.par.eqm.constraints.index which specifies the index<br />
of the system of equations. If this index is set to 1, the constraint equations are used<br />
on acceleration level, for 2 on velocity and for 3 on position level. However, the user<br />
has to ensure that the integration algorithm can handle the selected constraints.<br />
This function only calculates the necessary derivatives of the constraint equations<br />
and will skip the remaining part. Under #writeMbsNonLin the parameter<br />
formulation is described, which is closely related to the index.<br />
Data Structure<br />
The results are stored in sys.eqc.<br />
Contained subfunctions<br />
comcon<br />
con2loop<br />
calcForcesFelem<br />
Syntax<br />
[qa, felemStruct_, Data_] = calcForcesFelem(varargin);<br />
Description<br />
Calculates all forces from force elements like spring-damper combinations, i.e.<br />
everything stored <strong>und</strong>er sys.felem. If nothing is specified, this function does exactly<br />
that. However, the user may explicitly give a structure of force elements, then this is<br />
used and only the contained force elements are considered for the force calculation.<br />
Data Structure<br />
Entries have to be made by the user to the system data structure, so it is more<br />
versatile.<br />
Example<br />
calcForcesFelem;<br />
calcForcesReaction<br />
Syntax<br />
[qr, allRfelem] = calcForcesReaction(varargin);<br />
Description<br />
Calculate the necessary values for the evaluation of reaction forces. Depending on<br />
the options specified, the reaction forces are calculated symbolically in the<br />
respective frame of reference, or they are only calculated as in the Newton-Eulerequations<br />
and further evaluations are done numerically.<br />
Input parameters, all optional and pairwise, are<br />
13 von 19 30.08.2011 17:47
Neweulm2 - Equations of Motion - IT M Wiki<br />
Option<br />
Description<br />
Logical parameter, if true, reaction forces are calculated<br />
fullySymbolic symbolically, otherwise a part has to be evaluated<br />
numerically<br />
Default<br />
Value<br />
true<br />
Output parameters<br />
Option<br />
Description<br />
qr<br />
Vector of reaction forces of the Newton-Euler-equations being<br />
calculated.<br />
Structure of artificial force elements, which have been used for the<br />
allRfelem<br />
calculation of the reaction forces.<br />
Data Structure<br />
All vectors and matrices created in this function are stored <strong>und</strong>er sys.eqm Output<br />
parameters<br />
Field<br />
Description<br />
Vector of reaction forces contained in the Newton-Eulerequations,<br />
usually is removed by the pre-multiplication with the<br />
sys.eqm.qr<br />
global Jacobian matrix<br />
Vector of reaction forces described in the respective frame of<br />
sys.eqm.g<br />
reference of the bodies, following the equation qr=Q*g<br />
Distribution matrix, which describes the correlation between<br />
sys.eqm.Q the local reaction forces g and the forces qr in the global<br />
Newton-Euler-equations<br />
sys.eqm.N Matrix used in the calculation, is calculated as Q.'*inv(Mq)*Q<br />
Vector containing all generalized applied, coriolis, centrifugal,<br />
sys.eqm.kAndqhat<br />
inertia forces usually stored as vectors k and q<br />
Example<br />
calcForcesReaction;<br />
kardan2rotmat<br />
Syntax<br />
S = kardan2rotmat(phi, formulation_)<br />
14 von 19 30.08.2011 17:47
Neweulm2 - Equations of Motion - IT M Wiki<br />
Description<br />
When the user specifies a three parametric angular description, this function is used<br />
to obtain the rotation matrix. As a standard, kardan angles (rotation order: x-y-z) are<br />
used. However, any description using three parameters can be used by specifying<br />
the order of the rotation axis, e.g. 'zxz', [1 2 3]. The function rotmat2kardan covers<br />
the inverse operation.<br />
Data Structure<br />
No entry<br />
Example<br />
S = kardan2rotmat(sym('[a1;b1;c1]'), 'xyz');<br />
rotmat2kardan<br />
Syntax<br />
phi = rotmat2kardan(S, useSimplify, formulation_)<br />
Description<br />
From a given rotation matrix, this function extracts the three parameter angular<br />
description. As a standard, kardan angles (rotation order: x-y-z) are used. However,<br />
any description using three parameters can be used by specifying the order of the<br />
rotation axis, e.g. 'zxz', [1 2 3]. The function kardan2rotmat covers the inverse<br />
operation.<br />
Data Structure<br />
No entry<br />
Example<br />
phi = rotmat2kardan(sym('[1,0,0;0,cos(a1),-sin(a1);0,sin(a1),cos(a1)]'), true, 'xyz')<br />
relativeKinematics<br />
Syntax<br />
relativeKinematics(y,Dy,D2y,Yvars_,Yvars_D_,ksys)<br />
Description<br />
Calculates the relative kinematic values of all coordinate systems recursively,<br />
y,Dy,D2y are symbolic vectors containing the generalized coordinates, their time<br />
derivatives respectively. yt is a taylor-series expansion up to the second order terms<br />
of the generalized coordinates. Yvars_, Yvars_D_ contain the state dependent<br />
parameters and their directional derivatives. ksys has to be passed as the start<br />
coordinate system because of the recursive algorithm. Depending on the type of the<br />
coordinate system the subfunctions calcKinRel, calcKinRelNode are called.<br />
15 von 19 30.08.2011 17:47
Neweulm2 - Equations of Motion - IT M Wiki<br />
Data Structure<br />
The results are stored in the respective coordinate systems <strong>und</strong>er sys.ksys.(...).relkin<br />
absoluteKinematics<br />
Syntax<br />
absoluteKinematics(ksys)<br />
Description<br />
Starting from the relative kinematic values calculated by relativeKinematics absolute<br />
kinemativ values and values necessary for the equations of motion are calculated.<br />
Some interesting kinematic values can be obtained via the function<br />
getAbsoluteKinematics at need. This has been introduced to calculate them only<br />
when necessary and not always.<br />
Data Structure<br />
The results are stored in the respective coordinate systems. Depending on the<br />
calculation mode and the frame type the respective reference system is different.<br />
Let's have a look at the coordinate system named ksys with the reference system<br />
refsys and ISYS shall denote the inertial system. For flexible bodies refsys denotes<br />
the frame which describes the nonlinear reference motion. The first column gives<br />
the name of the substructure in 'sys.ksys.ksys '. The second column denotes the<br />
fields of these substructures, whereas in the remaining columns the coordinate<br />
systems in which the vector/matrix is described are given. If a field is left empty,<br />
this means that this value is not calculated by default.<br />
Structure<br />
entry<br />
Value<br />
Absolute<br />
Kinematics<br />
'abs'<br />
Relative<br />
Kinematics<br />
'rel'<br />
symkin r_rel refsys refsys refsys<br />
symkin phi_rel refsys refsys refsys<br />
symkin/numkin r ISYS ISYS ISYS<br />
symkin/numkin S ISYS ISYS ISYS<br />
symkin/numkin S_rel refsys refsys refsys<br />
symkin/numkin v ISYS ISYS ISYS<br />
symkin/numkin a ISYS ISYS ISYS<br />
symkin/numkin omega ISYS ISYS ISYS<br />
symkin/numkin alpha ISYS ISYS ISYS<br />
calckin v ISYS ksys ksys<br />
calckin a ISYS ksys ksys<br />
calckin omega ISYS ksys ksys<br />
calckin alpha ISYS ksys ksys<br />
calcKin phi ISYS ksys ksys<br />
Nodal<br />
frame<br />
'rel'<br />
16 von 19 30.08.2011 17:47
Neweulm2 - Equations of Motion - IT M Wiki<br />
calckin vq ISYS ksys ksys<br />
calckin aq ISYS ksys ksys<br />
calckin omegaq ISYS ksys ksys<br />
calckin alphaq ISYS ksys ksys<br />
calckin Jt ISYS ksys ksys<br />
calckin Jr ISYS ksys ksys<br />
calckin Je ksys<br />
calckin Jges ksys<br />
calckin Tt ksys<br />
calckin Tr ksys<br />
If the relative kinematics are selected the equations of motion are set up in each<br />
local coordinate system. For a rigid body this means in the frame in the center of<br />
gravity. For a flexible body this means in the reference frame. The reason why the<br />
values just mentioned are in this case all described in ksys itself is to ensure an<br />
easier code. If a body is defined from a nodal frame, this body will require the values<br />
of its reference frame, like velocity or jacobian matrix. If there were a difference<br />
between a rigid and a flexible body in the way in which the kinematical data is<br />
stored, this would require some distinction at this point.<br />
getabsoluteKinematics<br />
Syntax<br />
[result_,commonCSys] = getAbsoluteKinematics(kinematic, ksysFrom, ksysTo)<br />
Description<br />
It is reasonable to calculate only those absolute kinematic values which are actually<br />
necessary. This function provides the possibility to calculate symbolic expressions<br />
which are not calculated as a standard. Please see the function itself for which<br />
values are available, as this is still growing. The kinematic value should be specified<br />
as kinematic, and the two coordinate systems from and to which this value shall be<br />
evaluated symbolically. As the shortest available connection via the organizational<br />
tree of the coordinate systems is used, they are discribed in the commonCSys, which<br />
denotes the first coordinate system, where the two branches meet. If ISYS is one of<br />
the given coordinate systems, it will always be commonCSys as well.<br />
Data Structure<br />
If one of the two coordinate systems is ISYS the resulting absolute values will be<br />
stored <strong>und</strong>er sys.ksys.(...).symkin.<br />
Example<br />
[r, commonCSys] = getAbsoluteKinematics('r', 'ISYS', 'ksys1');<br />
17 von 19 30.08.2011 17:47
Neweulm2 - Equations of Motion - IT M Wiki<br />
mapleSimplify<br />
Syntax<br />
res = mapleSimplify(expr,varargin)<br />
Description<br />
Wrapper function to call the simplify command. The existance of this <strong>file</strong> enables the<br />
seamless switching between using Maple or MuPad as symbolic engine.<br />
Data Structure<br />
No entry<br />
Example<br />
res = mapleSimplify(sym('x1^2+6*x1+9'))<br />
mapleSubs<br />
Syntax<br />
res = mapleSubs(expr,old,new)<br />
Description<br />
Wrapper function to call the subs or eval command to either replace symbolic<br />
parameters or to evaluate symbolic expressions. The existance of this <strong>file</strong> enables the<br />
seamless switching between using Maple or MuPad as symbolic engine.<br />
Data Structure<br />
No entry<br />
Example<br />
res = mapleSubs(sym('x1^2+6*x1+9'),sym('x1'),sym('y2'))<br />
writeStructure<br />
Syntax<br />
writeStructure(structure)<br />
Description<br />
Handy function to simply write a structure. If nothing is specified, STDOUT is used<br />
for the fprintf commands. Can also be written to a <strong>file</strong>. The result is a printout of all<br />
substructures and fields together with its values so it could be evaluated to obtain<br />
the original data structure.<br />
Data Structure<br />
No entry<br />
18 von 19 30.08.2011 17:47
Neweulm2 - Equations of Motion - IT M Wiki<br />
Example<br />
writeStructure(sys.par.eqm)<br />
See also<br />
ITM Wiki<br />
neweulm2<br />
neweulm2#Function reference<br />
neweulm2 - System Definition<br />
neweulm2 - Simulation and Animation<br />
neweulm2 - Exporting<br />
Retrieved from "http://www.itm.uni-stuttgart.de/itmwiki/index.php/Neweulm2_-<br />
_Equations_of_Motion"<br />
This page was last modified 15:09, 30 August 2011.<br />
19 von 19 30.08.2011 17:47
Neweulm2 - Simulation and Animation - IT M Wiki<br />
http://www.itm.uni-stuttgart.de/itmwiki/index.php?ti...<br />
Neweulm2 - Simulation and<br />
Animation<br />
From ITM Wiki<br />
Neweul-M² can be used just to create equations of motion and the corresponding<br />
m-<strong>file</strong>s. But it also offers a great variety of possibilities for simulation and<br />
animation which will be presented in this paragraph.<br />
Contents<br />
1 Simulation and Analysis<br />
1.1 freqResPlot<br />
1.2 fullModelRun<br />
1.3 newOpt<br />
1.4 optiEvalFreqRes<br />
1.5 plotStandardResults<br />
1.6 printSystemInformation<br />
1.7 runKiAn<br />
1.8 runModalAnalysis<br />
1.9 runTimeInt<br />
1.10 runSensAn<br />
1.11 runSysOpt<br />
2 Auxiliary functions for the simulation<br />
2.1 calcNomLength<br />
2.2 freqResponse<br />
2.3 initOpt<br />
2.4 kinematicAnalysis<br />
2.5 modalAnalysis<br />
2.6 staticEquilibrium<br />
2.7 timeInt<br />
2.8 writeFinalCond<br />
3 Animation<br />
3.1 Functions to be called directly by the user<br />
3.1.1 addGraphics<br />
3.1.2 animFreqResponse<br />
3.1.3 animModeShape<br />
3.1.4 animTimeInt<br />
1 von 26 11.11.2011 18:06
Neweulm2 - Simulation and Animation - IT M Wiki<br />
http://www.itm.uni-stuttgart.de/itmwiki/index.php?ti...<br />
3.1.5 createAnimationWindow<br />
3.1.6 defineGraphics<br />
3.1.7 drawCube<br />
3.1.8 drawElasticBeam<br />
3.1.9 drawLine<br />
3.1.10 drawMesh<br />
3.1.11 drawRotBody<br />
3.1.12 drawSphere<br />
3.1.13 drawSpring<br />
3.1.14 drawSTL<br />
3.1.15 fitCanvas<br />
3.1.16 plotTrajectories<br />
3.1.17 setVisibility<br />
3.1.18 showModeShape<br />
3.1.19 transformGraphics<br />
3.1.20 updateGeo<br />
3.2 Functions called internally<br />
3.2.1 drawSys<br />
3.2.2 initGraphics<br />
4 See also<br />
4.1 ITM Wiki<br />
Simulation and Analysis<br />
Simulation<br />
Command<br />
Description<br />
freqResPlot<br />
Plot the frequency response from given inputs to<br />
outputs at certain frequency sample points<br />
fullModelRun<br />
Set up the system and run all predefined simulations<br />
printSystemInformation Print some information about the system<br />
runKiAn<br />
Perform a kinematic analysis after setting all<br />
necessary values<br />
runmodalAnalysis<br />
Perform a modal analysis after setting all necessary<br />
values<br />
runTimeInt<br />
Perform a numerical time integration after setting all<br />
necessary values<br />
2 von 26 11.11.2011 18:06
Neweulm2 - Simulation and Animation - IT M Wiki<br />
http://www.itm.uni-stuttgart.de/itmwiki/index.php?ti...<br />
runSensAn<br />
runSysOpt<br />
Calculate the gradient with respect to a given<br />
criterion function and design parameters<br />
Perform a parameter optimization of a given criterion<br />
function and design parameters<br />
Auxiliary functions for the simulation<br />
Command<br />
Description<br />
Calculate the nominal length of all force elements if at the<br />
calcNomLength initial conditions those elements are<br />
unstretched/compressed<br />
freqResponse<br />
Calculate the transfer function from certain system inputs<br />
to outputs at given frequency sample points<br />
initOpt<br />
Set options for a parameter optimization<br />
modalAnalysis Perform a modal analysis<br />
staticEquilibrium Calculate the static equilibrium numerically<br />
timeInt<br />
Perform a numerical time integration after some setting up<br />
and checking<br />
writeFinalCond<br />
If a final condition for the time integration is given, this<br />
function will do all necessary steps<br />
Animation<br />
Command<br />
Description<br />
addGraphics<br />
Attach a graphic surface object at a given coordinate<br />
system<br />
animModeShape Animate a mode shape after a modal analysis<br />
animTimeInt<br />
Animate the result of a numeric time integration,<br />
kinematic analysis, ...<br />
Create a new animation window, keeping current<br />
createAnimationWindow<br />
settings as far as possible<br />
defineGraphics<br />
Script in which the user can define graphic objects<br />
drawCube<br />
Create cuboid graphic representation<br />
drawLine<br />
Draw a line connecting several coordinate systems<br />
drawRotBody<br />
Create an axis rotational solid representing e.g. a<br />
body<br />
drawSphere<br />
Create a spherical graphical representation<br />
3 von 26 11.11.2011 18:06
Neweulm2 - Simulation and Animation - IT M Wiki<br />
http://www.itm.uni-stuttgart.de/itmwiki/index.php?ti...<br />
drawSTL<br />
fitCanvas<br />
plot_trajectories<br />
setVisibility<br />
showModeShape<br />
transformGraphics<br />
updateGeo<br />
Read data from a CAD geometry <strong>file</strong> (.stl) and create<br />
a graphical representation from it<br />
Adjust the axis scaling so the animation will stay<br />
visible during its run<br />
Function to create and update trajectories of<br />
coordinate systems<br />
Change visibility settings of all objects or classes of<br />
objects in the animation window<br />
Statically display mode shapes of a modal analysis<br />
Before attaching graphic representations to a<br />
coordinate system, this function can give them a<br />
constant translational or rotational offset<br />
Update the animation window to a certain time and<br />
set of generalized coordinates<br />
Auxiliary functions for the animation<br />
Command<br />
Description<br />
drawSys<br />
Create all necessary representations for a system in the<br />
animation window, called from createAnimationWindow<br />
Initialize settings and create an animation window, called from<br />
initGraphics<br />
createAnimationWindow<br />
freqResPlot<br />
Syntax<br />
[fh,ah,g] = freqResPlot(t,in,out,freqs,varargin);<br />
Description<br />
Creates a bode plot of the frequency response at given time t, from input in to<br />
output out for frequencies freqs. In varargin other options can be passed. It<br />
returns the figure fh, axes handles ah and the frequency response matrix g.<br />
Uses the function frequencyResponse to evaluate the transfer functions.<br />
Optional input arguments provide access to several settings like using certain<br />
groups of in- or outputs.<br />
Data Structure<br />
No entry<br />
4 von 26 11.11.2011 18:06
Neweulm2 - Simulation and Animation - IT M Wiki<br />
http://www.itm.uni-stuttgart.de/itmwiki/index.php?ti...<br />
Example<br />
freqRespPlot;<br />
freqRespPlot(0,'MyInput','MyOutput',[1:10:100]);<br />
fullModelRun<br />
Syntax<br />
fullModelRun(varargin);<br />
Description<br />
When a user does not yet know exactly how to use the software, this command is<br />
very useful. When it is called from an examples folder, first the system definition<br />
is called and the equations are set up. Then all available simulations for this<br />
model are called. This allows the user to easily call the provided <strong>file</strong>s and to<br />
investigate the system later. This function is also called by the graphical<br />
gettingStarted user interface.<br />
Data Structure<br />
No entry<br />
Example<br />
fullModelRun;<br />
fullModelRun('DisplayCommands',true);<br />
newOpt<br />
Syntax<br />
[res_, opts] = newOpt(varargin);<br />
Description<br />
This function combines all currently available ways for a parameter optimization<br />
or sensitivity analysis in one function. This incorporates the previously used<br />
functions optiEvalFreqRes, runSensAn and runSysOpt. Here all options stored<br />
<strong>und</strong>er sys.par.opt are used, but the user can specify options in the usual<br />
pairwise manner.<br />
Data Structure<br />
sys.results.opt<br />
Example<br />
newOpt;<br />
5 von 26 11.11.2011 18:06
Neweulm2 - Simulation and Animation - IT M Wiki<br />
http://www.itm.uni-stuttgart.de/itmwiki/index.php?ti...<br />
optiEvalFreqRes<br />
Syntax<br />
res_ = optiEvalFreqRes(varargin);<br />
Description<br />
There are many ways to conduct a parameter optimization of a mechanical<br />
system. One very fast and useful way is to use the transfer functions between<br />
system in- and outputs. Of course this uses a linear system formulation, which is<br />
not always suitable. But the great advantage is the speed and the simple usage<br />
of many transfer functions at once. As a standard, all available transfer<br />
functions are evaluated at the given frequencies, then for each frequency the<br />
maximum amplitude of all functions is determined. Over the complete set of<br />
frequency points, a certain number of maximum values is selected. These points<br />
represent the most critical combinations of transfer function and frequency. The<br />
double selection is necessary to avoid a certain independency from the number<br />
of system in- and outputs and frequency set points. For the selected points, the<br />
amplitudes of the transfer functions is summed and used as a criterion. This<br />
selection process is conducted in every optimization step, which has shown to be<br />
quite a good way to cover even complex systems. The design parameters are<br />
scaled to ensure good behavior of the optimization algorithm. All options are set<br />
in initOpt.m or any other options <strong>file</strong>, then being specified explicitly.<br />
Data Structure<br />
sys.results.opt<br />
Example<br />
optiEvalFreqRes;<br />
plotStandardResults<br />
Syntax<br />
plotStandardResults('Option1','Value1');<br />
Description<br />
If you want to plot any curve derived from a result in Neweul-M², this<br />
function is the place to try first.<br />
Very often similar calculations and plots are carried out with Neweul-M². This<br />
function provides a selection of the plots which are created most often. This<br />
includes plots of the states, trajectories of coordinate systems, system outputs<br />
and others. A complete list can be fo<strong>und</strong> in its help commentary. This function<br />
6 von 26 11.11.2011 18:06
Neweulm2 - Simulation and Animation - IT M Wiki<br />
http://www.itm.uni-stuttgart.de/itmwiki/index.php?ti...<br />
provides a large number of options, concerning both, the data to plot and its<br />
formatting and output. A very useful feature is that the calculated data is<br />
available as second output argument. This provides a very simple way to obtain<br />
trajectories, system outputs and other data at specific time points.<br />
Data Structure<br />
no entry<br />
Example<br />
plotStandardResults;<br />
plotStandardResults('Type','constraints','subplot',true);<br />
printSystemInformation<br />
Syntax<br />
printSystemInformation('Option1','Value1');<br />
Description<br />
Even though Neweul-M² can handle very different types of systems, there are<br />
some things which are good to know about systems. So this function was<br />
developed as a collection of commands to display information which I used to<br />
look up for systems I could lay my hands on. For example when one of the users<br />
had a problem with a model, then I used to look for some structure of the<br />
coordinate systems, the generalized coordinates have been used in which<br />
definitions, where do we have force elements, ... . At some point we created a<br />
function which would display all this information with just one command. At a<br />
later point in time, this function was extended to also provide numerical<br />
information about the system, meaning positions, orientations, mass properties,<br />
... for given states. This is especially useful when a system has been modeled in a<br />
different software before or measured from a real structure. Then one can easily<br />
verify the model by comparing the positions of some coordinate systems. Please<br />
type help printSystemInformation for more information on how to adjust the<br />
function to your needs. This function can be called from the GUI from the<br />
System Information menu item.<br />
Data Structure<br />
no entry<br />
Example<br />
printSystemInformation;<br />
printSystemInformation('all');<br />
printSystemInformation('numerical',true,'y0',0.1*ones(sys.dof,1));<br />
7 von 26 11.11.2011 18:06
Neweulm2 - Simulation and Animation - IT M Wiki<br />
http://www.itm.uni-stuttgart.de/itmwiki/index.php?ti...<br />
runKiAn<br />
Syntax<br />
runKiAn;<br />
Description<br />
Sets Parameters, runs a kinematic analysis and animates the results.<br />
Data Structure<br />
Parameters are stored in sys.par.kian, results in sys.results.kian.<br />
Example<br />
runModalAnalysis<br />
Syntax<br />
runModalAnalysis;<br />
Description<br />
Set options, run a modal analysis and display the results. This <strong>file</strong> calls<br />
#modalAnalysis and #showModeShape. It can be used to set specific options,<br />
otherwise these functions may be called directly as well.<br />
Data Structure<br />
Results are stored in sys.results.modal.<br />
Example<br />
runTimeInt<br />
Skript to set all necessary parameters and then start a time integration of the<br />
system. Syntax<br />
Description<br />
The script runTimeInt.m initializes all parameters necessary for a numeric<br />
time integration and animation of the equations of motion before calling the<br />
functions to perform this task. The functions that are called from<br />
runTimeInt.m are in this order<br />
Function name<br />
Tasks<br />
Calculating the static equilibrium of the system to be able<br />
staticEquilibrium.m to define initial conditions relative to the equilibrium.<br />
This only works for systems without kinematic loops.<br />
timeInt.m<br />
Run the numeric time integration with the given options.<br />
8 von 26 11.11.2011 18:06
Neweulm2 - Simulation and Animation - IT M Wiki<br />
http://www.itm.uni-stuttgart.de/itmwiki/index.php?ti...<br />
fitCanvas.m<br />
plot_trajectories.m<br />
animTimeInt.m<br />
Adjust the visible area in the animation window so the<br />
complete motion of all coordinate systems can be seen.<br />
Plot a line along the trajectory of the given coordinate<br />
systems. This line remains static while the coordinate<br />
system moves along it during the animation.<br />
Animate the result of the time integration with the<br />
defined coordinate systems, lines and shapes.<br />
Data Structure<br />
Options are stored in sys.par.timeInt, while results are stored in<br />
sys.results.timeInt.<br />
Example<br />
runSensAn<br />
Syntax<br />
runSensAn(varargin);<br />
Description<br />
Performs a sensitivity analysis, where all settings are done in initOpt.m, which<br />
can be fo<strong>und</strong> in each model folder. Optional parameters are only for the call<br />
with the GUI. Currently there are three methods available:<br />
Finite Differences, basic method but slow with big errors<br />
Direct Method, good choice if there are not too many design variables<br />
Adjoint Variable Method, especially good with many design variables, has<br />
larger errors for kinematic loops<br />
This task requires some calculations and therefore the following routines have<br />
been created<br />
Function name<br />
Tasks<br />
initOpt.m<br />
Set all options for the calculation, to be edited by user<br />
Matrices_grad.m Calculation of Matrices of partial derivatives<br />
OptiCalcInitCon.m Calculate initial conditions<br />
Calculate the function value and the gradient with the<br />
OptiEval_adj_sep.m<br />
adjoint variable method<br />
Calculate the function value and the gradient with the<br />
OptiEval_dir_tog.m direct method, where the sensitivity equations and the<br />
equations of motion are integrated together.<br />
9 von 26 11.11.2011 18:06
Neweulm2 - Simulation and Animation - IT M Wiki<br />
http://www.itm.uni-stuttgart.de/itmwiki/index.php?ti...<br />
write_psi.m Create <strong>file</strong>s from the definition of the function criterion<br />
writeOptiDirect.m Create all <strong>file</strong>s necessary for the direct method<br />
writeOptiAdjoint.m Create all <strong>file</strong>s necessary for the adjoint variable method<br />
Data Structure<br />
Parameters are stored in sys.opt and results in sys.results.opt.<br />
Example<br />
runSysOpt<br />
Syntax<br />
runSysOpt(varargin);<br />
Description<br />
Performs a parameter optimization, currently with the included Matlab<br />
optimization algorithms. For other options and settings see runSensAn.<br />
Data Structure<br />
Parameters are stored in sys.opt and results in sys.results.opt. Example<br />
Auxiliary functions for the simulation<br />
Here some functions are presented which can be quite useful but don't really<br />
make a simulation of their own. In addition they are often not directly called by<br />
the user but through some intermediate routines.<br />
calcNomLength<br />
Syntax<br />
calcNomLength(varargin);<br />
Description<br />
Determines the nominal lengths of force elements from given initial conditions.<br />
Then these initial conditions describe the state where all force elements have<br />
zero forces. Optionally the initial values can be passed. As numerical values are<br />
necessary it has to be called after initSys.<br />
Data Structure<br />
Changes values of parameters, but doesn't create new entries.<br />
Example<br />
10 von 26 11.11.2011 18:06
Neweulm2 - Simulation and Animation - IT M Wiki<br />
http://www.itm.uni-stuttgart.de/itmwiki/index.php?ti...<br />
freqResponse<br />
Syntax<br />
g = freqResponse(t,in,out,freqs,varargin);<br />
Description<br />
Calculates the frequency response g from input in to output out, where both<br />
can be vectors at given time t. This is evaluated at the frequencies defined in<br />
freqs. If the equations of motion have been linearized symbolically they are used<br />
as a standard. However, should they be unavailable, the necessary values are<br />
calculated numerically using finite differences.<br />
Data Structure<br />
Example<br />
g = freqResp(0,'MyInput','MyOutput',[1:10:100]);<br />
initOpt<br />
Syntax<br />
initOpt;<br />
Description<br />
This is a script which can be located in the model folders. If it exists, it is called<br />
during a sensitivity analysis and parameter optimization. Sets all options for a<br />
sensitivity analysis or parameter optimization. For more information, please first<br />
have a look at one of the provided examples and their version of this <strong>file</strong>. Then<br />
depending on the desired optimization, please investigate their options. The <strong>file</strong><br />
initOpt is just a collection of options, where those unnecessary for the current<br />
optimization are simply ignored.<br />
Data Structure<br />
Everything is stored in sys.par.opt.<br />
Example<br />
kinematicAnalysis<br />
Syntax<br />
kinematicAnalysis(varargin);<br />
Description<br />
Performs a kinematic analysis, which means that the user may prescribe<br />
functions for independent generalized coordinates. These functions will be<br />
11 von 26 11.11.2011 18:06
Neweulm2 - Simulation and Animation - IT M Wiki<br />
http://www.itm.uni-stuttgart.de/itmwiki/index.php?ti...<br />
evaluated, which can be used to investigate special configurations, reachable<br />
space of a robot or other such things. Please note, that here only the kinematics<br />
is investigated, meaning that all forces, torques or other effects are neglected.<br />
Constraint equations are respected.<br />
Data Structure<br />
sys.results.kian<br />
Example<br />
kinematicAnalysis;<br />
modalAnalysis<br />
Syntax<br />
modalAnalysis(t,varargin);<br />
Description<br />
Performs a modal analysis of the system with the default settings and without<br />
display. For a display of the Eigenmodes please see showModeShape. The<br />
Parameter t defines the time at which the matrices are evaluated. No optional<br />
parameters available yet.<br />
Data Structure<br />
sys.results.modal<br />
Example<br />
modalAnalysis(0);<br />
staticEquilibrium<br />
Syntax<br />
[ye,res] = staticEquilibrium(t,ys,Options);<br />
Description<br />
Calculates the static equilibrium ye of the system at time t to initial guess ys.<br />
The residual of this root finding is returned as res, which should be zeros. In<br />
Options additional options for the root finding can be passed. All parameters<br />
are optional.<br />
Data Structure<br />
Results are to be stored in sys.results.statEq, has to be selected by the user.<br />
Example<br />
12 von 26 11.11.2011 18:06
Neweulm2 - Simulation and Animation - IT M Wiki<br />
http://www.itm.uni-stuttgart.de/itmwiki/index.php?ti...<br />
[ye,res] = staticEquilibrium(sys.par.timeInt.t0, zeros(sys.dof,1));<br />
timeInt<br />
Perform a time Integration of the equations of motion. This includes all<br />
preparations because of possible options set in runTimeInt.<br />
Syntax<br />
result = timeInt(y0,Dy0, 'parameter1','value1', ...)<br />
Option Description Default value<br />
y0 Initial conditions for the position.<br />
sys.par.timeInt.y0 or<br />
zeros<br />
Dy0 Initial conditions for the velocity.<br />
sys.par.timeInt.Dy0<br />
or zeros<br />
'linear' Uses the linearized equations of motion. false<br />
'integrator' Specify the integration algorithm.<br />
@ode45<br />
'intOpts' Integration options structure. odeset;<br />
't0' or 't1' Initial or final time of the integration. 0 or 10<br />
'time' Time vector, equal to [t0 t1]. [0 10]<br />
'display'<br />
Display during integration, one of this list:<br />
'waitbar','odeplot','animation','none'.<br />
'none'<br />
'waitbar' Display a progress bar during integration. false<br />
'Function' Specify the function to be integrated. @eqm_nonlin_ss<br />
There are some other options available, which are also available through the<br />
parameters stored in sys.par.timeInt.<br />
Description<br />
Before starting the time integration some preparations take place<br />
Creating functions for the final conditions.<br />
Check if the integration algorithm is valid for this system.<br />
If the system contains kinematic loops, calculate consistent initial<br />
conditions.<br />
Set all necessary options.<br />
Data Structure<br />
Returns a structure similar to the result of Matlab ode-solvers extended by the<br />
calculation time and information whether the linear or nonlinear system has<br />
been integrated.<br />
13 von 26 11.11.2011 18:06
Neweulm2 - Simulation and Animation - IT M Wiki<br />
http://www.itm.uni-stuttgart.de/itmwiki/index.php?ti...<br />
Example<br />
sys.results.timeInt = timeInt(y0, Dy0);<br />
sys.results.timeInt = timeInt(ones(sys.dof,1),zeros(sys.dof,1), 'integrator',@ode45, ...<br />
'intOpts',odeset, 'time',[0,10], 'linear',' ');<br />
writeFinalCond<br />
Syntax<br />
writeFinalCond<br />
Description<br />
Usually the time integration goes over the complete time interval [t0, t1]. This<br />
function enables the user to define a condition, so the integration can be<br />
stopped when a certain condition changes its sign. If a final condition for the<br />
time integration is stored in the structure sys, this creates the necessary <strong>file</strong><br />
(sysFunctions/finalCond.m) and options.<br />
Data Structure<br />
The final condition is stored in sys.par.timeInt.finalCond<br />
Example<br />
Animation<br />
Functions to be called directly by the user<br />
addGraphics<br />
Syntax<br />
addGraphics(CoordSys, ObjectHandle, createEntry);<br />
Description<br />
Attaches created primitives with handle ObjectHandle to a given coordinate<br />
system CoordSys. With the boolean parameter createEntry the insertion into<br />
the system data structure can be avoided. Otherwise all surface or patch objects<br />
are stored in sys.graphics.surfaces<br />
Data Structure<br />
sys.graphics.surfaces<br />
Example<br />
14 von 26 11.11.2011 18:06
Neweulm2 - Simulation and Animation - IT M Wiki<br />
http://www.itm.uni-stuttgart.de/itmwiki/index.php?ti...<br />
ObjectHandle = drawSphere([0 0 0],0.02,20,'red');<br />
addGraphics('BODY1_cg', ObjectHandle);<br />
animFreqResponse<br />
Syntax<br />
[result ye_ t_] = animFreqResponse(t,in,freq,varargin);<br />
Description<br />
Evaluate the frequency response from input in to all generalized coordinates at<br />
frequency freq and animate it.<br />
Data Structure<br />
If nothing is specified, results are stored <strong>und</strong>er sys.results.freqResponse in the<br />
common format.<br />
Example<br />
animFreqResponse(0,'myInputID',300);<br />
animModeShape<br />
Syntax<br />
animModeShape(modalResults, OrderOfMode, varargin);<br />
Description<br />
Performs an animation of a given mode shape with index OrderOfMode,<br />
calculated by a prior call of ModalAnalysis.m. Optional parameters can be<br />
used for further options<br />
Option Description Default Value<br />
Amplitude Amplitude of the eigenmode 1<br />
FramesPerPeriod Specify number of frames for each period 40<br />
TimePerPeriod Set period duration 2<br />
Repetitions Set number of repetitions 3<br />
Data Structure<br />
Example<br />
animModeShape(sys.results.modal,1);<br />
15 von 26 11.11.2011 18:06
Neweulm2 - Simulation and Animation - IT M Wiki<br />
http://www.itm.uni-stuttgart.de/itmwiki/index.php?ti...<br />
animTimeInt<br />
Animation of results of a time integration or similarly stored results.<br />
Syntax<br />
animTimeInt(tisol, 'Parameter1','Value1', 'Parameter2','Value2')<br />
Description<br />
Animates the motion described by a result as from a time integration. Therefore<br />
also the result of a kinematic analysis can be used.<br />
Parameter<br />
Description<br />
Default<br />
value<br />
tisol Structure with integration result as of ode45 -<br />
'TimeStep' Stepsize for animation time 'Optimal'<br />
'Stride' Real time factor, e.g. slow motion 1<br />
'CenterCS'<br />
Centers the view during the animation to this<br />
Coordinate system<br />
-<br />
'Record_avi'<br />
Records animation, i.e. a movie, to the<br />
.avi-<strong>file</strong>name passed as argument<br />
-<br />
'Print_frames'<br />
Print all frames of the animation to the folder<br />
specified as second value<br />
-<br />
'Resolution' Set resolution for 'Print_frames' in dpi 600<br />
Usually the trajectories are updated<br />
'plot_trajectories'<br />
automatically, but can be switched off<br />
true<br />
If 'TimeStep' is passed with 'Optimal' as an argument the optimal time step size<br />
is decided automatically. If nothing is specified, the result of the time<br />
integration is used.<br />
Data Structure<br />
Example<br />
animTimeInt;<br />
createAnimationWindow<br />
Syntax<br />
createAnimationWindow(varargin);<br />
Description<br />
16 von 26 11.11.2011 18:06
Neweulm2 - Simulation and Animation - IT M Wiki<br />
http://www.itm.uni-stuttgart.de/itmwiki/index.php?ti...<br />
If an animation window exists, it is closed. All other plot windows are unaffected.<br />
Then a new animation window is made, including any previously defined graphic<br />
objects, no matter if lines, markers, surfaces, patches, ... . This function was<br />
created to simplify the creation of an animation window. Therefore no matter<br />
what is available, exists or has been defined previously, this function is meant to<br />
recreate it as close as possible. Therefore all settings should be checked so it<br />
always works. Currently no options are available.<br />
Data Structure<br />
Example<br />
createAnimationWindow;<br />
defineGraphics<br />
Syntax<br />
defineGraphics<br />
Description<br />
Script which the user has to write, to define graphic visualizations of the bodies.<br />
This includes the creation of primitives described below, e.g.<br />
drawCube Draw cuboids<br />
drawLine Draw lines connecting two coordinate systems<br />
drawRotBody Draw rotational bodies, open or closed<br />
drawSphere Draw spheres<br />
drawSTL Read .stl <strong>file</strong>s from CAD-softwares and draw corresponding shapes<br />
transformGraphics Transform graphic objects in position and orientation<br />
with respect to their governing coordinate system. This function is for<br />
constant offsets not for an animation.<br />
Data Structure<br />
Example<br />
drawCube<br />
Syntax<br />
h = drawCube(CenterVect,dx,dy,dz,color,varargin);<br />
Description<br />
Creates a cuboid in the animation window with handle h. This cuboid is centered<br />
at CenterVect(1x3), with the side lengths dx, dy, dz and a given color. It has to<br />
be attached to a coordinate system with addGraphics.<br />
17 von 26 11.11.2011 18:06
Neweulm2 - Simulation and Animation - IT M Wiki<br />
http://www.itm.uni-stuttgart.de/itmwiki/index.php?ti...<br />
As optional input arguments the following are possible<br />
Option<br />
Description<br />
Default<br />
Value<br />
Tag Specify the tag of this object 'Cube'<br />
Color of the faces, overwrites the previously given<br />
FaceColor<br />
color, available to unify creation of shapes.<br />
[0 0 1]<br />
EdgeColor Color of the edges<br />
'none'<br />
Color Set face and edge color -<br />
FaceAlpha Set transparency of the faces 1<br />
EdgeAlpha Set transparency of the edges 1<br />
Data Structure<br />
No entry<br />
Example<br />
h = drawCube([0 0 0], 0.3,0.1,0.1, 'blue');<br />
drawElasticBeam<br />
Syntax<br />
handle = drawElasticBeam(lineID, varargin);<br />
Description<br />
After adding a line element with drawLine this function can be used to asign a<br />
certain crosssection to this line. The crosssection can be specified arbitrarily or<br />
one of the predefined ones (rectangle, circle or triangle can be used. If desired<br />
the faces can be removed by setting the 'FaceColor' option to 'none' or they can<br />
be transparent. As is common, non-required options are to be given in<br />
argument/value pairs.<br />
Data Structure<br />
See sys.graphics.surfaces.<br />
Example<br />
drawElasticBeam('myLine','Sidelengths',0.1);<br />
drawElasticBeam('myLine','Triangle',0.15,'FaceColor','none');<br />
drawLine<br />
18 von 26 11.11.2011 18:06
Neweulm2 - Simulation and Animation - IT M Wiki<br />
http://www.itm.uni-stuttgart.de/itmwiki/index.php?ti...<br />
Syntax<br />
[handle, error_msg] = drawLine(ListofFrames, ID, varargin);<br />
Description<br />
Adds a line object to the animation window, which connects the coordinate<br />
systems specified in ListofFrames. If two are given, they are connected with a<br />
straight line, more coordinate systems are connected by splines. For<br />
identification it is assigned an ID, other options are optional in varargin. These<br />
additional options are to be given pairwise and all of Matlab's line options are<br />
available, as they are passed straight through.<br />
Data Structure<br />
See sys.graphics.line.<br />
Example<br />
drawLine({'BODY1', 'BODY2_cg'}, 'MyLine','Color',[0 1 1]);<br />
drawMesh<br />
Syntax<br />
h = drawMesh(ID_,varargin)<br />
Description<br />
Depending on the software used to model the elastic bodies and perform the<br />
model reduction, so called 'mesh' data is available. This is usually the complete<br />
outer surface of the elastic body, which can then be used for an animation. If<br />
such data is available, this function is called automatically at body definition.<br />
This function also provides options to change settings like the color of the<br />
graphical representation.<br />
Data Structure<br />
See sys.graphics.surfaces.Mesh_1.<br />
Example<br />
drawMesh('BODY1','FaceColor',[1 0 0])<br />
drawRotBody<br />
Syntax<br />
h = drawRotBody(rvec,zvec,varargin)<br />
Description<br />
Creates a rotational solid in the animation window with handle h. The<br />
19 von 26 11.11.2011 18:06
Neweulm2 - Simulation and Animation - IT M Wiki<br />
http://www.itm.uni-stuttgart.de/itmwiki/index.php?ti...<br />
crosssection which is rotated aro<strong>und</strong> the z-axis is defined by coordinate pairs of<br />
support points rvec, zvec. It has to be attached to a coordinate system with<br />
addGraphics.<br />
As optional input arguments the following are possible<br />
Option Description Default Value<br />
Tag Specify the tag of this object 'RotBody'<br />
FaceColor Color of the faces [0 0 1]<br />
EdgeColor Color of the edges [0 0 1]<br />
Color Set face and edge color -<br />
FaceAlpha Set transparency of the faces 1<br />
EdgeAlpha Set transparency of the edges 1<br />
NumPoints Number of interpolation points on circumference 32<br />
Data Structure<br />
No entry<br />
Example<br />
h = drawRotBody([0.025 0.025],[0 1]);<br />
h = drawRotBody([0.025 0.025],[0 1], 'FaceColor','yellow', 'EdgeColor','green');<br />
drawSphere<br />
Syntax<br />
h = drawSphere(CenterVect, r,n, color, varargin);<br />
Description<br />
Creates a sphere in the animation window with handle h. This sphere is centered<br />
at CenterVect(1x3), with the radius r, n interpolation points aro<strong>und</strong> the<br />
circumference and a given color. It has to be attached to a coordinate system<br />
with addGraphics.<br />
As optional input arguments the following are possible<br />
Option Description Default Value<br />
Tag Specify the tag of this object 'Sphere'<br />
EdgeColor Color of the edges<br />
'none'<br />
Color Set face and edge color -<br />
20 von 26 11.11.2011 18:06
Neweulm2 - Simulation and Animation - IT M Wiki<br />
http://www.itm.uni-stuttgart.de/itmwiki/index.php?ti...<br />
FaceAlpha Set transparency of the faces 1<br />
EdgeAlpha Set transparency of the edges 1<br />
Data Structure<br />
No entry<br />
Example<br />
h = drawSphere([0 0 0],0.2,20,'red');<br />
drawSpring<br />
Syntax<br />
drawSpring(ksys1, ksys2, ID, varargin);<br />
Description<br />
Creates a representation of an elastic spring connecting two coordinate systems<br />
ksys1 and ksys2. As optional inputs some specifications of the line and the<br />
dimensions of the spring can be given.<br />
Data Structure<br />
No entry<br />
Example<br />
drawSpring('KSYS1','KSYS2','mySpring');<br />
drawSpring('KSYS1','KSYS2','mySpring', 'Color',[1 0 0], 'diameter', 10);<br />
drawSTL<br />
Syntax<br />
h = drawSTL(<strong>file</strong>name, c, dx, dy, dz, fcolor, ecolor, varargin);<br />
Description<br />
Reads an STL <strong>file</strong> from <strong>file</strong>name which can be created with a CAD program and<br />
creates the corresponding shape in the animation window. This shape is located<br />
at the centervector c with scaling factors for all axis directions dx, dy, dz. The<br />
color of the faces is set to fcolor and the color of the edges to ecolor. The<br />
handle is returned in h, it has to be attached to a coordinate system with<br />
addGraphics.<br />
As optional input arguments the following are possible<br />
21 von 26 11.11.2011 18:06
Neweulm2 - Simulation and Animation - IT M Wiki<br />
http://www.itm.uni-stuttgart.de/itmwiki/index.php?ti...<br />
Option Description Default Value<br />
Tag Specify the tag of this object 'STL'<br />
Color Set face and edge color -<br />
FaceAlpha Set transparency of the faces 1<br />
EdgeAlpha Set transparency of the edges 1<br />
Data Structure<br />
No entry<br />
Example<br />
h = drawSTL(myshape.stl, [0 0 0], 1, 1, 1, [0 0 1], [0 1 0]);<br />
fitCanvas<br />
Syntax<br />
fitCanvas(figureOpt, varargin);<br />
Description<br />
Scales the axes in the animation window so the most recent simulation result fits<br />
in nicely. figureOpt is one of the following:<br />
'square' the same as if you type axis square by hand<br />
'small' the same as if you type axis small by hand<br />
'equal' the same as if you type axis equal by hand<br />
'CenterCS' allows you to center the animation to a given coordinate system.<br />
For more information type help fitCanvas in Matlab.<br />
There are some optional Parameters you can use, which are described in the <strong>file</strong>.<br />
Data Structure<br />
No entry<br />
Example<br />
fitCanvas('equal');<br />
plotTrajectories<br />
Syntax<br />
[curves, csys_names] = plotTrajectories(csys_specifier, varargin);<br />
22 von 26 11.11.2011 18:06
Neweulm2 - Simulation and Animation - IT M Wiki<br />
http://www.itm.uni-stuttgart.de/itmwiki/index.php?ti...<br />
Description<br />
Creates a line along the trajectory of a given coordinate system csys_specifier<br />
and optionally plotting options. When called without arguments all lines are<br />
updated. To reset everything call plotTrajectories('reset'). This function is<br />
usually called after a time integration, but can be called already in the modeling<br />
step. With the option 'Refine' a factor for the number of interpolation points can<br />
be specified, e.g. by calling plotTrajectories('Refine',2); twice as many<br />
interpolation points are used. In curves the support points are returned, while<br />
in csys_names the names of the corresponding coordinate systems are<br />
available.<br />
Data Structure<br />
All the information is stored <strong>und</strong>er sys.graphics.marker. Each line gets one<br />
substructure, called as its corresponding coordinate system. Most entries are<br />
optional, specifying line properties. A default structure for coordinate system<br />
csys1 looks like<br />
sys.graphics.marker.cys1.tag = 'automark_csys1';<br />
Example<br />
plotTrajectories('BODY1');<br />
setVisibility<br />
Syntax<br />
setVisibility(Vis, varargin);<br />
Description<br />
Sets the visibility of objects to Vis ('on'/'off'). Optionally you can select which<br />
object shall be changed.<br />
Data Structure<br />
No entry<br />
Example<br />
setVisibility('on'); % Switches everything on<br />
setVisibility('off','Type','Text'); % Disables the text<br />
setVisibility('off','Body','BODY_1'); % Makes 'BODY_1' invisible<br />
showModeShape<br />
23 von 26 11.11.2011 18:06
Neweulm2 - Simulation and Animation - IT M Wiki<br />
http://www.itm.uni-stuttgart.de/itmwiki/index.php?ti...<br />
Syntax<br />
[myFigs,myAxes] = showModeShape(modalResults,n,varargin);<br />
Description<br />
Displays the all or the given modeshapes. The modeshapes should be available in<br />
modalResults, while the index of a certain mode shape n can be specified.<br />
As optional input arguments the following are possible<br />
Option<br />
Description<br />
Default<br />
Value<br />
Amplitude Amplitude for the mode shape 1<br />
ShowRefPos<br />
Parameter if the reference position is to be<br />
displayed<br />
'off'<br />
RefPosTransparency Transparency of the reference position 0.5<br />
AdjustFigure Option if figure size is to be adjusted true<br />
Data Structure<br />
Example<br />
showModeShape(sys.results.modal, 2);<br />
transformGraphics<br />
Syntax<br />
transformGraphics(h,varargin);<br />
Description<br />
Move and rotate the graphic object with handle h. This changes the position and<br />
orientation of a graphic object relative to its describing coordinate system,<br />
which is moved during an animation. So it is a static translation or rotation.<br />
As optional input arguments the following are possible<br />
Option Description Default Value<br />
Translation Move graphic object [0 0 0]<br />
RotationAngles Kardan angles to rotate the object [0 0 0]<br />
RotationMatrix Specify rotation matrix to rotate object eye(3)<br />
RotationOrigin Specify the point of reference for the rotation [0 0 0]<br />
24 von 26 11.11.2011 18:06
Neweulm2 - Simulation and Animation - IT M Wiki<br />
http://www.itm.uni-stuttgart.de/itmwiki/index.php?ti...<br />
Data Structure<br />
No entry<br />
Example<br />
transformGraphics(h,'RotationAngles',[0,-0.5*pi, 0]);<br />
updateGeo<br />
Syntax<br />
updateGeo(t,y);<br />
Description<br />
Dynamically update the animation window to a given time t and a position vector<br />
y. If no input arguments are specified but an animation window exists, the same<br />
configuration is used, otherwise all values are initialized with zeros.<br />
Data Structure<br />
No entry<br />
Example<br />
updateGeo(0,zeros(sys.dof));<br />
Functions called internally<br />
drawSys<br />
Syntax<br />
drawSys(ksyslist);<br />
Description<br />
Creates coordinate systems and assigns them to the hggroups created by<br />
initGraphics. A list of coordinate systems can be specified, otherwise all are<br />
used. In former versions this function has been called directly by the user, now<br />
this task is done by #createAnimationWindow.<br />
Data Structure<br />
initGraphics<br />
Syntax<br />
initGraphics(varargin);<br />
25 von 26 11.11.2011 18:06
Neweulm2 - Simulation and Animation - IT M Wiki<br />
http://www.itm.uni-stuttgart.de/itmwiki/index.php?ti...<br />
Description<br />
Creates and initializes a figure window. This function is the first to be called. In<br />
former versions this function has been called directly by the user, now this task<br />
is done by #createAnimationWindow.<br />
As optional input arguments the following are possible<br />
Option Description Default Value<br />
KsysArrowSize<br />
Size of the arrays of coordinate<br />
systems<br />
0.08<br />
KsysArrowColors Colors of the vectors {'red','yellow','blue'}<br />
Number of points on<br />
KsysArrowNumPoints<br />
circumference<br />
10<br />
KsysArrowShapeRatio Ration length/thickness of arrows 1/20<br />
KsysFontSize Fontsize for labels 12<br />
Data Structure<br />
sys.graphics<br />
Example<br />
initGraphics;<br />
See also<br />
ITM Wiki<br />
neweulm2<br />
neweulm2#Function reference<br />
neweulm2 - System Definition<br />
neweulm2 - Equations of Motion<br />
neweulm2 - Exporting<br />
Retrieved from "http://www.itm.uni-stuttgart.de/itmwiki/index.php/Neweulm2_-<br />
_Simulation_and_Animation"<br />
This page was last modified 12:13, 10 November 2011.<br />
26 von 26 11.11.2011 18:06
Neweulm2 - Exporting - IT M Wiki<br />
Neweulm2 - Exporting<br />
From ITM Wiki<br />
Neweul-M² offers a few possibilities to create <strong>file</strong>s to export some parts of the<br />
model.<br />
Contents<br />
1 Export data from Neweul-M²<br />
2 Functions to be called by the user<br />
2.1 exportEqMot<br />
2.2 writeAnimGeo<br />
2.3 writeSfunction<br />
2.4 writeStrFile<br />
2.5 writeSysDef<br />
2.6 Loading and Saving<br />
3 Auxiliary functions<br />
3.1 mcode2c<br />
3.2 symStruct2num<br />
4 See also<br />
4.1 ITM Wiki<br />
Export data from Neweul-M²<br />
Overview over available <strong>file</strong>s:<br />
Command<br />
exportEqMot<br />
writeAnimGeo<br />
writeSfunction<br />
writeStrFile<br />
writeSysDef<br />
Description<br />
Export equations of motion to be independent of the system<br />
data structure<br />
For an animation in Anim, write the geometry <strong>file</strong>s<br />
Write the equations of motion to a Simulink S-function in C<br />
For an animation in Anim, write the simulation specific<br />
data<br />
Write the input<strong>file</strong> sysDef.m for the current model<br />
1 von 6 30.08.2011 17:48
Neweulm2 - Exporting - IT M Wiki<br />
Loading and<br />
Saving<br />
Loading and saving of systems is described <strong>und</strong>er system<br />
definition<br />
Auxiliary <strong>file</strong>s<br />
Command<br />
Description<br />
Replace symbolic constants by numerical values in a given<br />
symStruct2num<br />
data structure<br />
mcode2c Convert Matlab Syntax of symbolic expressions to C-code<br />
Functions to be called by the user<br />
exportEqMot<br />
Syntax<br />
exportEqMot(varargin);<br />
Description<br />
Write the equations of motion, or some interesting values to a <strong>file</strong>, where all<br />
parameter values are defined in the <strong>file</strong> itself. This makes it independent of the<br />
global structure sys. Therefore it is called export, because there is no way back<br />
to the actual system.<br />
Data Structure<br />
No entry<br />
Example<br />
exportEqMot;<br />
exportEqMot('Linear',true,'Symbolic',false);<br />
exportEqMot('Expression',sys.lin.eqm,'Symbolic',false,'WhiteList',{'alpha_s','Dalpha_s'});<br />
writeAnimGeo<br />
Syntax<br />
writeAnimGeo;<br />
Description<br />
In order to perform an animation with Anim some <strong>file</strong>s are necessary. One<br />
should create representations for the bodies (*.geo), a <strong>file</strong> with a list of all those<br />
2 von 6 30.08.2011 17:48
Neweulm2 - Exporting - IT M Wiki<br />
representations (*.geoall) and one <strong>file</strong> containing the positions and orientations<br />
of the corresponding frames of reference. This function creates all simulation<br />
independent <strong>file</strong>s, meaning the first two of this list for the geometry. For the<br />
simulation data, please have a look at writeStrFile. Currently there are no input<br />
parameters available. The list of all geometries is called [sys.id,'.geoall'] and for<br />
every surface object in the animation window one .geo <strong>file</strong> is created with the<br />
name of the corresponding data substructure being the <strong>file</strong>name followed by<br />
.geo. These names are not too clear, as they are called e.g. 'Cube_1.geo', but<br />
they are definitely unique.<br />
Data Structure<br />
No entries<br />
Example<br />
writeAnimGeo;<br />
writeSfunction<br />
Syntax<br />
writeSfunction(S_name, mode);<br />
Description<br />
Exports the equations of motion to a Simulink S-Function, which is written in C.<br />
Therefore the <strong>file</strong>name S_name has to be passed and the <strong>file</strong> will be created in<br />
the folder sysFunctions and readily compiled. Another <strong>file</strong> for the initialization<br />
will also be created but the function will print an explanation during its call. The<br />
parameter mode can be either 'linear' or 'nonlinear' describing which equations<br />
of motion are to be exported.<br />
In Simulink there are quite a few parameter names which are already<br />
assigned a specific value and purpose. This can cause problems, as this<br />
includes names like 'm' or 'S'. But there is no list of these names<br />
available.<br />
Currently this functionality is <strong>und</strong>er development, so check for changes in the<br />
release notes.<br />
Data Structure<br />
No entry<br />
Example<br />
writeSfunction('MySFunction.c', 'nonlinear');<br />
3 von 6 30.08.2011 17:48
Neweulm2 - Exporting - IT M Wiki<br />
writeStrFile<br />
Syntax<br />
writeStrFile(tisol, deltat, varargin);<br />
Description<br />
Creates a .str <strong>file</strong> for an animation with anim. The other <strong>file</strong>s, e.g. geometry,<br />
have to be provided by the user. As input a result of a time integration or other<br />
motion tisol has to be provided. A time stepsize deltat for the animation has to<br />
be given. If nothing else is specified the <strong>file</strong> has the name of the system ID.<br />
Optional input arguments are:<br />
'Filename','MyFile.str' Sets the <strong>file</strong>name to MyFile.str<br />
'CoordinateSystems',{'CSYS1','BODY1_cg'} Writes data only for these<br />
coordinate systems<br />
'CoordinateSystems','cg' Writes data only for centers of gravity of all bodies<br />
Data Structure<br />
No entries<br />
Example<br />
writeStrFile(sys.results.timeInt, 0.05, 'CoordinateSystems','cg')<br />
writeSysDef<br />
Syntax<br />
writeSysDef(sysDefName);<br />
Description<br />
From the data stored in the structure sys this function creates the necessary<br />
input <strong>file</strong> to recreate the system. In a former version two <strong>file</strong>s have been created,<br />
but now only sysDef.m is written containing all system definitions (bodies, force<br />
elements, ...). This allows the user to switch from the GUI to the command or<br />
input <strong>file</strong> based mode. The <strong>file</strong>name to which the system is exported can be<br />
specified in sysDefName. Now also all graphic objects, meaning surface/patch<br />
objects, dynamic lines and trajectories are exported to this <strong>file</strong>. This is possible<br />
because constants can be given a numerical value immediately and information<br />
on graphic objects is available in the data structure. So then only one <strong>file</strong> is<br />
necessary to store the complete information in one <strong>file</strong>.<br />
Data Structure<br />
No entries<br />
Example<br />
4 von 6 30.08.2011 17:48
Neweulm2 - Exporting - IT M Wiki<br />
writeSysDef;<br />
Loading and Saving<br />
To load or save a system to a .mat <strong>file</strong> and its animation window to a .fig <strong>file</strong>,<br />
please see neweulm2 - System Definition#Loading and Saving<br />
Auxiliary functions<br />
mcode2c<br />
Syntax<br />
outputvect = mcode2c(inputvect);<br />
Description<br />
For a given symbolic array inputvect this function returns C-code syntax<br />
evaluating this expression. This includes e.g. changing power signs and ensuring<br />
that all numerical values are of type double.<br />
Data Structure<br />
No entry<br />
Example<br />
outputvect = mcode2c(sys.eqm.M);<br />
outputvect = mcode2c(sys.eqm.M(1,1));<br />
symStruct2num<br />
Syntax<br />
exprStruct_ = symStruct2num(exprStruct_, whiteList_);<br />
Description<br />
In the data structure exprStruct_ all symbolic parameters previously declared<br />
as constants are replaced by their corresponding numerical values, unless those<br />
parameters in the cell array whiteList_, which are kept. A similar data<br />
structure is returned as exprStruct_. If the input data structure is only one<br />
array, the output has the same dimensions and data type.<br />
Data Structure<br />
No entry<br />
Example<br />
5 von 6 30.08.2011 17:48
Neweulm2 - Exporting - IT M Wiki<br />
exprStruct_ = symStruct2num(sys.eqm, {'g','alpha'});<br />
See also<br />
ITM Wiki<br />
neweulm2<br />
neweulm2#Function reference<br />
neweulm2 - System Definition<br />
neweulm2 - Equations of Motion<br />
neweulm2 - Simulation and Animation<br />
Retrieved from "http://www.itm.uni-stuttgart.de/itmwiki/index.php/Neweulm2_-<br />
_Exporting"<br />
This page was last modified 15:40, 30 June 2011.<br />
6 von 6 30.08.2011 17:48
Neweulm2 - Programming tips - IT M Wiki<br />
http://www.itm.uni-stuttgart.de/itmwiki/index.php?ti...<br />
Neweulm2 - Programming tips<br />
From ITM Wiki<br />
Contents<br />
1 Programming tips<br />
1.1 Comments<br />
1.2 Variable names<br />
1.3 File names<br />
1.4 Conditionals and loops<br />
1.5 Graphic user interfaces<br />
1.5.1 Useful hints to design a new GUI<br />
2 See also<br />
Programming tips<br />
The most important rule is:<br />
Upload only <strong>file</strong>s on the server, that run without errors!<br />
There will always be some bugs left to be fo<strong>und</strong> later when adding new<br />
features, but please test your <strong>file</strong>s before commiting them.<br />
Do a spell checking on all your prompts, printouts and labels.<br />
Remember that the program has to run not only on the institutes Linux<br />
computers, but on other ones, e.g. with Windows as well. A useful<br />
command in Matlab for this is '<strong>file</strong>sep', which gives you the correct divider<br />
(/ or \) for the current machine. Please avoid calling any non-Matlab<br />
commands, as they are usually not portable between different operating<br />
systems.<br />
A difficult thing to check is whether you are using a certain toolbox. If you<br />
are using a toolbox which not everyone might have, a fallback solution is<br />
very useful, which can run without the special features. Of course this<br />
fallback will offer less functionalities.<br />
Try to write the program so it checks if all information exists properly.<br />
Examples for this is ensuring linearized equations of motion for a modal<br />
analysis, or missing entries in the global variable gui for graphic<br />
applications.<br />
1 von 6 30.08.2011 17:48
Neweulm2 - Programming tips - IT M Wiki<br />
http://www.itm.uni-stuttgart.de/itmwiki/index.php?ti...<br />
Comments<br />
Please comment your <strong>file</strong>s extensively, you can hardly have too many comments.<br />
Without comments, not even you will <strong>und</strong>erstand the program after a month.<br />
The preferable language for comments is english although there are still some<br />
german comments left.<br />
In a <strong>file</strong> containing a function myfunction the commented block from line 2 is<br />
displayed when entering help myfunction in Matlab. Describe the purpose of this<br />
<strong>file</strong> and all in-/output variables. An extensive help comment can be fo<strong>und</strong> in the<br />
function finiteDifferences. It doesn't have to be always this long, but this text<br />
should be enough to know where this function fits in the complete program. The<br />
help comment however has to fulfill some criteria:<br />
The first line has to be the complete syntax of this function including all<br />
output and input arguments as written after the function command. This is<br />
vital as when this software is passed on to users outside the institute they<br />
cannot read the source code, but only the help messages. Therefore they<br />
need these informations.<br />
Following this, a short explanation has to follow what this function does.<br />
This section, as all other comments too, should be in english to ensure,<br />
everyone can <strong>und</strong>erstand it.<br />
Then write a list of all required input arguments in the order of their<br />
appearance together with explanations. These explanations should contain<br />
the required data type. However as soon as there is some standard value,<br />
which will usually be passed, you should check this argument in your code.<br />
If an empty expression is passed, or the user called the function with too<br />
few arguments, you should use this standard value. In the help text, this<br />
standard value should appear in curly brackets {}.<br />
Then write a list of all optional input parameters, usually to be given in<br />
argument/value pairs. Again, include the data type and the standard value.<br />
Then a list of all return values should follow so the user knows what he<br />
will get back and in which form.<br />
Depending on the <strong>file</strong>, you might want to include your name, so if someone<br />
has questions they can contact you.<br />
Variable names<br />
Please use telling names, so someone else can <strong>und</strong>erstand what this<br />
parameter is for, e.g. to determine if the linear or nonlinear equations are<br />
to be used, use islinear instead of flag.<br />
Name logical parameters so people <strong>und</strong>erstand them, islinear would be<br />
much better than only linear. Most often the prefixes is or use are very<br />
helpful. Try calling them affirmative like isFo<strong>und</strong> not isNotFo<strong>und</strong>.<br />
2 von 6 30.08.2011 17:48
Neweulm2 - Programming tips - IT M Wiki<br />
http://www.itm.uni-stuttgart.de/itmwiki/index.php?ti...<br />
Try to avoid the parameters i and j. Many people like to use them,<br />
especially for loops, but in Matlab they represent the complex unit! For<br />
internal parameters, try using parameters with trailing <strong>und</strong>erscores like g_,<br />
h_ to avoid name conflicts. They look strange at first, but that's why<br />
probably most users won't type them.<br />
Do not introduce new global variables! Should it be unavoidable, create<br />
a new global structure. Never create single global parameters.<br />
File names<br />
When thinking of <strong>file</strong>names, the most important rule is that it needs to be a<br />
telling name! If nobody <strong>und</strong>erstands what this <strong>file</strong> will do, it's no use.<br />
Please try to start them with lower case letters, which makes typing easier<br />
when using the [Tab] key.<br />
If the name consists of several words, it is easier to read when new words<br />
only start with capital letters, e.g. finiteDifferences.m. Use <strong>und</strong>erscores<br />
only if necessary.<br />
If you write a <strong>file</strong> <strong>und</strong>er a very general name, your code should live up to<br />
this task. E.g. when you call your <strong>file</strong> finiteDifferences or<br />
frequencyResponse it cannot be restricted to a very specialized case of<br />
application. Otherwise you would block other <strong>file</strong>names or provoke<br />
problems when two functions have the same name.<br />
If you wrote a function which will only be called from one <strong>file</strong>, insert it as a<br />
subfunction to this <strong>file</strong>. This avoids quadrillions of <strong>file</strong>s and keeps this<br />
number to a reasonable amount. At the end of each subfunction write a<br />
short comment like<br />
end % END OF myFunction<br />
Conditionals and loops<br />
Every if() statement ought to provide an else case, so nothing is forgotten,<br />
as well as every switch needs its otherwise. In the first appearance of such<br />
conditionals, you should throw errors if some input is not <strong>und</strong>erstood. The<br />
idea is to produce the error at the first possibility, especially before<br />
something would be changed at the system data structure.<br />
Try distinguishing your cases without respect to the case of characters by<br />
using strcmpi and switch lower(myCrit).<br />
In order to get Matlab as fast as possible, you should use vector operations<br />
as often as possible. Instead of 'for h_=1:10; myVect(h_) = h_; end' type<br />
'myVect=[1:10];', which is much faster.<br />
When you need to make a loop over a matrix like 'for h_=1:5; g_=1:10;<br />
myMatrix(g_,h_)=...; end; end' it is better to have the inner index (here 'g_')<br />
to run columnwise as shown in the example. This usually contradicts the<br />
3 von 6 30.08.2011 17:48
Neweulm2 - Programming tips - IT M Wiki<br />
http://www.itm.uni-stuttgart.de/itmwiki/index.php?ti...<br />
rule to use the loop parameters in alphabetical order at some point, but<br />
improves speed.<br />
Graphic user interfaces<br />
The only way to ascertain user expectations is to do user testing. No amount<br />
of study and debate will substitute, so use your GUI a few times or ask<br />
someone to use it.<br />
Try to provide default values which can be changed later and call this<br />
setting Standard.<br />
Write help messages tightly and make them responsive to the problem:<br />
good writing pays off big in comprehension and efficiency.<br />
Write Tooltip Messages whenever possible, this are the messages displayed<br />
when moving the mouse over this uicontrol.<br />
Make Actions reversible. Always allow "Undo". To close a GUI with saving all<br />
settings use "OK" button, without saving "Cancel".<br />
Spell check all labels visible in the GUI.<br />
When something takes longer, try to make some progress information. Or<br />
at least show that the program is busy and not dead.<br />
Print information on what is being done in the standard output (Matlab<br />
window).<br />
Menu and button labels should have the key word(s) first.<br />
Example from a fictitious word processor:<br />
Wrong:<br />
1.<br />
2.<br />
3.<br />
Insert page break<br />
Add Footnote<br />
Update Table of Contents<br />
Right:<br />
Insert:<br />
1.<br />
2.<br />
3.<br />
Page break<br />
Footnote<br />
Table of contents<br />
Useful hints to design a new GUI<br />
The eaiest way to design a GUI in Matlab is by typing guide, which is a graphical<br />
tool for this purpose. Here are some hints on how to proceed, based on our<br />
experience.<br />
Make a rough draft of your GUI on a paper first. It saves an incredible<br />
4 von 6 30.08.2011 17:48
Neweulm2 - Programming tips - IT M Wiki<br />
http://www.itm.uni-stuttgart.de/itmwiki/index.php?ti...<br />
amount of time and work.<br />
From the paper draft, you will know the following things:<br />
which information shall be entered and displayed in this GUI<br />
the arrangement of your control elements<br />
which types of control elements you want to use, e.g. several radio<br />
buttons or one popup menu<br />
is there a way to structure your elements, e.g. by combining them in<br />
frames, which are just boxes with titles, to make the GUI easier to<br />
<strong>und</strong>erstand<br />
insert the control elements in the order in which they shall be used. This<br />
automatically sets up the correct order when using the TAB key. When you<br />
insert the control elements, immediately specify the Tag property. This is<br />
the identification with which you can access the control elements. The Tag<br />
should always consist of two parts. First there should be the information of<br />
the type of control element, then a telling specification of its purpose. This<br />
makes the code easy to write, to read and to <strong>und</strong>erstand. In addition, it<br />
saves time, because the tags all follow the same pattern, so you don't have<br />
to think about them while programming. Examples for this are<br />
button_apply, popup_groups, radio_input, edit_id, text_id,<br />
panel_centerOfGravity<br />
as soon as you save the first time, an m-File is created. This contains<br />
functions called according to the used Tags. As soon as you change a Tag, a<br />
search and replace command is used, so be careful if your Tags have been<br />
too short or could also appear as variable names<br />
adjust the dimensions of the elements. For all text elements, a height of<br />
1.5 appears quite good. Don't choose the width of the elements too tight, as<br />
the sizes vary slightly between different Matlab versions and operating<br />
systems. The best is to select a standard width for each part of the GUI and<br />
assign it to all elements, regardless if they need or not. Choose one<br />
appropriate size for all buttons<br />
arrange the elements using the provided tool<br />
the Opening function should do all adjustments to update the GUI to<br />
current settings. Then you can simply call the GUI without closing after<br />
each significant change. Then the GUI will reappear at the current position.<br />
If some settings should be performed only the very first time, this GUI is<br />
called, insert them in the respective CreateFcn of the element.<br />
when some data shall be stored, e.g. to check whether the user changed the<br />
ID of the modeling element <strong>und</strong>er consideration, store this <strong>und</strong>er<br />
handles.data and don't forget the command guidata(hObject, handles); to<br />
store this data after the insertion.<br />
check whether all data is available to avoid errors<br />
use the function getTxtContent to ensure all entered information is valid<br />
5 von 6 30.08.2011 17:48
Neweulm2 - Programming tips - IT M Wiki<br />
http://www.itm.uni-stuttgart.de/itmwiki/index.php?ti...<br />
See also<br />
Web:<br />
http://www.asktog.com/basics/firstPrinciples.html<br />
http://www.usabilitynet.org/management/b_design.htm<br />
http://www.datatool.com/downloads/matlab_style_guidelines.pdf<br />
Retrieved from "http://www.itm.uni-stuttgart.de/itmwiki/index.php/Neweulm2_-<br />
_Programming_tips"<br />
This page was last modified 08:25, 2 August 2011.<br />
6 von 6 30.08.2011 17:48
Neweulm2 - FAQ - IT M Wiki<br />
Neweulm2 - FAQ<br />
From ITM Wiki<br />
Here a list of frequently asked questions could evolve. It is also meant for a place<br />
for useful comments, that somehow don't fit in a category.<br />
Contents<br />
1 Frequently asked Questions<br />
1.1 Are there any restrictions to the complexity of the systems?<br />
1.2 Are there any names reserved for special purposes?<br />
1.3 I modeled something, where can I find the data?<br />
1.4 I ran a simulation, where did the results go?<br />
1.5 Is there a way to access the equations of motion?<br />
1.6 I didn't specify any parameters, what did the program use?<br />
1.7 I fo<strong>und</strong> a .m and .p <strong>file</strong> with the same name?<br />
1.8 An error occurred or the program crashed, what shall I do?<br />
1.9 Is there a difference between commands and the GUI?<br />
2 My system is too complex, what can I do?<br />
2.1 I use only absolute coordinates and it still takes forever!<br />
2.2 To simplify or not to simplify, that is the question.<br />
2.3 Calculate fully symbolic or rather do some work numerically?<br />
2.4 There are so many options, where can I find which I chose?<br />
2.5 Nonlinear equations work, but it always crashes at the<br />
linearization.<br />
2.6 Symbolic modeling is the best!<br />
2.7 Can I split up my system in simple parts?<br />
2.8 What is the orientation of my force elements?<br />
2.9 When I open a <strong>file</strong>, the Matlab editor crashes!<br />
2.10 I've done everything and nothing helped!<br />
Frequently asked Questions<br />
Are there any restrictions to the complexity of<br />
the systems?<br />
1 von 8 30.08.2011 17:49
Neweulm2 - FAQ - IT M Wiki<br />
Yes, there are some restrictions. When entering really big systems Maple or<br />
MuPad require quite a lot of time to come up with a result. The operation that<br />
needs the most effort is to simplify expressions with mapleSimplify.<br />
There is another known problem. Because of the currently used explicit<br />
formulation, many rotations can bust the algorithm. Especially if these rotations<br />
are to be executed in a row, in a chain-like structure, the rotation matrices grow<br />
immensely. Up to approximately six rotations it usually works, above this the<br />
program cannot solve it. If you encounter problems have a look further down at<br />
#My system is too complex, what can I do?, where possible cures are presented.<br />
Are there any names reserved for special<br />
purposes?<br />
Yes, there are. See neweulm2 - System Definition#Restrictions for Names for<br />
more details.<br />
I modeled something, where can I find the data?<br />
Every modeling element is stored with its complete input data in the system data<br />
structure sys. For each type of modeling element you can find a substructure<br />
which is then separated by the IDs of these elements. If you want to know where<br />
to search, please have a look at Neweulm2_-_System_Definition#newSys.<br />
I ran a simulation, where did the results go?<br />
All simulation routines are written so they have to modes of calling them. If you<br />
specify a return argument, e.g.<br />
result1 = timeInt(0, ones(sys.dof,1));<br />
the result is only written to that variable. If nothing is specified, e.g.<br />
timeInt(0, ones(sys.dof,1));<br />
all results go in their default location in sys.results, here sys.results.timeInt.<br />
Is there a way to access the equations of motion?<br />
Yes, this is one main advantage of this program. You can find the nonlinear<br />
equations of motion in sys.eqm and the linearized equations of motion in<br />
2 von 8 30.08.2011 17:49
Neweulm2 - FAQ - IT M Wiki<br />
sys.lin.eqm. However, if you need numerical values for these expressions please<br />
have a look at the <strong>file</strong>s in the folder sysFunctions, because for each of the<br />
expressions you can find at the locations mentioned above, one m-<strong>file</strong> function is<br />
created exactly for this purpose.<br />
I didn't specify any parameters, what did the<br />
program use?<br />
All functions are written so they can run with only the most essential input data.<br />
If parameters are not specified, standard values are taken instead, e.g. you<br />
could start a time integration by typing timeInt;. If you wonder what these<br />
standard values are, please type help Functionname or just open the function<br />
and have a look in there. Always at the very top of the <strong>file</strong> you first find a<br />
comment containing the help explanations. And usually right <strong>und</strong>er this, the<br />
default values are set, then optional input arguments read and their properties<br />
checked.<br />
I fo<strong>und</strong> a .m and .p <strong>file</strong> with the same name?<br />
Matlab offers a function called pcode whose purpose is to hide source code from<br />
users. It does not compile the given <strong>file</strong> but creates an intermediate stage<br />
keeping platform independency. The resulting <strong>file</strong> then gets the <strong>file</strong> extension .p<br />
but cannot contain any comments. That's why for each .p <strong>file</strong> you will find a .m<br />
<strong>file</strong> with the same name containing the help message displayed when typing<br />
help functionname. We started to use these p-functions to distribute our code<br />
more easily without having the fear that someone starts his own development<br />
from there. If you have questions on what happens in those functions, think that<br />
there are some errors contained, please contact your contact person at the ITM.<br />
An error occurred or the program crashed, what<br />
shall I do?<br />
In the case you were trying something, when the error came, do it different ;-).<br />
However, if you were actually working with the program you might want to<br />
follow the following checklist:<br />
Save your work.<br />
If it is any error related to the graphical animation, create a new animation<br />
window by typing createAnimationWindow and try the task again, that<br />
crashed the program before.<br />
Check your entry, if you made some mistake. If you're not sure, how you<br />
were supposed to enter the information, type help FUNCTION were<br />
3 von 8 30.08.2011 17:49
Neweulm2 - FAQ - IT M Wiki<br />
FUNCTION stands for the function causing the error, or in the GUI, click on<br />
'?'. If this is the case, but you think this wrong way was more inuitive,<br />
please tell your contact person or developer!<br />
With every error, you get a link to the line in the <strong>file</strong>, where the error<br />
occurred. If it's in an m-<strong>file</strong>, try clicking that link and see if you find out,<br />
why the program crashed.<br />
Try, if the error is reproducible. If so, find out what you have to do, to cause<br />
it and inform your contact person for the software about it.<br />
Please do not leave any reproducible errors be without telling your<br />
contact person or developer!<br />
Sometimes, when deleting and editing elements with the GUI some things<br />
are left over and not cleaned up properly. So if you were working on the<br />
system for some time with the GUI you can try exporting it to an input <strong>file</strong><br />
through the [File][Export System] menu or by calling writeSysDef. After<br />
creating this input <strong>file</strong>, please save all your data to a .mat <strong>file</strong> and clear the<br />
workspace. Then run the input <strong>file</strong> you just created and calculate the<br />
equations of motion. Then your system has been built from scratch and<br />
should work again. If this didn't help, you probably encountered a more<br />
serious problem.<br />
Is there a difference between commands and the<br />
GUI?<br />
The graphical user interface (GUI) is only used to compose commands which<br />
already exist. Therefore the GUI does not provide any additional functionality<br />
except to provide the commands more easily. On the other hand, this means that<br />
all new developments appear in the command line version first, before being<br />
integrated into the GUI. And the GUI usually does not provide all possible options<br />
to make things more simple.<br />
My system is too complex, what can I<br />
do?<br />
There might be some situations like the following:<br />
If you want to set up the equations of motion and it takes very long time, you<br />
might want to know what you can try to speed things up. If your system quits<br />
with the message 'Out of memory!' you're looking for a solution. Or if you have<br />
any other problems with the way the equations are set up and you just want<br />
everything to be simpler you are in need of some tweaks. This section shall<br />
explain a few 'screws' which you can turn and they might change the programs<br />
behavior the way you like, without changing the result. As there are many<br />
4 von 8 30.08.2011 17:49
Neweulm2 - FAQ - IT M Wiki<br />
possibilities which cause you to look for such a solution, all questions are very<br />
vague. But their main purpose is to let you know in which direction you can<br />
investigate.<br />
I use only absolute coordinates and it still takes forever!<br />
The program offers two ways to calculate the kinematics, relative and<br />
absolute. When using absolute kinematics, the absolute position vectors are<br />
set up and symbolically differentiated with respect to the generalized<br />
coordinates and time. This is repeated to obtain the accelerations, and the<br />
rotations are calculated similarly. This mode works only for rigid bodies, as soon<br />
as you have at least one elastic body in the system, the program changes to the<br />
other mode. The main reason for this is that in absolute mode, all equations are<br />
set up in the intertial frame ISYS, which is very inconvenient for elastic bodies.<br />
When using relative kinematics, velocities and accelerations are mostly<br />
calculated by adding and multiplying the necessary expressions to obtain the<br />
derivatives. Only where absolutely necessary, symbolic derivatives are used.<br />
Another difference is that all equations are set up, described in the frame of<br />
reference of each single body, except for some elastic bodies in the center of<br />
gravity.<br />
These two aspects, the describing frame of reference and the way to obtain the<br />
accelerations may make quite a difference in the look of the equations of<br />
motion. This leads to two conclusions:<br />
'Use relative kinematics for relative coordinates and absolute kinematics for<br />
absolute coordinates.'<br />
'For long chains of bodies, relative kinematics is better.'<br />
At this point it might be good to just think and analyze whether you prefer<br />
relative or absolute descriptions. Sometimes, one defines the system in one<br />
specific way without thinking about possibilities of how to do it different.<br />
To simplify or not to simplify, that is the question.<br />
The function calcEqMotNonLin.m offers an option to control the way<br />
simplifications are attempted. Most often, it is better to use the 'simplify'<br />
command. But especially when the expressions get long, this can take a lot of<br />
time, so you might want to try it without simplification. In the past, you could<br />
only switch the simplifications on or off, now you have more control. The<br />
parameter to control this setting is sys.par.codegen.simplify which can take<br />
integer values from 0 to 10. The value 10, which is the default, means simplify<br />
at every opportunity. The value 0 means do not simplify at all. Therefore you<br />
should be extremly careful to set this parameter to 0, as then some algorithms<br />
will not work properly anymore. For all even values (2,4,6,8,10) when Maple is<br />
5 von 8 30.08.2011 17:49
Neweulm2 - FAQ - IT M Wiki<br />
used as symbolic engine, the combine command is called. For all odd numbers<br />
and zero, this command is omitted. The combine command helps recognize e.g.<br />
trigonometric addition formulas. If you run into problems, just try switching it<br />
off. So you can try reducing this value e.g. to 4, which will still simplify where<br />
it's probably quite useful, but mostly the expressions are simply kept.<br />
Calculate fully symbolic or rather do some work numerically?<br />
When using the relative kinematics, one can use the minimal form of the<br />
equations of motion (M*D2y+k=q) with the Mass matrix M being<br />
transpose(J)*Mq*J or do this multiplication with the transposed global jacobian<br />
matrix J numerically. To judge which way is preferable, we should have a look at<br />
the dimensions of these matrices. The matrix Mq is quadratic and has the<br />
dimension 6*p, where the system contains p rigid bodies. Of course if the<br />
system contains elastic bodies, the size will still increase. The jacobian matrix J<br />
has dof columns, where dof represents the number of degrees of freedom.<br />
When having a small number of bodies, but comparably many degrees of<br />
freedom such a partial symbolic formulation may be useful. This comes from the<br />
fact that this would probably cause a complex jacobian matrix. If you have many<br />
bodies, but a comparably small number of degrees of freedom, the minimal<br />
form should be better, because the jacobian matrix would contain a lot of zeros,<br />
vanishing during the multiplication.<br />
There are so many options, where can I find which I chose?<br />
Parameters to determine how the software handles your system are stored <strong>und</strong>er<br />
sys.par. So you can either have a look directly into the data structure, or you can<br />
choose one of two much more comfortable ways.<br />
SystemParameters: This opens a GUI which lets you inspect and change the<br />
parameter settings graphically. You also are shown all possibilities together<br />
with some explanations.<br />
printSystemInformation: This is a very useful function to give you<br />
information about your system. It currently offers three sets of information:<br />
general, numerical and parameter. Here the parameter is the one you are<br />
looking for as it will print all current choices together with explanations.<br />
The other two present either numerical data like positions, inertia, ... or<br />
general information about the system structure, like the structure of<br />
coordinate systems.<br />
Nonlinear equations work, but it always crashes at the<br />
linearization.<br />
When linearizing the equations of motion, as a default, for each generalized<br />
6 von 8 30.08.2011 17:49
Neweulm2 - FAQ - IT M Wiki<br />
coordinate and its time derivatives symbolic set values are introduced. If you<br />
already know that you will only linearize aro<strong>und</strong> set values being zeros, you can<br />
save quite some space and time by telling this to the program. For this purpose<br />
calcEqMotLin.m offers an option called NumericalSetValues, which will<br />
exactly do that.<br />
There is the possibility to do a numerical linearization. If you need the equations<br />
linearized only for one configuration, you might want to look at<br />
calcNumericalLinearization.<br />
Symbolic modeling is the best!<br />
Of course symbolic modeling and setting up of equations has many advantages.<br />
But if you define a parameter for everything, the expressions have to get very<br />
long. For small models this doesn't pose a problem, but if your PC cannot cope<br />
with the resulting amount of data, you should think about a change. Depending<br />
on the point, where the expressions you have different choices.<br />
If only the linearization gets stuck, you can set up the equations of motion<br />
symbolically and then have a look at the function symStruct2num.m. It allows<br />
you to replace constants by their values and keep desired parameters<br />
symbolically for any given structure. By this you could perform only the<br />
linearization with numerical values.<br />
If the system is already difficult to set up nonlinear, you could check which<br />
parameter values you can insert immediately at the definition. For this you<br />
might introduce parameters in sysDef.m but when creating modeling elements<br />
like bodies, you could directly pass those parameters' values.<br />
Can I split up my system in simple parts?<br />
A powerful one is to think if you can split up your system in substructures. If<br />
you can separate your system and model parts of it separately, you can save<br />
quite some time. For example, if your system contains a lot of linear force<br />
elements connecting two bodies, it is quite easy to split up the model. In a first<br />
step you only model those two bodies, where one of them is even unmovable,<br />
then you add all force elements. If you then calculate the equations of motion<br />
and linearize them, the resulting stiffness matrix, can directly used to represent<br />
all of those force elements. Meaning, you can store the numerical values of this<br />
stiffness matrix and simply insert it in the full model. Then the program only<br />
has to consider one force element and not the complete huge number.<br />
What is the orientation of my force elements?<br />
A bit similar to the last part, where it was proposed to insert numerical values<br />
7 von 8 30.08.2011 17:49
Neweulm2 - FAQ - IT M Wiki<br />
instead of symbolic parameters, where possible, another trick exists. If you have<br />
many force elements in some orientation, it may be possible to rotate their<br />
stiffness, damping and other properties numerically to one governing frame and<br />
insert them then in the equations of motion. Especially, if you can transform<br />
them to the frame of reference of the attached body, it is possible to save some<br />
calculation time.<br />
When I open a <strong>file</strong>, the Matlab editor crashes!<br />
Unfortunately the Matlab editor can only handle <strong>file</strong>s up to a certain <strong>file</strong> size,<br />
which can be topped quite easily. But don't worry, other editors like the Emacs<br />
or Vi don't have any problems up to significantly larger sizes. So please just try a<br />
different editor first.<br />
It can happen, that the <strong>file</strong>s get so big, it slows down the simulations<br />
significantly. If you are using Maple for the symbolic calculation, you can try an<br />
option of newSys called CodeOptimize, which sets<br />
sys.par.codegen.optimize=true;. This changes the creation of <strong>file</strong>s for the<br />
numerical evaluation. It causes the program to search in the expressions for<br />
repeating elements. Those are then evaluated at the top of the function and the<br />
full expressions are set together by these precalculated parts. Matlab does<br />
something a bit similar at runtime anyway, but for some systems it still has a big<br />
impact. One disadvantage is that you lose any readability in those <strong>file</strong>s.<br />
I've done everything and nothing helped!<br />
First remark, please consider all the things mentioned here to be tricks worth<br />
trying. They depend strongly on the system <strong>und</strong>er consideration and its<br />
description. So if you simply used all of them, you probably went from bad to<br />
worse. Please think about, which might help you or simply try them one by one,<br />
but they are no universal remedies!<br />
If you still get problems, don't worry, there are always some tricks left in the<br />
box. If they are not written here, they are either simply not documented, or<br />
maybe not even implemented. But if you still have some problems, please<br />
contact one of the persons developing this software and ask if they have an idea.<br />
Retrieved from "http://www.itm.uni-stuttgart.de/itmwiki/index.php<br />
/Neweulm2_-_FAQ"<br />
This page was last modified 17:58, 14 March 2011.<br />
8 von 8 30.08.2011 17:49
Neweulm2 - Release notes - IT M Wiki<br />
http://www.itm.uni-stuttgart.de/itmwiki/index.php?ti...<br />
Neweulm2 - Release notes<br />
From ITM Wiki<br />
Here a list shall be maintained with all major changes. This is mostly to allow the<br />
users to get informed of new features. It is kept in an anti-chronological order,<br />
so recent changes appear on top.<br />
This is a research software, this means that there can always be some errors in<br />
the code. New features are especially vulnerable for them! Please always<br />
critically estimate if your results are reasonable.<br />
10.11.2011: Introduced newOpt for the optimization/sensitivity analysis,<br />
fixed some other issues<br />
28.10.2011: Change in coriolisSum for elastic bodies<br />
21.10.2011: Bugfix for the evaluation of omega<br />
07.10.2011: Implemented better checking if variable names are valid<br />
06.10.2011: Fixed modal analysis for kinematic loops*04.10.2011:<br />
Introduced fullModelRun to model the system and simulate everything.<br />
Introduced rotateElBody to include constant rotations in the data structure<br />
of elastic bodies.<br />
15.09.2011: Improved drawRotBody, improved performance for force<br />
elements<br />
14.09.2011: Added a new example chain for the recursive algorithm<br />
09.09.2011: Fixed quite a few bugs. Introduced a way for restricted<br />
licensing.<br />
04.09.2011: Improved C-export and added many new features for it<br />
30.08.2011: Introduced automatic representation of elastic bodies with<br />
meshes, see drawMesh. Updated newmark-type integrators<br />
24.08.2011: Changed animation objects to all being patches.<br />
17.08.2011: Changed angular description for SpringDampCmp force<br />
elements. Now using very simple way. Old formulation is available as<br />
SpringDampCmp_Rotmat.<br />
04.08.2011: Updates in several GUIs.<br />
02.08.2011: Added Newmark Integrators by Andreas Hanselowski.<br />
25.07.2011: Reworked C-export.<br />
22.07.2011: Now supporting all three parameter angular descriptions.<br />
21.06.2011: Enabled constant orientation offest for nodes of elastic bodies.<br />
10.06.2011: Improved GUI for graphic objects to be able to edit objects.<br />
31.05.2011: Introduced the possibility to include general (meaning<br />
user-defined) surface and patch objects in the animation window.<br />
30.05.2011: Extended functionality of constraint equations, introduced<br />
1 von 6 11.11.2011 18:07
Neweulm2 - Release notes - IT M Wiki<br />
http://www.itm.uni-stuttgart.de/itmwiki/index.php?ti...<br />
modifyBody to edit bodies. Animation uses orientation of g-vector.<br />
24.05.2011: Automated abbreviations can now be selected in desired level<br />
via sys.par.eqm.abbreviations. Compatibility with MatlabR2010a was<br />
increased.<br />
18.05.2011: Changed storage of equations of motion to cell arrays.<br />
06.05.2011: Fixed the implementation of Joint Systems for elastic bodies.<br />
20.04.2011: Reintroduced absolute kinematics, as default using relative, as<br />
it's much faster.<br />
15.04.2011: Using abbreviations of values for elastic bodies.<br />
18.04.2011: Graphical user interface to get started. This shows commands<br />
which are necessary for simple examples.<br />
31.03.2011: Introduced animFreqResponse, allowing the animation of one<br />
specific frequency response, now using numerical linearization if symbolic<br />
is unavailable. Using findroot if fsolve is not available. Rewrote kinematic<br />
analysis to respect initial conditions.<br />
24.03.2011: Introduced drawSpring, improved calculation of phi angles,<br />
especially for rotational springs<br />
22.03.2011: The functions to define graphic objects now accept symbolic<br />
constants in use in neweulm2.<br />
21.03.2011: Introduced the possibility to use the complete FE mesh for an<br />
animation<br />
15.03.2011: Introduced scripts in calcEqMotNonlin and writeMbsNonlin to<br />
allow users to write their own modules<br />
14.03.2011: Rewrote kinematics to strictly distinguish between relative and<br />
absolute values, hopefully improves speed<br />
14.03.2011: Fixed time interpolation in plotStandardResults, allow<br />
combinations of symbolic parameters as set values<br />
05.03.2011: Improved mapleSimplify and mapleSubs<br />
23.02.2011: Added our own rootsearch algorithm 'findroot', then the<br />
Optimization Toolbox is not necessary to calculate an equilibrium.<br />
Generalized writeAnimGeo so it can be used without neweulm2<br />
18.02.2011: Fixed calculation of reaction forces for elastic bodies<br />
11.02.2011: Improved the recreation of the animation window by storing<br />
the current configuration in the axes<br />
10.02.2011: Added the GUI SystemParameters to inspect and set<br />
parameters to control the behavior of the software. Introduced automatic<br />
calculation of Lagrange Multipliers for the QR and SVD method<br />
04.02.2011: Added the reverse modeled slider crank which sports nice<br />
singular configurations to compare system descriptions<br />
03.02.2011: Implemented non orthogonal reduced bodies which may cause<br />
non-symmetric mass matrices<br />
20.01.2011: Introduced drawElasticBody for the graphical representation<br />
of elastic beams (no animation of torsion)<br />
20.01.2011: Modularized calcEqMotNonLin.m, finished DAE to ODE<br />
2 von 6 11.11.2011 18:07
Neweulm2 - Release notes - IT M Wiki<br />
http://www.itm.uni-stuttgart.de/itmwiki/index.php?ti...<br />
conversion via SVD and QR method<br />
19.01.2011: Generalized the possible angular descriptions<br />
12.01.2011: Added a new formulation for systems with kinematic loops<br />
03.01.2011: Added some fixed step solvers<br />
17.12.2010: Function plotStandardResults introduced to create the most<br />
common plots<br />
16.12.2010: Options can be displayed by<br />
printSystemInformation('Parameter',true)<br />
16.12.2010: A cheat sheet, meaning a very short explanation is available<br />
<strong>und</strong>er info/cheatSheet.pdf<br />
13.12.2010: Unified the option parameters substructures sys.par<br />
08.12.2010: Now only one set of constraint functions for DAE systems is<br />
being used, no special ones to calculate initial conditions.<br />
07.12.2010: Generalized kinematic loops and constraint equations to even<br />
allow nonholonomic constraints.<br />
10.11.2010: Fixed a few bugs. Removed initSys.m, its functionality is now<br />
included in startSysDef.m.<br />
03.11.2010: Another update for the linearization. The search path is now<br />
handled by addpathNeweulm2.m. The SHA1 Hash-keys from GIT are now<br />
stored to identify program versions.<br />
26.10.2010: Unified the syntax for system outputs. Changed to GIT as<br />
version control system.<br />
25.10.2010: Reworked the GUI to define elastic bodies, fixed calls for<br />
Krylov reduction of elastic bodies.<br />
15.10.2010: Linearization has completely changed, now being able to<br />
linearize DAE systems with kinematic loops.<br />
14.10.2010: Added the type combination for system outputs, freqResPlot<br />
allows all states to be considered outputs.<br />
01.10.2010: The function timeInt.m offers stabilization for systems with<br />
constraint equations. Recently updated some functions for kinematic<br />
analysis.<br />
17.09.2010: Fixed a bug in iszero.m, inertia tensors are checked for<br />
symmetry in newBody, separation of coordinates for kinematic loops works<br />
now also for absolute kinematics.<br />
09.09.2010: Included separation of coordinates for kinematic loops,<br />
introduced iszero.m<br />
26.08.2010: Fixed some issue for reaction forces. Updated system outputs<br />
in GUI.<br />
23.08.2010: printSystemInformation now also provides numerical<br />
information.<br />
16.08.2010: For elastic bodies the information can be given directly as a<br />
struct-variable.<br />
09.08.2010: Introduced version numbers. More possibilities to choose the<br />
system description with kinematic loops.<br />
3 von 6 11.11.2011 18:07
Neweulm2 - Release notes - IT M Wiki<br />
http://www.itm.uni-stuttgart.de/itmwiki/index.php?ti...<br />
05.08.2010: Runtime optimization now available <strong>und</strong>er MuPad.<br />
09.07.2010: In the last few days, some bugs have been fixed.<br />
22.06.2010: Matmorembs is now called via a symbolic link, using the new<br />
data structure of Matmorembs.<br />
17.06.2010: Included 'See also' in help messages.<br />
01.06.2010: Included integration algorithms (for research use only).<br />
31.05.2010: New folder structure.<br />
28.05.2010: Several bugfixes and improvements to the recent changes.<br />
26.05.2010: Implemented some big changes. The storage of in- and outputs<br />
is different, offering more types and possibilities. Removed many <strong>file</strong>s by<br />
including their funcionality as subfunctions in their calling <strong>file</strong>s.<br />
05.05.2010: Included the preprocessor implemented by Nicolai Wengert to<br />
define elastic bodies directly in Matlab.<br />
22.03.2010: The use of the simplify command can be controlled by the<br />
parameter sys.par.codegen.simplify varying in the integer range [0,10].<br />
The value 10 representing the most frequent use and 0 avoiding every<br />
single call of mapleSimplify.<br />
17.03.2010: Tested compatibility with Matlab 2010a. Introduced a gui for<br />
frequency response curves.<br />
15.02.2010: Recently many help messages have been rewritten and<br />
extended.<br />
14.01.2010: Improved behavior for zero entries in rotmat2kardan.m. Fixed<br />
some bugs<br />
05.11.2009: Sped up the independency checking for kinematic loops.<br />
Added the automated export of geometries to Anim by writeAnimGeo.m.<br />
21.10.2009: Fixed a bug from the last update concerning the Spline<br />
Toolbox and some minor issues. Fo<strong>und</strong> the replacement of set values for the<br />
second derivatives was missing in calcEqMotLin.m.<br />
08.10.2009: The Spline and System Control Toolbox were necessary for<br />
some tasks. Now the Spline Toolbox is not used anymore and the System<br />
Control Toolbox is used only if available. Otherwise the frequency response<br />
is calculated manually, which is often slower than with the toolbox.<br />
25.09.2009: Improved the change between Maple and MuPad. Implemented<br />
additional features in animTimeInt.m.<br />
11.08.2009: Improved the use of the assume command of the last update.<br />
06.08.2009: In calcEqMotNonLin.m Maple (not MuPad) is told to assume<br />
small values for all parameters. This basically only make a difference for<br />
inverse trigonometric functions. Then asin(sin(alpha)) can be reduced to<br />
alpha.<br />
04.08.2009: Introduced automatic checking, which symbolic engine is<br />
used. Now both, Maple and MuPad should work without adjustments.<br />
23.07.2009: Over the time several small changes have been applied<br />
improving comfort, error prevention, comments. In the meanwhile all<br />
graphic objects, meaning surface objects and both types of lines can be<br />
4 von 6 11.11.2011 18:07
Neweulm2 - Release notes - IT M Wiki<br />
http://www.itm.uni-stuttgart.de/itmwiki/index.php?ti...<br />
exported to sysDef.m as well.<br />
08.06.2009: Redesigned the GUIs EditBody and GraphicObjects. The first<br />
was necessary to offer all options and allow changes to the data. The latter<br />
shows more options on a smaller space and is a preparation that existing<br />
objects can be edited.<br />
27.05.2009: The gradient calculation now accepts the relative description<br />
and flexible bodies because the necessary explicit values of M, k and q are<br />
calculated automatically. The export to C was improved, because the<br />
function mcode2c.m has been rewritten.<br />
19.05.2009: Information of graphic objects like spheres, cubes, ... is now<br />
stored <strong>und</strong>er sys.graphics.surfaces. This enabled the writing of the function<br />
createAnimationWindow.m which recreates the complete animation<br />
window containing all graphic objects. This data is inserted upon creation<br />
of the graphic objects, so in order to have an effect loading a figure is not<br />
enough, but the <strong>file</strong> defineGraphics.m or defineGraphics_log.m has to be<br />
executed.<br />
05.05.2009: For constant parameters now the value can be specified upon<br />
creation. For flexible bodies with a buckens frame of reference a flag exists<br />
to distinguish different types of support. System inputs can be state<br />
dependent, which allows closed-loop-simulations. But for these system<br />
inputs the user has to be very careful about what he does, as hardly any<br />
checking is done.<br />
09.04.2009: Fixed some errors in calcEqMotNonLin.m. There values have<br />
been described in wrong coordinate systems. Now the mass matrix in<br />
sys.body.().M is always described in the local coordinate system. In the<br />
following table cases which contained problems are highlighted:<br />
Kinematics/body<br />
type<br />
Inertia<br />
tensor<br />
Gravity vector<br />
absolute/rigid ok ok ok<br />
relative/rigid<br />
described in<br />
ISYS, not CG<br />
relative/flexible ok ok<br />
described in<br />
primary system,<br />
not CG<br />
Force element<br />
described in<br />
coordinate system, not<br />
CG<br />
described in nodal<br />
frame, not frame of<br />
reference<br />
09.04.2009: Volume elements for pressure forces are included. STL <strong>file</strong>s<br />
can be imported to the animation window. Moved the storage position of SID<br />
data of flexible bodies.<br />
06.04.2009: Added the possibility to use buckens frame of reference in the<br />
center of gravity for flexible bodies. With the command drawLine.m several<br />
5 von 6 11.11.2011 18:07
Neweulm2 - Release notes - IT M Wiki<br />
http://www.itm.uni-stuttgart.de/itmwiki/index.php?ti...<br />
coordinate systems can be connected by cubic splines to represent flexible<br />
bodies.<br />
26.02.2009: Changed the names and folders on the server to Neweul-M²<br />
19.02.2009: Linearization of systems with flexible bodies available on two<br />
ways: Calculate M,k,q or use partial derivatives.<br />
06.02.2009: With the 'combine' command, addition theorems of sine/cosine<br />
are available. State dependent parameters support linearization, introduced<br />
two force-application points.<br />
08.01.2009: Force Elements offer a nominal force, which is applied at the<br />
nominal length.<br />
22.12.2008: Instantaneous update of the animation window in the GUI.<br />
19.12.2008: System can be changed to semi-symbolic formulation, export<br />
to m-<strong>file</strong>s (independent of sys) is possible.<br />
16.12.2008: Flexible bodies are supported in the GUI.<br />
05.12.2008: Flexible bodies are implemented, no buckens frame supported<br />
yet. Introduced the function printSystemInformation. Added the <strong>file</strong><br />
finiteDifferences.<br />
24.11.2008: Explicit definition of generalized coordinates wanted.<br />
11.10.2007: First available log entry.<br />
2006: Project has been started <strong>und</strong>er the name of Symbs.<br />
Retrieved from "http://www.itm.uni-stuttgart.de/itmwiki/index.php/Neweulm2_-<br />
_Release_notes"<br />
This page was last modified 16:28, 10 November 2011.<br />
6 von 6 11.11.2011 18:07