Exemple #1
0
Real CalculatedPoint::SetRealParameter(const Integer id,
                                       const Real value)
{
   if (id == EPOCH_PARAM)  // from SpacePoint
   {
      A1Mjd a1(value);
      GetMJ2000State(a1);
      return lastStateTime.Get();
   }

   return SpacePoint::SetRealParameter(id, value);
}
Exemple #2
0
Real BodyFixedPoint::SetRealParameter(const Integer id,
                                      const Real value)
{
   if (id == EPOCH_PARAM)  // from SpacePoint
   {
      A1Mjd a1(value);
      GetMJ2000State(a1);
      return lastStateTime.Get();
   }
   #ifdef DEBUG_BODYFIXED_SET_REAL
      MessageInterface::ShowMessage("Entering BFP::SetRealParameter with id = %d (%s) and value = %12.10f\n",
            id, (GetParameterText(id)).c_str(), value);
//      MessageInterface::ShowMessage("stateType = %s and horizon = %s\n",
//            stateType.c_str(), horizon.c_str());
   #endif
   if (((id == LOCATION_1) || (id == LOCATION_2)) && stateType == "Spherical")
   {
      // if Spherical statetype, then check if Latitude/Longitude are in the correct range
      if (id == LOCATION_1) // latitude
      {
         if ((value >= -90.0) && (value <= 90))
            location[id-LOCATION_1] = value * GmatMathConstants::RAD_PER_DEG;
         else
         {
            AssetException aException("");
            aException.SetDetails(errorMessageFormat.c_str(),
                        GmatStringUtil::ToString(value, 16).c_str(),
                        GetStringParameter(id-LOCATION_1+LOCATION_LABEL_1).c_str(), "Real Number >= -90.0 and <= 90.0");
            throw aException;
         }
      }
      else // longitude (0-360)
         location[id-LOCATION_1] = (GmatMathUtil::Mod(value,360)) * GmatMathConstants::RAD_PER_DEG;
      return location[id-LOCATION_1];
   }
   else if ((id >= LOCATION_1) && (id <= LOCATION_3)) // not Spherical
   {
      location[id-LOCATION_1] = value;
      return location[id-LOCATION_1];
   }

   return SpacePoint::SetRealParameter(id, value);
}
Exemple #3
0
//------------------------------------------------------------------------------
const Rvector3 SpaceObject::GetMJ2000Velocity(const A1Mjd &atTime)
{
   const Rvector6 rv6 = GetMJ2000State(atTime);
   return (rv6.GetV());
}
Exemple #4
0
//------------------------------------------------------------------------------
const Rvector3 SpaceObject::GetMJ2000Position(const A1Mjd &atTime)
{
   const Rvector6 rv6 = GetMJ2000State(atTime);
   return (rv6.GetR()); 
}
Exemple #5
0
//------------------------------------------------------------------------------
Real CalculatedPoint::SetEpoch(const Real ep)
{
   A1Mjd a1(ep);
   GetMJ2000State(a1);
   return lastStateTime.Get();
}
Exemple #6
0
//---------------------------------------------------------------------------
const Rvector3 Barycenter::GetMJ2000Velocity(const A1Mjd &atTime)
{
   Rvector6 tmp = GetMJ2000State(atTime);
   return (tmp.GetV());
}
Exemple #7
0
//---------------------------------------------------------------------------
const Rvector3 Barycenter::GetMJ2000Position(const A1Mjd &atTime)
{
   Rvector6 tmp = GetMJ2000State(atTime);
   return (tmp.GetR());
}
Exemple #8
0
//---------------------------------------------------------------------------
bool BodyFixedPoint::Initialize()
{
   // Initialize the body data
   if (!theBody)
   {
      if (!solarSystem)
         throw AssetException("Unable to initialize ground station " +
               instanceName + "; its solar system is not set\n");
      theBody = solarSystem->GetBody(cBodyName);
      if (!theBody)
      {
         throw AssetException("Unable to initialize ground station " +
               instanceName + "; its origin is not set\n");
      }
   }

   // Get required data from the body
   flattening            = theBody->GetRealParameter("Flattening");
   meanEquatorialRadius  = theBody->GetRealParameter("EquatorialRadius");

   // @todo: This should work, but doesn't.  It needs to be figured out
   //        eventually, I think.
   //
   //        One clue: When walking through this code in nemiver (Linux
   //        debugger), I saw a covariance matrix destructor being called,
   //        and did not expect that.  Maybe there is something around that
   //        piece...
   
   // set up local coordinate systems - delete the old ones if they have already been created
   //if (mj2kcs)   delete mj2kcs;
   //if (bfcs)     delete bfcs;
   if (!mj2kcs)
      mj2kcs  = CoordinateSystem::CreateLocalCoordinateSystem("mj2kcs", "MJ2000Eq", theBody,
                                                           NULL, NULL, theBody->GetJ2000Body(), solarSystem);
   if (!bfcs)
      bfcs    = CoordinateSystem::CreateLocalCoordinateSystem("bfcs", "BodyFixed", theBody,
                                                           NULL, NULL, theBody->GetJ2000Body(), solarSystem);

   // Calculate the body-fixed Cartesian position
   // If it was input in Cartesian, we're done
   UpdateBodyFixedLocation();

   #ifdef DEBUG_INIT
      MessageInterface::ShowMessage("...BodyFixedPoint %s Initialized!\n", instanceName.c_str());
   #endif

   #ifdef TEST_BODYFIXED_POINT
      MessageInterface::ShowMessage("For %s, %s %s location [%lf "
            "%lf %lf] --> XYZ [%lf %lf %lf]\n", instanceName.c_str(),
            stateType.c_str(), horizon.c_str(), location[0], location[1],
            location[2], bfLocation[0], bfLocation[1], bfLocation[2]);
      // Check the MJ2000 methods
      if (theBody == NULL)
      {
         MessageInterface::ShowMessage(
               "Error initializing ground station %s: theBody is not set\n",
               instanceName.c_str());
         return false;
      }
      if (bfcs == NULL)
      {
         MessageInterface::ShowMessage(
               "Error initializing ground station %s: bfcs is not set\n",
               instanceName.c_str());
         return false;
      }
      if (mj2kcs == NULL)
      {
         MessageInterface::ShowMessage(
               "Error initializing ground station %s: mj2kcs is not set\n",
               instanceName.c_str());
         return false;
      }

      Rvector6 j2kState = GetMJ2000State(GmatTimeConstants::MJD_OF_J2000);
      MessageInterface::ShowMessage("The resulting MJ2000 Cartesian state is "
            "\n   [%s]\n", j2kState.ToString(16).c_str());
   #endif
   return true;
}
Exemple #9
0
//------------------------------------------------------------------------------
const Rvector3 BodyFixedPoint::GetMJ2000Velocity(const A1Mjd &atTime)
{
   Rvector6 rv = GetMJ2000State(atTime);
   j2000Vel = rv.GetV();
   return j2000Vel;
}
Exemple #10
0
//------------------------------------------------------------------------------
const Rvector3 BodyFixedPoint::GetMJ2000Position(const A1Mjd &atTime)
{
   Rvector6 rv = GetMJ2000State(atTime);
   j2000Pos = rv.GetR();
   return j2000Pos;
}