diff options
author | Siddharth11235 | 2019-09-03 18:09:16 +0530 |
---|---|---|
committer | Siddharth11235 | 2019-09-03 18:09:16 +0530 |
commit | b4b6aa36e3486a3544acc52419149b5671f841e9 (patch) | |
tree | 66c1783158f23e6d21c77324156fc57e18d4ac67 /Flight_Eqns/Wind_Axis_eqns | |
parent | f5266f634f4fb4fd39933a83551a01cf446256b8 (diff) | |
download | OpenModelica_HIL-b4b6aa36e3486a3544acc52419149b5671f841e9.tar.gz OpenModelica_HIL-b4b6aa36e3486a3544acc52419149b5671f841e9.tar.bz2 OpenModelica_HIL-b4b6aa36e3486a3544acc52419149b5671f841e9.zip |
Diffstat (limited to 'Flight_Eqns/Wind_Axis_eqns')
-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 |
7 files changed, 1148 insertions, 0 deletions
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 |