Gelöste Aufgaben/JUMP: Unterschied zwischen den Versionen
Zeile 251: | Zeile 251: | ||
Running the program will deliver these results: | Running the program will deliver these results: | ||
[[Datei:JUMP-results-01.png|mini|target speed: 10 m/s.]] | [[Datei:JUMP-results-01.png|mini|target speed: 10 m/s.|alternativtext=|ohne]] | ||
<hr/> | <hr/> |
Version vom 24. März 2021, 11:41 Uhr
Problem Statement
This example from Mechatronics combines mathematical models of mechanical and electrical components to simulate an RC-car-model. We've taken some reference-parameters from commercial vendors and adopted them as appropriate.
Create a mathematical Model for an RC-Model Car.
The model shall account for the basic car-functions in a 2D-driving environment including vehicle dynamics, drive-train, battery and driver.
A 2D-test-parkour shall be provided to assess basic climbing and jumping capabilities of the car.
Overall Scope
We are tasked to provide a mathematical performance model for an RC-car model with a given reference-configuration. The mathematical model shall account for different operational envelopes and test for e.g. climbing capabilities, typical loads on springs and car-agility.
We follow a generic approach in modelling and simulation which consists of three overall steps:
- Structuring
- Modelling
- Simulating
Structure
The function of “structuring” is to break down this complex task - modelling and simulating the performance of our RC-car - into work-packages. We aim at reducing the complexity of the model until the remaining entities appears to be rather trivial to manage.
The structure we are aiming at is a pre-requisite for step 2: building the mathematical model. This model is the projection of the physical processes into mathematical equations. We’ll be implementing our model as an Initial-Value-Problem (IVP) , written in mathematical terms as
- Fehler beim Parsen (SVG (MathML kann über ein Browser-Plugin aktiviert werden): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \dot{\underline{Q}} = \underline{f}(\underline{Q},t) ; \dot{(.)} = \frac{\displaystyle d}{\displaystyle dt}(.)}
The left-hand side of the equation, q, are the state variables of our system. They are the minimum-set of values to describe the physical state of our model at a certain time t. The state variables stem from the car's sub-systems. We choose four workpackages to contribute to the state-variables:
- Battery:the power-source for the car
- Car Body: consisting of the car's chassis and its wheels
- Driver-Controls: processes that control acceleration and deceleration of the car
- E-Motor and Drive-Train: the mechanisms that transfer battery power into mechanical energy.
Each workpackage contributes state variables to the column vector q:
The IVP establishes mathematical equations describing how these state variables change over time, e.g. how a driver actuates the "gas"-pedal, which increases the motor-voltage, thus increasing the motor-torque and hence accelerating the car.
Our first approach is to depict each workpackage as graphical block and connect information / property exchange between blocks as in a diagramming tool:
The driver chooses a "gas"-pedal state "p" depending on information form the car's location, speed and battery temperature "TB".
At the E-motor, "p" sets the nominal voltage "UM" of the E-motor, this implies a motor current "IM" and wheel torque "MW".
The motor current "IM" then drives both the battery temperature and the available battery voltage "UB".
And the wheel torque propels the car, delivering new locations and velocities.
These are the submodels to be developed in each workpackage:
Model
The mathematical model consists of XX differential equations with coordinates for each subsystem:
- Fehler beim Parsen (SVG (MathML kann über ein Browser-Plugin aktiviert werden): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \underline{q}_B(t) := \left( \begin{array}{c} \color{orange} Q_B(t)\\ \color{orange} U_{B2}(t)\\ \color{orange} T_{B}(t)\\ \end{array}\right)} for the battery,
- Fehler beim Parsen (SVG (MathML kann über ein Browser-Plugin aktiviert werden): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \underline{q}_C(t) := \left( \begin{array}{c} \color{blue} u_1(t)\\ \color{blue} u_2(t)\\ \color{blue} u_3(t)\\ \color{blue} u_4(t)\\ \color{blue} \varphi(t)\\ \color{blue} \psi(t)\\ \end{array}\right)} for the car-body
- Fehler beim Parsen (SVG (MathML kann über ein Browser-Plugin aktiviert werden): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \underline{q}_D(t) := \left( \begin{array}{c} \color{green} E(t)\\ \end{array}\right)} for the driver and
- Fehler beim Parsen (SVG (MathML kann über ein Browser-Plugin aktiviert werden): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \underline{q}_E(t) := \left( \begin{array}{c} \color{red} I_M(t)\\ \color{red} \psi_M(t) \end{array}\right)} for the E-motor.
However, we have no elasticity accounted for between the E-motor and the wheel, thus
- Fehler beim Parsen (SVG (MathML kann über ein Browser-Plugin aktiviert werden): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \dot{\tilde{\psi}}(t) = n_G \cdot \dot{\tilde{\psi}}_M(t) }
and so the remaining coordinates are
- Fehler beim Parsen (SVG (MathML kann über ein Browser-Plugin aktiviert werden): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \underline{q}(t) := \left( \begin{array}{c} \color{orange} Q_B(t)\\ \color{orange} U_{B2}(t)\\ \color{orange} T_{B}(t)\\ \color{blue} u_1(t)\\ \color{blue} u_2(t)\\ \color{blue} u_3(t)\\ \color{blue} u_4(t)\\ \color{blue} \varphi(t)\\ \color{blue} \psi(t)\\ \color{green} E(t)\\ \color{red} I_M(t)\\ \end{array}\right)} .
We have to deal with first and second order time derivatives of coordinates from q. All mechanical coordinates (e.g. ui, φ) are represented with their second-order time-derivatives that come from their D'Alembert's Inertia Forces. In order to transfer the equations of motion into a uniform set of differential equation of first order, we employ e.g.
- Fehler beim Parsen (SVG (MathML kann über ein Browser-Plugin aktiviert werden): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \color{lightblue} \frac{\displaystyle d u_1(t)}{\displaystyle d t} \color{black} = \color{blue}v_1(t)\, , \, \color{lightblue} \frac{\displaystyle d \varphi(t)}{\displaystyle d t} \color{black} = \color{blue}\Omega(t) \text{ and } \color{lightblue} \frac{\displaystyle d \psi(t)}{\displaystyle d t} \color{black} = \color{blue}\omega(t)}
so that the column matrix of state variables of the system is
- Fehler beim Parsen (SVG (MathML kann über ein Browser-Plugin aktiviert werden): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \underline{Q}(t) := \left( \begin{array}{c} \color{orange} Q_B(t)\\ \color{orange} U_{B2}(t)\\ \color{orange} T_{B}(t)\\ \color{blue} v_1(t)\\ \color{blue} v_2(t)\\ \color{blue} v_3(t)\\ \color{blue} v_4(t)\\ \color{blue} \Omega(t)\\ \color{blue} \omega(t)\\ \color{lightblue} u_1(t)\\ \color{lightblue} u_2(t)\\ \color{lightblue} u_3(t)\\ \color{lightblue} u_4(t)\\ \color{lightblue} \varphi(t)\\ \color{blue} \psi(t) \color{black} \! \! \! \! \! \! \! \! \! \! \! --\\ \color{green} E(t)\\ \color{red} I_M(t)\\ \end{array} \right)} .
But as indicated above the rotation angle of the front wheel ψM never appears in our equation - we remove it from the list of state variables.
Now in matrix-notation, the resultant equations of motion are
- Fehler beim Parsen (SVG (MathML kann über ein Browser-Plugin aktiviert werden): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \underline{\underline{M}}\cdot \dot{\underline{Q}} = \underline{f}(\underline{Q})}
with
- Fehler beim Parsen (SVG (MathML kann über ein Browser-Plugin aktiviert werden): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \underline{\underline{M}} = \left( \begin{array}{cccccccccccccccc} \color{orange} 1&&&\\ &\color{orange} 1&&\\ &&\color{orange} 1&\\ &&&\color{blue} 2 {m_2}+{m_1} &\color{blue} 0 &\color{blue} 0 &\color{blue} 0 &\color{blue} 2 {m_2}\, {a_3} &\color{blue} 0\\ &&&\color{blue}0 &\color{blue} 2 {m_2}+{m_1} &\color{blue} {m_2} &\color{blue} {m_2} &\color{blue} {a_1}\, {m_2}-{a_2}\, {m_2} &\color{blue} 0\\ &&&\color{blue} 0 &\color{blue} {m_2} &\color{blue} {m_2} &\color{blue} 0 &\color{blue} {a_1}\, {m_2} &\color{blue} 0\\ &&&\color{blue} 0 &\color{blue} {m_2} &\color{blue} 0 &\color{blue} {m_2} &\color{blue} -{a_2}\, {m_2} &\color{blue} 0\\ &&&\color{blue} 2 {m_2}\, {a_3} &\color{blue} {a_1}\, {m_2}-{a_2}\, {m_2} &\color{blue} {a_1}\, {m_2} &\color{blue} -{a_2}\, {m_2}&\color{blue} {m_2}\left( 2 {{a}_{3}^{2}}+{{a}_{2}^{2}}+{{a}_{1}^{2}}\right)+{J_1}\color{black} +\color{red} \left(n_G^2+2\,n_G+1\right)\,J_3 &\color{blue} 0\color{red}-\left(n_G^2+n_G\right)\,J_3 \\ &&&\color{blue} 0 &\color{blue} 0 &\color{blue} 0 &\color{blue} 0 &\color{blue} 0 \color{red}-\left( n_G^2 +n_G \right) \,J_3 &\color{blue} {J_2}\color{black} +\color{red} n_G^2\,J_3\\ &&&&&&&&&\color{lightblue} 1&&&&\\ &&&&&&&&&&\color{lightblue} 1&&&\\ &&&&&&&&&&&\color{lightblue} 1&&\\ &&&&&&&&&&&&\color{lightblue} 1&\\ &&&&&&&&&&&&&\color{lightblue} 1\\ &&&&&&&&&&&&&&\color{green} 1\\ &&&&&&&&&&&&&&&\color{red} 1 \end{array} \right) }
and
- Fehler beim Parsen (SVG (MathML kann über ein Browser-Plugin aktiviert werden): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \underline{f}(\underline{Q}) = \left( \begin{array}{l} \color{orange} - \alpha(I_B)\cdot \beta(T_B)\cdot I_B\\ \color{orange} \frac{\displaystyle I_C}{\displaystyle C},\\ \color{orange} \frac{\displaystyle 1}{\displaystyle m_B \; c_B} \cdot \left( \dot{Q}_H - \dot{Q}_D\right)\\ \color{blue} \cos(\gamma_A)\, F_T - \sin(\gamma_2)\,F_{N2}-\sin(\gamma_A)\, F_{N1}\\ \color{blue} \left( -2 \,m_2-m_1\right) g+\sin(\gamma_A)\,F_T+\cos(\gamma_2)\, F_{N2}+\cos(\gamma_A) \, F_{N1}\\ \color{blue} -F_T \sin\left(\varphi(t)-\gamma_A\right)+F_{N1} \cos\left(\varphi(t)-\gamma_A\right)-m_2 g \cos\left(\varphi(t)\right)-b_1\,\dot{u}_3 -k_1\, u_3(t)\\ \color{blue} \sin(\gamma_2)\,F_{N2} \sin\left(\varphi(t)\right)+\left( \cos(\gamma_2)\,F_{N2}-m_2 g\right) \cos\left(\varphi(t)\right)-b_2\, \dot{u}_4 -k_2 \, u_4(t)\\ \color{blue} \left( a_3\, F_{N1}-a_1\, F_T\right) \sin\left(\varphi(t)-\gamma_A\right)+\left( a_3\, F_T+a_1\, F_{N1}\right) \cos\left(\varphi(t)-\gamma_A\right)+ \sin\left(\varphi(t)\right)+\left( \sin(\gamma_2(t))\,F_{N2} u_4(t)+\left( \sin(\gamma_1(t))\,F_{N1}-\cos(\gamma_2(t))\, F_T\right) u_3(t)+\left( a_2-a_1\right) \, m_2 g+\left( -a_3 \sin(\gamma_2(t))-a_2 \cos(\gamma_2(t))\right) \, F_{N2}\right) \cos(\varphi(t))+\left( \sin(\gamma_1(t))\, R\, F_T+\cos(\gamma_2(t)) F_{N1}\, R\right) \sin(\gamma_1(t))+\left( \cos(\gamma_2(t))\,R\, F_T -\sin(\gamma_1(t))\, F_{N1}\, R\right) \cos(\gamma_2(t)) + B \, \left(\omega(t)+\Omega(t) \right) +M_W\\ \color{blue} \left( -\sin(\gamma_A)\,R\, F_T-\cos(\gamma_A)\,F_{N1} \, R\right) \sin(\gamma_A(t)+\left( \sin(\gamma_A)\, F_{N1}\, R-\cos(\gamma_A)\, R\, F_T\right) \cos{\left( {{\gamma }_A}(t)\right) }+B \, \left(\omega(t)+\Omega(t) \right) +M_W\\ \color{lightblue} v_1\\ \color{lightblue} v_2\\ \color{lightblue} v_3\\ \color{lightblue} v_4\\ \color{lightblue} \Omega\\ \color{green} e\\ \color{red} \frac{\displaystyle 1}{\displaystyle L} \left( U_B \cdot p(t)-R\, I_M(t) - e \right)\\ \end{array} \right) }
Simulation
We implement the system of differential equations
- Fehler beim Parsen (SVG (MathML kann über ein Browser-Plugin aktiviert werden): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \underline{\underline{M}}\cdot \underline{\dot{Q}} = \underline{f}(\underline{Q})}
in MatlabⓇ - the nonlinear characteristics and the algorithm that computes the contact points between car and track are too demanding for Maxima.
Implementation in Matlab
We follow our basic process schema for implementing this initial-value-problem in Matlab.
The JUMP-script has these functions:
- pre-processing,
- solving and
- post-processing.
Key to the solution process is a call to Matlab's own solver
ode15s
for stiff differential equations. Though the equations of motion are not intrinsically stiff, this solver provided the best performance if the car encounters e.g. a rough touch-down after a jump-phase. The call to ode15s is
[t,y] = ode15s(@(t,y)jumpdydt(t,y,parC,parN,b,c,d,e,f),tspan,y0);
with parC, parN being maps of parameters.
The objects b, c, d, e, f are classes that hold parameters and functions related to each subsystem of the problem - from 'battery' to contact-'formulations'.
Matlab©-files
The folder-structure shows the main script JUMP.m. Classes and Functions are located in the respective dolfers. The Excel-file holds all system parameters.
To download the full Matlab-project download the zip-file from the link to your right.
download compressed archive →
Systamparameter
We collect all systems parameters in a spreadsheet file. Each system component has its own tab - e.g. the "car-body". We have two additional tabs, one for constants (gravity) and one for numerics (simulation end-time).
download spreadsheet →
Running the program will deliver these results:
Links
- ...
Literature
- ...