3.6.3.1. Construction of a simple OAT design-of-experiments
The easiest way to create an OAT design-of-experiments using TOATDesign is to proceed as follows:
create a dataserver with a list of attributes corresponding to the input factors;
set the default value of each attribute to the nominal value;
create a
TOATDesignobject, with the dataserver as first parameter;define the maximum range of variation of the factors using the
setRangefunction;generate the OAT design-of-experiments using the
generateSamplefunction.
At this point, the dataserver contains an OAT design-of-experiments where each factor of interest is modified twice. Below is an example:
"""
Example of simple OAT DoE
"""
from URANIE import DataServer, Sampler
# step 1
tds = DataServer.TDataServer("tdsoat", "Dataserver simple OAT design")
tds.addAttribute(DataServer.TAttribute("x1"))
tds.addAttribute(DataServer.TAttribute("x2"))
# step 2
tds.getAttribute("x1").setDefaultValue(0.0)
tds.getAttribute("x2").setDefaultValue(10.0)
# step 3
oatSampler = Sampler.TOATDesign(tds)
# step 4
use_percentage = True
oatSampler.setRange("x1", 2.0)
oatSampler.setRange("x2", 40.0, use_percentage)
# step 5
oatSampler.generateSample()
# display
tds.scan("*","","colsize=15 col=:2:2:")
This example produces:
****************************************************************************
* Row * tdsoat__n__iter * x1 * x2 * __nominal_set__ * __modified_att_ *
****************************************************************************
* 0 * 1 * 0 * 10 * 1 * -1 *
* 1 * 2 * -1 * 10 * 1 * 1 *
* 2 * 3 * 1 * 10 * 1 * 1 *
* 3 * 4 * 0 * 8 * 1 * 2 *
* 4 * 5 * 0 * 12 * 1 * 2 *
****************************************************************************
In the example above, we have two input factors: x1 and x2. Their nominal values are respectively 0.0 and 10.0, and their maximum variation ranges are 2.0 and 40% of 10.0, i.e. 4.0.
Tip
To indicate that the range of “x2” is a percentage of its nominal value, we simply need to set the third parameter of the setRange function to TRUE. This parameter is set to FALSE by default, which means that the value of the range is considered to be “absolute”.
The generated OAT design thus contains 5 experiments:
the reference, where x1 and x2 are set to their nominal values;
two variations of x1, where it equals -1.0 and 1.0 while x2 remains equal to 10.0;
two variations of x2, where it equals 8.0 and 12.0 while x1 is set back to 0.0;
It also contains two new attributes, automatically added by Uranie:
__nominal_set__: identifies which set of nominal values is used as a reference. In this case, we have only one set, thus __nominal_set__’s value remains equal to 1. This is further discussed in Multiple sets of nominal values
__modified_att__: identifies which factor has been modified in the current experiment. The value is the index of the corresponding attribute in the dataserver. A value equal to -1 means that all the factors have their nominal values.
Warning
The index of an attribute in the dataserver can be different from the one printed by the scan function, or inside an output file. To be certain to retrieve the correct number, always use the
TDataServer::getAttributeIndexfunction.