JavaGenes, NASA Ames. Written largely by Al Globus

gov.nasa.javaGenes.EOSscheduling
Class DutyCycleConstraint

java.lang.Object
  extended bygov.nasa.javaGenes.EOSscheduling.DutyCycleConstraint
All Implemented Interfaces:
java.io.Serializable

public class DutyCycleConstraint
extends java.lang.Object
implements java.io.Serializable

Implements constraints of the form: resource must be Available for no more than onTime in any totalTime period. DEFICIENCIES: Does not consider instrument warmup time and allows instument to be turned off for very short periods (e.g., 1 second) to meet constraint.

See Also:
Serialized Form

Field Summary
protected static boolean debug
           
protected  int maxOnTime
           
protected  int onTimeArrayElementDuration
           
protected  int[] onTimes
           
protected  int totalTime
           
 
Constructor Summary
DutyCycleConstraint(Horizon horizon, int inTotalTime, int inMaxOnTime)
          holds data for a constraint where something must be off for at least inOffTime in every period of inTotalTime
 
Method Summary
protected  boolean anyUnAvailableNodeTooLong(AvailableNode nodeAtCheckStart, int maxOnTimeForSearch, int startTime, int endTime)
           
protected  void checkEndNode(AvailableNode endNode, int startTime, int endTime)
           
protected  void checkOnTimes(int[] correct)
           
 int durationInEndBucket(int endTime)
           
 int durationInStartBucket(int startTime)
           
 boolean fastFitCheck(int startTime, int duration)
          used for a quick screening check.
 boolean fastFits(AvailabilityTimeline timeline, AvailableNode node, int startTime, int duration)
          if a period of 'duration' length starting at startTime became UnAvailable, would the timeline be consistant with the dutycycle constraint?
 boolean fits(AvailabilityTimeline timeline)
           
 boolean fits(AvailabilityTimeline timeline, AvailableNode node, int startTime, int duration)
           
protected  int getIndex(int time)
           
 int getOnTimes(int index)
           
 void initialize()
           
 void insertAt(int startTime, int endTime)
           
protected  boolean okBackward(AvailabilityTimeline timeline, AvailableNode node, int endTime, int maxOnTimeForSearch)
          starting at 'endTime', check backward 'totalTime' to see if there is no more than 'maxOnTimeForSearch' UnAvailable time
protected  boolean okForward(AvailabilityTimeline timeline, AvailableNode node, int startTime, int maxOnTimeForSearch)
          starting at 'startTime', check forward 'totalTime' to see if there is no more than 'maxOnTimeForSearch' UnAvailable time
 void setQuickCheckArrays(Horizon horizon)
           
 boolean slowFits(AvailabilityTimeline timeline, AvailableNode node, int startTime, int duration)
          if a period of 'duration' length starting at startTime became UnAvailable, would the timeline be consistant with the dutycycle constraint? Algorithm: - subtract duration to maxOnTime to get the maximum ontime acceptable - check from the beginning of the duration forward - check from the end of the duration backward - for UnAvailable nodes before the duration, check from it's beginning forward - for UnAvailable nodes after the duration, check from it's end backward
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

totalTime

protected int totalTime

maxOnTime

protected int maxOnTime

onTimeArrayElementDuration

protected int onTimeArrayElementDuration

onTimes

protected int[] onTimes

debug

protected static final boolean debug
See Also:
Constant Field Values
Constructor Detail

DutyCycleConstraint

public DutyCycleConstraint(Horizon horizon,
                           int inTotalTime,
                           int inMaxOnTime)
holds data for a constraint where something must be off for at least inOffTime in every period of inTotalTime

Method Detail

setQuickCheckArrays

public void setQuickCheckArrays(Horizon horizon)

initialize

public void initialize()

fastFitCheck

public boolean fastFitCheck(int startTime,
                            int duration)
used for a quick screening check. Must only be called if fit() true for other availability constraints.

Returns:
true if dutyCylce is definitely not violated using a quick check. May return false even if there isn't a violation, so when false is returned a more precise check must be made. Designed to quickly decide for performance.

insertAt

public void insertAt(int startTime,
                     int endTime)

getIndex

protected int getIndex(int time)

durationInStartBucket

public int durationInStartBucket(int startTime)

durationInEndBucket

public int durationInEndBucket(int endTime)

getOnTimes

public int getOnTimes(int index)
Returns:
0 if index 1 too big or small. Simplifies definitelyFits()

checkOnTimes

protected void checkOnTimes(int[] correct)

fits

public boolean fits(AvailabilityTimeline timeline)

fits

public boolean fits(AvailabilityTimeline timeline,
                    AvailableNode node,
                    int startTime,
                    int duration)

fastFits

public boolean fastFits(AvailabilityTimeline timeline,
                        AvailableNode node,
                        int startTime,
                        int duration)
if a period of 'duration' length starting at startTime became UnAvailable, would the timeline be consistant with the dutycycle constraint?


anyUnAvailableNodeTooLong

protected boolean anyUnAvailableNodeTooLong(AvailableNode nodeAtCheckStart,
                                            int maxOnTimeForSearch,
                                            int startTime,
                                            int endTime)

checkEndNode

protected void checkEndNode(AvailableNode endNode,
                            int startTime,
                            int endTime)

slowFits

public boolean slowFits(AvailabilityTimeline timeline,
                        AvailableNode node,
                        int startTime,
                        int duration)
if a period of 'duration' length starting at startTime became UnAvailable, would the timeline be consistant with the dutycycle constraint? Algorithm: - subtract duration to maxOnTime to get the maximum ontime acceptable - check from the beginning of the duration forward - check from the end of the duration backward - for UnAvailable nodes before the duration, check from it's beginning forward - for UnAvailable nodes after the duration, check from it's end backward


okForward

protected boolean okForward(AvailabilityTimeline timeline,
                            AvailableNode node,
                            int startTime,
                            int maxOnTimeForSearch)
starting at 'startTime', check forward 'totalTime' to see if there is no more than 'maxOnTimeForSearch' UnAvailable time


okBackward

protected boolean okBackward(AvailabilityTimeline timeline,
                             AvailableNode node,
                             int endTime,
                             int maxOnTimeForSearch)
starting at 'endTime', check backward 'totalTime' to see if there is no more than 'maxOnTimeForSearch' UnAvailable time


JavaGenes, NASA Ames. Written largely by Al Globus