AttitudePhysicalProperties.java

  1. /* Copyright 2022-2025 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. /** Spacecraft physical properties.
  24.  * <p>
  25.  * Beware that the Orekit getters and setters all rely on SI units. The parsers
  26.  * and writers take care of converting these SI units into CCSDS mandatory units.
  27.  * The {@link org.orekit.utils.units.Unit Unit} class provides useful
  28.  * {@link org.orekit.utils.units.Unit#fromSI(double) fromSi} and
  29.  * {@link org.orekit.utils.units.Unit#toSI(double) toSI} methods in case the callers
  30.  * already use CCSDS units instead of the API SI units. The general-purpose
  31.  * {@link org.orekit.utils.units.Unit Unit} class (without an 's') and the
  32.  * CCSDS-specific {@link org.orekit.files.ccsds.definitions.Units Units} class
  33.  * (with an 's') also provide some predefined units. These predefined units and the
  34.  * {@link org.orekit.utils.units.Unit#fromSI(double) fromSi} and
  35.  * {@link org.orekit.utils.units.Unit#toSI(double) toSI} conversion methods are indeed
  36.  * what the parsers and writers use for the conversions.
  37.  * </p>
  38.  * @author Luc Maisonobe
  39.  * @since 12.0
  40.  */
  41. public class AttitudePhysicalProperties extends CommentsContainer {

  42.     /** Drag coefficient. */
  43.     private double dragCoefficient;

  44.     /** Total mass at T₀. */
  45.     private double wetMass;

  46.     /** Mass without propellant. */
  47.     private double dryMass;

  48.     /** Reference frame for center of pressure. */
  49.     private FrameFacade centerOfPressureReferenceFrame;

  50.     /** Location of center of pressure. */
  51.     private Vector3D centerOfPressure;

  52.     /** Reference frame for inertia. */
  53.     private FrameFacade inertiaReferenceFrame;

  54.     /** Inertia matrix. */
  55.     private final RealMatrix inertiaMatrix;

  56.     /**
  57.      * Simple constructor.
  58.      */
  59.     public AttitudePhysicalProperties() {
  60.         dragCoefficient = Double.NaN;
  61.         wetMass         = Double.NaN;
  62.         dryMass         = Double.NaN;
  63.         inertiaMatrix   = MatrixUtils.createRealMatrix(3, 3);
  64.     }

  65.     /** {@inheritDoc} */
  66.     @Override
  67.     public void validate(final double version) {
  68.         super.validate(version);
  69.         if (centerOfPressureReferenceFrame != null) {
  70.             checkNotNull(centerOfPressure, AttitudePhysicalPropertiesKey.CP.name());
  71.         }
  72.     }

  73.     /** Get the drag coefficient.
  74.      * @return the drag coefficient
  75.      */
  76.     public double getDragCoefficient() {
  77.         return dragCoefficient;
  78.     }

  79.     /** Set the the drag coefficient.
  80.      * @param dragCoefficient the drag coefficient
  81.      */
  82.     public void setDragCoefficient(final double dragCoefficient) {
  83.         refuseFurtherComments();
  84.         this.dragCoefficient = dragCoefficient;
  85.     }

  86.     /** Get the total mass at T₀.
  87.      * @return total mass at T₀
  88.      */
  89.     public double getWetMass() {
  90.         return wetMass;
  91.     }

  92.     /** Set the total mass at T₀.
  93.      * @param wetMass total mass at T₀
  94.      */
  95.     public void setWetMass(final double wetMass) {
  96.         refuseFurtherComments();
  97.         this.wetMass = wetMass;
  98.     }

  99.     /** Get the mass without propellant.
  100.      * @return mass without propellant
  101.      */
  102.     public double getDryMass() {
  103.         return dryMass;
  104.     }

  105.     /** Set the mass without propellant.
  106.      * @param dryMass mass without propellant
  107.      */
  108.     public void setDryMass(final double dryMass) {
  109.         refuseFurtherComments();
  110.         this.dryMass = dryMass;
  111.     }

  112.     /** Get reference frame for center of pressure.
  113.      * @return reference frame for center of pressure
  114.      */
  115.     public FrameFacade getCenterOfPressureReferenceFrame() {
  116.         return centerOfPressureReferenceFrame;
  117.     }

  118.     /** Set reference frame for center of pressure.
  119.      * @param centerOfPressureReferenceFrame reference frame for center of pressure
  120.      */
  121.     public void setCenterOfPressureReferenceFrame(final FrameFacade centerOfPressureReferenceFrame) {
  122.         this.centerOfPressureReferenceFrame = centerOfPressureReferenceFrame;
  123.     }

  124.     /** Get the location of center of pressure.
  125.      * @return location of center of pressure
  126.      */
  127.     public Vector3D getCenterOfPressure() {
  128.         return centerOfPressure;
  129.     }

  130.     /** Set the location of center of pressure.
  131.      * @param centerOfPressure location of center of pressure
  132.      */
  133.     public void setCenterOfPressure(final Vector3D centerOfPressure) {
  134.         this.centerOfPressure = centerOfPressure;
  135.     }

  136.     /** Get reference frame for inertia.
  137.      * @return reference frame for inertia
  138.      */
  139.     public FrameFacade getInertiaReferenceFrame() {
  140.         return inertiaReferenceFrame;
  141.     }

  142.     /** Set reference frame for inertia.
  143.      * @param inertiaReferenceFrame reference frame for inertia
  144.      */
  145.     public void setInertiaReferenceFrame(final FrameFacade inertiaReferenceFrame) {
  146.         this.inertiaReferenceFrame = inertiaReferenceFrame;
  147.     }

  148.     /** Get the inertia matrix.
  149.      * @return the inertia matrix
  150.      */
  151.     public RealMatrix getInertiaMatrix() {
  152.         return inertiaMatrix;
  153.     }

  154.     /** Set an entry in the inertia matrix.
  155.      * <p>
  156.      * Both I(j, k) and I(k, j) are set.
  157.      * </p>
  158.      * @param j row index (must be between 0 and 3 (inclusive)
  159.      * @param k column index (must be between 0 and 3 (inclusive)
  160.      * @param entry value of the matrix entry
  161.      */
  162.     public void setInertiaMatrixEntry(final int j, final int k, final double entry) {
  163.         refuseFurtherComments();
  164.         inertiaMatrix.setEntry(j, k, entry);
  165.         inertiaMatrix.setEntry(k, j, entry);
  166.     }

  167. }