From 24f5034ca03ceb5ed416a3523a36445022dc5a98 Mon Sep 17 00:00:00 2001
From: Baptiste Mouginot <mouginot.baptiste@gmail.com>
Date: Fri, 24 Jan 2014 11:09:13 +0000
Subject: [PATCH] Add cumulative In and Out in each facto

git-svn-id: svn+ssh://svn.in2p3.fr/class@187 0e7d625b-0364-4367-a6be-d5be4a48d228
---
 source/trunk/include/CLASS.hxx        |  2 ++
 source/trunk/include/CLSSFacility.hxx | 12 +++++++++---
 source/trunk/src/FabricationPlant.cxx |  8 +++++++-
 source/trunk/src/Pool.cxx             |  8 ++++++--
 source/trunk/src/Reactor.cxx          | 12 ++++++++++++
 source/trunk/src/Storage.cxx          |  8 ++++++++
 6 files changed, 44 insertions(+), 6 deletions(-)

diff --git a/source/trunk/include/CLASS.hxx b/source/trunk/include/CLASS.hxx
index dad59aade..1b6cbc57b 100755
--- a/source/trunk/include/CLASS.hxx
+++ b/source/trunk/include/CLASS.hxx
@@ -148,6 +148,8 @@ protected :
 	IsotopicVector	fTotalCooling;		///< Sum of all IV in Cooling IV
 	IsotopicVector	fFuelFabrication;	///< Sum of all IV in Fabrication IV
 	IsotopicVector	fTotalInReactor;	///< Sum of all IV in Reactor IV
+
+
 	IsotopicVector	fIVInCycleTotal;	///< Summ of all IV in the cycle (without Waste) IV
 	IsotopicVector	fIVTotal;		///< Summ of all IV in the parc (including Waste) IV
 	double		fParcPower;		///< Summ of the Power of all reactor in the parc
diff --git a/source/trunk/include/CLSSFacility.hxx b/source/trunk/include/CLSSFacility.hxx
index 5b9ccaa4b..8e1b4c33d 100644
--- a/source/trunk/include/CLSSFacility.hxx
+++ b/source/trunk/include/CLSSFacility.hxx
@@ -41,7 +41,9 @@ public :
 	cSecond 	GetCreationTime()	const	{ return fCreationTime; }	//!< Return the creation time of the Facility
 	cSecond 	GetLifeTime()		const	{ return fLifeTime; }		//!< Return the life time of the Facility
 	CLASS*		GetParc()			{ return fParc; }
-		
+	IsotopicVector GetCumulativeIVIn(IsotopicVector IV) { return fCumulativeIVIn;}
+	IsotopicVector GetCumulativeIVOut(IsotopicVector IV) { return fCumulativeIVOut;}
+
 	
 		//********* Set Method *********//
 	void SetId(int id)			{ fId = id; }				//!< Set The Facility Parc'Id
@@ -54,7 +56,9 @@ public :
 	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 AddCumulativeIVIn(IsotopicVector IV) { fCumulativeIVIn += IV;}
+	void AddCumulativeIVOut(IsotopicVector IV) { fCumulativeIVOut += IV;}
+
 		//********* Modification Method *********//
 	virtual void Evolution(cSecond t)	{ }	//!< Performe the Evolution to the Time t
 	virtual void Dump()			{ }			//!< Write Modification (IV In/Out, filling the TF...)
@@ -71,7 +75,9 @@ protected :
 	cSecond		fCycleTime;		///< Cycle Time
 
 	IsotopicVector	fInsideIV;		///< All IV in the Facility (fuel for reactor, total for all others...)
-	
+	IsotopicVector	fCumulativeIVIn;		///< All IV in the Facility (fuel for reactor, total for all others...)
+	IsotopicVector	fCumulativeIVOut;		///< All IV in the Facility (fuel for reactor, total for all others...)
+
 
 		//********* Internal Parameter *********//
 private :
diff --git a/source/trunk/src/FabricationPlant.cxx b/source/trunk/src/FabricationPlant.cxx
index ed7ba5e3d..007162146 100644
--- a/source/trunk/src/FabricationPlant.cxx
+++ b/source/trunk/src/FabricationPlant.cxx
@@ -359,6 +359,10 @@ void FabricationPlant::BuildFuelForReactor(int ReactorId)
 					IResult = fReactorFuturIV.insert( pair<int, IsotopicVector>(ReactorId,IVBeginCycle) );
 					if(IResult.second == false)
 						IResult.first->second = IVBeginCycle;
+
+					AddCumulativeIVIn(IVBeginCycle);
+
+
 				}
 			}
 		}
@@ -436,9 +440,11 @@ void FabricationPlant::TakeReactorFuel(int Id)
 	
 	IsotopicVector IV;
 	map<int ,IsotopicVector >::iterator it2 = fReactorFuturIV.find( Id );
+	AddCumulativeIVOut(it2->second);
+
 	if (it2 != fReactorFuturIV.end())
 		(*it2).second = IV;
-	
+
 }
 
 	//________________________________________________________________________
diff --git a/source/trunk/src/Pool.cxx b/source/trunk/src/Pool.cxx
index e8b72440a..79bd4f2bc 100755
--- a/source/trunk/src/Pool.cxx
+++ b/source/trunk/src/Pool.cxx
@@ -146,7 +146,7 @@ IsotopicVector Pool::GetDecay(IsotopicVector isotopicvector, cSecond t)
 //________________________________________________________________________
 //	Add Temporary IV : 
 //		Cooling
-//		Separation
+//		
 //________________________________________________________________________
 void Pool::AddIVCooling(IsotopicVector IV)
 { 
@@ -156,12 +156,16 @@ void Pool::AddIVCooling(IsotopicVector IV)
 	fCoolingStartingTime.push_back(fInternalTime);
 	fCoolingLastIndex++;
 	fCoolingIndex.push_back(fCoolingLastIndex);
+
+	AddCumulativeIVIn(IV);
+
 }
 
 
 //________________________________________________________________________
 void Pool::RemoveIVCooling(int i)		//!< Remove a Cooling IsotopicVector
 {
+	AddCumulativeIVOut(fIVCooling[i]);
 
 	fIVCooling.erase(fIVCooling.begin()+i);
 	fCoolingStartingTime.erase(fCoolingStartingTime.begin()+i);
@@ -266,7 +270,7 @@ void Pool::Dump()
 			fStorage->AddToStock(fIVCooling[idx]);
 		else
 			GetParc()->AddWaste(fIVCooling[idx]);
-		
+
 		fCoolingEndOfCycle.erase(fCoolingEndOfCycle.begin()+i);	// Remove index entry
 		RemoveIVCooling(idx);					// Remove IVcooling
 	}
diff --git a/source/trunk/src/Reactor.cxx b/source/trunk/src/Reactor.cxx
index c271d7bb4..93f8f1b40 100755
--- a/source/trunk/src/Reactor.cxx
+++ b/source/trunk/src/Reactor.cxx
@@ -418,7 +418,10 @@ void Reactor::Dump()
 			fEndOfCycle = false;
 
 			if(fIsStarted == true )					// A Cycle has already been done
+			{
 				fAssociedPool->AddIVCooling(fInsideIV);
+				GetCumulativeIVOut(fInsideIV);
+			}
 			else fIsStarted = true;					// Just start the first cycle
 
 			if(GetParc()->GetStockManagement() == false && fIsStorage == true)
@@ -441,12 +444,15 @@ void Reactor::Dump()
 			else	GetParc()->AddGod(fIVInCycle);
 
 			fInsideIV  = fIVBeginCycle;
+			AddCumulativeIVIn(fIVBeginCycle);
+
 			fInCycleTime = 0;
 		}
 		else if (fEndOfCycle == true && fShutDown == true)		//shutdown at end of Cycle
 		{
 
 			fAssociedPool->AddIVCooling(fIVOutCycle);
+			GetCumulativeIVOut(fIVOutCycle);
 			fInsideIV.Clear();
 			fInCycleTime = 0;
 			fIsStarted = false;		// shut down the Reactor
@@ -454,6 +460,7 @@ void Reactor::Dump()
 		else if (fEndOfCycle == false && fShutDown == true) 					//shutdown during Cycle
 		{
 			fAssociedPool->AddIVCooling(fInsideIV);
+			GetCumulativeIVOut(fInsideIV);
 			fInsideIV.Clear();
 			fInCycleTime = 0;
 			fIsStarted = false;		// shut down the Reactor
@@ -476,6 +483,7 @@ void Reactor::Dump()
 			if(fIsStarted == true )					// A Cycle has already been done
 			{
 				fAssociedPool->AddIVCooling(fIVOutCycle);
+				GetCumulativeIVOut(fIVOutCycle);
 			}
 			else fIsStarted = true;					// Just start the first cycle
 
@@ -484,12 +492,15 @@ void Reactor::Dump()
 
 
 			fInsideIV  = fIVBeginCycle;
+			AddCumulativeIVIn(fIVBeginCycle);
+
 			fInCycleTime = 0;
 
 		}
 		else if (fEndOfCycle == true && fShutDown == true)		//shutdown at end of Cycle
 		{
 			fAssociedPool->AddIVCooling(fIVOutCycle);
+			GetCumulativeIVOut(fIVOutCycle);
 			fInsideIV.Clear();
 			fInCycleTime = 0;
 			fIsStarted = false;		// shut down the Reactor
@@ -497,6 +508,7 @@ void Reactor::Dump()
 		else if (fEndOfCycle == false && fShutDown == true) 					//shutdown during Cycle
 		{
 			fAssociedPool->AddIVCooling(fInsideIV);
+			GetCumulativeIVOut(fInsideIV);
 			fInsideIV.Clear();
 			fInCycleTime = 0;
 			fIsStarted = false;		// shut down the Reactor
diff --git a/source/trunk/src/Storage.cxx b/source/trunk/src/Storage.cxx
index ff45aec16..4e8fe5ada 100644
--- a/source/trunk/src/Storage.cxx
+++ b/source/trunk/src/Storage.cxx
@@ -96,6 +96,8 @@ void Storage::ClearStock()
 void Storage::AddToStock(IsotopicVector isotopicvector)
 {
 
+	AddCumulativeIVIn(isotopicvector);
+
 	if(GetParc()->GetStockManagement() == true)
 		fIVStock.push_back(isotopicvector);
 	AddToFullStock(isotopicvector);
@@ -117,6 +119,8 @@ void Storage::TakeFractionFromStock(int IVId,double fraction)
 		{
 			fInsideIV -= fIVStock[IVId]*fraction;
 			fIVStock[IVId] = fIVStock[IVId]*(1-fraction);
+
+			AddCumulativeIVOut(fIVStock[IVId]*fraction);
 			
 		}
 
@@ -137,7 +141,11 @@ void Storage::TakeFromStock(IsotopicVector isotopicvector)
 {
 
 	if(GetParc()->GetStockManagement() == false)
+	{
+
+		AddCumulativeIVOut(isotopicvector);
 		fInsideIV -= isotopicvector;
+	}
 	else
 	{
 		cout << "!!Warning!! !!!Storage!!! TakeFromStock can't be DEFINE WITH REAL stock management" << endl;
-- 
GitLab