public class MagneticCoilTorque extends TorqueModel
PropagationEulerianAxes
.Modifier | Constructor and Description |
---|---|
|
MagneticCoilTorque()
Initializes the magnetic coil torque model.
|
protected |
MagneticCoilTorque(MagneticCoilTorque existingInstance,
CopyContext context)
Initializes a new instance as a copy of an existing instance.
|
|
MagneticCoilTorque(Vector magneticFieldVector,
double numberOfLoops,
Scalar current,
Cartesian directedArea,
Axes bodyAxes)
Initializes the magnetic coil torque model.
|
|
MagneticCoilTorque(Vector magneticFieldVector,
double numberOfLoops,
Scalar current,
Vector directedArea,
Axes bodyAxes)
Initializes the magnetic coil torque model.
|
Modifier and Type | Method and Description |
---|---|
void |
buildTorqueEvaluator(ResultantTorqueBuilder builder,
EvaluatorGroup group)
Build lists of torques based on this model in order to create
an overall resultant torque.
|
protected boolean |
checkForSameDefinition(MagneticCoilTorque other)
Checks to determine if another instance has the same definition as this instance and
returns
true if it does. |
protected boolean |
checkForSameDefinition(TorqueModel other)
Checks to determine if another instance has the same definition as this instance and
returns
true if it does. |
Object |
clone(CopyContext context)
Clones this object using the specified context.
|
protected int |
computeCurrentDefinitionHashCode()
Computes a hash code based on the current properties of this object.
|
static MagneticCoilTorque |
createMagneticCoilTorqueUsingIgrfCofModel(String filename,
Point bodyCenterOfMass,
double numberOfLoops,
Scalar current,
Vector directedArea,
Axes bodyAxes)
Creates a new magnetic coil torque that uses an
InternationalGeomagneticReferenceFieldVector
to describe the magnetic field and a Point to describe
the position of the spacecraft. |
static MagneticCoilTorque |
createMagneticCoilTorqueUsingIgrfTxtModel(String filename,
Point bodyCenterOfMass,
double numberOfLoops,
Scalar current,
Vector directedArea,
Axes bodyAxes)
Creates a new magnetic coil torque that uses an
InternationalGeomagneticReferenceFieldVector
to describe the magnetic field and a Point to describe
the position of the spacecraft. |
static MagneticCoilTorque |
createMagneticCoilTorqueUsingWmmModel(String filename,
Point bodyCenterOfMass,
double numberOfLoops,
Scalar current,
Vector directedArea,
Axes bodyAxes)
Creates a new magnetic coil torque that uses a
WorldMagneticModelVector
to describe the magnetic field and a Point to describe
the position of the spacecraft. |
void |
enumerateDependencies(DependencyEnumerator enumerator)
Enumerates the dependencies of this object by calling
DependencyEnumerator#enumerate(T) for each object that this object directly depends upon. |
Axes |
getBodyAxes()
Gets the body axes of the spacecraft.
|
Scalar |
getCurrent()
Gets the electric current passing through the coil.
|
Vector |
getDirectedArea()
Gets the area of the coil multiplied by the unit vector that is normal
to the plane of the coil such that a positive current traveling through the coil
obeys the right hand rule.
|
Vector |
getMagneticFieldVector()
Gets a vector describing the magnetic field that the coil
is subjected to.
|
double |
getNumberOfLoops()
Gets the number of current loops in the magnetic torquer coil.
|
TorqueEvaluator |
getTorqueEvaluator(EvaluatorGroup group)
Gets an instance of an evaluator that can compute the torque.
|
void |
setBodyAxes(Axes value)
Sets the body axes of the spacecraft.
|
void |
setCurrent(Scalar value)
Sets the electric current passing through the coil.
|
void |
setDirectedArea(Vector value)
Sets the area of the coil multiplied by the unit vector that is normal
to the plane of the coil such that a positive current traveling through the coil
obeys the right hand rule.
|
void |
setMagneticFieldVector(Vector value)
Sets a vector describing the magnetic field that the coil
is subjected to.
|
void |
setNumberOfLoops(double value)
Sets the number of current loops in the magnetic torquer coil.
|
checkForSameDefinition, freezeAggregatedObjects, getTorqueEvaluator, getTorqueVector
areSameDefinition, areSameDefinition, areSameDefinition, areSameDefinition, areSameDefinition, collectionItemsAreSameDefinition, collectionItemsAreSameDefinition, collectionItemsAreSameDefinition, dictionaryItemsAreSameDefinition, freeze, getCollectionHashCode, getCollectionHashCode, getCollectionHashCode, getDefinitionHashCode, getDefinitionHashCode, getDefinitionHashCode, getDefinitionHashCode, getDefinitionHashCode, getDefinitionHashCode, getDictionaryHashCode, getIsFrozen, isSameDefinition, throwIfFrozen
public MagneticCoilTorque()
public MagneticCoilTorque(Vector magneticFieldVector, double numberOfLoops, Scalar current, @Nonnull Cartesian directedArea, Axes bodyAxes)
magneticFieldVector
- A vector describing the magnetic field that the coil
is subjected to. This is usually a MagneticFieldVector
(get
/ set
).numberOfLoops
- The number of current loops in the magnetic torquer coil.current
- The electric current passing through the coil.directedArea
- The area of the coil multiplied by the unit vector that is normal
to the plane of the coil such that a positive current traveling through the coil
obeys the right hand rule. In this constructor, the Cartesian value is converted into
a VectorFixed
in the bodyAxes
.bodyAxes
- The body axes of the spacecraft. These should be the
IntegrationAxes
(get
)
of the PropagationEulerianAxes
associated with the spacecraft.public MagneticCoilTorque(Vector magneticFieldVector, double numberOfLoops, Scalar current, Vector directedArea, Axes bodyAxes)
magneticFieldVector
- A vector describing the magnetic field that the coil
is subjected to. This is usually a MagneticFieldVector
(get
/ set
).numberOfLoops
- The number of current loops in the magnetic torquer coil.current
- The electric current passing through the coil.directedArea
- The area of the coil multiplied by the unit vector that is normal
to the plane of the coil such that a positive current traveling through the coil
obeys the right hand rule.bodyAxes
- The body axes of the spacecraft. These should be the
IntegrationAxes
(get
)
of the PropagationEulerianAxes
associated with the spacecraft.protected MagneticCoilTorque(MagneticCoilTorque existingInstance, CopyContext context)
See ICloneWithContext.clone(CopyContext)
for more information about how to implement this constructor
in a derived class.
existingInstance
- The existing instance to copy.context
- A CopyContext
that controls the depth of the copy.ArgumentNullException
- Thrown when existingInstance
or context
is null
.public Object clone(CopyContext context)
This method should be implemented to call a copy constructor on the class of the
object being cloned. The copy constructor should take the CopyContext
as a parameter
in addition to the existing instance to copy. The copy constructor should first call
CopyContext.addObjectMapping(T, T)
to identify the newly constructed instance
as a copy of the existing instance. It should then copy all fields, using
CopyContext.updateReference(T)
to copy any reference fields.
A typical implementation of ICloneWithContext
:
public static class MyClass implements ICloneWithContext {
public MyClass(MyClass existingInstance, CopyContext context) {
context.addObjectMapping(existingInstance, this);
someReference = context.updateReference(existingInstance.someReference);
}
@Override
public final Object clone(CopyContext context) {
return new MyClass(this, context);
}
private Object someReference;
}
In general, all fields that are reference types should be copied with a call to
CopyContext.updateReference(T)
. There are a couple of exceptions:
If one of these exceptions applies, the CopyContext
should be given an opportunity
to update the reference before the reference is copied explicitly. Use
CopyContext.updateReference(T)
to update the reference. If CopyContext.updateReference(T)
returns
the original object, indicating that the context does not have a replacement registered,
then copy the object manually by invoking a Clone method, a copy constructor, or by manually
constructing a new instance and copying the values.
alwaysCopy = context.updateReference(existingInstance.alwaysCopy);
if (existingInstance.alwaysCopy != null && alwaysCopy == existingInstance.alwaysCopy) {
alwaysCopy = (AlwaysCopy) existingInstance.alwaysCopy.clone(context);
}
If you are implementing an evaluator (a class that implements IEvaluator
), the
IEvaluator.updateEvaluatorReferences(agi.foundation.infrastructure.CopyContext)
method shares some responsibilities with the
copy context constructor. Code duplication can be avoided by doing the following:
CopyContext.updateReference(T)
. You should still call CopyContext.updateReference(T)
on any references to
non-evaluators.
IEvaluator.updateEvaluatorReferences(agi.foundation.infrastructure.CopyContext)
as the last line in the constructor and pass it the
same CopyContext
passed to the constructor.
IEvaluator.updateEvaluatorReferences(agi.foundation.infrastructure.CopyContext)
as normal. See the reference documentation for
IEvaluator.updateEvaluatorReferences(agi.foundation.infrastructure.CopyContext)
for more information on implementing that method.
public MyClass(MyClass existingInstance, CopyContext context) {
super(existingInstance, context);
someReference = context.updateReference(existingInstance.someReference);
evaluatorReference = existingInstance.evaluatorReference;
updateEvaluatorReferences(context);
}
@Override
public void updateEvaluatorReferences(CopyContext context) {
evaluatorReference = context.updateReference(evaluatorReference);
}
@Override
public Object clone(CopyContext context) {
return new MyClass(this, context);
}
private Object someReference;
private IEvaluator evaluatorReference;
clone
in interface ICloneWithContext
clone
in class DefinitionalObject
context
- The context to use to perform the copy.protected final boolean checkForSameDefinition(TorqueModel other)
true
if it does. Derived classes MUST override this method and check
all new fields introduced by the derived class for definitional equivalence. It is NOT necessary
to check base class fields because the base class will already have done that. When overriding this method,
you should NOT call the base implementation because it will return false
for all derived-class instances.
Derived classes should check the type of other
to preserve the symmetric nature of IEquatableDefinition.isSameDefinition(java.lang.Object)
.checkForSameDefinition
in class TorqueModel
other
- The other instance to compare to this one.true
if the two objects are defined equivalently; otherwise false
.protected boolean checkForSameDefinition(MagneticCoilTorque other)
true
if it does. Derived classes MUST override this method and check
all new fields introduced by the derived class for definitional equivalence. It is NOT necessary
to check base class fields because the base class will already have done that. When overriding this method,
you should NOT call the base implementation because it will return false
for all derived-class instances.
Derived classes should check the type of other
to preserve the symmetric nature of IEquatableDefinition.isSameDefinition(java.lang.Object)
.other
- The other instance to compare to this one.true
if the two objects are defined equivalently; otherwise false
.protected int computeCurrentDefinitionHashCode()
MagneticCoilTorque.checkForSameDefinition(agi.foundation.celestial.TorqueModel)
method.computeCurrentDefinitionHashCode
in class TorqueModel
public void enumerateDependencies(DependencyEnumerator enumerator)
DependencyEnumerator#enumerate(T)
for each object that this object directly depends upon.
Derived classes which contain additional dependencies MUST override this method, call the base
implementation, and enumerate dependencies introduced by the derived class.enumerateDependencies
in interface IEnumerateDependencies
enumerateDependencies
in class TorqueModel
enumerator
- The enumerator that is informed of the dependencies of this object.public final Vector getMagneticFieldVector()
public final void setMagneticFieldVector(Vector value)
public final double getNumberOfLoops()
public final void setNumberOfLoops(double value)
public final Scalar getCurrent()
public final void setCurrent(Scalar value)
public final Vector getDirectedArea()
public final void setDirectedArea(Vector value)
public final Axes getBodyAxes()
IntegrationAxes
(get
)
of the PropagationEulerianAxes
associated with the spacecraft.public final void setBodyAxes(Axes value)
IntegrationAxes
(get
)
of the PropagationEulerianAxes
associated with the spacecraft.@Nonnull public static MagneticCoilTorque createMagneticCoilTorqueUsingWmmModel(@Nonnull String filename, Point bodyCenterOfMass, double numberOfLoops, Scalar current, Vector directedArea, Axes bodyAxes)
WorldMagneticModelVector
to describe the magnetic field and a Point
to describe
the position of the spacecraft.filename
- String file path for WMM file.bodyCenterOfMass
- The center of mass of the Earth-orbiting spacecraft.numberOfLoops
- The number of current loops in the magnetic torquer coil.current
- The electric current passing through the coil.directedArea
- The area of the coil multiplied by the unit vector that is normal
to the plane of the coil such that a positive current traveling through the coil
obeys the right hand rule.bodyAxes
- The body axes of the spacecraft. These should be the
IntegrationAxes
(get
)
of the PropagationEulerianAxes
associated with the spacecraft.ArgumentNullException
- Thrown if the filename
is null
.@Nonnull public static MagneticCoilTorque createMagneticCoilTorqueUsingIgrfTxtModel(@Nonnull String filename, Point bodyCenterOfMass, double numberOfLoops, Scalar current, Vector directedArea, Axes bodyAxes)
InternationalGeomagneticReferenceFieldVector
to describe the magnetic field and a Point
to describe
the position of the spacecraft.filename
- String file path for IGRF .txt file.bodyCenterOfMass
- The center of mass of the Earth-orbiting spacecraft.numberOfLoops
- The number of current loops in the magnetic torquer coil.current
- The electric current passing through the coil.directedArea
- The area of the coil multiplied by the unit vector that is normal
to the plane of the coil such that a positive current traveling through the coil
obeys the right hand rule.bodyAxes
- The body axes of the spacecraft. These should be the
IntegrationAxes
(get
)
of the PropagationEulerianAxes
associated with the spacecraft.ArgumentNullException
- Thrown if the filename
is null
.@Nonnull public static MagneticCoilTorque createMagneticCoilTorqueUsingIgrfCofModel(@Nonnull String filename, Point bodyCenterOfMass, double numberOfLoops, Scalar current, Vector directedArea, Axes bodyAxes)
InternationalGeomagneticReferenceFieldVector
to describe the magnetic field and a Point
to describe
the position of the spacecraft.filename
- String file path for IGRF .COF file.bodyCenterOfMass
- The center of mass of the spacecraft.numberOfLoops
- The number of current loops in the magnetic torquer coil.current
- The electric current passing through the coil.directedArea
- The area of the coil multiplied by the unit vector that is normal
to the plane of the coil such that a positive current traveling through the coil
obeys the right hand rule.bodyAxes
- The body axes of the spacecraft. These should be the
IntegrationAxes
(get
)
of the PropagationEulerianAxes
associated with the spacecraft.ArgumentNullException
- Thrown if the filename
is null
.public TorqueEvaluator getTorqueEvaluator(EvaluatorGroup group)
getTorqueEvaluator
in class TorqueModel
group
- The group in which to create the evaluator and its dependents.ArgumentNullException
- Thrown when group
is null
.public void buildTorqueEvaluator(ResultantTorqueBuilder builder, EvaluatorGroup group)
buildTorqueEvaluator
in class TorqueModel
builder
- The builder object containing the lists and additional information
on the Axes
in which the overall resultant is defined.group
- The evaluator group in which to create evaluators.