RHSCMG:

Path: SCPro/DynamicalModels

% Spacecraft attitude and orbit dynamics with a disturbance function.
 This is a rigid body with single axis CMGs.
 It has an external force and torque input.
 The torque are constant across the integration time step.

 The function fDist (which should be a pointer) is of the form

   torque = MyFun( x, t, d )

 d can contain additional parameters for the model

 You can add additional fields to d. torque in Nm in the body frame. 
 This function allows you to add torques within the integration loop. 
 This is required for  torques that are functions of time or the
 state vector.
--------------------------------------------------------------------------
   Form:
   [xDot,inr,hECI] = RHSCMG( x, t, d )
--------------------------------------------------------------------------

   -------
   Inputs
   -------
   x    	(:,1)	State vector [q;phi;w;omegaG;omegaW] 
   t   	(1,1)	Time  (s)
   d   	(1,1)	Data structure for the simulation
                   .torque   (3,1)     External torque (Nm)
                   .force    (3,1)     External force (N)
                   .inr0     (3,3)     Core inertia (kg-m^2)
                   .inrG     {3}(3,3)	Gimbal inertia (kg-m^2)
                   .inrW     {3}(3,3)  Wheelinertia (kg-m^2)
                   .torqueG  (1,:)     Gimbal torque (Nm)
                   .torqueW  (1,:)     Wheel torque (Nm)
                   .fDist    (1,:)     Disturbance function pointer
                   .x0       (15,1)    Default data structure with 3 CMGs
                   .states   {15}      Corresponding state names

   -------
   Outputs
   -------
   xDot	(:,1) d[q;phi;w;omegaG;omegaW]/dt
   inr   (:,:) The generalized inertia matrix
   hECI  (3,:) The ECI momentum

--------------------------------------------------------------------------

Children:

AerospaceUtils: Coord/QIToBDot
Common: Control/C2DZOH
Common: Quaternion/QTForm
Math: Linear/Cross
Math: Linear/SkewSymm

Back to the SCPro Module page