Example #1
0
 def test_check_pos_vel_transformation(self):
     r = np.array([1e6, -2.03, -3.0])
     v = np.array([2.0e3, 2.8, -73.2])
     self.assertTrue(
         np.allclose(fr.ecif2orbit(r, v, r),
                     [0., 0., -1 * np.linalg.norm(r)]))
     self.assertTrue(
         np.allclose(fr.ecif2orbit(r, v, np.cross(v, r)),
                     [0., np.linalg.norm(np.cross(v, r)), 0.]))
Example #2
0
    def test_e2o_matrix_orthogonality(self, value):
        r = np.asarray(value[0:3])
        v = np.asarray(value[3:6])
        v_x = fr.ecif2orbit(r, v, np.array([1.0, 0.0, 0.0]))
        v_y = fr.ecif2orbit(r, v, np.array([0.0, 1.0, 0.0]))
        v_z = fr.ecif2orbit(r, v, np.array([0.0, 0.0, 1.0]))
        self.assertEqual(type(v_z), np.ndarray)

        m = np.array([v_x, v_y, v_z])
        mT = m.transpose()
        I = np.dot(m, mT)
        self.assertTrue(np.allclose(I[0, :], [1., 0., 0.]))
        self.assertTrue(np.allclose(I[1, :], [0., 1., 0.]))
        self.assertTrue(np.allclose(I[2, :], [0., 0., 1.]))
Example #3
0
	def getSun_o(self):	#get sun vector in orbit
		v_sun_o = fs.ecif2orbit(self.v_pos_i,self.v_vel_i,self.v_sun_i)
		return	v_sun_o
Example #4
0
	def getMag_o(self):	#return mag in orbit
		v_mag_o = fs.ecif2orbit(self.v_pos_i,self.v_vel_i,self.v_mag_i)
		return	v_mag_o
Sat4.setMag_i(arr3)
mag_i=Sat4.getMag_i()
if (mag_i==arr3).all():
	print ("setMag_i and getMag_i correct")
else:
	print ("setMag_i and getMag_i incorrect")

#Case 1 velocity and position are integer

Sat4.setPos(arr1)
v_Pos_i=Sat4.getPos()
Sat4.setVel(arr2)
v_vel_i=Sat4.getVel()

a=Sat4.getSun_o()
b=fs.ecif2orbit(v_Pos_i,v_vel_i,w)
if (a==b).all():
	print ("getSun_o correct")
else:
	print ("getSun_o incorrect")

#Case 2 velocity integer and position float

Sat4.setPos(arr3)
v_Pos_i=Sat4.getPos()
Sat4.setVel(arr2)
v_vel_i=Sat4.getVel()

a=Sat4.getSun_o()
b=fs.ecif2orbit(v_Pos_i,v_vel_i,w)
if (a==b).all():
Example #6
0
    Rz = np.array([[math.cos(z), math.sin(-z), 0.0],
                   [math.sin(z), math.cos(z), 0.0], [0.0, 0.0, 1.0]])
    R_orbit2body = Rx.dot(Ry).dot(Rz)

    for i in range(N):
        #setting time
        advitiy.setTime(T[i])
        dt = T[1] - T[0]
        #getting light, sun vector, position, velocity from csv files
        light = light_output[i, 1]
        v_sun_i = si_output[i, 1:4].copy()
        v_pos_i = sgp_output[i, 1:4].copy()
        v_vel_i = sgp_output[i, 4:7].copy()

        #calculating sun vector body and orbit frame
        v_sun_o = f.ecif2orbit(v_pos_i, v_vel_i, v_sun_i)
        v_sun_b = R_orbit2body.dot(v_sun_o)

        #setting attributes to satellite
        advitiy.setPos(v_pos_i)
        advitiy.setVel(v_vel_i)
        advitiy.setSun_i(v_sun_i)
        #advitiy.setSun_o(v_sun_o)
        advitiy.setSun_b_m(v_sun_b)
        advitiy.setLight(light)

        power_arr = pow.power(advitiy)
        #energy=energy+power_arr[6]*dt
        energy_output[j, 0] = j
        energy_output[j, 1] = energy_output[
            j, 1] + power_arr[0] * dt  #for each side:x,-x,y,-y,z,-z
Example #7
0
 def getSatMag_o(self):  #return mag in orbit
     v_sat_mag_o = fs.ecif2orbit(self.J2Data[0:3], self.J2Data[3:6],
                                 self.v_mag_i)
     return v_sat_mag_o
Example #8
0
 def getSatSun_o(self):  #get sun vector in orbit
     v_sat_sun_o = fs.ecif2orbit(self.J2Data[0:3], self.J2Data[3:6],
                                 self.v_sun_i)
     return v_sat_sun_o