Project

General

Profile

RE: Pour utiliser mon DataBase » RepThPu_Example_CLASS.cpp

Lin Kevin, 02/28/2014 06:28 AM

 
1
using namespace std;
2

    
3

    
4
#include "CLASSHeaders.hxx"
5
#include <sstream>
6
#include <iomanip>
7
string dtoa(double num)
8
{
9
	ostringstream os(ostringstream::out);
10
	os<<setprecision(3)<<num;
11
	return os.str();
12
}
13

    
14
int main(int argc, char** argv)
15
{
16

    
17
	CLASS gCLASS;
18
	gCLASS.SetStockManagement(true);
19
	cSecond year = 3600*8766; // 3600*24*365.25;//Year duration in seconds
20
	gCLASS.SetTimeStep(year/4);
21
	
22
	
23
	cout << "DB Definition... \t" << endl;
24
	cout << "\t -decay \t" ;
25
	DataBank<ZAI>* DecayDB = new DataBank<ZAI>(gCLASS.GetLog(), "/home/justine/CLASS/DataBase/Decay.idx");
26
	gCLASS.SetDecayDataBase(DecayDB);
27
	cout << "\t...OK!" << endl;
28
	
29

    
30
	cout << "\t -Th+Pu \t" ;
31
	DataBank<IsotopicVector>* ThPu = new DataBank<IsotopicVector>(gCLASS.GetLog(), "/home/justine/CLASS/DataBase/REP_Th+Pu.idx");
32
	cout << "Calculation of Distance Parameters : " << endl;
33
	ThPu->SetDistanceType(0);//Use coefficient calculated by CLASS to estimate the distance between an Isotopic Vector and an EvolutionData from the MOX DataBank
34
	cout << "\t...OK!" << endl;
35

    
36
	cout << "\t -UOx \t" ;
37
	EvolutionData DB_REP_UOX = EvolutionData(gCLASS.GetLog(), "/home/justine/CLASS/DataBase/PWRUOX.dat");
38
	cout << "\t...OK!" << endl;
39
	cout << "DB Definition...\t \t \t...Done!" << endl; 
40

    
41
	cout << "Storage Definition... \t"<<endl  ;
42
	Storage *Stock = new Storage(gCLASS.GetLog());
43
	Stock->SetName("Stock");
44
	Storage *ReUsable = new Storage(gCLASS.GetLog());
45
	ReUsable->SetName("ReUsable");
46
	cout << "\t...OK!" << endl;
47
	
48
	cout << "Pool Definition... \t" <<endl ;
49
	Pool *Cooling_UOX = new Pool(gCLASS.GetLog(),Stock, gCLASS.GetAbsoluteTime(), (double)year*5 );
50
	Cooling_UOX->SetName("Cooling Pool for UOX");
51
	Pool *Cooling_ThPu = new Pool(gCLASS.GetLog(),Stock, gCLASS.GetAbsoluteTime(), (double)year*5 );
52
	Cooling_ThPu->SetName("Cooling Pool for ThPu");
53
	cout << "\t...OK!" << endl;
54

    
55
	cout << "FabricationPlant Definition... \t" <<endl ;
56
	FabricationPlant *FP_ThPu = new FabricationPlant(gCLASS.GetLog(),Stock, ReUsable);
57
	FP_ThPu->SetName("Fabrication Plant for ThPu");
58
	cout << "\t...OK!" << endl;
59

    
60

    
61
	//double UOX_Cycle = year*4;
62
	//double MOX_Cycle = year*4;
63
	
64
	cout << "Reactor Definition... \t"<<endl ;
65
	int nUOX=4;
66
	Reactor *REP_UOX[nUOX];
67
	int nThPu=1;
68
	Reactor *REP_ThPu[nThPu];
69

    
70
	for(int i=0;i<nUOX;i++){
71

    
72
	REP_UOX[i] = new Reactor(gCLASS.GetLog(),DB_REP_UOX, Cooling_UOX,0, year*40, 4250e6,120,45,0.8 ) ;
73
	string Name;
74
	Name="UOX "+dtoa(i);
75
	REP_UOX[i]->SetName(Name.c_str());
76
	}
77

    
78
	for(int i=0;i<nThPu;i++){
79
	string Name;
80
	REP_ThPu[i] = new Reactor(gCLASS.GetLog(), ThPu, FP_ThPu, Cooling_ThPu, year*40 , year*40, 4250e6, 120, 45,0.8);
81
	Name="ThPu "+dtoa(i);
82
	REP_ThPu[i]->SetName(Name.c_str());
83
	}
84

    
85
	cout << "\t...OK!" << endl;
86
	cout << endl << endl;
87

    
88
	cout << "Addind Phase : " << endl;
89
	cout << "\t -FabricationPlant" ;
90
	gCLASS.AddFabricationPlant(FP_ThPu);
91
	cout << "\t...OK!" << endl;
92

    
93
	cout << "\t -Pool \t\t" ;
94
	gCLASS.AddPool(Cooling_UOX);
95
	gCLASS.AddPool(Cooling_ThPu);
96
	cout << "\t...OK!" << endl;
97

    
98
	cout << "\t -Reactor \t\t" ;
99
		
100
		
101
	for(int i = 0; i< nUOX; i++ ) gCLASS.AddReactor(REP_UOX[i]);
102

    
103
	for(int i = 0; i< nThPu; i++ ) gCLASS.AddReactor(REP_ThPu[i]);
104
	
105
	cout << "...OK!" << endl;
106

    
107
	cout << "\t -Storage \t\t" ;
108
	gCLASS.AddStorage(Stock);
109

    
110
	gCLASS.AddStorage(ReUsable);
111

    
112
	cout << "...OK!" << endl;
113

    
114
	cout << "Addind Phase...\t \t \t...Done!" << endl;
115
	cout << endl << endl;
116
	
117

    
118

    
119
	cout << "Beginning the Evolution" << endl;
120
	gCLASS.Evolution((double)year*100);
121

    
122
}
123
//==========================================================================================
124
// Compilation
125
//==========================================================================================
126
/*
127

    
128
\rm CLASS* ; g++ -o CLASS_exec Example_CLASS.cpp -I $CLASS_include -L $CLASS_lib -lCLASSpkg `root-config --cflags` `root-config --libs` -fopenmp -lgomp -Wunused-result 
129

    
130

    
131
*/
(3-3/5)