edu.nrao.sss.model.project
Class EnvironmentalConstraints

java.lang.Object
  extended by edu.nrao.sss.model.project.EnvironmentalConstraints
All Implemented Interfaces:
Cloneable

public class EnvironmentalConstraints
extends Object
implements Cloneable

Scheduling constraints related to environmental conditions. An instance of this object is held by a SchedulingBlock.

Version Info:

$Revision: 1915 $
$Date: 2009-01-21 16:15:07 -0700 (Wed, 21 Jan 2009) $
$Author: dharland $ (last person to modify)

Since:
2008-07-15
Author:
David M. Harland

Constructor Summary
EnvironmentalConstraints()
          Creates a new container of environmental scheduling constraints.
 
Method Summary
 EnvironmentalConstraints clone()
          Returns a copy of these constraints.
 boolean equals(Object o)
          Returns true if o is equal to these constraints.
 boolean getAvoidSunrise()
          Returns true if the scheduling block holding this object should not be scheduled near sunrise.
 boolean getAvoidSunset()
          Returns true if the scheduling block holding this object should not be scheduled near sunset.
 List<SchedulingConstraint> getBlockingConstraints(LinearVelocity windSpeed, Angle api, Angle ionosphericPhase, Angle solarSeparation, boolean nearSunrise, boolean nearSunset)
          Returns a list of all the constraints that should block scheduling based on the given conditions.
 Angle getMaxAllowableApi()
          Returns the maximum allowable atmospheric (tropospheric) phase.
 Angle getMaxAllowableIonospherePhase()
          Returns the maximum allowable ionospheric phase.
 double getMaxAllowableOpacity()
          Returns the maximum allowable atmospheric opacity.
 LinearVelocity getMaxAllowableWindSpeed()
          Returns the maximum allowable wind speed.
 Angle getMinAllowableElevation()
          Returns the minimum allowable elevation for an observed source.
 Angle getMinAllowableSolarSeparation()
          Returns the minimum allowable separation between the observed source and the sun.
static Angle getSuggestedMinimumSolarSeparation(ReceiverBand receiver, TelescopeConfiguration arrayConfig)
          Returns the suggested minimum angular separation between a target source and the sun.
 boolean hasApiConstraint()
          Returns false if the API constraint is so relaxed as to practically not exist.
 boolean hasBlockingConstraints(LinearVelocity windSpeed, Angle api, Angle ionosphericPhase, Angle solarSeparation, boolean nearSunrise, boolean nearSunset)
          Returns true if any of the given conditions are outside of this set of constraints.
 int hashCode()
          Returns a hash code value for these constraints.
 boolean hasIonosphereConstraint()
          Returns false if the ionospheric phase constraint is so relaxed as to practically not exist.
 boolean hasMinimumElevationConstraint()
          Always returns true because the antennas themselves may point only so low.
 boolean hasOpacityConstraint()
          Returns false if the opacity constraint is so relaxed as to practically not exist.
 boolean hasSolarSeparationConstraint()
          Returns false if the solar separation constraint is so relaxed as to practically not exist.
 boolean hasWindSpeedConstraint()
          Returns false if the wind speed constraint is so relaxed as to practically not exist.
 void reset()
          Puts the constraints held by this object back to their default values.
 void resetAvoidSunrise()
          Puts the avoidSunrise constraint back to its default value.
 void resetAvoidSunset()
          Puts the avoidSunset constraint back to its default value.
 void resetMaxAllowableApi()
          Puts the maxAllowableApi constraint back to its default value.
 void resetMaxAllowableIonospherePhase()
          Puts the maxAllowableIonospherePhase constraint back to its default value.
 void resetMaxAllowableOpacity()
          Puts the maxAllowableOpacity constraint back to its default value.
 void resetMaxAllowableWindSpeed()
          Puts the maxAllowableWindSpeed constraint back to its default value.
 void resetMinAllowableElevation()
          Puts the minAllowableElevation constraint back to its default value.
 void resetMinAllowableSolarSeparation()
          Puts the minAllowableSolarSeparation constraint back to its default value.
 void setAvoidSunrise(boolean avoid)
          Used to specify whether or not the scheduling block holding this object should avoid execution near sunrise.
 void setAvoidSunriseAndSunset(boolean avoid)
          A convenience method for avoiding both sunrise and sunset.
 void setAvoidSunset(boolean avoid)
          Used to specify whether or not the scheduling block holding this object should avoid execution near sunset.
 void setMaxAllowableOpacity(double newMax)
          Sets the maximum allowable atmospheric opacity.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnvironmentalConstraints

public EnvironmentalConstraints()
Creates a new container of environmental scheduling constraints.

Method Detail

reset

public void reset()
Puts the constraints held by this object back to their default values. The default values are those that typically would not prevent scheduling.


getMaxAllowableWindSpeed

public LinearVelocity getMaxAllowableWindSpeed()
Returns the maximum allowable wind speed. If the actual wind speed is above this value, the scheduling block holding this object should not be scheduled for execution.

The velocity returned is the one held internally by this object, so changes made to it will be reflected herein.

Returns:
the maximum allowable wind speed.
See Also:
hasWindSpeedConstraint(), resetMaxAllowableWindSpeed()

resetMaxAllowableWindSpeed

public final void resetMaxAllowableWindSpeed()
Puts the maxAllowableWindSpeed constraint back to its default value. The default value is one that typically would not prevent scheduling.

See Also:
getMaxAllowableWindSpeed(), hasWindSpeedConstraint()

hasWindSpeedConstraint

public boolean hasWindSpeedConstraint()
Returns false if the wind speed constraint is so relaxed as to practically not exist. This method is intended mainly for handling situations at the user interface level where one first wants to say I do or do not care about the wind speed, and only if I care will I enter a value. Most other clients can ignore this method and use getMaxAllowableWindSpeed(); if wind speed is not a concern, that method will return a value sufficiently high that it will not constrain scheduling.

Returns:
true if this set of constraints has a wind speed constraint.
See Also:
getMaxAllowableWindSpeed(), resetMaxAllowableWindSpeed()

getMaxAllowableApi

public Angle getMaxAllowableApi()
Returns the maximum allowable atmospheric (tropospheric) phase. If the actual API is above this value, the scheduling block holding this object should not be scheduled for execution.

The angle returned is the one held internally by this object, so changes made to it will be reflected herein.

Returns:
the maximum allowable atmospheric phase.
See Also:
hasApiConstraint(), resetMaxAllowableApi()

resetMaxAllowableApi

public final void resetMaxAllowableApi()
Puts the maxAllowableApi constraint back to its default value. The default value is one that typically would not prevent scheduling and results in hasApiConstraint() returning false.

See Also:
getMaxAllowableApi(), hasApiConstraint()

hasApiConstraint

public boolean hasApiConstraint()
Returns false if the API constraint is so relaxed as to practically not exist. This method is intended mainly for handling situations at the user interface level where one first wants to say I do or do not care about the API, and only if I care will I enter a value. Most other clients can ignore this method and use getMaxAllowableApi(); if API is not a concern, that method will return a value sufficiently high that it will not constrain scheduling.

Returns:
true if this set of constraints has an API constraint.
See Also:
getMaxAllowableApi(), resetMaxAllowableApi()

getMaxAllowableIonospherePhase

public Angle getMaxAllowableIonospherePhase()
Returns the maximum allowable ionospheric phase. If the actual phase is above this value, the scheduling block holding this object should not be scheduled for execution.

The angle returned is the one held internally by this object, so changes made to it will be reflected herein.

Returns:
the maximum allowable ionospheric phase.
See Also:
hasIonosphereConstraint(), resetMaxAllowableIonospherePhase()

resetMaxAllowableIonospherePhase

public final void resetMaxAllowableIonospherePhase()
Puts the maxAllowableIonospherePhase constraint back to its default value. The default value is one that typically would not prevent scheduling and results in hasIonosphereConstraint() returning false.

See Also:
getMaxAllowableIonospherePhase(), hasIonosphereConstraint()

hasIonosphereConstraint

public boolean hasIonosphereConstraint()
Returns false if the ionospheric phase constraint is so relaxed as to practically not exist. This method is intended mainly for handling situations at the user interface level where one first wants to say I do or do not care about the ionospheric phase, and only if I care will I enter a value. Most other clients can ignore this method and use getMaxAllowableIonospherePhase(); if ionospheric phase is not a concern, that method will return a value sufficiently high that it will not constrain scheduling.

Returns:
true if this set of constraints has an ionosphere phase constraint.
See Also:
getMaxAllowableIonospherePhase(), resetMaxAllowableIonospherePhase()

getMinAllowableSolarSeparation

public Angle getMinAllowableSolarSeparation()
Returns the minimum allowable separation between the observed source and the sun. If the actual angle is below this value, the scheduling block holding this object should not be scheduled for execution.

The angle returned is the one held internally by this object, so changes made to it will be reflected herein.

Returns:
the minimum allowable separation between the observed source and the sun.
See Also:
hasSolarSeparationConstraint(), resetMinAllowableSolarSeparation()

resetMinAllowableSolarSeparation

public final void resetMinAllowableSolarSeparation()
Puts the minAllowableSolarSeparation constraint back to its default value. The default value is one that typically would not prevent scheduling.

See Also:
getMinAllowableSolarSeparation(), hasSolarSeparationConstraint()

hasSolarSeparationConstraint

public boolean hasSolarSeparationConstraint()
Returns false if the solar separation constraint is so relaxed as to practically not exist. This method is intended mainly for handling situations at the user interface level where one first wants to say I do or do not care about the solar separation angle, and only if I care will I enter a value. Most other clients can ignore this method and use getMinAllowableSolarSeparation(); if solar separation is not a concern, that method will return a value sufficiently low that it will not constrain scheduling.

Returns:
true if this set of constraints has a solar separation constraint.
See Also:
getMinAllowableSolarSeparation(), resetMinAllowableSolarSeparation()

getMinAllowableElevation

public Angle getMinAllowableElevation()
Returns the minimum allowable elevation for an observed source. If the actual elevation is below this value, the scheduling block holding this object should not be scheduled for execution.

The angle returned is the one held internally by this object, so changes made to it will be reflected herein.

Returns:
the minimum allowable angle between the observed source and the horizon.
See Also:
hasSolarSeparationConstraint(), resetMinAllowableSolarSeparation()

resetMinAllowableElevation

public final void resetMinAllowableElevation()
Puts the minAllowableElevation constraint back to its default value. The default value is the minimum elevation at which an EVLA antenna can point.

See Also:
getMinAllowableSolarSeparation(), hasSolarSeparationConstraint()

hasMinimumElevationConstraint

public boolean hasMinimumElevationConstraint()
Always returns true because the antennas themselves may point only so low.

Returns:
true
See Also:
getMinAllowableElevation(), resetMinAllowableElevation()

getMaxAllowableOpacity

public double getMaxAllowableOpacity()
Returns the maximum allowable atmospheric opacity. If the actual opacity is above this value, the scheduling block holding this object should not be scheduled for execution.

Returns:
the maximum allowable atmospheric opacity.
See Also:
hasOpacityConstraint(), resetMaxAllowableOpacity(), setMaxAllowableOpacity(double)

setMaxAllowableOpacity

public void setMaxAllowableOpacity(double newMax)
Sets the maximum allowable atmospheric opacity.

Parameters:
newMax - the maximum allowable atmospheric opacity.
See Also:
getMaxAllowableOpacity(), hasOpacityConstraint(), resetMaxAllowableOpacity()

resetMaxAllowableOpacity

public void resetMaxAllowableOpacity()
Puts the maxAllowableOpacity constraint back to its default value. The default value is one that typically would not prevent scheduling.

See Also:
getMaxAllowableOpacity(), hasOpacityConstraint(), setMaxAllowableOpacity(double)

hasOpacityConstraint

public boolean hasOpacityConstraint()
Returns false if the opacity constraint is so relaxed as to practically not exist. This method is intended mainly for handling situations at the user interface level where one first wants to say I do or do not care about the opacity, and only if I care will I enter a value. Most other clients can ignore this method and use getMaxAllowableOpacity(); if opacity is not a concern, that method will return a value sufficiently low that it will not constrain scheduling.

Returns:
true if this set of constraints has an opacity constraint.
See Also:
getMaxAllowableOpacity(), resetMaxAllowableOpacity(), setMaxAllowableOpacity(double)

getAvoidSunrise

public boolean getAvoidSunrise()
Returns true if the scheduling block holding this object should not be scheduled near sunrise.

Returns:
true if sunrise should be avoided.

setAvoidSunrise

public void setAvoidSunrise(boolean avoid)
Used to specify whether or not the scheduling block holding this object should avoid execution near sunrise.

Parameters:
avoid - true if sunrise should be avoided.
See Also:
setAvoidSunriseAndSunset(boolean)

resetAvoidSunrise

public final void resetAvoidSunrise()
Puts the avoidSunrise constraint back to its default value. The default value is one that typically would not prevent scheduling.


getAvoidSunset

public boolean getAvoidSunset()
Returns true if the scheduling block holding this object should not be scheduled near sunset.

Returns:
true if sunset should be avoided.

setAvoidSunset

public void setAvoidSunset(boolean avoid)
Used to specify whether or not the scheduling block holding this object should avoid execution near sunset.

Parameters:
avoid - true if sunset should be avoided.
See Also:
setAvoidSunriseAndSunset(boolean)

resetAvoidSunset

public final void resetAvoidSunset()
Puts the avoidSunset constraint back to its default value. The default value is one that typically would not prevent scheduling.


setAvoidSunriseAndSunset

public void setAvoidSunriseAndSunset(boolean avoid)
A convenience method for avoiding both sunrise and sunset.

Parameters:
avoid - true if both sunrise and sunset should be avoided.
See Also:
setAvoidSunrise(boolean), setAvoidSunset(boolean)

getSuggestedMinimumSolarSeparation

public static Angle getSuggestedMinimumSolarSeparation(ReceiverBand receiver,
                                                       TelescopeConfiguration arrayConfig)
Returns the suggested minimum angular separation between a target source and the sun. This value varies based on the frequency observed and the array configuration.

Parameters:
receiver - the receiver band used to observe the source.
arrayConfig - the configuration of the telescope at the time the source is observed.
Returns:
the minimum solar separation angle.

getBlockingConstraints

public List<SchedulingConstraint> getBlockingConstraints(LinearVelocity windSpeed,
                                                         Angle api,
                                                         Angle ionosphericPhase,
                                                         Angle solarSeparation,
                                                         boolean nearSunrise,
                                                         boolean nearSunset)
Returns a list of all the constraints that should block scheduling based on the given conditions. A subset of the conditions may be tested by using null or false for those conditions you do not want to test.

Parameters:
windSpeed - the wind velocity to be tested against this constraint. If you do not wish to use wind in the test for blocking constraints, use a value of null.
api - the atmospheric phase to be tested against this constraint. If you do not wish to use API in the test for blocking constraints, use a value of null.
ionosphericPhase - the ionospheric phase to be tested against this constraint. If you do not wish to use this phase in the test for blocking constraints, use a value of null.
solarSeparation - the angle between the sun and the target to be tested against this constraint. If you do not wish to use this angle in the test for blocking constraints, use a value of null.
nearSunrise - an indication that the observing time is near sunrise. If you do not wish to use this quantity in the test for blocking constraints, use a value of false.
nearSunset - an indication that the observing time is near sunset. If you do not wish to use this quantity in the test for blocking constraints, use a value of false.
Returns:
a list of all the constraints that failed based on the given conditions.

hasBlockingConstraints

public boolean hasBlockingConstraints(LinearVelocity windSpeed,
                                      Angle api,
                                      Angle ionosphericPhase,
                                      Angle solarSeparation,
                                      boolean nearSunrise,
                                      boolean nearSunset)
Returns true if any of the given conditions are outside of this set of constraints. See getBlockingConstraints(LinearVelocity, Angle, Angle, Angle, boolean, boolean) for a description of the parameters.

This method is logically equivalent to calling getBlockingConstraints(...).size() > 0, but will often be faster because it stops testing on the first failure.

Returns:
true if any of the given conditions are outside of this set of constraints.

clone

public EnvironmentalConstraints clone()
Returns a copy of these constraints.

If anything goes wrong during the cloning procedure, a RuntimeException will be thrown.

Overrides:
clone in class Object

equals

public boolean equals(Object o)
Returns true if o is equal to these constraints.

Overrides:
equals in class Object

hashCode

public int hashCode()
Returns a hash code value for these constraints.

Overrides:
hashCode in class Object


Copyright © 2009. All Rights Reserved.