Woodylepic
New member
- Joined
- Dec 29, 2009
- Messages
- 71
- Reaction score
- 0
- Points
- 0
Can you post also declarations (QTV.h)?
Code:
// ==============================================================
// ORBITER MODULE: QTV
// Part of the ORBITER SDK
// Copyright (C) 1/20/2011 Ronald Dandurand
// All rights reserved
//
// QTV.h
// QTV basic specs and animations
//
// QTV mesh and textures by Ronald Dandurand
// ==============================================================
#ifndef __QTV_H
#define __QTV_H
#define STRICT
#include"orbitersdk.h"
#include"OrbiterSoundSDK35.h"
#define wind 5
#define LittleJoeLaunch 6
#define soundbarier 7
#define spaceaudity 9
#define jeep 10
// ==============================================================
// Airfoil coefficient functions
// Return lift, moment and zero-lift drag coefficients as a
// function of angle of attack (aoa (vertical) or beta (horizontal)
// ==============================================================
//Lift Coefficient = Lift Force / Dynamic Pressure * Wing Area
// 1. vertical lift component (wings and body)
void VLiftCoeff (VESSEL *v, double aoa, double M, double Re, void *context, double *cl, double *cm, double *cd)
{
int i;
constint HUIT = 8;//NOMBRE DE DONNE DANS LA TABLE
// 1 2 3 4 5 6 7 8
static const double AOA[HUIT] = {-180*RAD,-135*RAD,-90*RAD,-45*RAD,45*RAD,90*RAD,135*RAD,180*RAD};//ANGLE D'ATTACK
static const double CL[HUIT] = { 0, -0.2, 0, -0.1, 0.1, 0, 0.2, 0};//LIFT COEF
for (i = 0; i < HUIT-1 && AOA[i+1] < aoa; i++);//i=7 & AOA = CONTE EN descendand ET DEFINIE LE TABLEAUX
double f = (aoa-AOA[i]) / (AOA[i+1]-AOA[i]);//FORCE IN NEWTON
*cl = CL[i] + (CL[i+1]-CL[i]) * f; // aoa-dependent lift coefficient
*cm = 0.0; //moment coefficient
double saoa = sin(aoa);
double pd = 0.045 + 0.4*saoa*saoa; // profile drag
*cd = pd + oapiGetInducedDrag (*cl, 2.56, 0.123) + oapiGetWaveDrag (M, 0.75, 1.0, 1.1, 0.04);
//*cd = pd + oapiGetInducedDrag (*cl, 1.5, 0.3) + oapiGetWaveDrag (M, 0.75, 1.0, 1.1, 0.04);
//double oapiGetInducedDrag (double cl, double Aspec ratio, double wing efficiency factor = .5*hauteur/.5*chord)
// profile drag + (lift-)induced drag + transonic/supersonic wave (compressibility) drag
//AOA = ANGLE DATTACK RADIENT
//M = MACH NUMBER (MACH NUMBER EXP 1.1 = MACH 1.1)
//RE = REYNOLDS NUMBER
//CL= lift coefficient = Lift Force / Dynamic Pressure * Wing Area
// CM= moment coefficient
// CD= drag coefficient
//PD= profile drag
// SIN = OPPOSE/HYPOTENUSE
}
// 2. horizontal lift component (vertical stabilisers and body)
void HLiftCoeff (VESSEL *v, double beta, double M, double Re, void *context, double *cl, double *cm, double *cd)
{
int i;
constint HUIT = 8;//NOMBRE DE DONNE DANS LA TABLE
// 1 2 3 4 5 6 7 8 9
static const double BETA[HUIT] = {-180*RAD,-135*RAD,-90*RAD,-45*RAD,45*RAD,90*RAD,135*RAD,180*RAD};//ANGLE D'ATTACK
static const double CL[HUIT] = { 0, +0.2, 0, -0.1, +0.1, 0, -0.2, 0};//LIFT COEF
for (i = 0; i < HUIT-1 && BETA[i+1] < beta; i++);//CONTE EN MONTANT ET DEFINIE LE TABLEAUX
double f = (beta-BETA[i]) / (BETA[i+1]-BETA[i]);
*cl = CL[i] + (CL[i+1]-CL[i]) * f; // aoa-dependent lift coefficient
*cm = 0.0;//moment coefficient
double saoa = sin(beta);
double pd = 0.045 + 0.4*saoa*saoa; // profile drag
*cd = pd + oapiGetInducedDrag (*cl, 2.56, 0.123) + oapiGetWaveDrag (M, 0.75, 1.0, 1.1, 0.04);
}
// ==============================================================
// Some parameters and capabilities
// ==============================================================
char Planet_Name[6] = "Earth";
staticint refcount = 0;
static BOOL SoundPlayed=FALSE;
static double OldPression=10000000.0f;
static double Density=10000000.0f;
OBJHANDLE hVessel;
OBJHANDLE hEarth;
const double FIRSTSTAGE_SM_WEIGHT = 12340 *.45359237;//=kg ok
const double DUMMY_CM_WHIT_ADAPTER = 17612*.45359237;//=kg ok
const double LES_WEIGHT = 6612*.45359237;//=kg ok
const double STAGE1_RECRUIT_MASS_FUEL = 1605*.45359237;//(6)=ok
const double STAGE1_ALGOL_MASS_FUEL = 18996*.45359237;//=ok
const double STAGE1_RECRUIT_Thrust_VAC = ((315000/6)*.45359237)*9.81;//bon
const double STAGE1_RECRUIT_ISP_VAC = 294.3925234*9.81;//1.5sec bon
const double STAGE1_RECRUIT_ISP_SL = 294.3925234*9.81;//1.5sec bon
const double STAGE1_ALGOL_Thrust_VAC = (105100*.45359237)*9.81;//average thrust bon
const double STAGE1_ALGOL_ISP_VAC = 193.6460307*9.81;//35sec
const double STAGE1_ALGOL_ISP_SL = 193.6460307*9.81;//35sec bon
const double ISP_FIRST_SL = 0*9.81;
const double ISP_FIRST_VAC = 0*9.81;
const double THRUST_FIRST_VAC = 0*9.81;
const double MAX_ATT_FIRST = 0;
const double MAX_RCS_THRUST = 0;
const double U_EARTH = 3.986e5 * 1000 * 1000 * 1000; //( m^3/sec^2)
const VECTOR3 FIRSTSTAGE = { 0,0,0};//little joe position sur le sol
VECTOR3 Surface_Vel; // surface relative velocity components m/s
VECTOR3 Vel;
VECTOR3 avel;
double TimeMECO; // Time of MECO
double TZero = 0; // Time Zero - Launch time
double MET;// Mission Elasped Time
double MET1;
double POSTMET;
double SimT_Last;
double ignition_time=0.0;
double stage_sep=0;
double flag;
double MJD_Time ;
double Alt_Apoapsis;// Altitude of apoapsis (km)
double Vert_Vel; // vertical velocity in the last time step.
double fold_proc;
double a;// semi-major axis
double e; // eccentricity
double h; //altitude
double V_periapsis; // Velocity at MECO/periapsis.
double Velocity; //velocite depuis lalumage moteur
double longitude; // radians
double latitude; // radians
double oldMachnumber;
double radius;
double inclination;
double thruttle;
double get_vacc(OBJHANDLE vessel);
char test1[7];//met 7 espace
char test2[7];
char test3[7];
char test4[7];
double ang_Vel;
double Q;
double g;
double maxQ;
double oldQ;
double alt;
double alt1;
double MACH1;
double MACH;
double ORIGINAL_SIZE=0.0;
double frame = FRAME_EQU;
double *pressure;//POINTEUR TO PRESSURE
double *density;
double oldDensity;
UINT stage = 0;
UINT meshidx;
int status = 0;//definie la configuration de base
bool Test_point_conditions=false;
bool Display_Message=true;
bool T_minus_0=true; // True at T minus 10 seconds.
bool guidance=false; // guidance switch
bool engineignited = false;
bool sound_ON_OFF = true;
ELEMENTS elements;
ORBITPARAM prm;
// ==============================================================
// particule Effects
// ==============================================================
PARTICLESTREAMSPEC algol_motor_stream = {
0, 7.0, 800, 50.0, 0.2, 3.5, 3, 0.0, PARTICLESTREAMSPEC::DIFFUSE,
PARTICLESTREAMSPEC::LVL_PSQRT, 0, 7,
PARTICLESTREAMSPEC::ATM_PLOG, 1e-5, 1
};
PARTICLESTREAMSPEC algol_motor_engine = {
0, 2.5, 800, 50.0, 0.0, 0.7, 12.0, 0.0, PARTICLESTREAMSPEC::EMISSIVE,
PARTICLESTREAMSPEC::LVL_PSQRT, 0, 0,
PARTICLESTREAMSPEC::ATM_PLOG, 1e-5, 1
};
//recruit motor
PARTICLESTREAMSPEC recruit_motor_stream = {
0, 3.0, 800, 50.0, 1.0, 12.0, 15, 0.0, PARTICLESTREAMSPEC::DIFFUSE,
PARTICLESTREAMSPEC::LVL_PSQRT, 0, 2,
PARTICLESTREAMSPEC::ATM_PLOG, 1e-5, 1
};
// ==============================================================
// QTV class interface
// ==============================================================
class QTV: public VESSEL3 {
public:
PROPELLANT_HANDLE ph_recrut_tank,ph_algol_tank;
THRUSTER_HANDLE th_recruit_engine[6],th_algol_engine[1];//main thruster
THGROUP_HANDLE thg_recruit,thg_algol; //main thrustergroup
QTV (OBJHANDLE hObj, int fmodel);
void Guidance_Routine(double simt, double SimT_Last);
void SetfirstStage (void);
// ==============================================================
// Overloaded callback functions
// ==============================================================
//this line is for automatic activation of autopilot after release of payload
ATTACHMENTHANDLE launch_pad_attachement;
void clbkSetClassCaps (FILEHANDLE cfg);
void clbkPostStep (double simt, double simdt, double mjd);
int clbkConsumeBufferedKey (DWORD key, bool down, char *kstate);
void clbkPostCreation(void); // add this callback
int MyID; // Add this it will be needed by sound fonction
private:
};
#endif// !__QTV_H
Last edited by a moderator: