Noise Class
Navigation: PGMs > Classes > Predefined Classes
Related Links: Controller  Noise
Species Database Class  Particle Size Definition Class  Array Class  StrArray Class  Matrix Class  Tag Select Class  Plant Model Class  Noise Class  TimeClass 

Description
The Noise class can be used to add noise to a value.
 In SysCAD 9.3 Build 137 or later, a larger number of random number distributions are available, all using a single random number generator.
 In SysCAD 9.3 Build 136 or earlier, a Gaussian, Flat, Poisson, Gamma or Weibull random number distributions may be selected. Each noise generator uses one of two random number generators.
 If Init or SetType are not called, it is assumed that type 0 is required (Gaussian). If Init or SetGlobal are not called, it is assumed that a global random generator must be used.
 If the NoiseType specified is outside the specified range of methods available, then the nearest number will be used. eg. if a large number is specified, then the last method available (highest method number) will be used.
NOTE: The Controller  Noise model, is superseding this topic. However, this form is still available for users familiar with the PGM coding style.
Data Members
NOTE: The meaning of the data members Mean and StdDev depend on the Noise class Type! See table below.
Mean: For Gaussiana nd Flat Distributions, this is the value around which the random number must be generated. See table below for its meaning in other distributions. The default is 0.0.
StdDev: The Standard Deviation for Gaussian distribution (68.27% of the numbers generated will be between (Mean  StdDev) and (Mean + StdDev). For the Flat distribution StdDev represents the minimum and maximum distance from the Mean. See table below for its meaning in other distributions. The default is 1.0.
Output: The last value generated by GetVal. This is a constant and cannot be set.
Generator Type Mean parameter StdDev parameter Gaussian Mean Standard deviation Flat Mean Maximum deviation Poisson Mean Not used Gamma Alpha Beta Weibull Alpha Beta Bernoulli* Probability, p Not used Binomial* n Probability, p Geometric* Probability, p Not used Exponential* Mean Not used Extreme Value* Alpha Beta Log Normal* m s Cauchy* Alpha Beta Fisher F* m n Student t* n Not used
* Only available in SysCAD 9.3 Build 137 or later.
Member Functions
The examples in the table below is based on the following variables and 'Noise Class' declarations.
Noise a ;declares 'noise' instances Real d
Call 
Functionality 
Return Type 
Parameters 
Example 
Init (Mean, StdDev, NoiseType, Global, Seed ) 
This can be used to set all the parameters. The random number generator is initialised and reset. 
Mean :Refer to description above 
a.Init(5.0,1.0,1,0,3)  
Setup (Mean, StdDev, NoiseType, Global) 
This function can be used to set all the parameters. The random number generator is initialised and reset. 
Mean :Refer to description above 
a.Setup(4.0,0.9,4,1)  
SetType (NoiseType) 
This sets the random number generator type. 
NoiseType: Is a 'byte' field which specifies the noise generator type required. See below the table for a description of 'NoiseTypes'. 
a.SetType(6)  
SetGlobal (Global) 
This sets the global option. Must be used before the function SetSeed! 
Global: Is a 'bit' field which specifies if the random number must be obtained from a shared global random generator or from its own random number generator. 
a.SetGlobal(1)  
SetSeed (Seed) 
This function sets the seed value.

Seed: Is a data type 'long' field which specifies the seed value for generating the first random number. 
a.SetSeed(5)  
GetVal () 
This will return the value generated by the random number generator.

Real 
None 
d = a.GetVal() 
Noise Types
Descriptions of the NoiseType for the different versions of SysCAD are shown in the table below.
Field Value Generator Type
Build 136 or earlierGenerator Type
Build 137 or later0 Gaussian generator using Random Method 1 Gaussian generator 1 Gaussian generator using Random Method 2 Gaussian generator 2 Flat generator using Random Method 1 Flat generator 3 Flat generator using Random Method 2 Flat generator 4 Poisson generator using Random Method 1 Poisson generator 5 Poisson generator using Random Method 2 Poisson generator 6 Gamma generator using Random Method 1 Gamma generator 7 Gamma generator using Random Method 2 Gamma generator 8 Weibull generator using Random Method 1 Weibull generator 9 Weibull generator using Random Method 2 Weibull generator 10 Not used Bernoulli generator 11 Not used Binomial generator 12 Not used Geometric generator 13 Not used Exponential generator 14 Not used Extreme Value generator 15 Not used Log Normal generator 16 Not used Cauchy generator 17 Not used Fisher F generator 18 Not used Student t generator
Notes:
 In SysCAD 9.3 Build 136 or earlier, Random Method 1 and Random Method 2 refer to the use of two different types of random number generators used. Method 1 from Numerical Recipes in C  2nd Edition; and Method 2 uses C standard library rand() function.
 In SysCAD 9.3 Build 137 or later, there is no difference between the two methods, both use the C++ standard library.
 The Gaussian random noise generator's output characteristic is the "Bell curve" where 68.27% of the numbers generated are within +/ one StdDev from the Mean.
 The Flat random noise generator's output characteristic is flat where random numbers are generated between +/ StdDev from the Mean with equal probability.
 For further information see Controller  Noise