Class ModifiedScanningLaw

java.lang.Object
gaiasky.util.gaia.ModifiedScanningLaw

public class ModifiedScanningLaw extends Object
Class to generate Gaia Modified Scanning Law (MSL).

The MSL is generated by numerical integration of the differential equations for the heliotropic angles, which means that it is useful for creating a table of the MSL as function of time, but not for getting the MSL attitude at specific (random) times. Use the MslHermiteInterpolated for the latter.

Improved version (January 2013) allowing an array of high-density areas to be considered.

Further optimization (July 2013) to reduced the maximum acceleration.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    There are three modes of scanning, enumerated by the ScanState: NOMINAL = running as in NSL, MODIFIED = running at reduced precession speed, TRANSITION = the precession speed is ramping up or down between the NOMINAL and MODIFIED states.
    protected static enum 
    Enumerates the various transition functions tested.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected double
     
    protected static final double
     
    protected static final double
     
    protected double
    Additional fields used by numerical scanning laws
    protected double
    Value of the spin phase at tBeg
    protected double
    Additional fields used by numerical scanning laws
    protected gaiasky.util.gaia.ModifiedScanningLaw.Derivm
    The dn object allows the Runge-Kutta integrator to calculate derivatives and gives access to constants needed for the calculation
    protected long
     
    protected double[]
     
    protected static Vector3d
     
    protected static final double
     
    protected ComplexArea[]
     
    protected boolean
    Have computed quantities been properly initialized?
    protected double
     
    protected double
    Current value of the solar longitude [rad] and rate of solar longitude [rad/day]
    protected double
     
    protected double
    Reference solar longitude (at the reference epoch) [rad]
    protected double
    Current value of the heliotropic revolving phase [rad]
    protected double
    Value of the revolving phase at tBeg
    protected double
    Additional fields used by numerical scanning laws
    protected double
    Reference heliotropic revolving phase (at the reference epoch) [rad]
    protected static final double
     
    protected double
    Current value of the heliotropic spin phase Omega [rad].
    protected double
    Additional fields used by numerical scanning laws
    protected double
    Reference heliotropic spin phase (at the reference epoch) [rad]
    protected int
     
    protected int
     
    protected static final double
     
    protected double
    Precession rate (K) in [rev/yr].
    protected boolean
     
    protected Vector3d[]
     
    protected long
    Reference epoch to which the reference scan parameters refer
    protected double
    Local constants
    protected long
    Inertial scanning speed (omega_z) given either as a period in [ns] or as a rate in [deg/hour] = [arcsec/s].
    protected double
     
    protected double
    Local constants
    protected double
     
    protected double
    The uniform speed of the z-axis in solar motion units (S) for the nominal scaning law [dimensionless]
    protected Vector3d
     
    protected double
     
     
    protected long
    The starting time for the integration as GaiaTime and [ns] from J2010.0
    protected long
     
    protected long
    Current time in [ns] from 2010.0
    protected long
    Variables for the Runge-Kutta integrator
    protected static final double
     
    protected long
     
    protected double
    Current value of the solar aspect angle (revolving angle) [rad] and the quaternion representing a rotation by 90-xi about Y axis
    protected double[]
     
    protected double[]
     
    protected double
    Local constants
    protected double
    Local constants
  • Constructor Summary

    Constructors
    Constructor
    Description
    ModifiedScanningLaw(long gtBeg)
    Constructor with NSL initialization for given start time
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    Adjusts the spin phase (omega) and the number of spin revolutions (omegaRevs) so that 0 invalid input: '<'= omega invalid input: '<' 2*pi
    advanceScanningTo(long newTimeNs)
    Integrate the MSL forward in time by an arbitrary step.
    protected void
    Calculates omega and omegaRevs from deltaOmega, t, scanPerNs.
    double
    Get current speed of z axis in solar motion units
    double
    Get current spin phase offset (DeltaOmega)
    double
    Get current spin phase offset rate (d(DeltaOmega/dt)
    long
    Get initial time as GaiaTime
    Get a list of high-density areas that have been set
    double
    Get current kappa = d(nu)/d(sLon)
    double
     
    double
     
    long
    Get current time step in Runge-Kutta integrator
    double
    Returns the current heliotropic revolving phase in range [0,2*pi]
    double
    Get current precession angle rate (d(nu)/dt)
    double
    Returns the current heliotropic revolving phase in range [0,4*pi]
    double
    Returns the scanning phase angle (Omega) in the range [0, 2*pi].
    double
    Get current spin phase rate (d(Omega)/dt)
    double
    Returns the scanning phase angle (Omega) in the range [0, 4*pi].
    int
    Returns the integer number of revolutions to be added to the spin phase (omega) such that omega + 2 * pi * omegaRevs is a continuous function of time
    double
    Get the precession rate of the underlying NSL
    long
    Get reference epoch (for the reference values of nu and omega) as nanoseconds since J2010
    double
    Get reference value of nu
    double
    Get reference values of omega
    double
    Get the (target) scan rate
    Get current status of scanning (nominal, transition, modified)
    double
     
    protected void
    Make constants available to integrator and compute the initial values of the scanning law angles at the starting time of the integration.
    void
    Regret the last step
    protected void
    Reset the integrator to (tNow, nuBeg, omegaBeg, ...)
    void
    Set the region of the sky that is to be considered as "high density"
    void
    Set time step in Runge-Kutta integrator
    void
    setMslParameters(double factor, double zMaxDeg, double zMinDeg, double s1Min)
    Set MSL parameters: speed reduction factor for z axis and AC limits
    void
    setPrecRate(double precRate)
    Set the precession rate for the underlying NSL
    void
    setRefEpoch(long refEpoch)
    Set the reference epoch to which the reference heliotropic angles refer
    void
    setRefNu(double refNu)
    Set the reference heliotropic angle nu (at refEpoch)
    void
    setRefNuOmega(double refNu, double refOmega)
    Set the reference heliotropic angles (at refEpoch) to other values than the default values obtained with the contructor
    void
    setRefOmega(double refOmega)
    Set the reference heliotropic angle Omega (at refEpoch)
    void
    setRefXi(double refXi)
    Set the reference heliotropic angle xi (solar aspect angle).
    void
    setScanRate(double scanRate)
    Set the scan rates for the underlying NSL
    void
    Defines a typical high-density area for the MSL (as of April 2013).
    protected double
    sigmoid(double x)
    The sigmoid function provides a smooth transition from 0 (for x invalid input: '<'invalid input: '<' 0) to 1 (for x >> 0)
    void
    stepForward(long tStepNs)
    Integrate the MSL forward in time by an arbitrary step.
    protected double
    transitionKappa(double x, double kappaN, double kappaR, ModifiedScanningLaw.TransitionFunction tf)
    Calculates a smooth transition of kappa from a nominal value (kappaN) to the reduced value (kappaR), depending on the variable x, which must be in the range from 0 to 1.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • PI

      protected static final double PI
      See Also:
    • TWO_PI

      protected static final double TWO_PI
      See Also:
    • FOUR_PI

      protected static final double FOUR_PI
      See Also:
    • DEG

      protected static final double DEG
      See Also:
    • DAY_NS

      protected static final double DAY_NS
      See Also:
    • obliquity

      protected static final double obliquity
      See Also:
    • eclPole

      protected static Vector3d eclPole
    • refEpoch

      protected long refEpoch
      Reference epoch to which the reference scan parameters refer
    • precRate

      protected double precRate
      Precession rate (K) in [rev/yr].
    • scanPerNs

      protected long scanPerNs
      Inertial scanning speed (omega_z) given either as a period in [ns] or as a rate in [deg/hour] = [arcsec/s].
    • scanRate

      protected double scanRate
    • sNom

      protected double sNom
      The uniform speed of the z-axis in solar motion units (S) for the nominal scaning law [dimensionless]
    • lSunRef

      protected double lSunRef
      Reference solar longitude (at the reference epoch) [rad]
    • omegaRef

      protected double omegaRef
      Reference heliotropic spin phase (at the reference epoch) [rad]
    • nuRef

      protected double nuRef
      Reference heliotropic revolving phase (at the reference epoch) [rad]
    • tNow

      protected long tNow
      Current time in [ns] from 2010.0
    • lSun

      protected double lSun
      Current value of the solar longitude [rad] and rate of solar longitude [rad/day]
    • lSunDot

      protected double lSunDot
    • xi

      protected double xi
      Current value of the solar aspect angle (revolving angle) [rad] and the quaternion representing a rotation by 90-xi about Y axis
    • sinXi

      protected double sinXi
    • cosXi

      protected double cosXi
    • nu

      protected double nu
      Current value of the heliotropic revolving phase [rad]
    • omega

      protected double omega
      Current value of the heliotropic spin phase Omega [rad]. For good numerical precision, this is kept as an angle in the range [0, 2*pi]. The integer number of revolutions since the reference value (omega0) is given by the auxiliary variable omegaRevs. Thus a continuous angle as function of time is in principle given by the quantity omega + 2 * pi * omegaRevs.
    • omegaRevs

      protected int omegaRevs
    • initialized

      protected boolean initialized
      Have computed quantities been properly initialized?
    • tBeg

      protected long tBeg
      The starting time for the integration as GaiaTime and [ns] from J2010.0
    • tBegNs

      protected long tBegNs
    • nuBeg

      protected double nuBeg
      Value of the revolving phase at tBeg
    • deltaOmegaBeg

      protected double deltaOmegaBeg
      Value of the spin phase at tBeg
    • omegaRevsBeg

      protected int omegaRevsBeg
    • deltaOmega

      protected double deltaOmega
      Additional fields used by numerical scanning laws
    • deltaOmegaDot

      protected double deltaOmegaDot
      Additional fields used by numerical scanning laws
    • omegaDot

      protected double omegaDot
      Additional fields used by numerical scanning laws
    • nuDot

      protected double nuDot
      Additional fields used by numerical scanning laws
    • tOld

      protected long tOld
      Variables for the Runge-Kutta integrator
    • y

      protected double[] y
    • yOld

      protected double[] yOld
    • dydt

      protected double[] dydt
    • dn

      protected gaiasky.util.gaia.ModifiedScanningLaw.Derivm dn
      The dn object allows the Runge-Kutta integrator to calculate derivatives and gives access to constants needed for the calculation
    • sFactor

      protected double sFactor
      Local constants
    • zMax

      protected double zMax
      Local constants
    • zMin

      protected double zMin
      Local constants
    • s1min

      protected double s1min
      Local constants
    • sRed

      protected double sRed
    • kappa

      protected double kappa
    • reduced

      protected boolean reduced
    • spinAxis

      protected Vector3d spinAxis
    • refDir

      protected Vector3d[] refDir
    • unit

      protected long unit
    • dt

      protected long dt
    • highDensityAreas

      protected ComplexArea[] highDensityAreas
    • status

  • Constructor Details

    • ModifiedScanningLaw

      public ModifiedScanningLaw(long gtBeg)
      Constructor with NSL initialization for given start time
      Parameters:
      gtBeg - - The time elapsed in nanoseconds since epoch J2010
  • Method Details

    • initialize

      protected void initialize()
      Make constants available to integrator and compute the initial values of the scanning law angles at the starting time of the integration.
    • reset

      protected void reset()
      Reset the integrator to (tNow, nuBeg, omegaBeg, ...)
    • setRefNuOmega

      public void setRefNuOmega(double refNu, double refOmega)
      Set the reference heliotropic angles (at refEpoch) to other values than the default values obtained with the contructor
      Parameters:
      refNu - value of revolving phase (nu) at refEpoch [rad]
      refOmega - value of spin phase (omega) at refEpoch [rad]
    • setRefXi

      public void setRefXi(double refXi)
      Set the reference heliotropic angle xi (solar aspect angle).

      This is nominally constant, so it does not refer to any specific epoch.

      Parameters:
      refXi - value of solar aspect angle (xi) [rad]
    • getMaxInternalTimeStep

      public long getMaxInternalTimeStep()
      Get current time step in Runge-Kutta integrator
      Returns:
      time step [ns]
    • setMaxInternalTimeStep

      public void setMaxInternalTimeStep(long stepNs)
      Set time step in Runge-Kutta integrator
      Parameters:
      stepNs - time step [ns]
    • setMslParameters

      public void setMslParameters(double factor, double zMaxDeg, double zMinDeg, double s1Min)
      Set MSL parameters: speed reduction factor for z axis and AC limits
      Parameters:
      factor - reduction factor z speed
      zMaxDeg - maximum AC coordinate for reduced speed [deg]
      zMinDeg - minimum AC coordinate for reduced speed [deg]
      s1Min - minimum parallax factor for reduced speed [-]
    • setTypicalHighDensityArea

      public void setTypicalHighDensityArea()
      Defines a typical high-density area for the MSL (as of April 2013).

      The area consists of two circles of 0.5 deg radius each, centred on BW (at Galactic coordinates lon = 1.04 deg, lat = -3.88 deg) and Sgr I (at lon = 1.44 deg, lat = -2.64 deg). See presentation by LL at GST-41.

    • getHighDensityAreas

      public ComplexArea[] getHighDensityAreas()
      Get a list of high-density areas that have been set
      Returns:
    • setHighDensityAreas

      public void setHighDensityAreas(ComplexArea[] areas)
      Set the region of the sky that is to be considered as "high density"
      Parameters:
      areas - high density area
    • stepForward

      public void stepForward(long tStepNs)
      Integrate the MSL forward in time by an arbitrary step.
      Parameters:
      tStepNs - - time step
      See Also:
    • regretLastStep

      public void regretLastStep()
      Regret the last step

      The time and integration variables are reset to their values before the last invocation of the stepForward method

    • getLSun

      public double getLSun()
    • getLSunDot

      public double getLSunDot()
    • getXi

      public double getXi()
    • getNu

      public double getNu()
      Returns the current heliotropic revolving phase in range [0,2*pi]
      Returns:
      current heliotropic revolving phase [rad] at time given by the advanceScanningTo(long) call.
    • getNuMod4Pi

      public double getNuMod4Pi()
      Returns the current heliotropic revolving phase in range [0,4*pi]
      Returns:
      current heliotropic revolving phase [rad] at time given by the advanceScanningTo(long) call.
    • getOmega

      public double getOmega()
      Returns the scanning phase angle (Omega) in the range [0, 2*pi].
      Returns:
      Scanning phase angle in radian at time given by the last advanceScanningTo(long) call.
    • getOmegaMod4Pi

      public double getOmegaMod4Pi()
      Returns the scanning phase angle (Omega) in the range [0, 4*pi].
      Returns:
      Scanning phase angle in radian at time given by the last advanceScanningTo(long) call.
    • getOmegaRevs

      public int getOmegaRevs()
      Returns the integer number of revolutions to be added to the spin phase (omega) such that omega + 2 * pi * omegaRevs is a continuous function of time
      Returns:
      number of revolutions for the spin phase
    • getNuDot

      public double getNuDot()
      Get current precession angle rate (d(nu)/dt)
      Returns:
      precession angle rate [rad/day]
    • getOmegaDot

      public double getOmegaDot()
      Get current spin phase rate (d(Omega)/dt)
      Returns:
      spin phase rate [rad/day]
    • getDeltaOmega

      public double getDeltaOmega()
      Get current spin phase offset (DeltaOmega)
      Returns:
      spin phase offset [rad] - continuous
    • getDeltaOmegaDot

      public double getDeltaOmegaDot()
      Get current spin phase offset rate (d(DeltaOmega/dt)
      Returns:
      spin phase offset rate [rad/day]
    • getCurrentS

      public double getCurrentS()
      Get current speed of z axis in solar motion units
      Returns:
      speed of z axis [-]
    • getKappa

      public double getKappa()
      Get current kappa = d(nu)/d(sLon)
      Returns:
      kappa [-]
    • getStatus

      public ModifiedScanningLaw.ScanState getStatus()
      Get current status of scanning (nominal, transition, modified)
      Returns:
      status
    • getGTimeBeg

      public long getGTimeBeg()
      Get initial time as GaiaTime
      Returns:
      initial time
    • getRefEpoch

      public long getRefEpoch()
      Get reference epoch (for the reference values of nu and omega) as nanoseconds since J2010
      Returns:
      reference epoch
    • setRefEpoch

      public void setRefEpoch(long refEpoch) throws RuntimeException
      Set the reference epoch to which the reference heliotropic angles refer
      Parameters:
      refEpoch -
      Throws:
      RuntimeException
    • getRefNu

      public double getRefNu()
      Get reference value of nu
      Returns:
      value of nu at refEpoch [rad]
    • setRefNu

      public void setRefNu(double refNu)
      Set the reference heliotropic angle nu (at refEpoch)
      Parameters:
      refNu - value of revolving phase (nu) at refEpoch [rad]
    • getRefOmega

      public double getRefOmega()
      Get reference values of omega
      Returns:
      value of omega at refEpoch [rad]
    • setRefOmega

      public void setRefOmega(double refOmega)
      Set the reference heliotropic angle Omega (at refEpoch)
      Parameters:
      refOmega - value of spin phase (omega) at refEpoch [rad]
    • getPrecRate

      public double getPrecRate()
      Get the precession rate of the underlying NSL
      Returns:
      precession rate in [rev/yr]
    • setPrecRate

      public void setPrecRate(double precRate)
      Set the precession rate for the underlying NSL
      Parameters:
      precRate - (target) precession rate in [rev/yr]
    • getScanRate

      public double getScanRate()
      Get the (target) scan rate
      Returns:
      scan rate in [arcsec/s]
    • setScanRate

      public void setScanRate(double scanRate)
      Set the scan rates for the underlying NSL
      Parameters:
      scanRate - (target) scan rate in [arcsec/s]
    • calcOmega

      protected void calcOmega()
      Calculates omega and omegaRevs from deltaOmega, t, scanPerNs. omegaDot is calculated at the same time
    • advanceScanningTo

      public ModifiedScanningLaw advanceScanningTo(long newTimeNs)
      Integrate the MSL forward in time by an arbitrary step.

      Since the numerical implementation of Scanning Law integrates a differential equation, the only way to advance the scanning is to integrate from the current time (t) to the desired time (tNs), provided that tNs >= t. Otherwise, start from the initial conditions and integrate up to tNs.

      See Also:
    • adjustOmega

      protected void adjustOmega()
      Adjusts the spin phase (omega) and the number of spin revolutions (omegaRevs) so that 0 invalid input: '<'= omega invalid input: '<' 2*pi
    • transitionKappa

      protected double transitionKappa(double x, double kappaN, double kappaR, ModifiedScanningLaw.TransitionFunction tf)
      Calculates a smooth transition of kappa from a nominal value (kappaN) to the reduced value (kappaR), depending on the variable x, which must be in the range from 0 to 1.

      x = 0 returns kappa = kappaR, x = 1 returns kappaN.

      Parameters:
      x -
      kappaN - value for x = 1
      kappaR - value for x = 0
      tf - type of transition function
      Returns:
    • sigmoid

      protected double sigmoid(double x)
      The sigmoid function provides a smooth transition from 0 (for x invalid input: '<'invalid input: '<' 0) to 1 (for x >> 0)
      Parameters:
      x -
      Returns: