13.3.1. Macro “samplingFlowrate.C”
13.3.1.1. Objective
The objective of this macro is to generate a design-of-experiments, of length 100 using the LHS method, with eight random attributes (\(r_{\omega}\), \(r\), \(T_u\), \(T_l\), \(H_u\), \(H_l\), \(L\), \(K_{\omega}\)) which obey uniform laws on specific intervals.
13.3.1.2. Macro Uranie
// Define the DataServer
TDataServer *tds = new TDataServer("tdsFlowrate", "Design of experiments for Flowrate");
Int_t nS = 1000;
// Add the study attributes
tds->addAttribute( new TUniformDistribution("rw", 0.05, 0.15));
tds->addAttribute( new TUniformDistribution("r", 100.0, 50000.0));
tds->addAttribute( new TUniformDistribution("tu", 63070.0, 115600.0));
tds->addAttribute( new TUniformDistribution("tl", 63.1, 116.0));
tds->addAttribute( new TUniformDistribution("hu", 990.0, 1110.0));
tds->addAttribute( new TUniformDistribution("hl", 700.0, 820.0));
tds->addAttribute( new TUniformDistribution("l", 1120.0, 1680.0));
tds->addAttribute( new TUniformDistribution("kw", 9855.0, 12045.0));
// test Generateur de plan d'experience
TSampling * sampling = new TSampling(tds, "lhs", nS);
sampling->generateSample();
tds->exportData("_flowrate_sampler_.dat");
// Visualisation
TCanvas *Canvas = new TCanvas("Canvas", "Graph for the Macro samplingFlowrate",5,64,1270,667);
gStyle->SetPalette(1);
TPad *pad = new TPad("pad","pad",0, 0.03, 1, 1); pad->Draw();
pad->Divide(2, 2);
pad->cd(1); tds->draw("r");
pad->cd(2); tds->draw("rw");
pad->cd(3); tds->drawTufte("rw:r");
pad->cd(4); tds->draw("rw:r:hu");
An uniform law is set for each attribute and then, linked to a the TDataServer:
tds->addAttribute( new TUniformDistribution("rw", 0.05, 0.15));
tds->addAttribute( new TUniformDistribution("r", 100.0, 50000.0));
tds->addAttribute( new TUniformDistribution("tu", 63070.0, 115600.0));
tds->addAttribute( new TUniformDistribution("tl", 63.1, 116.0));
tds->addAttribute( new TUniformDistribution("hu", 990.0, 1110.0));
tds->addAttribute( new TUniformDistribution("hl", 700.0, 820.0));
tds->addAttribute( new TUniformDistribution("l", 1120.0, 1680.0));
tds->addAttribute( new TUniformDistribution("kw", 9855.0, 12045.0));
The sampling is generated with the LHS method:
TSampling * sampling = new TSampling(tds, "lhs", nS);
sampling->generateSample();
Data are exported in an ASCII file:
tds->exportData("_flowrate_sampler_.dat");
13.3.1.3. Graph
Figure 13.9 Graph of the macro “samplingFlowrate.C”