setRandomSeedCounter

Syntax

setRandomSeedCounter(CounterValue:integer) → integer

The function setRandomSeedCounter is only required if you want to influence the automatic allocation of the random number seed value, compare Random Numbers Variant/RandomSeed, which normally is not required.

Whenever you insert an object, which has the attribute RandomSeed, Plant Simulation assigns a unique value to the attribute, i.e., a value which no other object in the simulation model has as random number seed value. This guarantees that the newly inserted object uses different random numbers, for example for processing times, for failures, etc. To facilitate this, each model has a counter that Plant Simulation increases when automatically assigning the random number seed value. When you call the function setRandomSeedCounter with a value other than zero, Plant Simulation sets the counter to this value.

Besides, the function setRandomSeedCounter returns the previous value of the counter. If you only want to get the current value of the counter, call the function with the counter values NewCounter=0.

Note:

If you set the counter to a value smaller than the previous value, it is not guaranteed that each newly inserted object has a unique random number seed value.

This function can be useful when you want to automatically create simulation models. You could, for example, use the Teamcenter interface to detect the objects within your installation to then create these objects using a Method. When you then delete the created objects and get the up-to-date information from Teamcenter and create the model anew, the created object will get different random number seed values, even if the Teamcenter database did not change. If you would like to use the same random number seed values, call the function setRandomSeedCounter once before creating the objects to always initialize the counter with the same value.

Parameter

The parameter CounterValue of data type integer designates the value of the counter.

Return Value

The return value has the data type integer.

Example

setRandomSeedCounter(4)