KerMor  0.9
Model order reduction for nonlinear dynamical systems and nonlinear approximation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
System.m
Go to the documentation of this file.
1 namespace models{
2 namespace golf{
3 
4 
5 /* (Autoinserted by mtoc++)
6  * This source code has been filtered by the mtoc++ executable,
7  * which generates code that can be processed by the doxygen documentation tool.
8  *
9  * On the other hand, it can neither be interpreted by MATLAB, nor can it be compiled with a C++ compiler.
10  * Except for the comments, the function bodies of your M-file functions are untouched.
11  * Consequently, the FILTER_SOURCE_FILES doxygen switch (default in our Doxyfile.template) will produce
12  * attached source files that are highly readable by humans.
13  *
14  * Additionally, links in the doxygen generated documentation to the source code of functions and class members refer to
15  * the correct locations in the source code browser.
16  * However, the line numbers most likely do not correspond to the line numbers in the original MATLAB source files.
17  */
18 
19 class System
39  public:
40 
42 
43 
44  public:
45 
47  this = this@models.BaseSecondOrderSystem(model);
48 
49  /* Initial position */
50  this.addParam(" x_0 ",1);
51  this.addParam(" y_0 ",1);
52 
53  /* Initial velocity */
54  this.addParam(" vx_0 ",1);
55  this.addParam(" vy_0 ",0);
56 
57  /* Hole position */
58  this.addParam(" hole_x ",0);
59  this.addParam(" hole_y ",0);
60 
61  /* #7: Gravity */
62  this.addParam(" Gravity ",9.81);
63  /* #8: Friction on grass */
64  this.addParam(" Grass friction ",0.03);
65 
66  this.NumStateDofs= 2;
67  this.NumDerivativeDofs= 2;
68  this.updateDimensions;
69 
70  x0 = dscomponents.AffineInitialValue;
71  x0.addMatrix(" mu(1) ",[1;0]);
72  x0.addMatrix(" mu(2) ",[0;1]);
73  this.x0= x0;
74 
75  this.f= models.golf.Force(this);
76 
78  }
79 
80 
82  prepareSimulation@models.BaseSecondOrderSystem(this, mu, inputidx);
83  m = this.Model;
84 
85  maxv = sqrt((1/(2*m.rad_ball)) * mu(7) * (2*m.rad_hole - m.rad_ball)^2 ); /* m/s */
86 
87  this.maxvforhole= maxv;
88 
89  /* Evtl. den Zeitschritt verkleinern, so dass der Ball nicht pro Schritt
90  * die Lochweite überspringen kann ODER
91  * Mindestens eine Auflösung von 24 Bildern pro sekunde, damit beim
92  * Aviexport ein flüssiges Video entsteht! */
93  dt = m.dt;
94  if (dt > 2*m.rad_hole/maxv) || (dt > 1/24)
95  this.MaxTimestep= min(0.9*2*m.rad_hole/maxv, 1/24);
96  else
97  this.MaxTimestep= dt;
98  end
99  }
100 
101 
102  protected:
103 
105  dv = [];
106  }
107 
108 
110  val = mu(3:4);
111  }
112 
113 
114 
115 };
116 }
117 }
118 
function val = getDerivativeInitialValues(colvec< double > mu)
Definition: System.m:109
function updateSparsityPattern()
The state space vector (NumTotalDofs) is composed of x: Original state space of second order model...
The base class for any KerMor detailed model.
Definition: BaseFullModel.m:18
Model
The Model this System is attached to.
An integer value.
inputidx
The current inputindex of the function .
Base class for all KerMor second-order dynamical systems.
dscomponents.AInitialValue x0
Function handle to initial state evaluation.
System:
Definition: System.m:19
System(models.BaseFullModel model)
Definition: System.m:46
mu
The current parameter for simulations, [] is none used.
function prepareSimulation(colvec< double > mu,integer inputidx)
Definition: System.m:81
dscomponents.ACoreFun f
The core f function from the dynamical system.
double MaxTimestep
The maximum timestep allowed for any ODE solvers.
function ModelParam p = addParam(char name, default, varargin)
Adds a parameter with the given values to the parameter collection of the current dynamical system...
function dv = getDerivativeDirichletValues()
Definition: System.m:104