コード例 #1
0
	triple Force::planet(int IDP, double mu) {
		triple Xa = X;
		double poss[3];
		double lt1;
		triple rp, Delta;
		spkgps_c(IDP, time, "J2000", Global::IDC, poss, &lt1);

		triple Xp(poss);
		Delta = Xp - Xa;
		double d = Delta.getAbs();
		double r = Xp.getAbs();
		triple accp = Delta*mu / pow(d, 3) - Xp*mu / pow(r, 3);

		return accp;
	}
コード例 #2
0
	//
	//the perturbation by additional body #5(central and none-central gravity)
	triple Force:: acc5th_body()
	{
		triple acc_;
		if (Global::b_add5_cun_on)
		{
			//centric part of  acceleration 
			triple acc_point = planet(Global::ID5, Global::GravField_add5.getGM());

			double pos[3], lt;
			spkgps_c(Global::IDC, time, "J2000", Global::ID5, pos, &lt);
			triple pos_CB(pos);
			triple Xbs = pos_CB + X;
			// non-centric part of  acceleration by #5
			triple fs = Global::GravField_add5.getAcceleration(Global::ID5, time, Xbs);
			triple fcb = Global::GravField_add5.getAcceleration(Global::ID5, time, pos_CB);

			acc_ = acc_point + (fs - fcb);
		}
		else
		{
			acc_ = planet(Global::ID5);
		}
		return acc_;
	}
コード例 #3
0
	void Force::force_w(double Ti)
	{
		ConstSpiceChar *pictur = "YYYY MM DD HR:MN:SC.####### ::UTC";

		triple acc, accp, accr, acc_SRP, accA;

		SRP EFG;
		AtmosphericDrag HIJ;

		SpiceChar        utcstr[100];
		//et2utc_c ( this->time,  "C", 10, 80, utcstr );
		timout_c(time, pictur, 50, utcstr);
		fprintf(facc, "%s", utcstr);
		fprintf(facc, et_F, time);
		triple acccb = force_cb();
		fprintf(facc, et_F, acccb.getAbs());

		//Central body + harmonic coefficients
		if (Global::b_Cunn)
		{
			triple accCunn = Global::GravField_CB.getAcceleration(Global::IDC, time, X);
			fprintf(facc, et_F, accCunn.getAbs());
		}
		else fprintf(facc, " 0");

		//Sun
		if (Global::b_10) { accp = planet(10); fprintf(facc, et_F, accp.getAbs()); }
		else { fprintf(facc, " 0"); }

		//Mercury 
		if (Global::b_1) { accp = planet(1); fprintf(facc, et_F, accp.getAbs()); }
		else { fprintf(facc, " 0"); }

		//Venus
		if (Global::b_2) { accp = planet(2); fprintf(facc, et_F, accp.getAbs()); }
		else { fprintf(facc, " 0"); }

		//Earth+Moon
		if (Global::b_3) { accp = planet(3); fprintf(facc, et_F, accp.getAbs()); }
		else { fprintf(facc, " 0"); }
		//Mars
		if (Global::b_4) { accp = planet(4); fprintf(facc, et_F, accp.getAbs()); }
		else { fprintf(facc, " 0"); }
		//Jupiter
		if (Global::b_5) { accp = planet(5); fprintf(facc, et_F, accp.getAbs()); }
		else { fprintf(facc, " 0"); }
		//Saturn
		if (Global::b_6) { accp = planet(6); fprintf(facc, et_F, accp.getAbs()); }
		else { fprintf(facc, " 0"); }
		//Uranus
		if (Global::b_7) { accp = planet(7); fprintf(facc, et_F, accp.getAbs()); }
		else { fprintf(facc, " 0"); }
		//Neptune
		if (Global::b_8) { accp = planet(8); fprintf(facc, et_F, accp.getAbs()); }
		else { fprintf(facc, " 0"); }
		//Pluto
		if (Global::b_9) { accp = planet(9); fprintf(facc, et_F, accp.getAbs()); }
		else { fprintf(facc, " 0"); }

		//add1
		if (Global::b_add1) { accp = planet(Global::ID1); fprintf(facc, et_F, accp.getAbs()); }
		else { fprintf(facc, " 0"); }
		//add2
		if (Global::b_add2) { accp = planet(Global::ID2); fprintf(facc, et_F, accp.getAbs()); }
		else { fprintf(facc, " 0"); }
		//add3
		if (Global::b_add3) { accp = planet(Global::ID3); fprintf(facc, et_F, accp.getAbs()); }
		else { fprintf(facc, " 0"); }
		//add4
		if (Global::b_add4) { accp = planet(Global::ID4); fprintf(facc, et_F, accp.getAbs()); }
		else { fprintf(facc, " 0"); }

		if (Global::b_add5) 
		{
			//add5's central gravity part 
			accp = planet(Global::ID5);
			// add5's non-central gravity part
			if (Global::b_add5_cun_on) {

				double pos[3], lt;
				spkgps_c(Global::IDC, time, "J2000", Global::ID5, pos, &lt);
				
				triple pos_CB(pos);
				triple Xbs = pos_CB + X;

				triple fs = Global::GravField_add5.getAcceleration(Global::ID5, time, Xbs);
				triple fcb = Global::GravField_add5.getAcceleration(Global::ID5, time, pos_CB);

				fprintf(facc, " %13.5e  %13.5e ", accp.getAbs(), (fs - fcb).getAbs());
			}
			else 
			{
				fprintf(facc, " %13.5e  0 ", accp.getAbs());
			}
		}
		else { fprintf(facc, " 0 0 "); }

		//SRP
		if (Global::b_SRP) {
			EFG.setpos(X);
			acc_SRP = EFG.getAcceleration(time);

			fprintf(facc, et_F, acc_SRP.getAbs());
		}
		else { fprintf(facc, " 0"); }

		//atmospheric drag
		if (Global::b_atm) {
			HIJ.setPos(X);
			HIJ.setVel(V);
			accA = HIJ.getAcc(time);

			fprintf(facc, et_F, accA.getAbs());
		}
		else { fprintf(facc, " 0"); }

		//General relativity effects (Swartsshild metric,PPN=1)
		if (Global::b_rel) { accp = relativ();  fprintf(facc, et_F, accp.getAbs()); }
		else { fprintf(facc, " 0"); }

		//General relativity effects (L-T precession, PPN=1)
		if (Global::b_rel_LT) { accp = L_T(); fprintf(facc, et_F, accp.getAbs()); }
		else { fprintf(facc, " 0"); }
		fprintf(facc, "\n");
	}
コード例 #4
0
 void SpicePosition::getpos(int body, double et, double *xyz) {spkgps_c (body, et, "ECLIPJ2000", 0, xyz, &m_lt);}