API Question ShiftCG

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,624
Reaction score
2,342
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
This is what I am trying to do. So press a key and the cruise mass drops thus changing the CoG. Then at another time press a key or automatic entry masses are dropped and now CoG is restored and capsule is level.

I know, I was already sure that you had been up to this. :lol:

But you mistake things there:

The capsule did not change the attitude when the ballast was dropped.
What was affected was the stable attitude during re-entry.

Without dropping one set of ballast, the AOA would be 0° and guided re-entry would be impossible.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,724
Reaction score
2,689
Points
203
Location
Dallas, TX
So at the start I assume the AoA is 0. Just starting the Entry.

Then 1 set (cruise mass) dropped and then the AoA shifts as the CofG.

Then after the chute deploys the other set is dropped and the craft returns to 0 AofA.
right?

Or just Rcs to get the correct Aof A.
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,624
Reaction score
2,342
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
So at the start I assume the AoA is 0. Just starting the Entry.

Then 1 set (cruise mass) dropped and then the AoA shifts as the CofG.

Then after the chute deploys the other set is dropped and the craft returns to 0 AofA.
right?

Or just Rcs to get the correct Aof A.

Both. Without RCS, the capsule would tumble around the stable attitude and would be uncontrollable. The RCS is used for fine corrections. Without the CoG position, the RCS would be consuming much more fuel for holding AOA.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,724
Reaction score
2,689
Points
203
Location
Dallas, TX
Ok. So back to the original question. So the capsule is 4.5M diameter. So should the CoG shift be (0,-2.25,0) And then stable any spin using RCs?

All SHIFTCG seems to do is visually move the mesh.

Should changing the CoG also change the Angle of Attack?
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,624
Reaction score
2,342
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Should changing the CoG also change the Angle of Attack?

No. You would have to test it in free fall.

Without changing the CP the capsule will fall with 0° AOA.
With a change in CP the capsule will "fall" with the preset AOA.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,724
Reaction score
2,689
Points
203
Location
Dallas, TX
What is CP?

So how do I change the CoG without the RCS? If the RCS is just to stablize it
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,624
Reaction score
2,342
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
What is CP?

So how do I change the CoG without the RCS? If the RCS is just to stablize it

Centre of pressure. It is the position where the aerodynamic forces attach to.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,724
Reaction score
2,689
Points
203
Location
Dallas, TX
Thanks. How do I change the CP?

This is what I am trying to do:
 
Last edited:

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,624
Reaction score
2,342
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Thanks. How do I change the CP?

This is what I am trying to do:

Try it with ShiftCG, if this doesn't work, there is a function like "EditAirfoil" or so.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,724
Reaction score
2,689
Points
203
Location
Dallas, TX
Thanks. So if the capsule is falling towards the surface. If I shiftCG in the Y axis. Should the capsule tilt back? If it does then I can adjust the amount of ShiftCg to geta 16 degree change.
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,624
Reaction score
2,342
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Thanks. So if the capsule is falling towards the surface. If I shiftCG in the Y axis. Should the capsule tilt back? If it does then I can adjust the amount of ShiftCg to geta 16 degree change.

Observe. If it does not tilt back... you need to manually shift the aerodynamic model with the meshes.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,724
Reaction score
2,689
Points
203
Location
Dallas, TX
This is what I have in Space.
MSLSPACE_zpsesaxvmle.jpg


Then when I enter the atmosphere.
MSLAIR1_zps6okhkqnq.jpg


The pitch goes to -90. Aoa is 1.

ShiftCG just moves the mesh.

Not sure what to change?
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,724
Reaction score
2,689
Points
203
Location
Dallas, TX
Interesting.

Well I re orientated the mesh So now +Z is in the direction of the heat shield.
mslassembly1_zpsp7tnanin.jpg


But now when I try to enter the atmosphere. I can rcs to get a AOA of 25 but a pitch of -65.

ShiftCg does nothing except move the mesh
 

kocmolyf

Addon Developer
Addon Developer
Joined
Aug 16, 2014
Messages
95
Reaction score
1
Points
8
What aerodynamics are you using? Airfoils, or something else?
 

francisdrake

Addon Developer
Addon Developer
Joined
Mar 23, 2008
Messages
1,085
Reaction score
901
Points
128
Website
francisdrakex.deviantart.com
If you aim for an aerodynamic tilt, so the capsule can be steered during reentry, this needs the airfoils to be off-center. Below is an example I use for the Orion capsule. Note the negative signs, they required so the capsule enters ass-first.

Code:
void CEV::SetConfig2_Reentry(void)
{	SetSize (6);
	SetEmptyMass (CM_DRYMASS);
	SetPMI (_V(1,1,1));

	SetCrossSections (_V(24,28,19));
	SetWingAspect (1);
	SetWingEffectiveness (1);

	SetPitchMomentScale (-1e-4);

	SetBankMomentScale (-1e-4);
	SetRotDrag (_V(0.01,0.01,0.005));
	
	SetCameraOffset (_V(0,0,-1.8));
	SetTouchdownPoints(_V(0,-2,0),_V(-2,1,0),_V(2,1,0));
	SetSurfaceFrictionCoeff (0.2, 0.2);

	SetDockParams (_V(0,0,2.1), _V(0,0,1), _V(0,1,0));

	CreateAirfoil (LIFT_VERTICAL,   _V(0, 0.01,0.1), VLiftCoeff, 5.5, 0, 1.27);
	CreateAirfoil (LIFT_HORIZONTAL, _V(0, 0,  0.01), HLiftCoeff, 5.5, 0, 1.27);

	mode = 2;
	ReloadMeshes();
	SetThrusters2_Reentry();
}

And these are the corresponding VLift and HLift functions:

Code:
void VLiftCoeff (double aoa, double M, double Re, double *cl, double *cm, double *cd)
{
	static const double step = RAD*30.0;
	static const double istep = 1.0/step;
	static const int nabsc = 13;
//	Angle of attack	-180	-150	-120	-90		-60		-30		0		30	 60		90		120		150	  180
	static const double CL[nabsc] = {	0,	-0.12,	-0.1,	  0,	  0,	  0,	0,		0,	  0,	 0,		0.1,	0.12,	0};
	static const double CM[nabsc] = {	0,	-0.0002,-0.0004, -0.0004,-0.0003,-0.0002, 0, 0.0002, 0.0003, 0.0004, 0.0004,0.0002,	0};
	// lift and moment coefficients from -180 to 180 in 30 degree steps.

	aoa += PI;
	int idx = max (0, min (11, (int)(aoa*istep)));
	double d = aoa*istep - idx;
	*cl = CL[idx] + (CL[idx+1]-CL[idx])*d;
	*cm = ( CM[idx] + (CM[idx+1]-CM[idx])*d ) / 10;
	*cd = 0.25 + oapiGetInducedDrag (*cl, 1.27, 0.3);
}

// 2. horizontal lift component (vertical stabiliser and body)

void HLiftCoeff (double beta, double M, double Re, double *cl, double *cm, double *cd)
{
	static const double step = RAD*30;
	static const double istep = 1.0/step;
	static const int nabsc = 13;
	static const double CL[nabsc] = {	0,	-0.1,	-0.1,	  0,	  0,	  0,	0,		0,	  0,	 0,		0.1,	0.1,	0};

	beta += PI;
	int idx = max (0, min (11, (int)(beta*istep)));
	double d = beta*istep - idx;
	*cl = CL[idx] + (CL[idx+1]-CL[idx])*d;
	*cm = 0.0;
	*cd = 0.25 + oapiGetInducedDrag (*cl, 1.27, 0.3);
}
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,724
Reaction score
2,689
Points
203
Location
Dallas, TX
Now I am using Francisdrake's. Here is what I get when hitting the atmosphere
mslcapsule1_zpsxglz1lxz.jpg
 

francisdrake

Addon Developer
Addon Developer
Joined
Mar 23, 2008
Messages
1,085
Reaction score
901
Points
128
Website
francisdrakex.deviantart.com
I forgot to mention my capsule lift function is for a heads-down entry. Sorry, can't read too much in the screen shot, and I don't see a green lift vector.
Aside from this, could it be your capsule mesh is rotated by 90°?
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,724
Reaction score
2,689
Points
203
Location
Dallas, TX
Thanks. Yes. I think so. I believe the weight which are by those hatch should be on top/bottom rather than the side.

mslcapsuleorient1_zps8zncmqnr.jpg


mslcapsuleorient_zpsrlupazxg.jpg


Someone mention that the diagram may be different than orbiter also.

So I guess I need to change the airfoils?

I didn't see a lift arrow either?
 

kocmolyf

Addon Developer
Addon Developer
Joined
Aug 16, 2014
Messages
95
Reaction score
1
Points
8
Yes, you need to manually move the airfoils in exactly the opposite direction of ShiftCG.
 
Top