diff options
Diffstat (limited to 'Flight_Eqns')
-rwxr-xr-x | Flight_Eqns/Equations/Equations.aux | 1 | ||||
-rwxr-xr-x | Flight_Eqns/Equations/Equations.log | 184 | ||||
-rwxr-xr-x | Flight_Eqns/Equations/Equations.pdf | bin | 0 -> 104191 bytes | |||
-rwxr-xr-x | Flight_Eqns/Equations/Equations.tex | 72 | ||||
-rw-r--r-- | Flight_Eqns/Wind_Axis_eqns/Wind6DOF.mo | 191 | ||||
-rw-r--r-- | Flight_Eqns/Wind_Axis_eqns/Wind6DOFBasic.mo | 95 | ||||
-rw-r--r-- | Flight_Eqns/Wind_Axis_eqns/Wind6DOFBlock.mo | 185 | ||||
-rw-r--r-- | Flight_Eqns/Wind_Axis_eqns/Wind6DOFLinTest.mo | 184 | ||||
-rw-r--r-- | Flight_Eqns/Wind_Axis_eqns/Wind6DOFVer.mo | 182 | ||||
-rw-r--r-- | Flight_Eqns/Wind_Axis_eqns/Wind6DOFZagi.mo | 187 | ||||
-rw-r--r-- | Flight_Eqns/Wind_Axis_eqns/WindForceMoment.mo | 124 |
11 files changed, 1405 insertions, 0 deletions
diff --git a/Flight_Eqns/Equations/Equations.aux b/Flight_Eqns/Equations/Equations.aux new file mode 100755 index 0000000..f23e546 --- /dev/null +++ b/Flight_Eqns/Equations/Equations.aux @@ -0,0 +1 @@ +\relax diff --git a/Flight_Eqns/Equations/Equations.log b/Flight_Eqns/Equations/Equations.log new file mode 100755 index 0000000..c5d053c --- /dev/null +++ b/Flight_Eqns/Equations/Equations.log @@ -0,0 +1,184 @@ +This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017/Debian) (preloaded format=pdflatex 2018.5.22) 8 JUN 2018 12:57 +entering extended mode + restricted \write18 enabled. + %&-line parsing enabled. +**Equations.tex +(./Equations.tex +LaTeX2e <2017-04-15> +Babel <3.18> and hyphenation patterns for 84 language(s) loaded. +(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls +Document Class: article 2014/09/29 v1.4h Standard LaTeX document class +(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo +File: size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option) +) +\c@part=\count79 +\c@section=\count80 +\c@subsection=\count81 +\c@subsubsection=\count82 +\c@paragraph=\count83 +\c@subparagraph=\count84 +\c@figure=\count85 +\c@table=\count86 +\abovecaptionskip=\skip41 +\belowcaptionskip=\skip42 +\bibindent=\dimen102 +) +(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty +Package: amsmath 2017/09/02 v2.17a AMS math features +\@mathmargin=\skip43 + +For additional information on amsmath, use the `?' option. +(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty +Package: amstext 2000/06/29 v2.01 AMS text + +(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty +File: amsgen.sty 1999/11/30 v2.0 generic functions +\@emptytoks=\toks14 +\ex@=\dimen103 +)) +(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty +Package: amsbsy 1999/11/29 v1.2d Bold Symbols +\pmbraise@=\dimen104 +) +(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty +Package: amsopn 2016/03/08 v2.02 operator names +) +\inf@bad=\count87 +LaTeX Info: Redefining \frac on input line 213. +\uproot@=\count88 +\leftroot@=\count89 +LaTeX Info: Redefining \overline on input line 375. +\classnum@=\count90 +\DOTSCASE@=\count91 +LaTeX Info: Redefining \ldots on input line 472. +LaTeX Info: Redefining \dots on input line 475. +LaTeX Info: Redefining \cdots on input line 596. +\Mathstrutbox@=\box26 +\strutbox@=\box27 +\big@size=\dimen105 +LaTeX Font Info: Redeclaring font encoding OML on input line 712. +LaTeX Font Info: Redeclaring font encoding OMS on input line 713. +\macc@depth=\count92 +\c@MaxMatrixCols=\count93 +\dotsspace@=\muskip10 +\c@parentequation=\count94 +\dspbrk@lvl=\count95 +\tag@help=\toks15 +\row@=\count96 +\column@=\count97 +\maxfields@=\count98 +\andhelp@=\toks16 +\eqnshift@=\dimen106 +\alignsep@=\dimen107 +\tagshift@=\dimen108 +\tagwidth@=\dimen109 +\totwidth@=\dimen110 +\lineht@=\dimen111 +\@envbody=\toks17 +\multlinegap=\skip44 +\multlinetaggap=\skip45 +\mathdisplay@stack=\toks18 +LaTeX Info: Redefining \[ on input line 2817. +LaTeX Info: Redefining \] on input line 2818. +) (./Equations.aux) +\openout1 = `Equations.aux'. + +LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 8. +LaTeX Font Info: ... okay on input line 8. +LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 8. +LaTeX Font Info: ... okay on input line 8. +LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 8. +LaTeX Font Info: ... okay on input line 8. +LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 8. +LaTeX Font Info: ... okay on input line 8. +LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 8. +LaTeX Font Info: ... okay on input line 8. +LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 8. +LaTeX Font Info: ... okay on input line 8. + +LaTeX Warning: No \author given. + + +Overfull \hbox (95.66002pt too wide) detected at line 20 +\OML/cmm/m/it/10 C[] \OT1/cmr/m/n/10 = [] + [] + + +Underfull \hbox (badness 10000) in paragraph at lines 20--23 + + [] + + +Underfull \hbox (badness 10000) in paragraph at lines 30--32 + + [] + + +Underfull \hbox (badness 10000) in paragraph at lines 41--51 + + [] + + +Underfull \hbox (badness 10000) in paragraph at lines 41--51 + + [] + + +Underfull \hbox (badness 10000) in paragraph at lines 41--51 + + [] + + +Underfull \hbox (badness 10000) in paragraph at lines 41--51 + + [] + + +Underfull \hbox (badness 10000) in paragraph at lines 54--71 + + [] + + +Underfull \hbox (badness 10000) in paragraph at lines 54--71 + + [] + + +Underfull \hbox (badness 10000) in paragraph at lines 54--71 + + [] + + +Underfull \hbox (badness 10000) in paragraph at lines 54--71 + + [] + +[1 + +{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] [2] (./Equations.aux) ) +Here is how much of TeX's memory you used: + 841 strings out of 492982 + 9389 string characters out of 6134896 + 70413 words of memory out of 5000000 + 4465 multiletter control sequences out of 15000+600000 + 7803 words of font info for 29 fonts, out of 8000000 for 9000 + 1141 hyphenation exceptions out of 8191 + 27i,8n,20p,270b,193s stack positions out of 5000i,500n,10000p,200000b,80000s +</u +sr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmex10.pfb></usr/sha +re/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi10.pfb></usr/share/tex +live/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi5.pfb></usr/share/texlive/te +xmf-dist/fonts/type1/public/amsfonts/cm/cmmi7.pfb></usr/share/texlive/texmf-dis +t/fonts/type1/public/amsfonts/cm/cmr10.pfb></usr/share/texlive/texmf-dist/fonts +/type1/public/amsfonts/cm/cmr12.pfb></usr/share/texlive/texmf-dist/fonts/type1/ +public/amsfonts/cm/cmr17.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/ +amsfonts/cm/cmr7.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts +/cm/cmsy10.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cm +sy7.pfb> +Output written on Equations.pdf (2 pages, 104191 bytes). +PDF statistics: + 51 PDF objects out of 1000 (max. 8388607) + 36 compressed objects within 1 object stream + 0 named destinations out of 1000 (max. 500000) + 1 words of extra memory for PDF output out of 10000 (max. 10000000) + diff --git a/Flight_Eqns/Equations/Equations.pdf b/Flight_Eqns/Equations/Equations.pdf Binary files differnew file mode 100755 index 0000000..a3d9af7 --- /dev/null +++ b/Flight_Eqns/Equations/Equations.pdf diff --git a/Flight_Eqns/Equations/Equations.tex b/Flight_Eqns/Equations/Equations.tex new file mode 100755 index 0000000..dab0ffb --- /dev/null +++ b/Flight_Eqns/Equations/Equations.tex @@ -0,0 +1,72 @@ +\documentclass{article} + +\usepackage{amsmath} +\newcommand\inv[1]{#1\raisebox{1.15ex}{$\scriptscriptstyle-\!1$}} + + +\title{Equation of Motions already included} +\begin{document} +\maketitle + +These are the equations already included the 6DOF model. + +\[ +C_{b/n}= + \begin{bmatrix} + cos(\theta)cos(\psi) & cos(\theta)sin(\psi) & -sin(\theta) \\ + -cos(\phi)sin(\psi) + sin(\phi)sin(\theta)cos(\psi) & cos(\phi)cos(\psi) + sin(\phi)sin(\theta)sun(\psi) & sin(\phi)cos(\theta) \\ + sin(\phi)sin(\psi) + cos(\phi)sin(\theta)cos(\psi) & -sin(\phi)cos(\psi) + cos(\phi)sin(\theta)sin(\psi) & cos(\phi)cos(\theta) + \end{bmatrix} +\]\\ +Also represented as: $C_{b/n} = fn(\Theta)$ +\\ +\[ +\Omega= + \begin{bmatrix} + 0 & -R & Q \\ + R & 0 & -P\\ + -Q & P & 0 + \end{bmatrix} +\] +\\ +\[ +\left[ \begin{array}{c} + \dot{\phi} +\\ \dot{\theta} +\\ \dot{\psi} + \end{array} \right] = \begin{bmatrix} 1 & tan(\theta)sin(\phi) & tan(\theta)cos(\phi) \\ 0 & cos(\phi) & -sin(\phi)\\ +0 & sin(\phi)/cos(\theta) & cos(\phi)/cos(\theta) + \end{bmatrix} \times \left[ \begin{array}{c} P\\Q \\ R \end{array} \right] +\\ +\] +\\ Also represented as: $\dot{\Phi} = H(\Phi) \omega^b _{b/e}$ +\\ +\\ +${}^b\dot{v}^b_{CM/e} =(\frac{1}{m})F^b_{A,T} + C_{b/n} \times g + \Omega^b _{b/e}\times v^b_{CM/e} $ +\\ \\ +${}^e \dot{p}^n_{CM/T} = C_{n/b} \times v^b_{CM/e} $ +\\ \\ +${}^b\dot{\omega}^b_{b/e} = inv(J^b) \times [M^b_{A,T}- \Omega^b_{b/e}\times J^b \times \omega^b_{b/e}]$ +\\ + +These are the equations in the force-moment model. + +$\alpha = tan^-1 (w/u) $ +\\ +$Q = 0.5 \times \rho \times \lVert V \rVert ^2 $ +\\\\ +$C_{L} = C_{L0} + C_{L \alpha} \times \alpha + (\frac{C_{Lq} \times q \times c_{bar}}{2 \times \lVert V \rVert}) + C_{Lde} \times \delta_{e} $ +\\ +$C_{m} = C_{m0} + C{m \alpha} \times \alpha +(\frac{C_{mq}*q*c_{bar}}{(2 \times \lVert V \rVert})+C_{mde} \times \delta_{e}$ +\\ +$C_{D} = C_{D0} + K_{drag} \times C_{L} ^2$ +\\ \\ +$L = C_{L} \times s \times Q$ +\\ +$D = C_{D} \times s \times Q$ +\\ \\ +$Force = \left[ \begin{array}{c} -D \times cos(\alpha)+L \times sin(\alpha)+ thrust - mg \times sin(\theta)\\0 \\ -D \times sin(\alpha)-L \times cos(\alpha)+mg \times cos(\theta) \end{array} \right]$ +\\ \\ +$Moment = \left[ \begin{array}{c} 0\\C_{m} \times s\times c_{bar} \times Q \\ 0 \end{array} \right]$ + + \end{document}
\ No newline at end of file diff --git a/Flight_Eqns/Wind_Axis_eqns/Wind6DOF.mo b/Flight_Eqns/Wind_Axis_eqns/Wind6DOF.mo new file mode 100644 index 0000000..bff2c49 --- /dev/null +++ b/Flight_Eqns/Wind_Axis_eqns/Wind6DOF.mo @@ -0,0 +1,191 @@ +block Wind6DOF + +import Modelica.Math.Matrices.*; +import Modelica.SIunits.*; +import Modelica.Blocks.Interfaces.*; +import Modelica.Math.Vectors.*; + + +RealInput thrust annotation( + Placement(visible = true, transformation(origin = {-110, 33}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-110, 33}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));//Thrust force + +RealInput[3] delta annotation( + Placement(visible = true, transformation(origin = {-110, -33}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-110, -33}, extent = {{-20, -20}, {20, 20}}, rotation = 0))); + + +Modelica.Blocks.Interfaces.RealOutput V annotation(start =39.8858, + Placement(visible = true, transformation(origin = {110, 100}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {110, 100}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); //Linear velocity + +Modelica.Blocks.Interfaces.RealOutput alpha annotation(start =0.1, + Placement(visible = true, transformation(origin = {110, 60}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {110, 60}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); //Angle of attack + +Modelica.Blocks.Interfaces.RealOutput beta annotation(start = 0, + Placement(visible = true, transformation(origin = {110, 20}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {110, 20}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); //Angle of sideslip + + +Modelica.Blocks.Interfaces.RealOutput pos[3]annotation( + Placement(visible = true, transformation(origin = {110, -20}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {110, -20}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); + //Position (Displacement) //Displacement + +Modelica.Blocks.Interfaces.RealOutput omega[3] annotation( + Placement(visible = true, transformation(origin = {110, -60}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {110, -60}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); //Angular velocity around the CM +Modelica.Blocks.Interfaces.RealOutput angles[3] annotation( + Placement(visible = true, transformation(origin = {110, -100}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {110, -100}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); //mu, gamma, and chi + + + + + + +parameter Real rho; +parameter Real m;//1.56 for zagi +parameter Real S_ref;//reference area +parameter Real C_bar ;//average chord +parameter Real b ;//span +parameter Real g = 9.81;//gravitational force +//parameter Real b= 1.4224, C_bar = 0.3302,s = 0.2589; + + + +parameter Real CD0;//= 0.01631;for Zagi +parameter Real K_drag ;//for cessna +parameter Real CD_beta;//for cessna +parameter Real CD_alpha; +parameter Real CD_q; +parameter Real CD_delta_e; + +//side force +parameter Real Cy_beta;//for cessna +parameter Real Cy_p;//for cessna +parameter Real Cy_r;//for cessna +parameter Real Cy_delta_r; //for cessna +parameter Real Cy_delta_a; //for cessna + +// lift +parameter Real CL0 ; //for cessna +parameter Real CL_alpha;//for cessna +parameter Real CL_q;//for cessna +parameter Real CL_delta_e;//for cessna + +// rolling moment +parameter Real Cl_beta;//for cessna +parameter Real Cl_p;//for cessna +parameter Real Cl_r;//for cessna +parameter Real Cl_delta_a;//for cessna +parameter Real Cl_delta_r ;//for cessna + +// pitching moment +parameter Real Cm0;//for cessna +parameter Real Cm_alpha ;//for cessna +parameter Real Cm_q;//for cessna +parameter Real Cm_delta_e;//for cessna + +// yawing moment +parameter Real Cn_beta;//for cessna +parameter Real Cn_p;//for cessna +parameter Real Cn_r;//for cessna +parameter Real Cn_delta_a ;//for cessna +parameter Real Cn_delta_r;//for cessna + + +//Initial conditions. (delta[2], thrust[1] and the others are straightforward) + +parameter Real I_xx; +parameter Real I_yy; +parameter Real I_zz; + +Real CL; +Real CD; +Real CY; +Real Cl; +Real Cm; +Real Cn; +Real CX; +Real CZ; +//Params +//parameter Real delta[1] = 0; +//parameter Real delta[3] = 0; + +//Modelica.Blocks.Sources.RealExpression delta[2] (y = if time > 100 and time < 105 then -0.15625+3.1412 /180 else -0.15625) annotation( Placement(visible = true, transformation(origin = {-112, 1}, extent = {{-26, -47}, {26, 47}}, rotation = 0))); +//parameter Real delta[2] = -0.15625; + +//parameter Real thrust = 1112.82; + + + +Real qbar = 0.5*rho*V^2; + +Real Vdot; +Real alphadot; +Real betadot; + +Real pdot; +Real qdot; +Real rdot; + +Real mudot; +Real gammadot; +Real chidot; + +Real xdot; +Real ydot; +Real zdot; + + +equation +CL = CL0+CL_alpha*alpha+((CL_q*omega[2]*C_bar)/(2*V))+CL_delta_e*delta[2]; +//CD = CD0+CD_alpha*alpha+((CD_q*omega[2]*C_bar)/(2*V))+CD_delta_e*abs(delta[2]);// + CDbeta * beta + CDdelta[2] * Elevator; +CD = CD0 + K_drag*CL^2; +CY = Cy_beta * beta + Cy_p * (omega[1]*b)/(2*V) + Cy_r *(omega[3]*b)/(2*V) + Cy_delta_a * delta[1] + Cy_delta_r*delta[3];//Sideslip coeff + + +Cl = Cl_beta * beta + Cl_p*(omega[1]*b)/(2*V) + Cl_r *(omega[3]*b)/(2*V) + Cl_delta_a * delta[1] + Cl_delta_r * delta[3];//Rolling coeff + +Cm = Cm0+Cm_alpha*alpha+((Cm_q*omega[2]*C_bar)/(2*V))+Cm_delta_e*delta[2];//pitching coeff + +Cn = Cn_beta * beta + Cn_p * (omega[1]*b)/(2*V) + Cn_r *(omega[3]*b) /(2*V) + Cn_delta_a * delta[1] + Cn_delta_r * delta[3];//Yawing coeff + +CX = -CD*cos(alpha) + CL*sin(alpha); +CZ = -CD*sin(alpha) - CL*cos(alpha); + + +Vdot = der(V); +alphadot = der(alpha); +betadot = der(beta); + +pdot = der(omega[1]); +qdot = der(omega[2]); +rdot = der(omega[3]); + +xdot = der(pos[1]); +ydot = der(pos[2]); +zdot = der(pos[3]); + +mudot = der(angles[1]); +gammadot = der(angles[2]); +chidot = der(angles[3]); + + + + +Vdot = 1/m*(thrust*cos(alpha)*cos(beta)-0.5*rho*V^2*S_ref*(CD*cos(beta)-CY*sin(beta))-m*g*sin(angles[2])); + +alphadot = omega[2]-1/cos(beta)*((omega[1]*cos(alpha)+omega[3]*sin(alpha))*sin(beta)-g/V*cos(angles[2])*cos(angles[1])+0.5*rho*V^2*S_ref*CL/(m*V)+thrust*sin(alpha)/(m*V)); + +betadot = (omega[1]*sin(alpha)-omega[3]*cos(alpha))+1/(m*V)*(-thrust*cos(alpha)*sin(beta)+0.5*rho*V^2*S_ref*(CY*cos(beta)+CD*sin(beta))+m*g*cos(angles[2])*sin(angles[1])); + + +pdot = (I_yy-I_zz)/I_xx*omega[2]*omega[3]+1/(2*I_xx)*rho*V^2*S_ref*b*Cl; +qdot = (I_zz-I_xx)/I_yy*omega[1]*omega[3]+1/(2*I_yy)*rho*V^2*S_ref*C_bar*Cm; +rdot = (I_xx-I_yy)/I_zz*omega[1]*omega[2]+1/(2*I_zz)*rho*V^2*S_ref*b*Cn; + + +xdot=V*cos(angles[2])*cos(angles[3]); +ydot=V*cos(angles[2])*sin(angles[3]); +zdot=-V*sin(angles[2]); + +mudot = omega[1]+tan(angles[2])*sin(angles[1])*omega[2]+tan(angles[2])*cos(angles[1])*omega[3]; +gammadot = cos(angles[1])*omega[2]-sin(angles[1])*omega[3]; +chidot=(1/cos(angles[2]))*sin(angles[1])*omega[2]+(1/cos(angles[2]))*cos(angles[1])*omega[3]; + +end Wind6DOF;
\ No newline at end of file diff --git a/Flight_Eqns/Wind_Axis_eqns/Wind6DOFBasic.mo b/Flight_Eqns/Wind_Axis_eqns/Wind6DOFBasic.mo new file mode 100644 index 0000000..0d4c90c --- /dev/null +++ b/Flight_Eqns/Wind_Axis_eqns/Wind6DOFBasic.mo @@ -0,0 +1,95 @@ +model Wind6DOFBasic + +import Modelica.Math.Matrices.*; +import SI=Modelica.SIunits; +import Modelica.Blocks.Interfaces.*; + + + +parameter Real g = 9.81; +parameter Real m = 1043.26;//1.56 for zagi +parameter Real[3,3] J = {{1285.31, 0.0, 0.0}, {0.0, 1824.93, 0.0}, {0.0, 0.0, 2666.893}}; + + + +//12 states +RealOutput[3] omega(start = {0.0,0.0,0}) annotation( Placement(visible = true, transformation(origin = {110, -33}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {110, -33}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));//omega + +Real OMEGA[3,3] = skew(omega);//Skew symmetric matrix form of the angular velocity term + + +Real V (start =39.8858); +Real alpha (start =0.1); +Real beta (start = 0); + +RealOutput[3] VAB annotation( Placement(visible = true, transformation(origin = {110, 33}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {110, 33}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));//V, alpha, beta + + +Real x (start = 0); +Real y (start = 0); +Real z (start = 100); + +Real mu (start = 0); +Real gamma (start = 0); +Real chi (start = 0); + + +RealInput Force[3] annotation( Placement(visible = true, transformation(origin = {-110, 33}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-110, 33}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));//Thrust force + +RealInput Moment[3] annotation( Placement(visible = true, transformation(origin = {-110, -33}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-110, -33}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));//Thrust force + + + +Real Vdot; +Real alphadot; +Real betadot; + +Real[3] omegadot; + +Real mudot; +Real gammadot; +Real chidot; + +Real xdot; +Real ydot; +Real zdot; + + +equation + + +Vdot = der(V); +alphadot = der(alpha); +betadot = der(beta); + +omegadot= der(omega); + +xdot = der(x); +ydot = der(y); +zdot = der(z); + +mudot = der(mu); +gammadot = der(gamma); +chidot = der(chi); + + +Vdot = 1/m*(Force[1] -m*g*sin(gamma)); + +alphadot = omega[2]-1/cos(beta)*((omega[1]*cos(alpha)+omega[3]*sin(alpha))*sin(beta)-g/V*cos(gamma)*cos(mu)+Force[3]/(m*V)); + +betadot = (omega[1]*sin(alpha)-omega[3]*cos(alpha))+1/(m*V)*(Force[2]+m*g*cos(gamma)*sin(mu)); + + +omegadot = inv(J) * (Moment- OMEGA* J*omega); + +xdot=V*cos(gamma)*cos(chi); +ydot=V*cos(gamma)*sin(chi); +zdot=-V*sin(gamma); + +mudot = omega[1]+tan(gamma)*sin(mu)*omega[2]+tan(gamma)*cos(mu)*omega[3]; +gammadot = cos(mu)*omega[2]-sin(mu)*omega[3]; +chidot=(1/cos(gamma))*sin(mu)*omega[2]+(1/cos(gamma))*cos(mu)*omega[3]; + +VAB = {V,alpha,beta}; + +end Wind6DOFBasic;
\ No newline at end of file diff --git a/Flight_Eqns/Wind_Axis_eqns/Wind6DOFBlock.mo b/Flight_Eqns/Wind_Axis_eqns/Wind6DOFBlock.mo new file mode 100644 index 0000000..40731a3 --- /dev/null +++ b/Flight_Eqns/Wind_Axis_eqns/Wind6DOFBlock.mo @@ -0,0 +1,185 @@ +block Wind6DOFBlock + +import Modelica.Math.Matrices.*; +import SI=Modelica.SIunits; +import Modelica.Blocks.Interfaces.*; + +parameter Real rho = 1.225; +parameter Real g = 9.81; +parameter Real m = 1043.26;//1.56 for zagi +parameter Real S_ref = 16.1651;//reference area +parameter Real C_bar = 1.493 ;//average chord +parameter Real b = 10.911 ;//span +//parameter Real b= 1.4224, cbar = 0.3302,s = 0.2589; + + + +parameter Real CD0 = 0.036;//= 0.01631;for Zagi +parameter Real K_drag = 0.0830304;//for cessna +parameter Real CD_beta = 0.17;//for cessna +parameter Real CD_alpha= 0.2108; +parameter Real CD_q = 0; +parameter Real CD_delta_e= 0.3045; + +//side force +parameter Real Cy_beta = -0.31;//for cessna +parameter Real Cy_p = -0.037;//for cessna +parameter Real Cy_r = 0.21;//for cessna +parameter Real Cy_delta_r = 0.187; //for cessna +parameter Real Cy_delta_a= 0; //for cessna + +// lift +parameter Real CL0 = 0.25; //for cessna +parameter Real CL_alpha = 4.47;//for cessna +parameter Real CL_q = 3.9;//for cessna +parameter Real CL_delta_e = 0.3476;//for cessna + +// rolling moment +parameter Real Cl_beta = -0.089;//for cessna +parameter Real Cl_p = -0.47;//for cessna +parameter Real Cl_r = 0.096;//for cessna +parameter Real Cl_delta_a= -0.09;//for cessna +parameter Real Cl_delta_r = 0.0147;//for cessna + +// pitching moment +parameter Real Cm0 = -0.02;//for cessna +parameter Real Cm_alpha = -1.8;//for cessna +parameter Real Cm_q = -12.4;//for cessna +parameter Real Cm_delta_e = -1.28;//for cessna + +// yawing moment +parameter Real Cn_beta = 0.065;//for cessna +parameter Real Cn_p = -0.03;//for cessna +parameter Real Cn_r = -0.99;//for cessna +parameter Real Cn_delta_a = -0.0053;//for cessna +parameter Real Cn_delta_r = -0.0657;//for cessna + + +//Initial conditions. (deltaE, thrust[1] and the others are straightforward) + +parameter Real[3,3] J = {{1285.31, 0.0, 0.0}, {0.0, 1824.93, 0.0}, {0.0, 0.0, 2666.893}}; + +Real CL; +Real CD; +Real CY; +Real Cl; +Real Cm; +Real Cn; +Real CX; +Real CZ; +//Params +RealInput deltaE (start = -0.15625) annotation(start = 0.1,Placement(visible = true, transformation(origin = {-110, -33}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-110, -33}, extent = {{-20, -20}, {20, 20}}, rotation = 0))); + +//Change inelevator angle +parameter Real deltaR = 0; + +parameter Real deltaA= 0; + + + + +RealInput thrust (start = 1112.82) annotation(Placement(visible = true, transformation(origin = {-110, 33}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-110, 33}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));//Thrust force = 1112.82; + +//12 states +Real p (start = 0); +Modelica.Blocks.Interfaces.RealOutput q (start = 0) annotation(Placement(visible = true, transformation(origin = {110, 33}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {110, 33}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); //Angular velocity +Real r (start = 0); + +Real OMEGA[3,3] = skew({p,q,r});//Skew symmetric matrix form of the angular velocity term + + +Real V (start =39.8858); +Modelica.Blocks.Interfaces.RealOutput alpha (start = 0.1) annotation( Placement(visible = true, transformation(origin = {110, -33}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {110, -33}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); //Angle of attack +Real beta (start = 0); + + +Real x (start = 0); +Real y (start = 0); +Real z (start = 100); + +Real gamma (start = 0); +Real chi (start = 0); +Real mu (start = 0); + +Real qbar = 0.5*rho*V^2; +Real [3] Moment; + + + +Real Vdot; +Real alphadot; +Real betadot; + +Real[3] omegadot; + +Real mudot; +Real gammadot; +Real chidot; + +Real xdot; +Real ydot; +Real zdot; + + +equation +CL = CL0+CL_alpha*alpha+((CL_q*q*C_bar)/(2*V))+CL_delta_e*deltaE; +//CD = CD0+CD_alpha*alpha+((CD_q*q*C_bar)/(2*V))+CD_delta_e*abs(deltaE) ; +CD = CD0 + K_drag*CL^2; +CY = Cy_beta * beta + Cy_p * (p*b)/(2*V) + Cy_r *(r*b)/(2*V) + Cy_delta_a * deltaA + Cy_delta_r*deltaR;//Sideslip coeff + + +Cl = Cl_beta * beta + Cl_p*(p*b)/(2*V) + Cl_r *(r*b)/(2*V) + Cl_delta_a * deltaA + Cl_delta_r * deltaR;//Rolling coeff + +Cm = Cm0+Cm_alpha*alpha+((Cm_q*q*C_bar)/(2*V))+Cm_delta_e*deltaE;//pitching coeff + +Cn = Cn_beta * beta + Cn_p * (p*b)/(2*V) + Cn_r *(r*b) /(2*V) + Cn_delta_a * deltaA + Cn_delta_r * deltaR;//Yawing coeff + +CX = -CD*cos(alpha) + CL*sin(alpha); +CZ = -CD*sin(alpha) - CL*cos(alpha); + +Moment[2] = Cm*qbar*S_ref*C_bar; +Moment[1] = Cl*qbar*S_ref*b; +Moment[3] = Cn*qbar*S_ref*b; + +Vdot = der(V); +alphadot = der(alpha); +betadot = der(beta); + +omegadot[1] = der(p); +omegadot[2] = der(q); +omegadot[3] = der(r); + +xdot = der(x); +ydot = der(y); +zdot = der(z); + +mudot = der(mu); +gammadot = der(gamma); +chidot = der(chi); + + + + +Vdot = 1/m*(thrust*cos(alpha)*cos(beta)-0.5*rho*V^2*S_ref*(CD*cos(beta)-CY*sin(beta))-m*g*sin(gamma)); + +alphadot = q-1/cos(beta)*((p*cos(alpha)+r*sin(alpha))*sin(beta)-g/V*cos(gamma)*cos(mu)+0.5*rho*V^2*S_ref*CL/(m*V)+thrust*sin(alpha)/(m*V)); + +betadot = (p*sin(alpha)-r*cos(alpha))+1/(m*V)*(-thrust*cos(alpha)*sin(beta)+0.5*rho*V^2*S_ref*(CY*cos(beta)+CD*sin(beta))+m*g*cos(gamma)*sin(mu)); + + +omegadot = inv(J) * (Moment- OMEGA* J*{p,q,r}); + + + +xdot=V*cos(gamma)*cos(chi); +ydot=V*cos(gamma)*sin(chi); +zdot=-V*sin(gamma); + +mudot = p+tan(gamma)*sin(mu)*q+tan(gamma)*cos(mu)*r; +gammadot = cos(mu)*q-sin(mu)*r; +chidot=(1/cos(gamma))*sin(mu)*q+(1/cos(gamma))*cos(mu)*r; + + +annotation(experiment(StartTime = 0, StopTime = 500, Interval = 0.002), + uses(Modelica(version = "3.2.2"))); +end Wind6DOFBlock;
\ No newline at end of file diff --git a/Flight_Eqns/Wind_Axis_eqns/Wind6DOFLinTest.mo b/Flight_Eqns/Wind_Axis_eqns/Wind6DOFLinTest.mo new file mode 100644 index 0000000..3005f2e --- /dev/null +++ b/Flight_Eqns/Wind_Axis_eqns/Wind6DOFLinTest.mo @@ -0,0 +1,184 @@ +model Wind6DOFLinTest + +import Modelica.Math.Matrices.*; +import SI=Modelica.SIunits; +import Modelica.Blocks.Interfaces.*; + +parameter Real rho = 1.225; +parameter Real g = 9.81; +parameter Real m = 1043.26;//1.56 for zagi +parameter Real S_ref = 16.1651;//reference area +parameter Real C_bar = 1.493 ;//average chord +parameter Real b = 10.911 ;//span +//parameter Real b= 1.4224, cbar = 0.3302,s = 0.2589; + + + +parameter Real CD0 = 0.036;//= 0.01631;for Zagi +parameter Real K_drag = 0.0830304;//for cessna +parameter Real CD_beta = 0.17;//for cessna +parameter Real CD_alpha= 0.2108; +parameter Real CD_q = 0; +parameter Real CD_delta_e= 0.3045; + +//side force +parameter Real Cy_beta = -0.31;//for cessna +parameter Real Cy_p = -0.037;//for cessna +parameter Real Cy_r = 0.21;//for cessna +parameter Real Cy_delta_r = 0.187; //for cessna +parameter Real Cy_delta_a= 0; //for cessna + +// lift +parameter Real CL0 = 0.25; //for cessna +parameter Real CL_alpha = 4.47;//for cessna +parameter Real CL_q = 3.9;//for cessna +parameter Real CL_delta_e = 0.3476;//for cessna + +// rolling moment +parameter Real Cl_beta = -0.089;//for cessna +parameter Real Cl_p = -0.47;//for cessna +parameter Real Cl_r = 0.096;//for cessna +parameter Real Cl_delta_a= -0.09;//for cessna +parameter Real Cl_delta_r = 0.0147;//for cessna + +// pitching moment +parameter Real Cm0 = -0.02;//for cessna +parameter Real Cm_alpha = -1.8;//for cessna +parameter Real Cm_q = -12.4;//for cessna +parameter Real Cm_delta_e = -1.28;//for cessna + +// yawing moment +parameter Real Cn_beta = 0.065;//for cessna +parameter Real Cn_p = -0.03;//for cessna +parameter Real Cn_r = -0.99;//for cessna +parameter Real Cn_delta_a = -0.0053;//for cessna +parameter Real Cn_delta_r = -0.0657;//for cessna + + +//Initial conditions. (deltaE, thrust[1] and the others are straightforward) + +parameter Real[3,3] J = {{1285.31, 0.0, 0.0}, {0.0, 1824.93, 0.0}, {0.0, 0.0, 2666.893}}; + +Real CL; +Real CD; +Real CY; +Real Cl; +Real Cm; +Real Cn; +Real CX; +Real CZ; +//Params +RealInput deltaE (start = -0.15625) annotation(Placement(visible = true, transformation(origin = {-110, -33}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-110, -33}, extent = {{-20, -20}, {20, 20}}, rotation = 0))); +parameter Real deltaR = 0; + +parameter Real deltaA = 0; +// Modelica.Blocks.Sources.Constant deltaA (k =0) annotation( Placement(visible = true, transformation(origin = {-42, 28}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); + + + + +RealInput thrust (start = 1112.82) annotation(Placement(visible = true, transformation(origin = {-110, 33}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-110, 33}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));//Thrust force = 1112.82; + +//12 states +Real p (start = 0); +Real q (start = 0); +Real r (start = 0); + +Real OMEGA[3,3] = skew({p,q,r});//Skew symmetric matrix form of the angular velocity term + + +Real V (start =39.8858); +Real alpha (start = 0.1); +Real beta (start = 0); + + +Real x (start = 0); +Real y (start = 0); +Real z (start = 100); + +Real gamma (start = 0); +Real chi (start = 0); +Real mu (start = 0); + +Real qbar = 0.5*rho*V^2; +Real [3] Moment; + + + +Real Vdot; +Real alphadot; +Real betadot; + +Real[3] omegadot; + +Real mudot; +Real gammadot; +Real chidot; + +Real xdot; +Real ydot; +Real zdot; + + +equation +CL = CL0+CL_alpha*alpha+((CL_q*q*C_bar)/(2*V))+CL_delta_e*deltaE; +//CD = CD0+CD_alpha*alpha+((CD_q*q*C_bar)/(2*V))+CD_delta_e*abs(deltaE) ; +CD = CD0 + K_drag*CL^2; +CY = Cy_beta * beta + Cy_p * (p*b)/(2*V) + Cy_r *(r*b)/(2*V) + Cy_delta_a * deltaA + Cy_delta_r*deltaR;//Sideslip coeff + + +Cl = Cl_beta * beta + Cl_p*(p*b)/(2*V) + Cl_r *(r*b)/(2*V) + Cl_delta_a * deltaA + Cl_delta_r * deltaR;//Rolling coeff + +Cm = Cm0+Cm_alpha*alpha+((Cm_q*q*C_bar)/(2*V))+Cm_delta_e*deltaE;//pitching coeff + +Cn = Cn_beta * beta + Cn_p * (p*b)/(2*V) + Cn_r *(r*b) /(2*V) + Cn_delta_a * deltaA + Cn_delta_r * deltaR;//Yawing coeff + +CX = -CD*cos(alpha) + CL*sin(alpha); +CZ = -CD*sin(alpha) - CL*cos(alpha); + +Moment[2] = Cm*qbar*S_ref*C_bar; +Moment[1] = Cl*qbar*S_ref*b; +Moment[3] = Cn*qbar*S_ref*b; + +Vdot = der(V); +alphadot = der(alpha); +betadot = der(beta); + +omegadot[1] = der(p); +omegadot[2] = der(q); +omegadot[3] = der(r); + +xdot = der(x); +ydot = der(y); +zdot = der(z); + +mudot = der(mu); +gammadot = der(gamma); +chidot = der(chi); + + + + +Vdot = 1/m*(thrust*cos(alpha)*cos(beta)-0.5*rho*V^2*S_ref*(CD*cos(beta)-CY*sin(beta))-m*g*sin(gamma)); + +alphadot = q-1/cos(beta)*((p*cos(alpha)+r*sin(alpha))*sin(beta)-g/V*cos(gamma)*cos(mu)+0.5*rho*V^2*S_ref*CL/(m*V)+thrust*sin(alpha)/(m*V)); + +betadot = (p*sin(alpha)-r*cos(alpha))+1/(m*V)*(-thrust*cos(alpha)*sin(beta)+0.5*rho*V^2*S_ref*(CY*cos(beta)+CD*sin(beta))+m*g*cos(gamma)*sin(mu)); + + +omegadot = inv(J) * (Moment- OMEGA* J*{p,q,r}); + + + +xdot=V*cos(gamma)*cos(chi); +ydot=V*cos(gamma)*sin(chi); +zdot=-V*sin(gamma); + +mudot = p+tan(gamma)*sin(mu)*q+tan(gamma)*cos(mu)*r; +gammadot = cos(mu)*q-sin(mu)*r; +chidot=(1/cos(gamma))*sin(mu)*q+(1/cos(gamma))*cos(mu)*r; + + +annotation(experiment(StartTime = 0, StopTime = 500, Interval = 0.002), uses(Modelica(version = "3.2.2"))); + +end Wind6DOFLinTest;
\ No newline at end of file diff --git a/Flight_Eqns/Wind_Axis_eqns/Wind6DOFVer.mo b/Flight_Eqns/Wind_Axis_eqns/Wind6DOFVer.mo new file mode 100644 index 0000000..353e365 --- /dev/null +++ b/Flight_Eqns/Wind_Axis_eqns/Wind6DOFVer.mo @@ -0,0 +1,182 @@ +model Wind6DOFVer + +import Modelica.Math.Matrices.*; +import SI=Modelica.SIunits; +import Modelica.Blocks.Interfaces.*; + +parameter Real rho = 1.225; +parameter Real g = 9.81; +parameter Real m = 1043.26;//1.56 for zagi +parameter Real S_ref = 16.1651;//reference area +parameter Real C_bar = 1.493 ;//average chord +parameter Real b = 10.911 ;//span +//parameter Real b= 1.4224, cbar = 0.3302,s = 0.2589; + + + +parameter Real CD0 = 0.036;//= 0.01631;for Zagi +parameter Real K_drag = 0.0830304;//for cessna +parameter Real CD_beta = 0.17;//for cessna +parameter Real CD_alpha= 0.2108; +parameter Real CD_q = 0; +parameter Real CD_delta_e= 0.3045; + +//side force +parameter Real Cy_beta = -0.31;//for cessna +parameter Real Cy_p = -0.037;//for cessna +parameter Real Cy_r = 0.21;//for cessna +parameter Real Cy_delta_r = 0.187; //for cessna +parameter Real Cy_delta_a= 0; //for cessna + +// lift +parameter Real CL0 = 0.25; //for cessna +parameter Real CL_alpha = 4.47;//for cessna +parameter Real CL_q = 3.9;//for cessna +parameter Real CL_delta_e = 0.3476;//for cessna + +// rolling moment +parameter Real Cl_beta = -0.089;//for cessna +parameter Real Cl_p = -0.47;//for cessna +parameter Real Cl_r = 0.096;//for cessna +parameter Real Cl_delta_a= -0.09;//for cessna +parameter Real Cl_delta_r = 0.0147;//for cessna + +// pitching moment +parameter Real Cm0 = -0.02;//for cessna +parameter Real Cm_alpha = -1.8;//for cessna +parameter Real Cm_q = -12.4;//for cessna +parameter Real Cm_delta_e = -1.28;//for cessna + +// yawing moment +parameter Real Cn_beta = 0.065;//for cessna +parameter Real Cn_p = -0.03;//for cessna +parameter Real Cn_r = -0.99;//for cessna +parameter Real Cn_delta_a = -0.0053;//for cessna +parameter Real Cn_delta_r = -0.0657;//for cessna + + +//Initial conditions. (deltaE, thrust[1] and the others are straightforward) + +parameter Real[3,3] J = {{1285.31, 0.0, 0.0}, {0.0, 1824.93, 0.0}, {0.0, 0.0, 2666.893}}; + +Real CL; +Real CD; +Real CY; +Real Cl; +Real Cm; +Real Cn; +Real CX; +Real CZ; +//Params +parameter Real deltaE = -0.15625; +parameter Real deltaR = 0; + +parameter Real deltaA = 0; + + + + +parameter Real thrust = 1112.82; + +//12 states +Real p (start = 0); +Real q (start = 0); +Real r (start = 0); + +Real OMEGA[3,3] = skew({p,q,r});//Skew symmetric matrix form of the angular velocity term + + +Real V (start =39.8858); +Real alpha (start =0.1); +Real beta (start = 0); + + +Real x (start = 0); +Real y (start = 0); +Real z (start = 100); + +Real mu (start = 0); +Real gamma (start = 0); +Real chi (start = 0); + +Real qbar = 0.5*rho*V^2; +Real [3] Moment; + + + +Real Vdot; +Real alphadot; +Real betadot; + +Real[3] omegadot; + +Real mudot; +Real gammadot; +Real chidot; + +Real xdot; +Real ydot; +Real zdot; + + +equation +CL = CL0+CL_alpha*alpha+((CL_q*q*C_bar)/(2*V))+CL_delta_e*deltaE; +//CD = CD0+CD_alpha*alpha+((CD_q*q*C_bar)/(2*V))+CD_delta_e*abs(deltaE) ; +CD = CD0 + K_drag*CL^2; +CY = Cy_beta * beta + Cy_p * (p*b)/(2*V) + Cy_r *(r*b)/(2*V) + Cy_delta_a * deltaA + Cy_delta_r*deltaR;//Sideslip coeff + + +Cl = Cl_beta * beta + Cl_p*(p*b)/(2*V) + Cl_r *(r*b)/(2*V) + Cl_delta_a * deltaA + Cl_delta_r * deltaR;//Rolling coeff + +Cm = Cm0+Cm_alpha*alpha+((Cm_q*q*C_bar)/(2*V))+Cm_delta_e*deltaE;//pitching coeff + +Cn = Cn_beta * beta + Cn_p * (p*b)/(2*V) + Cn_r *(r*b) /(2*V) + Cn_delta_a * deltaA + Cn_delta_r * deltaR;//Yawing coeff + +CX = -CD*cos(alpha) + CL*sin(alpha); +CZ = -CD*sin(alpha) - CL*cos(alpha); + +Moment[2] = Cm*qbar*S_ref*C_bar; +Moment[1] = Cl*qbar*S_ref*b; +Moment[3] = Cn*qbar*S_ref*b; + +Vdot = der(V); +alphadot = der(alpha); +betadot = der(beta); + +omegadot[1] = der(p); +omegadot[2] = der(q); +omegadot[3] = der(r); + +xdot = der(x); +ydot = der(y); +zdot = der(z); + +mudot = der(mu); +gammadot = der(gamma); +chidot = der(chi); + + + + +Vdot = 1/m*(thrust*cos(alpha)*cos(beta)-0.5*rho*V^2*S_ref*(CD*cos(beta)-CY*sin(beta))-m*g*sin(gamma)); + +alphadot = q-1/cos(beta)*((p*cos(alpha)+r*sin(alpha))*sin(beta)-g/V*cos(gamma)*cos(mu)+(0.5*rho*V^2*S_ref*CL+thrust*sin(alpha))/(m*V)); + +betadot = (p*sin(alpha)-r*cos(alpha))+1/(m*V)*(-thrust*cos(alpha)*sin(beta)+0.5*rho*V^2*S_ref*(CY*cos(beta)+CD*sin(beta))+m*g*cos(gamma)*sin(mu)); + + +omegadot = inv(J) * (Moment- OMEGA* J*{p,q,r}); + + + +xdot=V*cos(gamma)*cos(chi); +ydot=V*cos(gamma)*sin(chi); +zdot=-V*sin(gamma); + +mudot = p+tan(gamma)*sin(mu)*q+tan(gamma)*cos(mu)*r; +gammadot = cos(mu)*q-sin(mu)*r; +chidot=(1/cos(gamma))*sin(mu)*q+(1/cos(gamma))*cos(mu)*r; + + +annotation(experiment(StartTime = 0, StopTime = 500, Interval = 0.002), uses(Modelica(version = "3.2.2"))); +end Wind6DOFVer;
\ No newline at end of file diff --git a/Flight_Eqns/Wind_Axis_eqns/Wind6DOFZagi.mo b/Flight_Eqns/Wind_Axis_eqns/Wind6DOFZagi.mo new file mode 100644 index 0000000..b6c90d7 --- /dev/null +++ b/Flight_Eqns/Wind_Axis_eqns/Wind6DOFZagi.mo @@ -0,0 +1,187 @@ +model Wind6DOFZagi + +import Modelica.Math.Matrices.*; +import SI=Modelica.SIunits; +import Modelica.Blocks.Interfaces.*; + +parameter Real rho = 1.225; +parameter Real m = 1.56;//1.56 for zagi +parameter Real S_ref = 0.2589;//reference area +parameter Real C_bar = 0.3302 ;//average chord +parameter Real b = 1.4224 ;//span +parameter Real g = 9.81;//gravitational force +//parameter Real b= 1.4224, C_bar = 0.3302,s = 0.2589; + +// lift +parameter Real CL0 = 0.09167; //for cessna +parameter Real CL_alpha = 3.5016;//for cessna +parameter Real CL_q = 2.8932;//for cessna +parameter Real CL_delta_e = 0.2724;//for cessna + +parameter Real CD0 = 0.01631;//= 0.01631;for Zagi +parameter Real K_drag = 0.0830304;//for cessna +parameter Real CD_beta = 0.17;//for cessna +parameter Real CD_alpha= 0.2108; +parameter Real CD_q = 0; +parameter Real CD_delta_e= 0.3045; + +//side force +parameter Real Cy_0; +parameter Real Cy_beta = -0.07359;//for cessna +parameter Real Cy_p = 0;//for cessna +parameter Real Cy_r = 0.21;//for cessna +parameter Real Cy_delta_r = 0.187; //for cessna +parameter Real Cy_delta_a= 0; //for cessna + + + +// rolling moment +parameter Real Cl_0 = 0; +parameter Real Cl_beta = -0.02854;//for cessna +parameter Real Cl_p = -0.3209;//for cessna +parameter Real Cl_r = 0.03066;//for cessna +parameter Real Cl_delta_a= 0.1682;//for cessna +parameter Real Cl_delta_r = 0;//for cessna + +// pitching moment +parameter Real Cm0 = -0.02338;//for cessna +parameter Real Cm_alpha = -0.5675;//for cessna +parameter Real Cm_q = -1.3990;//for cessna +parameter Real Cm_delta_e = -0.3254;//for cessna + +// yawing moment +parameter Real Cn_0 = 0; +parameter Real Cn_beta = -0.00040;//for cessna +parameter Real Cn_p = -0.01297;//for cessna +parameter Real Cn_r = -0.00434;//for cessna +parameter Real Cn_delta_a = -0.00328;//for cessna +parameter Real Cn_delta_r = 0;//for cessna + + +//Initial conditions. (deltaE, thrust[1] and the others are straightforward) + +parameter Real[3,3] J = {{0.1147, 0.0, -0.0015}, {0.0, 0.0576, 0.0}, {-0.0015, 0.0, 0.2589}}; + +Real CL; +Real CD; +Real CY; +Real Cl; +Real Cm; +Real Cn; +Real CX; +Real CZ; +//Params +parameter Real deltaE = -0.246251; +parameter Real deltaR = 0; + +//Modelica.Blocks.Sources.RealExpression deltaA (y = if time > 100 and time < 105 then 3.1412 /180 elseif time > 105 and time < 110 then -3.1412 /180 else 0) annotation( Placement(visible = true, transformation(origin = {-112, 1}, extent = {{-26, -47}, {26, 47}}, rotation = 0))); + Modelica.Blocks.Sources.Constant deltaA (k =0) annotation( Placement(visible = true, transformation(origin = {-42, 28}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); + + + + +parameter Real thrust = 4.47729; + +//12 states +Real p (start = 0); +Real q (start = 0); +Real r (start = 0); + +Real OMEGA[3,3] = skew({p,q,r});//Skew symmetric matrix form of the angular velocity term + + +Real V (start =15.8114); +Real alpha (start =0.1); +Real beta (start = 0); + + +Real x (start = 0); +Real y (start = 0); +Real z (start = 100); + +Real gamma (start = 0); +Real chi (start = 0); +Real mu (start = 0); + +Real qbar = 0.5*rho*V^2; +Real [3] Moment; + + + +Real Vdot; +Real alphadot; +Real betadot; + +Real[3] omegadot; + +Real mudot; +Real gammadot; +Real chidot; + +Real xdot; +Real ydot; +Real zdot; + + +equation +CL = CL0+CL_alpha*alpha+((CL_q*q*C_bar)/(2*V))+CL_delta_e*deltaE; +CD = CD0+CD_alpha*alpha+((CD_q*q*C_bar)/(2*V))+CD_delta_e*abs(deltaE) ; +//CD = CD0 + K_drag*CL^2; +CY = Cy_beta * beta + Cy_p * (p*b)/(2*V) + Cy_r *(r*b)/(2*V) + Cy_delta_a * deltaA.k + Cy_delta_r*deltaR;//Sideslip coeff + + +Cl = Cl_beta * beta + Cl_p*(p*b)/(2*V) + Cl_r *(r*b)/(2*V) + Cl_delta_a * deltaA.k + Cl_delta_r * deltaR;//Rolling coeff + +Cm = Cm0+Cm_alpha*alpha+((Cm_q*q*C_bar)/(2*V))+Cm_delta_e*deltaE;//pitching coeff + +Cn = Cn_beta * beta + Cn_p * (p*b)/(2*V) + Cn_r *(r*b) /(2*V) + Cn_delta_a * deltaA.k + Cn_delta_r * deltaR;//Yawing coeff + +CX = -CD*cos(alpha) + CL*sin(alpha); +CZ = -CD*sin(alpha) - CL*cos(alpha); + +Moment[2] = Cm*qbar*S_ref*C_bar; +Moment[1] = Cl*qbar*S_ref*b; +Moment[3] = Cn*qbar*S_ref*b; + +Vdot = der(V); +alphadot = der(alpha); +betadot = der(beta); + +omegadot[1] = der(p); +omegadot[2] = der(q); +omegadot[3] = der(r); + +xdot = der(x); +ydot = der(y); +zdot = der(z); + +mudot = der(mu); +gammadot = der(gamma); +chidot = der(chi); + + + + +Vdot = 1/m*(thrust*cos(alpha)*cos(beta)-0.5*rho*V^2*S_ref*(CD*cos(beta)-CY*sin(beta))-m*g*sin(gamma)); + +alphadot = q-1/cos(beta)*((p*cos(alpha)+r*sin(alpha))*sin(beta)-g/V*cos(gamma)*cos(mu)+0.5*rho*V^2*S_ref*CL/(m*V)+thrust*sin(alpha)/(m*V)); + +betadot = (p*sin(alpha)-r*cos(alpha))+1/(m*V)*(-thrust*cos(alpha)*sin(beta)+0.5*rho*V^2*S_ref*(CY*cos(beta)+CD*sin(beta))+m*g*cos(gamma)*sin(mu)); + + +omegadot = inv(J) * (Moment- OMEGA* J*{p,q,r}); + + + +xdot=V*cos(gamma)*cos(chi); +ydot=V*cos(gamma)*sin(chi); +zdot=-V*sin(gamma); + +mudot = p+tan(gamma)*sin(mu)*q+tan(gamma)*cos(mu)*r; +gammadot = cos(mu)*q-sin(mu)*r; +chidot=(1/cos(gamma))*sin(mu)*q+(1/cos(gamma))*cos(mu)*r; + + +annotation(experiment(StartTime = 0, StopTime = 500, Interval = 0.002), + uses(Modelica(version = "3.2.2"))); +end Wind6DOFZagi;
\ No newline at end of file diff --git a/Flight_Eqns/Wind_Axis_eqns/WindForceMoment.mo b/Flight_Eqns/Wind_Axis_eqns/WindForceMoment.mo new file mode 100644 index 0000000..9f3c8e4 --- /dev/null +++ b/Flight_Eqns/Wind_Axis_eqns/WindForceMoment.mo @@ -0,0 +1,124 @@ +model WindForceMoment + +import Modelica.Math.Matrices.*; +import Modelica.SIunits.*; +import Modelica.Blocks.Interfaces.*; +import Modelica.Math.Vectors.*; + + + +parameter Real rho = 1.225; +parameter Real g = 9.81; +parameter Real m = 1043.26;//1.56 for zagi +parameter Real S_ref = 16.1651;//reference area +parameter Real C_bar = 1.493 ;//average chord +parameter Real b = 10.911 ;//span + +parameter Real CD0 = 0.036;//= 0.01631;for Zagi +parameter Real K_drag = 0.0830304;//for cessna +parameter Real CD_beta = 0.17;//for cessna +parameter Real CD_alpha= 0.2108; +parameter Real CD_q = 0; +parameter Real CD_delta_e= 0.3045; + +//side force +parameter Real Cy_beta = -0.31;//for cessna +parameter Real Cy_p = -0.037;//for cessna +parameter Real Cy_r = 0.21;//for cessna +parameter Real Cy_delta_r = 0.187; //for cessna +parameter Real Cy_delta_a= 0; //for cessna + +// lift +parameter Real CL0 = 0.25; //for cessna +parameter Real CL_alpha = 4.47;//for cessna +parameter Real CL_q = 3.9;//for cessna +parameter Real CL_delta_e = 0.3476;//for cessna + +// rolling moment +parameter Real Cl_beta = -0.089;//for cessna +parameter Real Cl_p = -0.47;//for cessna +parameter Real Cl_r = 0.096;//for cessna +parameter Real Cl_delta_a= -0.09;//for cessna +parameter Real Cl_delta_r = 0.0147;//for cessna + +// pitching moment +parameter Real Cm0 = -0.02;//for cessna +parameter Real Cm_alpha = -1.8;//for cessna +parameter Real Cm_q = -12.4;//for cessna +parameter Real Cm_delta_e = -1.28;//for cessna + +// yawing moment +parameter Real Cn_beta = 0.065;//for cessna +parameter Real Cn_p = -0.03;//for cessna +parameter Real Cn_r = -0.99;//for cessna +parameter Real Cn_delta_a = -0.0053;//for cessna +parameter Real Cn_delta_r = -0.0657;//for cessna + +Real CL; +Real CD; +Real CY; +Real Cl; +Real Cm; +Real Cn; +Real CX; +Real CZ; + +RealInput thrust annotation( Placement(visible = true, transformation(origin = {-110, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-110, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));//Thrust force + +RealInput[3] delta annotation( + Placement(visible = true, transformation(origin = {-110, -50}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-110, -50}, extent = {{-20, -20}, {20, 20}}, rotation = 0))); + +RealInput[3] VAB annotation( Placement(visible = true, transformation(origin = {-33, 110}, extent = {{-20, -20}, {20, 20}}, rotation = -90), iconTransformation(origin = {-33, 110}, extent = {{-20, -20}, {20, 20}}, rotation = -90)));//V, alpha, beta + +RealInput[3] omega annotation( Placement(visible = true, transformation(origin = {33, 110}, extent = {{-20, -20}, {20, 20}}, rotation = -90), iconTransformation(origin = {33, 110}, extent = {{-20, -20}, {20, 20}}, rotation = -90)));//Angular velocities + + + +Real V = VAB[1]; +Real alpha = VAB[2]; +Real beta = VAB[3]; + +Real p = omega[1]; +Real q = omega[2]; +Real r = omega[3]; + +Real deltaE = delta[1]; +Real deltaR = delta[2]; +Real deltaA = delta[3]; + +Real qbar = 0.5*rho*V^2; + + + +RealOutput Force[3] annotation( Placement(visible = true, transformation(origin = {110, 33}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {110, 33}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));//Thrust force + +RealOutput Moment[3] annotation( Placement(visible = true, transformation(origin = {110, -33}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {110, -33}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));//Thrust force + + + +equation +CL = CL0+CL_alpha*alpha+((CL_q*q*C_bar)/(2*V))+CL_delta_e*deltaE; +//CD = CD0+CD_alpha*alpha+((CD_q*q*C_bar)/(2*V))+CD_delta_e*abs(deltaE) ; +CD = CD0 + K_drag*CL^2; +CY = Cy_beta * beta + Cy_p * (p*b)/(2*V) + Cy_r *(r*b)/(2*V) + Cy_delta_a * deltaA + Cy_delta_r*deltaR;//Sideslip coeff + + +Cl = Cl_beta * beta + Cl_p*(p*b)/(2*V) + Cl_r *(r*b)/(2*V) + Cl_delta_a * deltaA + Cl_delta_r * deltaR;//Rolling coeff + +Cm = Cm0+Cm_alpha*alpha+((Cm_q*q*C_bar)/(2*V))+Cm_delta_e*deltaE;//pitching coeff + +Cn = Cn_beta * beta + Cn_p * (p*b)/(2*V) + Cn_r *(r*b) /(2*V) + Cn_delta_a * deltaA + Cn_delta_r * deltaR;//Yawing coeff + +CX = -CD*cos(alpha) + CL*sin(alpha); +CZ = -CD*sin(alpha) - CL*cos(alpha); + +Force[1] = thrust*cos(alpha)*cos(beta)-0.5*rho*V^2*S_ref*(CD*cos(beta)-CY*sin(beta)); +Force[2] = -thrust*cos(alpha)*sin(beta)+0.5*rho*V^2*S_ref*(CY*cos(beta)+CD*sin(beta)); +Force[3] = 0.5*rho*V^2*S_ref*CL+thrust*sin(alpha); + + +Moment[2] = Cm*qbar*S_ref*C_bar; +Moment[1] = Cl*qbar*S_ref*b; +Moment[3] = Cn*qbar*S_ref*b; + +end WindForceMoment;
\ No newline at end of file |