From 9c28b983eaa948c7249529a93009b33b0cc3941d Mon Sep 17 00:00:00 2001
From: Baptiste Mouginot <mouginot.baptiste@gmail.com>
Date: Fri, 19 Jun 2015 21:11:04 +0000
Subject: [PATCH] Adding few method for reactor... (AddFuel...)

git-svn-id: svn+ssh://svn.in2p3.fr/class@669 0e7d625b-0364-4367-a6be-d5be4a48d228
---
 source/trunk/include/CLASSFacility.hxx        | 13 +++++++----
 source/trunk/include/CLASSNucleiFiliation.hxx |  4 ++--
 source/trunk/include/Reactor.hxx              | 11 ++++++++-
 source/trunk/src/CLASSFacility.cxx            |  2 +-
 source/trunk/src/CLASSNucleiFiliation.cxx     |  5 ++--
 source/trunk/src/EquivalenceModel.cxx         |  2 +-
 source/trunk/src/Reactor.cxx                  | 23 +++++++++++++++++++
 source/trunk/src/Scenario.cxx                 |  2 +-
 source/trunk/src/SeparationPlant.cxx          |  8 ++-----
 9 files changed, 51 insertions(+), 19 deletions(-)

diff --git a/source/trunk/include/CLASSFacility.hxx b/source/trunk/include/CLASSFacility.hxx
index 8950b40a2..e51ff9bb7 100644
--- a/source/trunk/include/CLASSFacility.hxx
+++ b/source/trunk/include/CLASSFacility.hxx
@@ -159,11 +159,14 @@ public :
 
 
 	void SetInsideIV(IsotopicVector isotopicvector)	{ fInsideIV = isotopicvector; }	//!< Set the IV inside the Facility
-	void SetCreationTime(double creationtime)	{ fCreationTime = (cSecond)creationtime;} //!< Set the creation Time
-	void SetLifeTime(double lifetime)		{ fLifeTime = (cSecond)lifetime; }	//!< Set the life time of the facility
-	virtual void SetCycleTime(double cycletime)	{ fCycleTime = (cSecond)cycletime; }	//!< Set the cycle time (Cycle of the loading Plan)
-	void SetInCycleTime(double incycletime)		{ fInCycleTime = (cSecond)incycletime; fIsStarted = true; }	//!< Set the cycle time (Cycle of the loading Plan)
-	void SetInternalTime(double internaltime)	{ fInternalTime = (cSecond)internaltime; }	//!< Set the cycle time (Cycle of the loading Plan)
+
+	void SetCreationTime(cSecond CTtime)	{ fCreationTime = CTtime;}		//!< Set the creation Time
+	void SetLifeTime(cSecond Ltime)		{ fLifeTime = Ltime; }			//!< Set the life time of the facility
+	void SetShutDownTime(cSecond SDTime)	{ fLifeTime = SDTime-fCreationTime; }	//!< Set the shutdown time of the facility
+
+	void SetInCycleTime(cSecond ICtime)	{ fInCycleTime = ICtime; fIsStarted = true; }	//!< Set the In cycle time
+	void SetInternalTime(cSecond INtime)	{ fInternalTime = INtime; }		//!< Set the Internal Time
+	virtual void SetCycleTime(cSecond Ctime){ fCycleTime = Ctime; }			//!< Set the cycle time (Cycle of the loading Plan)
 
 	//@}
 
diff --git a/source/trunk/include/CLASSNucleiFiliation.hxx b/source/trunk/include/CLASSNucleiFiliation.hxx
index 47e4ffee2..46e6b2d4b 100644
--- a/source/trunk/include/CLASSNucleiFiliation.hxx
+++ b/source/trunk/include/CLASSNucleiFiliation.hxx
@@ -79,7 +79,7 @@ public:
 	ZAI GetArtificialDecay(ZAI Mother);			//!< Make an artificial and instantaneus decay of the ZAI, (desexcitation, or Beta decay)
 	
 	
-	void SetNucleiFIliation(map<ZAI, IsotopicVector> Fiiliation) { fNucleiFiliation = Fiiliation;}	//!< Return the full filiation list
+	void SetNucleiFIliation(map<ZAI, IsotopicVector> Fiiliation) { fNucleiFiliation = Fiiliation;}	//!< Set the full filiation list
 
 	//}
 	
@@ -103,7 +103,7 @@ public:
 	
 	void FiliationCleanUp(map<ZAI, int> GoodNuclei, CLASSNucleiFiliation CuttedNuclei);	//!< Cutting all pathway until each path ends on a nuclei in the GoodList following the CuttedNuclei. If nuclei are neither in the GoodNuclei list or in CuttedNuclei, then artificial decay are performed
 	
-	void SelfFiliationCleanUp(map<ZAI, int> GoodNuclei);	//!< Cutting all the pathway ending on a nuclei not present as a motehr nuclei
+	void SelfFiliationCleanUp(map<ZAI, int> GoodNuclei);	//!< Cutting all the pathway ending on a nuclei not present as a mother nuclei
 	
 	void NormalizeBranchingRatio(double Value = 1);		//!< Normalization of all the branching ratio to 1
 	
diff --git a/source/trunk/include/Reactor.hxx b/source/trunk/include/Reactor.hxx
index 9728d9f3d..f7d0f8452 100755
--- a/source/trunk/include/Reactor.hxx
+++ b/source/trunk/include/Reactor.hxx
@@ -194,7 +194,7 @@ class Reactor : public CLASSFacility
 	IsotopicVector	GetIVInCycle()		const	{ return fIVInCycle; }		//!< Return the In Cycle IV
 	//!< (Note : IVIn != IVBegin, only if using charging plan)
 	
-	
+	cSecond GetNextCycleTime(cSecond time);
 	
 	bool	IsFuelFixed()	const	{ return fFixedFuel; }		//!< True if using fixed fuel, False otherwise
 	double	GetHeavyMetalMass() const { return fHeavyMetalMass; }	//!< Return the HeavyMetal Mass in the Core at the begining of the cycle
@@ -264,6 +264,15 @@ class Reactor : public CLASSFacility
 	void Dump();								//!< Write modification (IV In/Out, filling the TF...)
 	void SetNewFuel(EvolutionData ivdb);					//!< Change the Evolutive DB of the Reactor
 	
+#ifndef __CINT__
+
+	void AddFuel(cSecond time,  CLASSFuel fuel, double BurnUp);	//!< Add A new CLASSFuel 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
+	void AddFuel(cSecond time,  PhysicsModels* fuel, double BurnUp)
+	{ AddFuel( time, CLASSFuel(fuel), BurnUp); }			//!< Add A new Physicis Model at the corresponding time and Burnup
+#endif
+
 	//@}
 	
 	
diff --git a/source/trunk/src/CLASSFacility.cxx b/source/trunk/src/CLASSFacility.cxx
index eca60a50e..e2c19f2c2 100644
--- a/source/trunk/src/CLASSFacility.cxx
+++ b/source/trunk/src/CLASSFacility.cxx
@@ -58,7 +58,7 @@ CLASSFacility::CLASSFacility(CLASSLogger* log, cSecond creationtime, cSecond lif
 
 	fFacilityType = type;
 	
-	fInternalTime = 0;
+	fInternalTime = fCreationTime;
 	fInCycleTime = 0;
 	fCycleTime = -1;
 	
diff --git a/source/trunk/src/CLASSNucleiFiliation.cxx b/source/trunk/src/CLASSNucleiFiliation.cxx
index 481b6e915..f7ab8d038 100644
--- a/source/trunk/src/CLASSNucleiFiliation.cxx
+++ b/source/trunk/src/CLASSNucleiFiliation.cxx
@@ -134,7 +134,7 @@ ZAI CLASSNucleiFiliation::GetArtificialDecay(ZAI Mother)
 		return ZAI(Z,A,I-1);
 	else
 	{
-		//Coef Ac & As of Bette & Weisacker are approximativ but enough precise for this application....
+		//Coef Ac & As of Bette & Weisacker are approximativ but precise enough for this application....
 		double Ac = 0.695;
 		double As = 23.2;
 		
@@ -208,7 +208,8 @@ void CLASSNucleiFiliation::SelfFiliationCleanUp(map<ZAI, int> GoodNuclei)
 			
 		}
 		fNucleiFiliation = CopyfNucleiFiliation;
-			Cleaned = true;
+		Cleaned = true;
+		
 		for(it_Filiation = fNucleiFiliation.begin(); it_Filiation != fNucleiFiliation.end(); it_Filiation++) // Loop on the mother ZAI
 		{
 			vector<ZAI> DautherList = it_Filiation->second.GetZAIList(); // Get the list of daughter ZAI
diff --git a/source/trunk/src/EquivalenceModel.cxx b/source/trunk/src/EquivalenceModel.cxx
index 2d30a29bd..4d6413ee8 100644
--- a/source/trunk/src/EquivalenceModel.cxx
+++ b/source/trunk/src/EquivalenceModel.cxx
@@ -88,7 +88,7 @@ bool EquivalenceModel::Build_Fuel_According_Lambda(vector<double> &lambda,vector
 	
 	SetLambda(lambda, (int)FissilArray.size(), (int)lambda.size()-1, LAMBDA_FERTILE);
 	
-	int j=-1;
+	int j = -1;
 	Fertile.Clear();
 	for(int i = (int)FissilArray.size() ; i < (int)FissilArray.size()+(int)FertilArray.size() ; i++)
 	{
diff --git a/source/trunk/src/Reactor.cxx b/source/trunk/src/Reactor.cxx
index e2281c8e9..2ee9f4f3d 100755
--- a/source/trunk/src/Reactor.cxx
+++ b/source/trunk/src/Reactor.cxx
@@ -603,5 +603,28 @@ DBGL
 }
 
 
+//________________________________________________________________________
+void Reactor::AddFuel(cSecond time,  CLASSFuel fuel, double BurnUp)
+{
+	DBGL
+	fFuelPlan->AddFuel(time, fuel, BurnUp);
+	DBGL
+}
+
 
+//________________________________________________________________________
+cSecond Reactor::GetNextCycleTime(cSecond time)
+{
+	DBGL
+	cSecond LastCycle = fInternalTime - fInCycleTime;
+
+	while ( LastCycle < time)
+	{
+		cSecond cycletime = (cSecond)(fFuelPlan->GetFuelAt(LastCycle).second*1e9 / (fPower)  * fHeavyMetalMass  *3600*24);
+		LastCycle += cycletime;
+	}
+	
+	DBGL
+	return LastCycle;
+}
 
diff --git a/source/trunk/src/Scenario.cxx b/source/trunk/src/Scenario.cxx
index c69615326..10de9170f 100755
--- a/source/trunk/src/Scenario.cxx
+++ b/source/trunk/src/Scenario.cxx
@@ -488,7 +488,7 @@ void Scenario::BuildTimeVector(cSecond t)
 		}
 
 
-		while(step <= t && step <= R_ShutDownTime )
+		while( step <= t && step <= R_ShutDownTime )
 		{
 			DBGL
 
diff --git a/source/trunk/src/SeparationPlant.cxx b/source/trunk/src/SeparationPlant.cxx
index c9781b914..00cae400e 100644
--- a/source/trunk/src/SeparationPlant.cxx
+++ b/source/trunk/src/SeparationPlant.cxx
@@ -75,6 +75,7 @@ void SeparationPlant::SetBackEndDestination(CLASSBackEnd* storagedestination, Is
 }
 
 
+//________________________________________________________________________
 void SeparationPlant::AddIV(IsotopicVector IV)
 { 
 DBGL
@@ -103,6 +104,7 @@ DBGL
 
 
 
+//________________________________________________________________________
 map<cSecond,int> SeparationPlant::GetTheBackEndTimePath()
 {
 	DBGL
@@ -131,11 +133,5 @@ map<cSecond,int> SeparationPlant::GetTheBackEndTimePath()
 
 
 //________________________________________________________________________
-//	Time Action with the reste of the Universe : 
-//		Out Storage
-//		Evolution : 
-//			Cooling
-//________________________________________________________________________
-
 
 
-- 
GitLab