飞行器气动参数读入方法研究与实操(VC++代码,类和对象)_Lesson2

在昨天的文章中,作者介绍了在飞行器工程型号研制过程中,气动参数的读入方法。今天的文章,介绍一下三自由度弹道仿真和六自由度制导控制仿真中,气动参数读入和气动力、气动力矩建模的实操,VC++编程语言,类和对象架构。

利用Visual studio 2012创建一个Win32控制台的应用程序项目,项目的名字为:Aero_Project,创建好工程项目之后,利用类向导添加类:CAerodynamic_coefficient,会同时生成头文件Aerodynamic_coefficient.h和源文件Aerodynamic_coefficient.cpp。在类CAerodynamic_coefficient里面定义如下的成员函数:   void Atmosphere_model(double H_km, double &rou_output, double &a_output, double &Ps);   //大气模型函数

    void Aerodynamic_Calculation(double H_in, double V_in, double alpha_rad_in, double beta_rad_in, double FM_aero_out[6]);   //气动力和力矩计算函数

    double Interpolation_1D(double p[], double NUM[],double niu,int n );   //一维插值函数

    double Interpolation_2D(double *niudun, double A[], double B[], double jx,double jy,int N1, int N2 );   //二维插值函数

    double Interpolation_3D(double *y, double *x1, double *x2, double*x3,double fish1,double fish2, double fish3,int l, int m,int n) ;  //三维插值函数

程序的文件架构为:

飞行器气动参数读入方法研究与实操(VC++代码,类和对象)_Lesson2_第1张图片

程序的界面如下:

飞行器气动参数读入方法研究与实操(VC++代码,类和对象)_Lesson2_第2张图片 

头文件Aerodynamic_coefficient.h的代码为:

#pragma once

#include

#include

#include

#include

using namespace std;

#include

#include

#include

#include

#define rad2deg_GL    57.295779513082323

#define r_earth   6356.766     //地球公称半径(km)

#define Rz   287.05287        //专用气体常数287.053//

#define gn   9.80665         //重力加速度

#define beta_XHGNC_num         3    //侧滑角的维数

#define alpha_XHGNC_num        8    //攻角的维数

#define mach_XHGNC_num         10   //马赫数的维数

class CAerodynamic_coefficient

{

public:

    CAerodynamic_coefficient(void);   //构造函数

    void Aerodynamic_Calculation(double H_in, double V_in, double alpha_rad_in, double beta_rad_in, double FM_aero_out[6]);   //气动力和力矩计算

    void Atmosphere_model(double H_km, double &rou_output, double &a_output, double &Ps);   //大气模型,rou_output为空气密度, a_output为音速,Ps_output为大气压强

    double vector_3D(int m,int n, double *v,int i, int j, int k);

    double sat2(double yint, double sat_down, double sat_up);    //不对称限幅函数     XHGNC   20250720_2253

    double Interpolation_1D(double p[], double NUM[],double niu,int n );   //一维插值函数

    double Interpolation_2D(double *niudun, double A[], double B[], double jx,double jy,int N1, int N2 );   //二维插值函数

    double Interpolation_3D(double *y, double *x1, double *x2, double*x3,double fish1,double fish2, double fish3,int l, int m,int n) ;  //三维插值函数

    double CN1_Matrix_XHGNC[beta_XHGNC_num][alpha_XHGNC_num][mach_XHGNC_num];    //法向力系数_弹体坐标系 CN1_Matrix_XHGNC

    double CA1_Matrix_XHGNC[beta_XHGNC_num][alpha_XHGNC_num][mach_XHGNC_num];

    double CZ1_Matrix_XHGNC[beta_XHGNC_num][alpha_XHGNC_num][mach_XHGNC_num];

    double CMX1_Matrix_XHGNC[beta_XHGNC_num][alpha_XHGNC_num][mach_XHGNC_num];

    double CMY1_Matrix_XHGNC[beta_XHGNC_num][alpha_XHGNC_num][mach_XHGNC_num];

    double CMZ1_Matrix_XHGNC[beta_XHGNC_num][alpha_XHGNC_num][mach_XHGNC_num];

    double beta_Matrix_XHGNC[beta_XHGNC_num];

    double alpha_Matrix_XHGNC[alpha_XHGNC_num];

    double mach_Matrix_XHGNC[mach_XHGNC_num];

    double CN1_coefficient;

    double CA1_coefficient;

    double CZ1_coefficient;

    double CMX1_coefficient;

    double CMY1_coefficient;

    double CMZ1_coefficient;

    double S_ref;   //参考面积

    double L_ref;    //参考长度

    virtual ~CAerodynamic_coefficient(void);    //析构函数

};

源文件Aerodynamic_coefficient.cpp的代码为:

#include "stdafx.h"

#include "Aerodynamic_coefficient.h"

CAerodynamic_coefficient::CAerodynamic_coefficient(void)

{

余下的代码请参阅Wechat Public Platform:弹道制导控制业余爱好者,里面的文章《飞行器气动参数读入方法研究与实操(VC++代码,类和对象)_Lesson2》。

 

你可能感兴趣的:(c++,开发语言,visual,studio,气动参数,飞行器,火箭,六自由度仿真)