Problem Orbiter crash whene i reload a scenario for 2em time ?

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:
The problem lies in this line in "void QTV::SetfirstStage (void)" function:
Code:
	ShiftCG (_V(-0.000508,0.000762,0.256540051));
I'm not sure why, but I'll dig more into it later today, after work.


Command F:\ORBITER 2010\orbiter.exe
Work F:\ORBITER 2010\


I have try this but I see a blank page no scenario ?

I just noticed there's a space in the directory name. Putting quotes around should help, i.e. "F:\ORBITER 2010".
 
Your Right Orb :thumbup: I have disable this line and now all ok.

For the Orbiter 2010 debug I have try to debug an other Orbiter whit only Orbiter in the word and same problem blank liste.


Thank for your Help Orb Now I know where is the trouble.

But how to resolve this ?
I have a multitude of this kind of line in all my other Little Joe rockets (A001,A002,A003,A004) and I need this to adjust the weight, the view and also when staging,
 
Last edited:
But how to resolve this ?
You need to move calls to the ShiftCG function out of clbkSetClassCaps (SetfirstStage method from which you call ShiftCG is called from clbkSetClassCaps).
 
You need to move calls to the ShiftCG function out of clbkSetClassCaps (SetfirstStage method from which you call ShiftCG is called from clbkSetClassCaps).


void QTV::clbkSetClassCaps (FILEHANDLE cfg)
{
stage=0;
SetfirstStage ();
char attach_id[8]={"SH"};
launch_pad_attachement=CreateAttachment (
true,_V(0, 0, -8.771),_V(0,-1,0),_V(0,0,1),attach_id);
}



Ok Orb :thumbup: but I have to initiate the first stage some where ?

So I need to put the ShiftCG in the autopilot or somewhere ?

Moving the SetfirstStage ();
out side clbkSetClassCaps will not work ?

Ok Orb I think I got it !
I have put the ShiftCG in the clbkPostStep sequence like this (WHIT THE IGNITION SEQUENCE)

//setfirststage
if (stage == 0)//activation stage 0
{

ShiftCG (_V(-0.000508,0.000762,0.256540051)); HERE !!!

SetThrusterGroupLevel(thg_recruit,thruttle);
if (guidance)
{
if (TZero == 0)
{
MET = 0 ;//met a 0
TZero = 0;
}

AND ALL WORK PERFECLY NOW !!!

THANK SO MUSCH ORB !
 
Last edited:
I'd move it to clbkLoadStateEx, as current stage will most likely be saved to the scenario in the future (it can be set to first stage by default if the stage entry hasn't been found in the saved state).
 
Back
Top