Class SineGenerator

  • All Implemented Interfaces:
    SimulationValueGenerator

    public class SineGenerator
    extends Object
    implements SimulationValueGenerator
    Generates a sine wave with a default period of one hour and a specifiable offset. Used for data generation in the unit tests.
    Author:
    mshankar
    • Constructor Detail

      • SineGenerator

        public SineGenerator​(int phasediffindegress)
      • SineGenerator

        public SineGenerator​(int phasediffindegress,
                             int numberofsamples)
    • Method Detail

      • getNumberOfSamples

        public int getNumberOfSamples​(ArchDBRTypes type)
        Description copied from interface: SimulationValueGenerator
        Get the number of events in the stream; this can be based on the incoming DBR_type. If you want the simulation stream decide on the number of samples (perhaps based on the year), return -1 here and an appropriate default is chosen.
        Specified by:
        getNumberOfSamples in interface SimulationValueGenerator
        Parameters:
        type - ArchDBRTypes
        Returns:
        The number of samples
      • getSampleValue

        public SampleValue getSampleValue​(ArchDBRTypes type,
                                          int secondsIntoYear)
        Description copied from interface: SimulationValueGenerator
        Get the value at a particular point in time. Many unit tests rely on the value being returned being absolutely reproducible given the time.
        Specified by:
        getSampleValue in interface SimulationValueGenerator
        Parameters:
        type - ArchDBRTypes
        secondsIntoYear -  
        Returns:
        Sample value