Class Plan

java.lang.Object
gda.factory.FindableBase
uk.ac.diamond.daq.experiment.plan.Plan
All Implemented Interfaces:
Findable, ConveniencePlanFactory, IPlan, IPlanFactory, IPlanRegistrar

public class Plan extends FindableBase implements IPlan, IPlanRegistrar, ConveniencePlanFactory
  • Field Details

  • Constructor Details

    • Plan

      public Plan(String name)
  • Method Details

    • start

      public void start()
      Description copied from interface: IPlan
      Once the entire plan is defined, this method will initiate it by activating the first ISegment
      Specified by:
      start in interface IPlan
    • abort

      public void abort()
      Description copied from interface: IPlan
      Stop the plan wherever it is, aborting the experiment driver also (if configured)
      Specified by:
      abort in interface IPlan
    • isRunning

      public boolean isRunning()
      Description copied from interface: IPlan
      Test whether the plan is still running
      Specified by:
      isRunning in interface IPlan
      Returns:
      true if there is an active ISegment, else false
    • triggerOccurred

      public void triggerOccurred(ITrigger trigger)
      Description copied from interface: IPlanRegistrar
      Called to report that the specified ITrigger fired due to the specified signal
      Specified by:
      triggerOccurred in interface IPlanRegistrar
      Parameters:
      trigger -
    • triggerComplete

      public void triggerComplete(ITrigger trigger, TriggerEvent event, String sampleEnvironmentName)
      Description copied from interface: IPlanRegistrar
      Complementary method to
      invalid reference
      #triggerOccurred(ITrigger, double)
      called when a trigger ends either successfully or unsuccessfully
      Specified by:
      triggerComplete in interface IPlanRegistrar
      Parameters:
      trigger -
      event -
    • segmentActivated

      public void segmentActivated(ISegment segment, String sampleEnvironmentName)
      Description copied from interface: IPlanRegistrar
      Called to report that the specified ISegment has become active
      Specified by:
      segmentActivated in interface IPlanRegistrar
      Parameters:
      segment -
      sampleEnvironmentName - the name of the sample environment this segment depends on
    • segmentComplete

      public void segmentComplete(ISegment completedSegment, double terminatingSignal)
      Description copied from interface: IPlanRegistrar
      Called to report that the specified ISegment has completed due to the specified signal
      Specified by:
      segmentComplete in interface IPlanRegistrar
      Parameters:
      completedSegment -
      terminatingSignal -
    • setFactory

      public void setFactory(IPlanFactory factory)
      Description copied from interface: IPlan
      Sets the factory which creates the plan components
      Specified by:
      setFactory in interface IPlan
      Parameters:
      factory -
    • setRegistrar

      public void setRegistrar(IPlanRegistrar registrar)
      Description copied from interface: IPlanFactory
      The registrar is used for creating components which need to report their events.
      Specified by:
      setRegistrar in interface IPlanFactory
      Parameters:
      registrar -
    • setDriver

      public void setDriver(ExperimentDriver experimentDriver)
      Description copied from interface: IPlan
      We can optionally set an experiment driver to the plan, which is started when the plan starts
      Specified by:
      setDriver in interface IPlan
    • addSEV

      public ISampleEnvironmentVariable addSEV(Scannable scannable)
      Description copied from interface: IPlanFactory
      Creates an ISampleEnvironmentVariable which samples the specified Scannable.
      Specified by:
      addSEV in interface IPlanFactory
      Parameters:
      scannable -
      Returns:
      reference to created sev
    • addSEV

      public ISampleEnvironmentVariable addSEV(DoubleSupplier signalSource)
      Description copied from interface: IPlanFactory
      Creates an ISampleEnvironmentVariable which samples the specified DoubleSupplier.
      Specified by:
      addSEV in interface IPlanFactory
      Returns:
      reference to the created sev
    • addTimer

      public ISampleEnvironmentVariable addTimer()
      Description copied from interface: IPlanFactory
      Gets a timer to use as an ISampleEnvironmentVariable.
      Specified by:
      addTimer in interface IPlanFactory
    • addSegment

      public ISegment addSegment(String name, ISampleEnvironmentVariable sev, LimitCondition limit, ITrigger... triggers)
      Description copied from interface: IPlanFactory
      Creates the next segment in the experiment (segments are executed in order of creation).
      Specified by:
      addSegment in interface IPlanFactory
      Parameters:
      name - The name of this segment.
      sev - The ISampleEnvironmentVariable acting as source for the limiting signal
      limit - The LimitCondition which will terminate this segment once met.
      triggers - The triggers which should be enabled during this segment
      Returns:
      Reference to the created segment
    • addSegment

      public ISegment addSegment(String name, ISampleEnvironmentVariable sev, double duration, ITrigger... triggers)
      Description copied from interface: IPlanFactory
      Creates the next time-based segment with the given duration
      Specified by:
      addSegment in interface IPlanFactory
      Parameters:
      name - The name of this segment.
      sev - The ISampleEnvironmentVariable acting as source for the limiting signal
      duration - The duration in seconds of this segment
      triggers - The triggers which should be enabled during this segment
      Returns:
      Reference to the created segment
    • getExperimentRecord

      public IExperimentRecord getExperimentRecord()
      Description copied from interface: IPlanRegistrar
      Gets the ExperimentRecord once the experiment is complete.
      Specified by:
      getExperimentRecord in interface IPlanRegistrar
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • addTrigger

      public ITrigger addTrigger(String name, Payload payload, ISampleEnvironmentVariable sev, double target, double tolerance)
      Description copied from interface: IPlanFactory
      Create a trigger that will perform an operation only once, when signal from sev = target ± tolerance
      Specified by:
      addTrigger in interface IPlanFactory
      Parameters:
      name - Name of this trigger
      payload - Request to handle upon triggering
      sev - The ISampleEnvironmentVariable used as triggering signal source
      target - The optimal triggering signal
      tolerance - The acceptable tolerance around the target signal
      Returns:
      Reference to the created trigger
    • addTrigger

      public ITrigger addTrigger(String name, Object payload, ISampleEnvironmentVariable sev, double target, double tolerance)
      Description copied from interface: IPlanFactory
      Create a trigger that will perform an operation only once, when signal from sev = target ± tolerance
      Specified by:
      addTrigger in interface IPlanFactory
      Parameters:
      name - Name of this trigger
      payload - Request to handle upon triggering
      sev - The ISampleEnvironmentVariable used as triggering signal source
      target - The optimal triggering signal
      tolerance - The acceptable tolerance around the target signal
      Returns:
      Reference to the created trigger
    • addTrigger

      public ITrigger addTrigger(String name, Payload payload, ISampleEnvironmentVariable sev, double interval)
      Description copied from interface: IPlanFactory
      Creates a trigger which will execute the given operation in specified intervals of signal from sample environment variable provided
      Specified by:
      addTrigger in interface IPlanFactory
      Parameters:
      name - of this trigger
      payload - to handle upon triggering
      sev - the ISampleEnvironmentVariable this trigger will listen to
      interval - or period between triggers
      Returns:
      reference to the created trigger
    • addTrigger

      public ITrigger addTrigger(String name, Object payload, ISampleEnvironmentVariable sev, double interval)
      Description copied from interface: IPlanFactory
      Creates a trigger which will execute the given operation in specified intervals of signal from sample environment variable provided
      Specified by:
      addTrigger in interface IPlanFactory
      Parameters:
      name - of this trigger
      payload - to handle upon triggering
      sev - the ISampleEnvironmentVariable this trigger will listen to
      interval - or period between triggers
      Returns:
      reference to the created trigger
    • addTrigger

      public ITrigger addTrigger(String name, Payload payload, double target, double tolerance)
      Description copied from interface: ConveniencePlanFactory
      Create a trigger that will perform an operation only once, when signal from sev = target ± tolerance
      Specified by:
      addTrigger in interface ConveniencePlanFactory
      Parameters:
      name - Name of this trigger
      payload - Request to handle upon triggering
      target - The optimal triggering signal
      tolerance - The acceptable tolerance around the target signal
      Returns:
      Reference to the created trigger
    • addTrigger

      public ITrigger addTrigger(String name, Object payload, double target, double tolerance)
      Description copied from interface: ConveniencePlanFactory
      Create a trigger that will perform an operation only once, when signal from sev = target ± tolerance
      Specified by:
      addTrigger in interface ConveniencePlanFactory
      Parameters:
      name - Name of this trigger
      payload - Request to handle upon triggering
      target - The optimal triggering signal
      tolerance - The acceptable tolerance around the target signal
      Returns:
      Reference to the created trigger
    • addTrigger

      public ITrigger addTrigger(String name, Payload payload, double interval)
      Description copied from interface: ConveniencePlanFactory
      Creates a trigger which will execute the given operation in specified intervals of signal from sample environment variable provided
      Specified by:
      addTrigger in interface ConveniencePlanFactory
      Parameters:
      name - of this trigger
      payload - to handle upon triggering
      interval - or period between triggers
      Returns:
      reference to the created trigger
    • addTrigger

      public ITrigger addTrigger(String name, Object payload, double interval)
      Description copied from interface: ConveniencePlanFactory
      Creates a trigger which will execute the given operation in specified intervals of signal from sample environment variable provided
      Specified by:
      addTrigger in interface ConveniencePlanFactory
      Parameters:
      name - of this trigger
      payload - to handle upon triggering
      interval - or period between triggers
      Returns:
      reference to the created trigger
    • addSegment

      public ISegment addSegment(String name, LimitCondition limit, ITrigger... triggers)
      Description copied from interface: ConveniencePlanFactory
      Creates the next segment in the experiment (segments are executed in order of creation).
      Specified by:
      addSegment in interface ConveniencePlanFactory
      Parameters:
      name - The name of this segment.
      limit - The LimitCondition which will terminate this segment once met.
      triggers - The triggers which should be enabled during this segment
      Returns:
      Reference to the created segment
    • addSegment

      public ISegment addSegment(String name, double duration, ITrigger... triggers)
      Description copied from interface: ConveniencePlanFactory
      Creates the next time-based segment with the given duration
      Specified by:
      addSegment in interface ConveniencePlanFactory
      Parameters:
      name - The name of this segment.
      duration - The duration in seconds of this segment
      triggers - The triggers which should be enabled during this segment
      Returns:
      Reference to the created segment
    • setSegments

      protected void setSegments(List<ISegment> segments)
      See Also: