AttitudePhysicalProperties.java

  1. /* Copyright 2002-2024 Luc Maisonobe
  2.  * Licensed to CS GROUP (CS) under one or more
  3.  * contributor license agreements.  See the NOTICE file distributed with
  4.  * this work for additional information regarding copyright ownership.
  5.  * CS licenses this file to You under the Apache License, Version 2.0
  6.  * (the "License"); you may not use this file except in compliance with
  7.  * the License.  You may obtain a copy of the License at
  8.  *
  9.  *   http://www.apache.org/licenses/LICENSE-2.0
  10.  *
  11.  * Unless required by applicable law or agreed to in writing, software
  12.  * distributed under the License is distributed on an "AS IS" BASIS,
  13.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.  * See the License for the specific language governing permissions and
  15.  * limitations under the License.
  16.  */

  17. package org.orekit.files.ccsds.ndm.adm.acm;

  18. import org.hipparchus.geometry.euclidean.threed.Vector3D;
  19. import org.hipparchus.linear.MatrixUtils;
  20. import org.hipparchus.linear.RealMatrix;
  21. import org.orekit.files.ccsds.definitions.FrameFacade;
  22. import org.orekit.files.ccsds.section.CommentsContainer;
  23. import org.orekit.time.AbsoluteDate;

  24. /** Spacecraft physical properties.
  25.  * @author Luc Maisonobe
  26.  * @since 12.0
  27.  */
  28. public class AttitudePhysicalProperties extends CommentsContainer {

  29.     /** Drag coefficient. */
  30.     private double dragCoefficient;

  31.     /** Total mass at T₀. */
  32.     private double wetMass;

  33.     /** Mass without propellant. */
  34.     private double dryMass;

  35.     /** Reference frame for center of pressure. */
  36.     private FrameFacade centerOfPressureReferenceFrame;

  37.     /** Location of center of pressure. */
  38.     private Vector3D centerOfPressure;

  39.     /** Reference frame for inertia. */
  40.     private FrameFacade inertiaReferenceFrame;

  41.     /** Inertia matrix. */
  42.     private RealMatrix inertiaMatrix;

  43.     /** Simple constructor.
  44.      * @param epochT0 T0 epoch from file metadata
  45.      */
  46.     public AttitudePhysicalProperties(final AbsoluteDate epochT0) {
  47.         dragCoefficient = Double.NaN;
  48.         wetMass         = Double.NaN;
  49.         dryMass         = Double.NaN;
  50.         inertiaMatrix   = MatrixUtils.createRealMatrix(3, 3);
  51.     }

  52.     /** {@inheritDoc} */
  53.     @Override
  54.     public void validate(final double version) {
  55.         super.validate(version);
  56.         if (centerOfPressureReferenceFrame != null) {
  57.             checkNotNull(centerOfPressure, AttitudePhysicalPropertiesKey.CP.name());
  58.         }
  59.     }

  60.     /** Get the drag coefficient.
  61.      * @return the drag coefficient
  62.      */
  63.     public double getDragCoefficient() {
  64.         return dragCoefficient;
  65.     }

  66.     /** Set the the drag coefficient.
  67.      * @param dragCoefficient the drag coefficient
  68.      */
  69.     public void setDragCoefficient(final double dragCoefficient) {
  70.         refuseFurtherComments();
  71.         this.dragCoefficient = dragCoefficient;
  72.     }

  73.     /** Get the total mass at T₀.
  74.      * @return total mass at T₀
  75.      */
  76.     public double getWetMass() {
  77.         return wetMass;
  78.     }

  79.     /** Set the total mass at T₀.
  80.      * @param wetMass total mass at T₀
  81.      */
  82.     public void setWetMass(final double wetMass) {
  83.         refuseFurtherComments();
  84.         this.wetMass = wetMass;
  85.     }

  86.     /** Get the mass without propellant.
  87.      * @return mass without propellant
  88.      */
  89.     public double getDryMass() {
  90.         return dryMass;
  91.     }

  92.     /** Set the mass without propellant.
  93.      * @param dryMass mass without propellant
  94.      */
  95.     public void setDryMass(final double dryMass) {
  96.         refuseFurtherComments();
  97.         this.dryMass = dryMass;
  98.     }

  99.     /** Get reference frame for center of pressure.
  100.      * @return reference frame for center of pressure
  101.      */
  102.     public FrameFacade getCenterOfPressureReferenceFrame() {
  103.         return centerOfPressureReferenceFrame;
  104.     }

  105.     /** Set reference frame for center of pressure.
  106.      * @param centerOfPressureReferenceFrame reference frame for center of pressure
  107.      */
  108.     public void setCenterOfPressureReferenceFrame(final FrameFacade centerOfPressureReferenceFrame) {
  109.         this.centerOfPressureReferenceFrame = centerOfPressureReferenceFrame;
  110.     }

  111.     /** Get the location of center of pressure.
  112.      * @return location of center of pressure
  113.      */
  114.     public Vector3D getCenterOfPressure() {
  115.         return centerOfPressure;
  116.     }

  117.     /** Set the location of center of pressure.
  118.      * @param centerOfPressure location of center of pressure
  119.      */
  120.     public void setCenterOfPressure(final Vector3D centerOfPressure) {
  121.         this.centerOfPressure = centerOfPressure;
  122.     }

  123.     /** Get reference frame for inertia.
  124.      * @return reference frame for inertia
  125.      */
  126.     public FrameFacade getInertiaReferenceFrame() {
  127.         return inertiaReferenceFrame;
  128.     }

  129.     /** Set reference frame for inertia.
  130.      * @param inertiaReferenceFrame reference frame for inertia
  131.      */
  132.     public void setInertiaReferenceFrame(final FrameFacade inertiaReferenceFrame) {
  133.         this.inertiaReferenceFrame = inertiaReferenceFrame;
  134.     }

  135.     /** Get the inertia matrix.
  136.      * @return the inertia matrix
  137.      */
  138.     public RealMatrix getInertiaMatrix() {
  139.         return inertiaMatrix;
  140.     }

  141.     /** Set an entry in the inertia matrix.
  142.      * <p>
  143.      * Both I(j, k) and I(k, j) are set.
  144.      * </p>
  145.      * @param j row index (must be between 0 and 3 (inclusive)
  146.      * @param k column index (must be between 0 and 3 (inclusive)
  147.      * @param entry value of the matrix entry
  148.      */
  149.     public void setInertiaMatrixEntry(final int j, final int k, final double entry) {
  150.         refuseFurtherComments();
  151.         inertiaMatrix.setEntry(j, k, entry);
  152.         inertiaMatrix.setEntry(k, j, entry);
  153.     }

  154. }