From e0e629bc0af8263a1dabbde12d58cd76df06302d Mon Sep 17 00:00:00 2001
From: Baptiste Mouginot <mouginot.baptiste@gmail.com>
Date: Tue, 23 Jun 2015 15:06:40 +0000
Subject: [PATCH] XSM starting the map<string, MthPtr> keyword. Adding Electric
 Power to reactor and park

Cleaning in reactor the AddFuel() methods

git-svn-id: svn+ssh://svn.in2p3.fr/class@670 0e7d625b-0364-4367-a6be-d5be4a48d228
---
 source/trunk/Model/XS/XSM_MLP.cxx         | 28 ++++----
 source/trunk/Model/XS/XSM_MLP.hxx         |  4 --
 source/trunk/include/CLASSHeaders.hxx     |  2 +
 source/trunk/include/CLASSMethod.hxx      | 42 +++++++++++
 source/trunk/include/FabricationPlant.hxx |  4 +-
 source/trunk/include/Reactor.hxx          |  9 ++-
 source/trunk/include/Scenario.hxx         |  4 +-
 source/trunk/include/XSModel.hxx          | 25 ++++++-
 source/trunk/src/EvolutionData.cxx        | 19 +----
 source/trunk/src/Makefile                 |  4 +-
 source/trunk/src/Reactor.cxx              | 37 ++++++----
 source/trunk/src/Scenario.cxx             | 15 +---
 source/trunk/src/XSModel.cxx              | 86 +++++++++++++++++++++--
 13 files changed, 202 insertions(+), 77 deletions(-)
 create mode 100644 source/trunk/include/CLASSMethod.hxx

diff --git a/source/trunk/Model/XS/XSM_MLP.cxx b/source/trunk/Model/XS/XSM_MLP.cxx
index 1ae0e7f39..aae0883a9 100644
--- a/source/trunk/Model/XS/XSM_MLP.cxx
+++ b/source/trunk/Model/XS/XSM_MLP.cxx
@@ -96,22 +96,22 @@ void XSM_MLP::GetDataBaseInformation()
 			int pos=0;
 			if(foundRType != std::string::npos)
 			{	StringLine::NextWord(line,pos,':');
-				fDataBaseRType = atof( (StringLine::NextWord(line,pos,':')).c_str() );
+				fDBRType = atof( (StringLine::NextWord(line,pos,':')).c_str() );
 			}
 			 pos=0;
 			if(foundFType != std::string::npos)
 			{	StringLine::NextWord(line,pos,':');
-				fDataBaseFType = atof( (StringLine::NextWord(line,pos,':')).c_str() );
+				fDBFType = atof( (StringLine::NextWord(line,pos,':')).c_str() );
 			}
 			pos=0;
 			if(foundHM != std::string::npos)
 			{	StringLine::NextWord(line,pos,':');
-				fDataBaseHMMass = atof( (StringLine::NextWord(line,pos,':')).c_str() );
+				fDBHMMass = atof( (StringLine::NextWord(line,pos,':')).c_str() );
 			}
 			pos=0;
 			if(foundPower !=std::string::npos)
 			{	StringLine::NextWord(line,pos,':');
-				fDataBasePower = atof( (StringLine::NextWord(line,pos,':') ).c_str() );
+				fDBPower = atof( (StringLine::NextWord(line,pos,':') ).c_str() );
 			}
  			pos=0;
 			if(foundTime!=std::string::npos)
@@ -158,7 +158,7 @@ void XSM_MLP::GetDataBaseInformation()
 					ssline>>Z>>A>>I>>min>>max;
 					if(StringLine::IsDouble(Z) && StringLine::IsDouble(A) && StringLine::IsDouble(I) && StringLine::IsDouble(min) && StringLine::IsDouble(max) )
 					{	
-						fFreshFuelDomain.insert( pair<ZAI,pair<double,double> >(ZAI(atoi(Z.c_str()),atoi(A.c_str()),atoi(I.c_str())),make_pair(atof(min.c_str()),atof(max.c_str()))) );
+						fZAILimits.insert( pair<ZAI,pair<double,double> >(ZAI(atoi(Z.c_str()),atoi(A.c_str()),atoi(I.c_str())),make_pair(atof(min.c_str()),atof(max.c_str()))) );
 					}
 
 				}
@@ -177,8 +177,8 @@ void XSM_MLP::GetDataBaseInformation()
 
 	/********DEBUG*************************************/
 	INFO<<"\tMLP XS Data Base Information : "<<endl;
-	INFO<<"\t\tHeavy Metal (t) :"<<fDataBaseHMMass<<endl;
-	INFO<<"\t\tThermal Power (W) :"<<fDataBasePower<<endl;
+	INFO<<"\t\tHeavy Metal (t) :"<<fDBHMMass<<endl;
+	INFO<<"\t\tThermal Power (W) :"<<fDBPower<<endl;
 	INFO<<"\t\tTime (s) :"<<endl;
 	for (int i = 0; i < (int)fMLP_Time.size(); ++i)
 		INFO<<"\t\t\t"<<fMLP_Time[i]<<endl;
@@ -190,7 +190,7 @@ void XSM_MLP::GetDataBaseInformation()
 		INFO<<"\t\t\t"<< it->first.Z()<<" "<<it->first.A()<<" "<<it->second<<endl;
 
 	INFO<<"\t\tFuel range"<<endl;
-	for (map<ZAI,pair<double,double> >::iterator it_dom = fFreshFuelDomain.begin();it_dom!=fFreshFuelDomain.end();it_dom++)
+	for (map<ZAI,pair<double,double> >::iterator it_dom = fZAILimits.begin();it_dom!=fZAILimits.end();it_dom++)
 		INFO<<"\t\t\t"<< it_dom->second.first<<" <= "<<it_dom->first.Z()<<" "<<it_dom->first.A()<<" "<<it_dom->first.I()<<" <= "<<it_dom->second.second<<endl;;
 
 
@@ -377,10 +377,10 @@ EvolutionData XSM_MLP::GetCrossSectionsTime(IsotopicVector IV)
 
 	map<ZAI,TGraph*> ExtrapolatedXS[3];
 	/*************DATA BASE INFO****************/
-	EvolutionDataFromMLP.SetReactorType(fDataBaseRType);
-	EvolutionDataFromMLP.SetFuelType(fDataBaseFType);
-	EvolutionDataFromMLP.SetPower(fDataBasePower);
-	EvolutionDataFromMLP.SetHeavyMetalMass(fDataBaseHMMass);
+	EvolutionDataFromMLP.SetReactorType(fDBRType);
+	EvolutionDataFromMLP.SetFuelType(fDBFType);
+	EvolutionDataFromMLP.SetPower(fDBPower);
+	EvolutionDataFromMLP.SetHeavyMetalMass(fDBHMMass);
 	/************* The Cross sections***********/
 	for(int i=0;i<int(fWeightFiles.size());i++)
 	{
@@ -484,8 +484,8 @@ EvolutionData XSM_MLP::GetCrossSectionsStep(IsotopicVector IV)
 	/*************DATA BASE INFO****************/
 	EvolutionDataFromMLP.SetReactorType("PWR");
 	EvolutionDataFromMLP.SetFuelType("MOX");
-	EvolutionDataFromMLP.SetPower(fDataBasePower);
-	EvolutionDataFromMLP.SetHeavyMetalMass(fDataBaseHMMass);
+	EvolutionDataFromMLP.SetPower(fDBPower);
+	EvolutionDataFromMLP.SetHeavyMetalMass(fDBHMMass);
 
 	/************* The Cross sections***********/
 
diff --git a/source/trunk/Model/XS/XSM_MLP.hxx b/source/trunk/Model/XS/XSM_MLP.hxx
index 03570b303..eda1d1faa 100644
--- a/source/trunk/Model/XS/XSM_MLP.hxx
+++ b/source/trunk/Model/XS/XSM_MLP.hxx
@@ -97,10 +97,6 @@ class XSM_MLP : public XSModel
 	string fTMVAWeightFolder;	//!<  folder containing all the weight file
  	string fMLPInformationFile;	//!<  file containing Reactor Type, Fuel type, HM mass, Power, time vector, and TMVA input variables names (looks the manual for format details)
 	
-	double fDataBasePower;		//!<  Power of the data base (read from fMLPInformationFile )
- 	double fDataBaseHMMass;		//!<  Heavy metal mass of the data base (read from fMLPInformationFile )
- 	string fDataBaseFType;		//!<  Reactor Type (e.g PWR, FBR-Na, ADS..)
- 	string fDataBaseRType;		//!<  Fuel Type    (e.g MOX, UOX, ThU, ThPu ...)
 	
  	bool fIsStepTime;		//!<  true if one TMVA weihgt per step time is requiered otherwise it assumes time is part of the MLP inputs
 
diff --git a/source/trunk/include/CLASSHeaders.hxx b/source/trunk/include/CLASSHeaders.hxx
index 08575e6ac..8fb55cd2f 100755
--- a/source/trunk/include/CLASSHeaders.hxx
+++ b/source/trunk/include/CLASSHeaders.hxx
@@ -19,4 +19,6 @@
 #include "EvolutionData.hxx"
 #include "PhysicsModels.hxx"
 
+
+
 #endif
diff --git a/source/trunk/include/CLASSMethod.hxx b/source/trunk/include/CLASSMethod.hxx
new file mode 100644
index 000000000..b59391f9e
--- /dev/null
+++ b/source/trunk/include/CLASSMethod.hxx
@@ -0,0 +1,42 @@
+#ifndef _CLASSMETHOD_
+#define _CLASSMETHOD_
+
+#include <cmath>
+#include <iostream>
+#include <iomanip>
+#include <stdlib.h>
+#include <algorithm>
+
+struct my_tolower
+{
+	char operator()(char c) const
+	{
+		return std::tolower(static_cast<unsigned char>(c));
+	}
+};
+
+//To Lower Case, convert any string in lower case
+static std::string tlc(string data)
+{
+	transform(data.begin(), data.end(), data.begin(), my_tolower());
+	return data;
+};
+
+
+
+static float random(float a, float b) //peak random numebr between a and b
+{
+	float range = pow(2., 31);
+	srand(time(NULL)); //initialize the srand
+	return (float)a + (float)(b-a)*rand()/range;
+};
+
+static std::string dtoa(double num)
+{
+	std::ostringstream os(std::ostringstream::out);
+	os << setprecision(3) << num;
+	return os.str();
+};
+
+
+#endif
diff --git a/source/trunk/include/FabricationPlant.hxx b/source/trunk/include/FabricationPlant.hxx
index f4eda5669..23f753bfb 100644
--- a/source/trunk/include/FabricationPlant.hxx
+++ b/source/trunk/include/FabricationPlant.hxx
@@ -90,6 +90,7 @@ public :
 	 */
 	//@{
 
+#ifndef __CINT__
 	void SetDecayDataBank(DecayDataBank* decayDB) {fDecayDataBase = decayDB;}	//! Set the Decay DataBank
 
 	void SetFiFo(bool bval = true)	{ fFiFo = bval;}				//!< Set the chronological priority (true for chronological, false instead)
@@ -101,7 +102,6 @@ public :
 	void AddReactor(int reactorid, double creationtime)
 			{ fReactorNextStep.insert( pair<int,cSecond> (reactorid, (cSecond)creationtime-GetCycleTime() ) ); }	//!< Add a new reactor to be filled with the fresh fuel build by the FabricationPlant
 
-#ifndef __CINT__
 	void SetReUsableStorage(Storage* store) { fReUsable = store; fIsReusable = true;} //!< Set the Storage where all the separated matetial not used in the fabrication process will be sent. (if not present it goes to WASTE)
 #endif
 
@@ -124,8 +124,8 @@ public :
 	vector<Storage*>	GetFertileStorage()		{ return fFertileStorage; }		//!< Return the Pointer to the fertile Storage
 
 	EvolutionData GetReactorEvolutionDB(int ReactorId);			//!< Return the EvolutionData of Reactor ReactorId
-#endif
 	IsotopicVector GetDecay(IsotopicVector isotopicvector, cSecond t);	//!< Get IsotopicVector Decay at time t
+#endif
 
 	map<int, IsotopicVector >	GetReactorFuturIncome() const
 						{ return fReactorFuturIV;}	//!< Return the list of the futur fuel IV
diff --git a/source/trunk/include/Reactor.hxx b/source/trunk/include/Reactor.hxx
index f7d0f8452..e575438e7 100755
--- a/source/trunk/include/Reactor.hxx
+++ b/source/trunk/include/Reactor.hxx
@@ -266,11 +266,12 @@ class Reactor : public CLASSFacility
 	
 #ifndef __CINT__
 
-	void AddFuel(cSecond time,  CLASSFuel fuel, double BurnUp);	//!< Add A new CLASSFuel at the corresponding time and Burnup
+	void AddFuel(cSecond time,  CLASSFuel fuel, double BurnUp)	//!< Add A new CLASSFuel at the corresponding time and Burnup
+	{ fFuelPlan->AddFuel( time, fuel, BurnUp); }			//!< Add A new EvolutionData at the corresponding time and Burnup
 	void AddFuel(cSecond time,  EvolutionData* fuel, double BurnUp)
-	{ AddFuel( time, CLASSFuel(fuel), BurnUp); }			//!< Add A new EvolutionData at the corresponding time and Burnup
+	{ fFuelPlan->AddFuel( time, CLASSFuel(fuel), BurnUp); }			//!< Add A new EvolutionData at the corresponding time and Burnup
 	void AddFuel(cSecond time,  PhysicsModels* fuel, double BurnUp)
-	{ AddFuel( time, CLASSFuel(fuel), BurnUp); }			//!< Add A new Physicis Model at the corresponding time and Burnup
+	{ fFuelPlan->AddFuel( time, CLASSFuel(fuel), BurnUp); }			//!< Add A new EvolutionData at the corresponding time and Burnup
 #endif
 
 	//@}
@@ -285,6 +286,8 @@ class Reactor : public CLASSFacility
 	//********* Internal Parameter *********//
 	
 	double 		fPower;			///< Power (in Watt)
+	double 		fElectricPower;		///< ElectrocPower (in Watt)
+	double 		fEfficiencyFactor;	///< ElectrocPower (in Watt)
 	
 	IsotopicVector	fIVBeginCycle;		///< Fuel IV at the beginning of a cycle
 	IsotopicVector	fIVInCycle;		///< IVBegin add at the beginning of the cycle
diff --git a/source/trunk/include/Scenario.hxx b/source/trunk/include/Scenario.hxx
index 42b15471c..1b1509d2d 100755
--- a/source/trunk/include/Scenario.hxx
+++ b/source/trunk/include/Scenario.hxx
@@ -227,7 +227,8 @@ class Scenario : public CLASSObject
 	void AddOutIncome(IsotopicVector isotopicvector){ fOutIncome.Add(isotopicvector); }	//!< Add a isotopicVector to OutIncomeIncome
 	void AddWaste(ZAI zai, double quantity)		{ AddWaste(zai*quantity); }		//!< Add a ZAI*quantity to Waste
 	void AddWaste(IsotopicVector isotopicvector)	{ fWaste.Add(isotopicvector); }		//!< Add a isotopicVector to Waste
-	void AddToPower(double power)			{ fParcPower += power;}			//!< Add power to the installed power in the Parc
+	void AddToPower(double power, double elpower)	{ fParcPower += power; fParcElectricPower += elpower; }
+											//!< Add power to the installed power in the Parc
 	
 	
 	void ApplyZAIThreshold();
@@ -302,6 +303,7 @@ class Scenario : public CLASSObject
 	IsotopicVector	fIVInCycleTotal;	///< Sum of all IV in the cycle (without Waste) IV
 	IsotopicVector	fIVTotal;		///< Sum of all IV in the parc (including Waste) IV
 	double		fParcPower;		///< Sum of the Power of all reactor in the parc
+	double		fParcElectricPower;		///< Sum of the Power of all reactor in the parc
 	
 };
 
diff --git a/source/trunk/include/XSModel.hxx b/source/trunk/include/XSModel.hxx
index 73b326797..bd522cce4 100644
--- a/source/trunk/include/XSModel.hxx
+++ b/source/trunk/include/XSModel.hxx
@@ -14,11 +14,18 @@
 #include "EvolutionData.hxx"
 #include "CLASSObject.hxx"
 
+#include <iostream>
+#include <map>
 
 using namespace std;
 
 class IsotopicVector;
 
+class XSModel;
+#ifndef __CINT__
+typedef void (XSModel::*MthPtr)( const string & ) ;
+#endif
+
 //-----------------------------------------------------------------------------//
 //!  Defines a mean cross section predictor
 
@@ -83,13 +90,29 @@ class XSModel : public CLASSObject
 	virtual  bool isIVInDomain(IsotopicVector IV) ;
 	//@}
 	
+	void ReadZAIlimits(const string &line);
+	void ReadType(const string &line);
+	void ReadRParam(const string &line);
+	
+	void LoadKeyword();
 	
 	
 	void SetZAIThreshold(int Z_Threshold){fZAIThreshold = Z_Threshold;}//!< Set the Z threshold : ZAI with Z < fZAIThreshold are not manage by CLASS
 	int  GetZAIThreshold(){return fZAIThreshold;}//!< Get the Z threshold
 
 	protected :
-	map< ZAI, pair<double,double> > fFreshFuelDomain; //!< Fresh fuel range : map<ZAI<min edge ,max edge >>
+	
+	double fDBPower;		//!<  Power of the data base (read from fMLPInformationFile )
+	double fDBHMMass;		//!<  Heavy metal mass of the data base (read from fMLPInformationFile )
+	string fDBFType;		//!<  Fuel Type    (e.g MOX, UOX, ThU, ThPu ...)
+	string fDBRType;		//!<  Reactor Type (e.g PWR, FBR-Na, ADS..)
+
+	map< ZAI, pair<double,double> > fZAILimits; //!< Fresh fuel range : map<ZAI<min edge ,max edge >>
+	
+#ifndef __CINT__
+	map<string, MthPtr> fKeyword;
+#endif
+	
 	int fZAIThreshold;	//!< Z threshold for handling nuclei mean cross section (take only ZAI reaction of Z>=fZAIThresold)
 };
 
diff --git a/source/trunk/src/EvolutionData.cxx b/source/trunk/src/EvolutionData.cxx
index 50e5280c2..6be228a73 100755
--- a/source/trunk/src/EvolutionData.cxx
+++ b/source/trunk/src/EvolutionData.cxx
@@ -1,4 +1,5 @@
 #include "EvolutionData.hxx"
+#include "CLASSMethod.hxx"
 
 #include "CLASSLogger.hxx"
 #include "CLASSConstante.hxx"
@@ -22,24 +23,6 @@
 	//________________________________________________________________________
 
 
-
-struct my_tolower
-{
-	char operator()(char c) const
-	{
-		return std::tolower(static_cast<unsigned char>(c));
-	}
-};
-
-	//To Lower Case, convert any string in lower case
-string tlc(string data)
-{
-	transform(data.begin(), data.end(), data.begin(), my_tolower());
-	return data;
-}
-
-
-
 double 	Distance(IsotopicVector IV1, EvolutionData Evd1 )
 {
 
diff --git a/source/trunk/src/Makefile b/source/trunk/src/Makefile
index bfa87aee7..7822b65ff 100755
--- a/source/trunk/src/Makefile
+++ b/source/trunk/src/Makefile
@@ -69,9 +69,9 @@ ROOTOBJS	= 	CLASSLogger.o \
 
 
 CXX           = g++
-CXXFLAGS      = -O2 -g -Wall -fopenmp -fPIC -I$(LOCALINC) $(ROOTCFLAGS)
+CXXFLAGS      = -O2 -g -fopenmp -fPIC -I$(LOCALINC) $(ROOTCFLAGS)
 LD            = g++
-LDFLAGS       =  -g -Wall -fPIC $(ROOTLIBS) -lTMVA -shared -lgomp
+LDFLAGS       =  -g -fPIC $(ROOTLIBS) -lTMVA -shared -lgomp
 
 all:		$(OBJS) $(OBJMODEL)
 		$(LD) $(LDFLAGS) $(OBJS) $(OBJMODEL) -o $(LIBDIR)/lib$(LIBNAME).so
diff --git a/source/trunk/src/Reactor.cxx b/source/trunk/src/Reactor.cxx
index 2ee9f4f3d..401e285f6 100755
--- a/source/trunk/src/Reactor.cxx
+++ b/source/trunk/src/Reactor.cxx
@@ -34,6 +34,7 @@ Reactor::Reactor():CLASSFacility(4)
 	fOutBackEndFacility = 0;
 	fStorage = 0;
 	fFabricationPlant = 0;
+	fFuelPlan = 0;
 
 }
 
@@ -44,6 +45,7 @@ Reactor::Reactor(CLASSLogger* log):CLASSFacility(log, 4)
 	fOutBackEndFacility = 0;
 	fStorage = 0;
 	fFabricationPlant = 0;
+	fFuelPlan = 0;
 	SetName("R_Reactor.");
 
 	DBGL
@@ -72,6 +74,9 @@ Reactor::Reactor(CLASSLogger* log,
 	fOutBackEndFacility = Pool;
 
 	fPower = power * CapacityFactor;
+	fEfficiencyFactor = 0.33;
+	fElectricPower = fEfficiencyFactor*fPower;
+	
 
 	fHeavyMetalMass = HMMass;
 
@@ -118,6 +123,9 @@ Reactor::Reactor(CLASSLogger* log,
 	fBurnUp = -1;
 	fHeavyMetalMass = HMMass;
 	fPower = Power*CapacityFactor;
+	fEfficiencyFactor = 0.33;
+	fElectricPower = fEfficiencyFactor*fPower;
+	
 	fCycleTime = -1;	 //BU in GWd/t
 
 	fFuelPlan = 0;
@@ -159,6 +167,8 @@ Reactor::Reactor(CLASSLogger* log, PhysicsModels* fueltypeDB, FabricationPlant*
 	fBurnUp = BurnUp;
 	fHeavyMetalMass = HMMass;
 	fPower = Power*CapacityFactor;
+	fEfficiencyFactor = 0.33;
+	fElectricPower = fEfficiencyFactor*fPower;
 	fCycleTime = (cSecond) (fBurnUp*1e9 / (fPower)  * fHeavyMetalMass  *3600*24);	 //BU in GWd/t
 
 	fFuelPlan = new CLASSFuelPlan(log);
@@ -203,7 +213,9 @@ Reactor::Reactor(CLASSLogger* log, PhysicsModels* 	fueltypeDB,
 
 	fOutBackEndFacility = Pool;
 	fPower = BurnUp*3600.*24. / (fCycleTime) * HMMass *1e9; //BU in GWd/t
-
+	fEfficiencyFactor = 0.33;
+	fElectricPower = fEfficiencyFactor*fPower;
+	
 	fFuelPlan = new CLASSFuelPlan(log);
 	fFuelPlan->AddFuel(creationtime, CLASSFuel(fueltypeDB), fBurnUp);
 
@@ -246,7 +258,9 @@ Reactor::Reactor(CLASSLogger* log, EvolutionData* evolutivedb,
 	fOutBackEndFacility = Pool;
 
 	fPower = power * CapacityFactor;
-
+	fEfficiencyFactor = 0.33;
+	fElectricPower = fEfficiencyFactor*fPower;
+	
 	fHeavyMetalMass = HMMass;
 
 	double M0 = cZAIMass.GetMass( evolutivedb->GetIsotopicVectorAt(0.).GetActinidesComposition() );
@@ -297,7 +311,9 @@ Reactor::Reactor(CLASSLogger* log, EvolutionData* evolutivedb,
 	fOutBackEndFacility = Pool;
 
 	fPower = BurnUp*3600.*24. / (fCycleTime) * HMMass *1e9; //BU in GWd/t
-
+	fEfficiencyFactor = 0.33;
+	fElectricPower = fEfficiencyFactor*fPower;
+	
 	fHeavyMetalMass = HMMass;
 
 	double M0 = cZAIMass.GetMass( evolutivedb->GetIsotopicVectorAt(0.).GetActinidesComposition() );
@@ -311,6 +327,7 @@ Reactor::Reactor(CLASSLogger* log, EvolutionData* evolutivedb,
 	fIVOutCycle = fEvolutionDB.GetIsotopicVectorAt( (cSecond)(fCycleTime/fEvolutionDB.GetPower()*fPower) );
 
 
+	fFuelPlan = new CLASSFuelPlan(log);
 	fFuelPlan->AddFuel(creationtime, CLASSFuel(evolutivedb), fBurnUp);
 
 	INFO << " A Reactor has been define :" << endl;
@@ -407,12 +424,12 @@ DBGL
 
 	if( fIsShutDown  || t < GetCreationTime() ) return; // Reactor stop or not started...
 
-	if(Norme(fInsideIV)!=0)
+	if(Norme(fInsideIV)!=0 && fIsStarted)
 	{
 #pragma omp critical(ParcPowerUpdate)
-		{GetParc()->AddToPower(fPower);}
+		{GetParc()->AddToPower(fPower, fElectricPower);}
 	}
-	else if(fIsStarted==true)
+	else if(fIsStarted)
 	{
 		WARNING << " Reactor should be working but have no Heavy Nucleus Inside. It's not working so have a zero power..."
 		<< " Time : "<< t/cYear << " years" << endl;
@@ -603,14 +620,6 @@ DBGL
 }
 
 
-//________________________________________________________________________
-void Reactor::AddFuel(cSecond time,  CLASSFuel fuel, double BurnUp)
-{
-	DBGL
-	fFuelPlan->AddFuel(time, fuel, BurnUp);
-	DBGL
-}
-
 
 //________________________________________________________________________
 cSecond Reactor::GetNextCycleTime(cSecond time)
diff --git a/source/trunk/src/Scenario.cxx b/source/trunk/src/Scenario.cxx
index 10de9170f..834521f24 100755
--- a/source/trunk/src/Scenario.cxx
+++ b/source/trunk/src/Scenario.cxx
@@ -1,4 +1,5 @@
 #include "Scenario.hxx"
+#include "CLASSMethod.hxx"
 
 #include <ctime>
 #include "time.h"
@@ -30,19 +31,6 @@
 
 
 
-float random(float a, float b) //peak random numebr between a and b
-{
-	float range = pow(2., 31);
-	srand(time(NULL)); //initialize the srand
-	return (float)a + (float)(b-a)*rand()/range;
-}
-
-string dtoa(double num)
-{
-	ostringstream os(ostringstream::out);
-	os<<setprecision(3)<<num;
-	return os.str();
-}
 
 //________________________________________________________________________
 Scenario::Scenario(CLASSLogger* log, cSecond abstime):CLASSObject(log)
@@ -627,6 +615,7 @@ void Scenario::ReactorEvolution()
 {
 	DBGL
 	fParcPower = 0;
+	fParcElectricPower = 0;
 #pragma omp parallel for
 	for(int i = 0; i < (int)fReactor.size(); i++)
 		fReactor[i]->Evolution(fAbsoluteTime);
diff --git a/source/trunk/src/XSModel.cxx b/source/trunk/src/XSModel.cxx
index 8f6aa2ee5..1522534f5 100644
--- a/source/trunk/src/XSModel.cxx
+++ b/source/trunk/src/XSModel.cxx
@@ -7,25 +7,101 @@
 //
 
 #include "XSModel.hxx"
+#include "StringLine.hxx"
+#include "CLASSMethod.hxx"
+
 
 using namespace std;
 
+
+
 XSModel::XSModel():CLASSObject()
 {
-
+	LoadKeyword();
 }
 
 
 XSModel::XSModel(CLASSLogger* log):CLASSObject(log)
 {
-
+	LoadKeyword();
 }	
 
+void XSModel::LoadKeyword()
+{
+	DBGL
+	fKeyword.insert( pair<string, MthPtr>( "k_zail",	& XSModel::ReadZAIlimits));
+	fKeyword.insert( pair<string, MthPtr>( "k_reactor",	& XSModel::ReadType)	);
+	fKeyword.insert( pair<string, MthPtr>( "k_fuel",	& XSModel::ReadType)	);
+	fKeyword.insert( pair<string, MthPtr>( "k_mass",	& XSModel::ReadRParam)	);
+	fKeyword.insert( pair<string, MthPtr>( "k_power",	& XSModel::ReadRParam)	);
+	DBGL
+}
+
+void XSModel::ReadRParam(const string &line)
+{
+	DBGL
+	int start = 0;
+	string type = tlc(StringLine::NextWord(line, start, ' '));
+	if( type != "k_power" || type != "k_mass" )	// Check the keyword
+	{
+		ERROR << " Bad keyword : " << type << " Not found !" << endl;
+		exit(1);
+	}
+	if( type == "k_mass" )
+		fDBHMMass = atof(StringLine::NextWord(line, start, ' ').c_str());
+	else if( type == "k_mass" )
+		fDBPower = atof(StringLine::NextWord(line, start, ' ').c_str());
+	
+	DBGL
+}
+
+
+void XSModel::ReadType(const string &line)
+{
+	DBGL
+	int start = 0;
+	string type = tlc(StringLine::NextWord(line, start, ' '));
+	if( type != "k_fuel" || type != "k_reactor" )	// Check the keyword
+	{
+		ERROR << " Bad keyword : " << type << " Not found !" << endl;
+		exit(1);
+	}
+	if( type == "k_fuel" )
+		fDBFType = StringLine::NextWord(line, start, ' ');
+	else if( type == "k_reactor" )
+		fDBRType = StringLine::NextWord(line, start, ' ');
+
+	DBGL
+}
+
+
+void XSModel::ReadZAIlimits(const string &line)
+{
+	DBGL
+	int start = 0;
+	if( tlc(StringLine::NextWord(line, start, ' ')) != "k_zail" )	// Check the keyword
+	{
+		ERROR << " Bad keyword : \"k_zail\" not found !" << endl;
+		exit(1);
+	}
+	
+	int Z = atoi(StringLine::NextWord(line, start, ' ').c_str());
+	int A = atoi(StringLine::NextWord(line, start, ' ').c_str());
+	int I = atoi(StringLine::NextWord(line, start, ' ').c_str());
+	
+	double upLimit = atof(StringLine::NextWord(line, start, ' ').c_str());
+	double downLimit = atof(StringLine::NextWord(line, start, ' ').c_str());
+	
+	DBGL
+}
+
+
 bool XSModel::isIVInDomain(IsotopicVector IV)
-{DBGL
+{
+DBGL
 	bool IsInDomain=true;
 
-	if(fFreshFuelDomain.empty())
+	if(fZAILimits.empty())
 	{
 	 WARNING << "Fresh Fuel variation domain is not set" << endl;
 	 WARNING << "CLASS has no clue if the computed evolution for this fresh fuel is correct" << endl;
@@ -36,7 +112,7 @@ bool XSModel::isIVInDomain(IsotopicVector IV)
 	else
 	{ 
 		IsotopicVector IVNorm = IV /IV.GetSumOfAll();
-		for (map< ZAI,pair<double,double> >::iterator Domain_it=fFreshFuelDomain.begin(); Domain_it!=fFreshFuelDomain.end(); Domain_it++)
+		for (map< ZAI,pair<double,double> >::iterator Domain_it=fZAILimits.begin(); Domain_it!=fZAILimits.end(); Domain_it++)
 		{		
 			double ThatZAIProp = IVNorm.GetIsotopicQuantity()[Domain_it->first]	;
 			double ThatZAIMin  = Domain_it->second.first;
-- 
GitLab