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 18 package org.orekit.files.ccsds.ndm.adm.acm; 19 20 import org.hipparchus.geometry.euclidean.threed.Vector3D; 21 import org.hipparchus.linear.MatrixUtils; 22 import org.hipparchus.linear.RealMatrix; 23 import org.orekit.files.ccsds.definitions.FrameFacade; 24 import org.orekit.files.ccsds.section.CommentsContainer; 25 26 /** Spacecraft physical properties. 27 * <p> 28 * Beware that the Orekit getters and setters all rely on SI units. The parsers 29 * and writers take care of converting these SI units into CCSDS mandatory units. 30 * The {@link org.orekit.utils.units.Unit Unit} class provides useful 31 * {@link org.orekit.utils.units.Unit#fromSI(double) fromSi} and 32 * {@link org.orekit.utils.units.Unit#toSI(double) toSI} methods in case the callers 33 * already use CCSDS units instead of the API SI units. The general-purpose 34 * {@link org.orekit.utils.units.Unit Unit} class (without an 's') and the 35 * CCSDS-specific {@link org.orekit.files.ccsds.definitions.Units Units} class 36 * (with an 's') also provide some predefined units. These predefined units and the 37 * {@link org.orekit.utils.units.Unit#fromSI(double) fromSi} and 38 * {@link org.orekit.utils.units.Unit#toSI(double) toSI} conversion methods are indeed 39 * what the parsers and writers use for the conversions. 40 * </p> 41 * @author Luc Maisonobe 42 * @since 12.0 43 */ 44 public class AttitudePhysicalProperties extends CommentsContainer { 45 46 /** Drag coefficient. */ 47 private double dragCoefficient; 48 49 /** Total mass at T₀. */ 50 private double wetMass; 51 52 /** Mass without propellant. */ 53 private double dryMass; 54 55 /** Reference frame for center of pressure. */ 56 private FrameFacade centerOfPressureReferenceFrame; 57 58 /** Location of center of pressure. */ 59 private Vector3D centerOfPressure; 60 61 /** Reference frame for inertia. */ 62 private FrameFacade inertiaReferenceFrame; 63 64 /** Inertia matrix. */ 65 private final RealMatrix inertiaMatrix; 66 67 /** 68 * Simple constructor. 69 */ 70 public AttitudePhysicalProperties() { 71 dragCoefficient = Double.NaN; 72 wetMass = Double.NaN; 73 dryMass = Double.NaN; 74 inertiaMatrix = MatrixUtils.createRealMatrix(3, 3); 75 } 76 77 /** {@inheritDoc} */ 78 @Override 79 public void validate(final double version) { 80 super.validate(version); 81 if (centerOfPressureReferenceFrame != null) { 82 checkNotNull(centerOfPressure, AttitudePhysicalPropertiesKey.CP.name()); 83 } 84 } 85 86 /** Get the drag coefficient. 87 * @return the drag coefficient 88 */ 89 public double getDragCoefficient() { 90 return dragCoefficient; 91 } 92 93 /** Set the the drag coefficient. 94 * @param dragCoefficient the drag coefficient 95 */ 96 public void setDragCoefficient(final double dragCoefficient) { 97 refuseFurtherComments(); 98 this.dragCoefficient = dragCoefficient; 99 } 100 101 /** Get the total mass at T₀. 102 * @return total mass at T₀ 103 */ 104 public double getWetMass() { 105 return wetMass; 106 } 107 108 /** Set the total mass at T₀. 109 * @param wetMass total mass at T₀ 110 */ 111 public void setWetMass(final double wetMass) { 112 refuseFurtherComments(); 113 this.wetMass = wetMass; 114 } 115 116 /** Get the mass without propellant. 117 * @return mass without propellant 118 */ 119 public double getDryMass() { 120 return dryMass; 121 } 122 123 /** Set the mass without propellant. 124 * @param dryMass mass without propellant 125 */ 126 public void setDryMass(final double dryMass) { 127 refuseFurtherComments(); 128 this.dryMass = dryMass; 129 } 130 131 /** Get reference frame for center of pressure. 132 * @return reference frame for center of pressure 133 */ 134 public FrameFacade getCenterOfPressureReferenceFrame() { 135 return centerOfPressureReferenceFrame; 136 } 137 138 /** Set reference frame for center of pressure. 139 * @param centerOfPressureReferenceFrame reference frame for center of pressure 140 */ 141 public void setCenterOfPressureReferenceFrame(final FrameFacade centerOfPressureReferenceFrame) { 142 this.centerOfPressureReferenceFrame = centerOfPressureReferenceFrame; 143 } 144 145 /** Get the location of center of pressure. 146 * @return location of center of pressure 147 */ 148 public Vector3D getCenterOfPressure() { 149 return centerOfPressure; 150 } 151 152 /** Set the location of center of pressure. 153 * @param centerOfPressure location of center of pressure 154 */ 155 public void setCenterOfPressure(final Vector3D centerOfPressure) { 156 this.centerOfPressure = centerOfPressure; 157 } 158 159 /** Get reference frame for inertia. 160 * @return reference frame for inertia 161 */ 162 public FrameFacade getInertiaReferenceFrame() { 163 return inertiaReferenceFrame; 164 } 165 166 /** Set reference frame for inertia. 167 * @param inertiaReferenceFrame reference frame for inertia 168 */ 169 public void setInertiaReferenceFrame(final FrameFacade inertiaReferenceFrame) { 170 this.inertiaReferenceFrame = inertiaReferenceFrame; 171 } 172 173 /** Get the inertia matrix. 174 * @return the inertia matrix 175 */ 176 public RealMatrix getInertiaMatrix() { 177 return inertiaMatrix; 178 } 179 180 /** Set an entry in the inertia matrix. 181 * <p> 182 * Both I(j, k) and I(k, j) are set. 183 * </p> 184 * @param j row index (must be between 0 and 3 (inclusive) 185 * @param k column index (must be between 0 and 3 (inclusive) 186 * @param entry value of the matrix entry 187 */ 188 public void setInertiaMatrixEntry(final int j, final int k, final double entry) { 189 refuseFurtherComments(); 190 inertiaMatrix.setEntry(j, k, entry); 191 inertiaMatrix.setEntry(k, j, entry); 192 } 193 194 }