Advanced Question Change Solar Flux 10.7

infotechggs

New member
Joined
May 29, 2014
Messages
10
Reaction score
0
Points
1
Dear friend,following this post and the Martins suggestion
http://www.orbiter-forum.com/showthread.php?p=224490&highlight=f107#post224490

with this code i'm able to get the atmosferics data (T,rho,p) just passing the altitude

Code:
////////////Function 1
double GetAtmospheredata(CELBODY* planet, double Altitude)// alt in meters
{
	if (planet==NULL) 
	{
		return 0.0;
	};
	ATMPARAM atm;
	ATMOSPHERE* atm2;
	ATMOSPHERE::PRM_IN inparam ;
	ATMOSPHERE::PRM_OUT outparam;
	//ATMOSPHERE::PRM_IN_FLAG paramflag;
	CELBODY2 * pl2;
		pl2 = (CELBODY2 *) planet;
		//double solar_flux = pl2->GetAtmosphere()->PRM_F;
		atm2 = pl2->GetAtmosphere();
		
		//paramflag = atm2->PRM_ALT;
[COLOR="Red"]		inparam.flag = atm2->PRM_ALT;  ///without the flag the data is no updated  [/COLOR]
		//inparam.flag = atm2->PRM_F;
		//inparam.flag = atm2->PRM_FBR;
		//inparam.flag = atm2->PRM_F;
		inparam.alt = Altitude;
		inparam.lat = 0.0;
		inparam.lng = 0.0;
		inparam.ap = 3.0;
		//inparam.f107bar = 300;
		//inparam.f107 = 300;
		//inparam.f107 = inparam.f107bar;
		if (atm2->clbkParams(&inparam, &outparam)==true)
		
		{
			return outparam.rho;
			//return outparam.T;
			//return outparam.p;
	
		}
		else
		{
			return 10.0;
		};
}


//////////Function 2
double GetAtmospheredata2(CELBODY* planet, double Altitude)// alt in meters
	{
		if (planet==NULL) 
		{
			return 0.0;
		};
		ATMPARAM atm;
		if (planet->clbkAtmParam(Altitude, &atm)==true)
		{
			return atm.rho;
				}
		else
		{
		return 0.0;
		};
	}

////////////////////////////////////////////////
At this point i would like to modify the solax flux value to a number different from the default (should be 140) and use the respective atmo data that should be changed (T,rho,p).
Using the value "inparam.flag = atm2->PRM_ALT;"i've flagged the altitude but i would like to flag also the PRM_FBR and PRM_F, so how can i add the others flags?
Do you have any suggestions to change the solar flux from the default value?
Thanks in advance


Ok problem solved
The good Cristiapi, give me the right suggestion and now the i'm able to get the Athmosphere data corrected for any solar flux or geomagnetic activity.
just add
inparam.flag = atm2->PRM_ALT | atm2->PRM_FBR | atm2->PRM_F;
and set
inparam.ap = 13.0;
inparam.f107bar = 300;///(Default 140)
inparam.f107 = inparam.f107bar;
Make a function to change the solar flux and geomagnet and evaluate the results.
Thanks
Enrico
 
Last edited:

BrianJ

Addon Developer
Addon Developer
Joined
Apr 19, 2008
Messages
1,679
Reaction score
902
Points
128
Location
Code 347
Hi Enrico,
I'm a bit "out of my depth" using CELBODY functions, but I'm trying to keep up :)

I can't get it working even if I use
Code:
inparam.flag = atm2->PRM_ALT | atm2->PRM_FBR | atm2->PRM_F;
or (including geomagnetic component?)
Code:
inparam.flag = atm2->PRM_ALT | atm2->PRM_FBR | atm2->PRM_F | atm2->PRM_AP;

inparam.alt is the only input parameter that changes my values of
Code:
outparam.rho;
outparam.T;
outparam.p;

Changing the value of inparam.ap, inparam.f107bar, inparam.f107 has no effect on my outputs.

Could you post what your final code looks like? Many thanks!

Cheers,
Brian
 

infotechggs

New member
Joined
May 29, 2014
Messages
10
Reaction score
0
Points
1
Dear Brian,
this is the final code
///////////////////////////////////////////////
double GetAtmospheredata(CELBODY* planet, double Altitude)// alt in meters
{
if (planet==NULL)
{
return 0.0;
};
ATMPARAM atm;
ATMOSPHERE* atm2;
ATMOSPHERE::pRM_IN inparam ;
ATMOSPHERE::pRM_OUT outparam;
//ATMOSPHERE::pRM_IN_FLAG paramflag;
CELBODY2 * pl2;
pl2 = (CELBODY2 *) planet;
//double solar_flux = pl2->GetAtmosphere()->PRM_F;
atm2 = pl2->GetAtmosphere();
inparam.flag = atm2->PRM_F | atm2->PRM_ALT | atm2->PRM_FBR;
inparam.alt = Altitude;
inparam.lat = 0.0;
inparam.lng = 0.0;
inparam.ap = 3.0;
inparam.f107bar = 140;
//inparam.f107bar = 300;
inparam.f107 = inparam.f107bar;
if (atm2->clbkParams(&inparam, &outparam)==true)

{
return outparam.rho;
//return outparam.T;
//return outparam.p;

}
else
{
return 0.0;
};
}
///////////////////////////////////////////////////
I call the function everytime i need the rho and use this for my needs, passing the updated altitude as input

rho_solar_flux_mod = GetAtmospheredata(pPlanet,altitude2);//altitude2 is the altitude of the vessel

I've changed the value of the solar flux from 70 to 300 and i've checked that the airdensity and drag force changing in the correct way.
You can do the same with the geomag but you have to add the flag here
inparam.flag = atm2->PRM_F | atm2->PRM_ALT | atm2->PRM_FBR | atm2->PRM_AP;
During high solar activity the flux create heating in the air increasing density that increase the drag
I'm going to make some double check between orbiter and STK using HPOP propagator that should be the state of the art of the satellite and debris propagator.
Thanks for every help that you give me.
 

BrianJ

Addon Developer
Addon Developer
Joined
Apr 19, 2008
Messages
1,679
Reaction score
902
Points
128
Location
Code 347
Hi,
thanks so much, I'll give it a try later. It's teaching me lots about the CelbodyAPI :)
 
Top