Class ModifiedScanningLaw


  • public class ModifiedScanningLaw
    extends java.lang.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 class  ModifiedScanningLaw.ScanState
      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 class  ModifiedScanningLaw.TransitionFunction
      Enumerates the various transition functions tested.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected double cosXi  
      protected static double DAY_NS  
      protected static double DEG  
      protected double deltaOmega
      Additional fields used by numerical scanning laws
      protected double deltaOmegaBeg
      Value of the spin phase at tBeg
      protected double deltaOmegaDot
      Additional fields used by numerical scanning laws
      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
      protected long dt  
      protected double[] dydt  
      protected static Vector3d eclPole  
      protected static double FOUR_PI  
      protected ComplexArea[] highDensityAreas  
      protected boolean initialized
      Have computed quantities been properly initialized?
      protected double kappa  
      protected double lSun
      Current value of the solar longitude [rad] and rate of solar longitude [rad/day]
      protected double lSunDot  
      protected double lSunRef
      Reference solar longitude (at the reference epoch) [rad]
      protected double nu
      Current value of the heliotropic revolving phase [rad]
      protected double nuBeg
      Value of the revolving phase at tBeg
      protected double nuDot
      Additional fields used by numerical scanning laws
      protected double nuRef
      Reference heliotropic revolving phase (at the reference epoch) [rad]
      protected static double obliquity  
      protected double omega
      Current value of the heliotropic spin phase Omega [rad].
      protected double omegaDot
      Additional fields used by numerical scanning laws
      protected double omegaRef
      Reference heliotropic spin phase (at the reference epoch) [rad]
      protected int omegaRevs  
      protected int omegaRevsBeg  
      protected static double PI  
      protected double precRate
      Precession rate (K) in [rev/yr].
      protected boolean reduced  
      protected Vector3d[] refDir  
      protected long refEpoch
      Reference epoch to which the reference scan parameters refer
      protected double s1min
      Local constants
      protected long scanPerNs
      Inertial scanning speed (omega_z) given either as a period in [ns] or as a rate in [deg/hour] = [arcsec/s].
      protected double scanRate  
      protected double sFactor
      Local constants
      protected double sinXi  
      protected double sNom
      The uniform speed of the z-axis in solar motion units (S) for the nominal scaning law [dimensionless]
      protected Vector3d spinAxis  
      protected double sRed  
      protected ModifiedScanningLaw.ScanState status  
      protected long tBeg
      The starting time for the integration as GaiaTime and [ns] from J2010.0
      protected long tBegNs  
      protected long tNow
      Current time in [ns] from 2010.0
      protected long tOld
      Variables for the Runge-Kutta integrator
      protected static double TWO_PI  
      protected long unit  
      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
      protected double[] y  
      protected double[] yOld  
      protected double zMax
      Local constants
      protected double zMin
      Local constants
    • Constructor Summary

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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void adjustOmega()
      Adjusts the spin phase (omega) and the number of spin revolutions (omegaRevs) so that 0 <= omega < 2*pi
      ModifiedScanningLaw advanceScanningTo​(long newTimeNs)
      Integrate the MSL forward in time by an arbitrary step.
      protected void calcOmega()
      Calculates omega and omegaRevs from deltaOmega, t, scanPerNs.
      double getCurrentS()
      Get current speed of z axis in solar motion units
      double getDeltaOmega()
      Get current spin phase offset (DeltaOmega)
      double getDeltaOmegaDot()
      Get current spin phase offset rate (d(DeltaOmega/dt)
      long getGTimeBeg()
      Get initial time as GaiaTime
      ComplexArea[] getHighDensityAreas()
      Get a list of high-density areas that have been set
      double getKappa()
      Get current kappa = d(nu)/d(sLon)
      double getLSun()  
      double getLSunDot()  
      long getMaxInternalTimeStep()
      Get current time step in Runge-Kutta integrator
      double getNu()
      Returns the current heliotropic revolving phase in range [0,2*pi]
      double getNuDot()
      Get current precession angle rate (d(nu)/dt)
      double getNuMod4Pi()
      Returns the current heliotropic revolving phase in range [0,4*pi]
      double getOmega()
      Returns the scanning phase angle (Omega) in the range [0, 2*pi].
      double getOmegaDot()
      Get current spin phase rate (d(Omega)/dt)
      double getOmegaMod4Pi()
      Returns the scanning phase angle (Omega) in the range [0, 4*pi].
      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
      double getPrecRate()
      Get the precession rate of the underlying NSL
      long getRefEpoch()
      Get reference epoch (for the reference values of nu and omega) as nanoseconds since J2010
      double getRefNu()
      Get reference value of nu
      double getRefOmega()
      Get reference values of omega
      double getScanRate()
      Get the (target) scan rate
      ModifiedScanningLaw.ScanState getStatus()
      Get current status of scanning (nominal, transition, modified)
      double getXi()  
      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.
      void regretLastStep()
      Regret the last step The time and integration variables are reset to their values before the last invocation of the stepForward method
      protected void reset()
      Reset the integrator to (tNow, nuBeg, omegaBeg, ...)
      void setHighDensityAreas​(ComplexArea[] areas)
      Set the region of the sky that is to be considered as "high density"
      void setMaxInternalTimeStep​(long stepNs)
      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 setTypicalHighDensityArea()
      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 << 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 Detail

      • 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
      • unit

        protected long unit
      • dt

        protected long dt
      • highDensityAreas

        protected ComplexArea[] highDensityAreas
    • Constructor Detail

      • ModifiedScanningLaw

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

      • 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, ...)
      • setRefEpoch

        public void setRefEpoch​(long refEpoch)
                         throws java.lang.RuntimeException
        Set the reference epoch to which the reference heliotropic angles refer
        Parameters:
        refEpoch -
        Throws:
        java.lang.RuntimeException
      • setPrecRate

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

        public void setScanRate​(double scanRate)
        Set the scan rates for the underlying NSL
        Parameters:
        scanRate - (target) scan rate in [arcsec/s]
      • 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]
      • setRefNu

        public void setRefNu​(double refNu)
        Set the reference heliotropic angle nu (at refEpoch)
        Parameters:
        refNu - value of revolving phase (nu) 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]
      • setMaxInternalTimeStep

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

        public long getMaxInternalTimeStep()
        Get current time step in Runge-Kutta integrator
        Returns:
        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.
      • 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
      • getHighDensityAreas

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

        public void stepForward​(long tStepNs)
        Integrate the MSL forward in time by an arbitrary step.
        Parameters:
        tStepNs - - time step
        See Also:
        advanceScanningTo(long)
      • 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 [-]
      • 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
      • getRefNu

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

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

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

        public double getScanRate()
        Get the (target) scan rate
        Returns:
        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:
        stepForward(long)
      • adjustOmega

        protected void adjustOmega()
        Adjusts the spin phase (omega) and the number of spin revolutions (omegaRevs) so that 0 <= omega < 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 << 0) to 1 (for x >> 0)
        Parameters:
        x -
        Returns: