R/SimulateISAStartTime.R

Defines functions SimulateISAStartTime.Uniform SimulateISAStartTime.SetTime SimulateISAStartTime.default SimulateISAStartTime SimulateAllISAStartTimes.default SimulateAllISAStartTimes

Documented in SimulateAllISAStartTimes SimulateAllISAStartTimes.default SimulateISAStartTime SimulateISAStartTime.default SimulateISAStartTime.SetTime SimulateISAStartTime.Uniform

##### COPYRIGHT #############################################################################################################
#
# Copyright (C) 2018 JANSSEN RESEARCH & DEVELOPMENT, LLC
# This package is governed by the JRD OCTOPUS License, which is the
# GNU General Public License V3 with additional terms. The precise license terms are located in the files
# LICENSE and GPL.
#
#############################################################################################################################.

#This file contains the generic methods that could be used to set the start time of any ISA, by default the time is specified.

#' @name  SimulateAllISAStartTimes
#' @title  Simulate ISA Start Times for all ISAs
#' @seealso { \href{https://github.com/kwathen/OCTOPUS/blob/master/R/SimulateISAStartTime.R}{View Code on GitHub} }
#' @export
SimulateAllISAStartTimes <- function( cISASimDesigns )
{
    UseMethod( "SimulateAllISAStartTimes", cISASimDesigns )

}

#' @name  SimulateAllISAStartTimes
#' @title  Simulate ISA Start Times for all ISAs
#' @seealso { \href{https://github.com/kwathen/OCTOPUS/blob/master/R/SimulateISAStartTime.R}{View Code on GitHub} }
#' @export
SimulateAllISAStartTimes.default <- function( cISASimDesigns)
{
    nQtyISA       <- length( cISASimDesigns )
    vISAStartTime <- rep( 0, nQtyISA )

    for( i in 1:nQtyISA )
    {
        vISAStartTime[ i ] <- SimulateISAStartTime( cISASimDesigns[[ i ]]$cSimISAStart  )
    }
    return( vISAStartTime )
}


#' @name  SimulateISAStartTime
#' @title  Simulate ISA Start Time
#' @seealso { \href{https://github.com/kwathen/OCTOPUS/blob/master/R/SimulateISAStartTime.R}{View Code on GitHub} }
#' @export
SimulateISAStartTime <- function( cParams )
{
    UseMethod( "SimulateISAStartTime", cParams )

}

#' @name  SimulateISAStartTime.default
#' @title  Simulate ISA Start Time
#' @description This version should not be implemented
#' @seealso { \href{https://github.com/kwathen/OCTOPUS/blob/master/R/SimulateISAStartTime.R}{View Code on GitHub} }
#' @export
SimulateISAStartTime.default <- function( cParams )
{
    stop( "SimulateISAStartTime.default is not defined. ")
}


#' @name  SimulateISAStartTime.SetTime
#' @title  SimulateISAStartTime SetTime
#' @description This version assumes the cParams has a dParam1 which specifies the start time for the ISA, eg it is fixed when the ISA starts
#' @seealso { \href{https://github.com/kwathen/OCTOPUS/blob/master/R/SimulateISAStartTime.R}{View Code on GitHub} }
#' @export
SimulateISAStartTime.SetTime <- function( cParams )
{
    #print( "SimulateISAStartTime.SetTime")

    return( cParams$dParam1 )

}


#' @name  SimulateISAStartTime.Uniform
#' @title  Simulate ISA Start Time from a uniform distribution
#' @description This version assumes the cParams has a dParam1 and dParam2 and simulates a unif( dParam1, dParam2 ) as the ISA start time
#' @seealso { \href{https://github.com/kwathen/OCTOPUS/blob/master/R/SimulateISAStartTime.R}{View Code on GitHub} }
#' @export
SimulateISAStartTime.Uniform <- function( cParams )
{
    #print( " SimulateISAStartTime.Uniform")
    return( runif( 1, cParams$dParam1, cParams$dParam2 ))

}
kwathen/OCTOPUS documentation built on Oct. 24, 2024, 12:36 p.m.