Skip to content

Commit

Permalink
Magnetic Field simplification
Browse files Browse the repository at this point in the history
  • Loading branch information
leocelente committed Jul 14, 2021
1 parent b7f39e9 commit dea9816
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Satellite.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,14 @@ def Model(t: float, state: list[float]):
# Convert NED (North East Down to X,Y,Z in ECI frame)
# First we need to create a rotation matrix from the NED frame to the
# inertial frame
BNED = np.matrix([BNED.north, BNED.east, BNED.down]) # ECI
BI = DCM.fromEulerAngle(euler=np.matrix(
[phiE, thetaE+pi, psiE]).T) * BNED # Satellite Orbit
Model.BB = DCM.fromQuaternion(q0123).T * BI # Satellite Body
BNED = np.array([BNED.north, BNED.east, BNED.down], dtype=float)
assert(BNED.shape == (3, 1))
pos_angles = np.array([[phiE, thetaE+pi, psiE]], dtype=float).T
assert(pos_angles.shape == (3, 1))
BI = DCM.fromEulerAngle(pos_angles) @ BNED
assert(BI.shape == (3, 1))
Model.BB = DCM.fromQuaternion(q0123).T @ BI
assert(Model.BB.shape == (3, 1))
# Convert to Tesla
Model.BB = Model.BB*1e-9

Expand Down

0 comments on commit dea9816

Please sign in to comment.