diff --git a/source/trunk/include/CLASS.hxx b/source/trunk/include/CLASS.hxx index ef965c1f2af503dc24aef6cb7954f6c4128bc4a3..55127bbc77478c9a2999751945e87829187f9221 100755 --- a/source/trunk/include/CLASS.hxx +++ b/source/trunk/include/CLASS.hxx @@ -5,7 +5,7 @@ \brief Header file for CLASS classes. */ -#include "CLSSObject.hxx" +#include "CLASSObject.hxx" #include "IsotopicVector.hxx" #include <TFile.h> @@ -39,7 +39,7 @@ The aim of these class is to manage the parc and its evolution and to lead all S //________________________________________________________________________ -class CLASS : public CLSSObject +class CLASS : public CLASSObject { public : @@ -88,6 +88,9 @@ public : bool GetStockManagement() { return fStockManagement; } ///< Return the StockManagement method (True or False) string GetOutputFileName() { return fOutputFileName; } ///< Return the Output File name string GetOutputTreeName() { return fOutputTreeName; } ///< Return the Output ROOT TTree name + + map<cSecond,int> GetTheBackEndTimePath(Reactor* reactor); ///< BUild and return the time path of a iradiated fuel + //@} @@ -168,6 +171,8 @@ public : \name Evolution Method */ //@{ + void OldBuildTimeVector(cSecond t); + void BuildTimeVector(cSecond t); ///< Build the Time Evolution Vector where : /// \li 1 printing, diff --git a/source/trunk/include/CLASSBackEnd.hxx b/source/trunk/include/CLASSBackEnd.hxx new file mode 100644 index 0000000000000000000000000000000000000000..27005149c96c858a8ffce03c4a1dde98f41c0dc4 --- /dev/null +++ b/source/trunk/include/CLASSBackEnd.hxx @@ -0,0 +1,95 @@ + +#ifndef _CLASSBACKEND_HXX +#define _CLASSBACKEND_HXX + + +/*! + \file + \brief Header file for CLASSFacility class. + + */ + +#include <string> +#include <fstream> + +#include "CLASSFacility.hxx" +#include "IsotopicVector.hxx" +#include "DecayDataBank.hxx" + +#include "TNamed.h" + +using namespace std; +typedef long long int cSecond; + +class CLASS; + +//-----------------------------------------------------------------------------// +/*! + Define a CLASS Facility. + The aim of these class is synthetyse all the commum properties of the nuclear facilities which are involve in the BackEnd Fuel cycle. + + + @author BaM + @version 2.0 + */ +//________________________________________________________________________ + + + + +class CLASSBackEnd : public CLASSFacility +{ + public : + ///< Normal Constructor. + CLASSBackEnd(); + + //********* Get Method *********// + /*! + \name Get Function + */ + //@{ + + DecayDataBank* GetDecayDataBank() { return fDecayDataBase;} //!< Return the pointer to the decay DataBank + vector<IsotopicVector> GetIVArray() const { return fIVArray; } //!< Return the IsotopicVector Array + bool GetStorageType() const { return fIsStorageType;} //!< Return the storageType + CLASSBackEnd* GetOutBackEndFacility() { return fOutBackEndFacility;} + //@} + + //********* Set Method *********// + /*! + \name Set Function + */ + //@{ + void SetIsStorageType(bool val = true) { fIsStorageType = val;} //! + void SetDecayDataBank(DecayDataBank* decayDB) { fDecayDataBase = decayDB;} //! Set the Decay DataBank + virtual void SetIVArray(vector<IsotopicVector> ivarray) { fIVArray = ivarray; } //!< Set The isotopicVector Array + virtual void SetOutBackEndFacility(CLASSBackEnd* befacility) { fOutBackEndFacility = befacility; } + //@} + + + /*! + \name BackEndFacility specific Method + */ + //@{ + virtual void AddIV(IsotopicVector isotopicvector); //!< Add an Isotopicvector to the IVArray + void ClearIVArray(); //!< Empty the IVArray removing all fuel stored + + //@} + + + protected : + IsotopicVector GetDecay(IsotopicVector isotopicvector, cSecond t); //!< Get IsotopicVector Decay at the t time + vector<IsotopicVector> fIVArray; ///< Vector containning all the fuel stored. + CLASSBackEnd* fOutBackEndFacility; + + //********* Internal Parameter *********// + private : + int fBackEndType; + bool fIsStorageType; //!< True if there is not OutBAckEndFacility (like a storage...) + DecayDataBank* fDecayDataBase; //!< Pointer to the Decay DataBase + + ClassDef(CLASSFacility,1); +}; + +#endif + diff --git a/source/trunk/include/CLASSFacility.hxx b/source/trunk/include/CLASSFacility.hxx new file mode 100644 index 0000000000000000000000000000000000000000..12dbbaf16d53ca1922c48e2dc3f301193c05fa15 --- /dev/null +++ b/source/trunk/include/CLASSFacility.hxx @@ -0,0 +1,127 @@ + +#ifndef _CLASSFACILITY_HXX +#define _CLASSFACILITY_HXX + + +/*! + \file + \brief Header file for CLASSFacility class. + + */ + +#include <string> +#include <fstream> + +#include "CLASSObject.hxx" +#include "IsotopicVector.hxx" +#include "DecayDataBank.hxx" + +#include "TNamed.h" + +using namespace std; +typedef long long int cSecond; + +class CLASS; +//-----------------------------------------------------------------------------// +/*! + Define a CLASS Facility. + The aim of these class is synthetyse all the commum properties of the nuclear facilities. + + + @author BaM + @version 2.0 + */ +//________________________________________________________________________ + + + + +class CLASSFacility : public CLASSObject +{ +public : + ///< Normal Constructor. + CLASSFacility(); + + //********* Get Method *********// + /*! + \name Get Function + */ + //@{ + + int GetId() const { return fId; } //!< Return the Facility Parc'Is + IsotopicVector GetInsideIV() const { return fInsideIV; } //!< Return the IV contain in the Facility + + int GetFacilityType() const { return fFacilityType; } + + cSecond GetInternalTime() const { return fInternalTime; } //!< Return Creation Time + + cSecond GetCycleTime() const { return fCycleTime; } //!< Return the cycle time of the Facility + 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; } //!< return the pointer to the Park + + + IsotopicVector GetCumulativeIVIn() { return fCumulativeIVIn;} //!< return the culative sum of all incoming IV + IsotopicVector GetCumulativeIVOut() { return fCumulativeIVOut;} //!< return the culative sum of all outcoming IV + //@} + + //********* Set Method *********// + /*! + \name Set Function + */ + //@{ + void SetId(int id) { fId = id; } //!< Set The Facility Parc'Id + void SetParc(CLASS* parc) { fParc = parc; } //!< Set the Pointer to the Parc + void SetFacilityType(int type) { fFacilityType = type; } + + + void SetInsideIV(IsotopicVector isotopicvector) { fInsideIV = isotopicvector; } //!< Set the IV inside the Facility Core + void SetCreationTime(double creationtime) { fCreationTime = (cSecond)creationtime;} + 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) + + //@} + + + /*! + \name Evolution Method + */ + //@{ + + void AddCumulativeIVIn(IsotopicVector IV) { fCumulativeIVIn += IV;} //!< Add the Input IsotopicVector the The cumulative IV IN + void AddCumulativeIVOut(IsotopicVector IV) { fCumulativeIVOut += IV;} //!< Add the Input IsotopicVector the The cumulative IV OUT + virtual void Evolution(cSecond t) { } //!< Performe the Evolution to the Time t + virtual void Dump() { } //!< Write Modification (IV In/Out, filling the TF...) + + //@} +protected : + bool fIsStarted; ///< True if Running, False Otherwise + bool fIsShutDown; ///< True if the facility is stoped, False Otherwise + bool fIsAtEndOfCycle; ///< True if Reaching the End of a Facility Cycle + + + cSecond fInternalTime; ///< Internal Clock + cSecond fInCycleTime; ///< Time spend since the beginning of the last Cycle + cSecond fCycleTime; ///< Cycle duration 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 : + int fId; //!< Identity of the Facility inside the Parc + int fFacilityType; + + CLASS* fParc; //!< Pointer to the main Parc + + cSecond fCreationTime; ///< CLASS Universal Time of Creation + cSecond fLifeTime; ///< LifeTime Of the Reactor (Operating's Duration) + + ClassDef(CLASSFacility,1); +}; + +#endif + diff --git a/source/trunk/include/CLASSObject.hxx b/source/trunk/include/CLASSObject.hxx new file mode 100644 index 0000000000000000000000000000000000000000..aa5d8ae79fbb28910a8dcf82623d5b5ce75a55a1 --- /dev/null +++ b/source/trunk/include/CLASSObject.hxx @@ -0,0 +1,57 @@ + +#ifndef _CLASSOBJECT_HXX +#define _CLASSOBJECT_HXX + + +/*! + \file + \brief Header file for CLASSObject class. + + + @author BaM + @version 2.0 + */ + +#include <string> +#include <fstream> + +#include "LogFile.hxx" + +#include "TNamed.h" + +using namespace std; + +//-----------------------------------------------------------------------------// +/*! + Define a CLASS Object. + The aim of these class is synthetyse all the commum properties to all CLASS Element. + + + @author BaM + @version 2.0 + */ +//________________________________________________________________________ + + + +class CLASSObject : public TNamed +{ +public : + ///< Normal Constructor. + CLASSObject(); + virtual CLASSObject* Clone() { return new CLASSObject(*this); } //!< Correct way to copy a CLASSObject in case of derivation + + + void SetLog(LogFile* log) { fLog = log; fIsLog = true; } //!< Set the LogFile + + LogFile* GetLog() { return fLog; } //!< Return the Pointer to the Log + bool IsLog() { return fIsLog; } //!< reutrn true if a LogFile is defined + +private : + LogFile* fLog; //!< Pointer to the Log + bool fIsLog; //!< Set at true if a LogFile are define + ClassDef(CLASSObject,0); +}; + +#endif + diff --git a/source/trunk/include/DataBank.hxx b/source/trunk/include/DataBank.hxx index 0e90cf9ed68de768036d3fcd2d6fc5bd8bfea2e5..f00f50fe1f7374f73a65b7b5da1714c83bfcd49b 100755 --- a/source/trunk/include/DataBank.hxx +++ b/source/trunk/include/DataBank.hxx @@ -7,7 +7,7 @@ @version 2.0 */ -#include "CLSSObject.hxx" +#include "CLASSObject.hxx" #include "TMatrix.h" #include "IsotopicVector.hxx" #include "DynamicalSystem.hxx" @@ -48,7 +48,7 @@ double ReactionRateWeightedDistance(EvolutionData DB, IsotopicVector IV1 ); template <class T> -class DataBank : public CLSSObject, DynamicalSystem +class DataBank : public CLASSObject, DynamicalSystem { public : diff --git a/source/trunk/include/DecayDataBank.hxx b/source/trunk/include/DecayDataBank.hxx index 3b4f420c900c005f93b4a4b3e3f49a8678b77472..ed4cbe22c540f26a7c9de6c5d20dd90edb43f36d 100644 --- a/source/trunk/include/DecayDataBank.hxx +++ b/source/trunk/include/DecayDataBank.hxx @@ -7,7 +7,7 @@ @version 2.0 */ -#include "CLSSObject.hxx" +#include "CLASSObject.hxx" #include "TMatrix.h" #include "EvolutionData.hxx" #include "IsotopicVector.hxx" @@ -42,7 +42,7 @@ double ReactionRateWeightedDistance(EvolutionData DB, IsotopicVector IV1 ); -class DecayDataBank : public CLSSObject, DynamicalSystem +class DecayDataBank : public CLASSObject { public : diff --git a/source/trunk/include/EvolutionData.hxx b/source/trunk/include/EvolutionData.hxx index 609ee1aba4e3e79bf9cd02763d56c870c6912112..dd3d15f1222b1a1e0c6ed6d2e0307e41c8d04164 100755 --- a/source/trunk/include/EvolutionData.hxx +++ b/source/trunk/include/EvolutionData.hxx @@ -11,7 +11,7 @@ #include <map> #include "IsotopicVector.hxx" -#include "CLSSObject.hxx" +#include "CLASSObject.hxx" #include "ZAI.hxx" #include "TMatrix.h" @@ -49,7 +49,7 @@ double Distance(EvolutionData Evd1, IsotopicVector IV1 ); -class EvolutionData : public CLSSObject +class EvolutionData : public CLASSObject { public : diff --git a/source/trunk/include/FabricationPlant.hxx b/source/trunk/include/FabricationPlant.hxx index f15f22117cb8cf8d8e9501eaabfbca2a3a02677e..8d7ea30556e6f06d67c81cbf75e7ed050d875fdf 100644 --- a/source/trunk/include/FabricationPlant.hxx +++ b/source/trunk/include/FabricationPlant.hxx @@ -12,7 +12,7 @@ #include <vector> #include <map> -#include "CLSSFacility.hxx" +#include "CLASSFacility.hxx" #include "IsotopicVector.hxx" #include "EvolutionData.hxx" #include "CLASS.hxx" @@ -43,7 +43,7 @@ class DecayDataBank; class FuelDataBank; -class FabricationPlant : public CLSSFacility +class FabricationPlant : public CLASSFacility { public : @@ -94,6 +94,8 @@ public : */ //@{ + void SetDecayDataBank(DecayDataBank* decayDB) {fDecayDataBase = decayDB;} //! Set the Decay DataBank + void SetUpdateReferenceDBatEachStep(bool val){ fUpdateReferenceDBatEachStep = val;} //!< Set fUpdateReferenceDBatEachStep variable void SetStorage(Storage* storage) { fStorage = storage; } //!< Set the Pointer to the Storage @@ -123,6 +125,7 @@ public : IsotopicVector GetFullFabrication(); //!< Return the Sum of all Fuel waiting to be put in a reator EvolutionData GetReactorEvolutionDB(int ReactorId); //!< Return the EvolutionData of Reactor ReactorId + IsotopicVector GetDecay(IsotopicVector isotopicvector, cSecond t); //!< Get IsotopicVector Decay at the t time //@} @@ -137,14 +140,14 @@ public : */ //@{ - void AddValorisableIV(ZAI zai, double factor); ///< Add Valorisable Element - void Evolution(cSecond t); //!< Perform the Evolution - virtual void BuildFuelForReactor(int ReactorId); //!< Build a Fuel for the reactor ReactorId - void RecycleStock(double fraction); //!< Take a franction of the current stock - IsotopicVector GetStockToRecycle(); //!< Get the next stock to recycle - void DumpStock(); //!< Update the storage + void AddValorisableIV(ZAI zai, double factor); ///< Add Valorisable Element + void Evolution(cSecond t); //!< Perform the Evolution + virtual void BuildFuelForReactor(int ReactorId); //!< Build a Fuel for the reactor ReactorId + void RecycleStock(double fraction); //!< Take a franction of the current stock + IsotopicVector GetStockToRecycle(); //!< Get the next stock to recycle + void DumpStock(); //!< Update the Stock status after building process EvolutionData BuildEvolutiveDB(int ReactorId, IsotopicVector isotopicvector); //!< Build the Evolution Database for the Reactir ReactorId Fuel - void TakeReactorFuel(int ReactorId) ; //!< Remove the Fuel of reactor ReactorId + void TakeReactorFuel(int ReactorId) ; //!< Remove the Fuel of reactor ReactorId //@} @@ -172,6 +175,7 @@ protected : bool fSubstitutionFuel; //!< true if a subtitution fuel as been set EvolutionData fSubstitutionEvolutionData; //!< EvolutionData of the subtitution fuel + DecayDataBank* fDecayDataBase; //!< Pointer to the Decay DataBase //********* Private Method *********// void FabricationPlantEvolution(cSecond t); //!< Deal the FabricationPlant Evolution diff --git a/source/trunk/include/FuelDataBank.hxx b/source/trunk/include/FuelDataBank.hxx index 7833048e7589a0615016a0451871a3fc19883c80..25fb316ab3d43e6fbe944f25ee9d8484638ccaec 100644 --- a/source/trunk/include/FuelDataBank.hxx +++ b/source/trunk/include/FuelDataBank.hxx @@ -7,7 +7,7 @@ @version 2.0 */ -#include "CLSSObject.hxx" +#include "CLASSObject.hxx" #include "TMatrix.h" #include "IsotopicVector.hxx" #include "DynamicalSystem.hxx" @@ -45,7 +45,7 @@ double ReactionRateWeightedDistance(EvolutionData DB, IsotopicVector IV1 ); -class FuelDataBank : public CLSSObject, DynamicalSystem +class FuelDataBank : public CLASSObject, DynamicalSystem { public : diff --git a/source/trunk/include/LogFile.hxx b/source/trunk/include/LogFile.hxx index 1915f1373bcc20f2bb70d5995fa422001a75c65d..ff50c202900c33eac154f7d652250f7109768ea3 100755 --- a/source/trunk/include/LogFile.hxx +++ b/source/trunk/include/LogFile.hxx @@ -54,7 +54,6 @@ public: \name In/Out */ //@{ - string GetLogFileName() const { return fLogFileName; } //!w return the logfile name std::ofstream fLog; //!< Log Stream diff --git a/source/trunk/include/Pool.hxx b/source/trunk/include/Pool.hxx index cf567a00a20cdd45fb03c064e2a2b18fc4717b24..33061c59be95005b615901619167c175b2cd38bf 100755 --- a/source/trunk/include/Pool.hxx +++ b/source/trunk/include/Pool.hxx @@ -8,13 +8,13 @@ #include <string> #include <map> -#include "CLSSFacility.hxx" +#include "CLASSBackEnd.hxx" #include "IsotopicVector.hxx" using namespace std; typedef long long int cSecond; -class Storage; +class CLASSBackEnd; class CLASS; class LogFile; class DecayDataBank; @@ -32,7 +32,7 @@ class DecayDataBank; -class Pool : public CLSSFacility +class Pool : public CLASSBackEnd { public : @@ -79,7 +79,7 @@ public : \param abstime time to start the Pool \param coolingtime duration of the cooling. */ - Pool(LogFile* log, Storage* Storage, + Pool(LogFile* log, CLASSBackEnd* Storage, double abstime = 0, double coolingtime = 5*3600.*24.*365.25); //!< //} @@ -98,10 +98,14 @@ public : */ //@{ - void SetStorage(Storage* storage) { fStorage = storage; fPutToWaste = true; } //!< Set the Pointer to the Storage + void SetOutBackEndFacility(CLASSBackEnd* befacility) { fOutBackEndFacility = befacility; + SetIsStorageType(); + fPutToWaste = true; } //!< Set the Pointer to the Storage + void SetPutToWaste(bool val) { fPutToWaste = val; } //!< Set True if IV goes to waste after cooling false instead - void SetCoolingTime(double time) { SetCycleTime((cSecond)time); } //!< Set Cooling Time + void SetIVArray(vector<IsotopicVector> ivarray); //! not use there (Does nothing!!!) + void SetIVArray(vector<IsotopicVector> ivarray, vector<cSecond> timearray); //!< Set The isotopicVector Array at the corresponding time //@} @@ -115,11 +119,8 @@ public : */ //@{ - Storage* GetStorage() const { return fStorage; } //!< Return the Pointer to the Storage bool GetPutToWaste() const { return fPutToWaste; } //!< Return True if IV goes to waste after cooling false instead - cSecond GetCoolingTime() const { return GetCycleTime(); } //!< Return the Cooling Time - //@} @@ -134,11 +135,9 @@ public : vector<cSecond> GetCoolingStartingTime() const { return fCoolingStartingTime; } //!< Return the vector of Cooling Sstarting Time - vector<IsotopicVector> GetIVCooling() const { return fIVCooling; } //!< Return the vector of Cooling IsotopicVector - void AddIVCooling(IsotopicVector IV); //!< Add Cooling IsotopicVector - void RemoveIVCooling(int i); //!< Remove a Cooling IsotopicVector - IsotopicVector GetFullCooling() {return GetInsideIV(); } + void RemoveIVCooling(int i); //!< Remove a Cooling IsotopicVector + void AddIV(IsotopicVector isotopicvector); //!< Add an Isotopicvector to the IVArray //@} @@ -162,13 +161,11 @@ protected : //********* Internal Parameter *********// - Storage* fStorage; //!< Pointer to the Stock bool fPutToWaste; //!< True if IV goes to waste after cooling false instead //********* Isotopic Quantity *********// //--------- Cooling ---------// - vector<IsotopicVector> fIVCooling; ///< Vector of the Cooling Isotopic Vector vector<cSecond> fCoolingStartingTime; ///< Vector of the Cooling Starting Time vector<int> fCoolingIndex; ///< Vector of the Cooling Index int fCoolingLastIndex; //!< Number of Cooling IV Treated diff --git a/source/trunk/include/Reactor.hxx b/source/trunk/include/Reactor.hxx index a62aed6de2fdfb624c6fdc6d62c2ae6d44d88d31..94f5337831d76a6d1cda659870fe21fcb0b07d7b 100755 --- a/source/trunk/include/Reactor.hxx +++ b/source/trunk/include/Reactor.hxx @@ -9,7 +9,7 @@ #include <string> #include <map> -#include "CLSSFacility.hxx" +#include "CLASSFacility.hxx" #include "IsotopicVector.hxx" #include "EvolutionData.hxx" @@ -18,7 +18,8 @@ typedef long long int cSecond; class CLASS; -class Pool; +class CLASSBackEnd; +//class Pool; class EvolutionData; class FuelDataBank; class FabricationPlant; @@ -38,7 +39,7 @@ class LogFile; -class Reactor : public CLSSFacility +class Reactor : public CLASSFacility { public : @@ -72,7 +73,8 @@ public : \param lifetime working time duration. */ Reactor(LogFile* log, FuelDataBank* fueltypeDB, - FabricationPlant* fabricationplant, Pool* Pool, + FabricationPlant* fabricationplant, CLASSBackEnd* Pool, +// FabricationPlant* fabricationplant, Pool* Pool, double creationtime , double lifetime); //} @@ -90,7 +92,8 @@ public : \param BurnUp Burnup reach by the fuel at the end of the cycle */ Reactor(LogFile* log, FuelDataBank* fueltypeDB, - FabricationPlant* fabricationplant, Pool* Pool, +// FabricationPlant* fabricationplant, Pool* Pool, + FabricationPlant* fabricationplant, CLASSBackEnd* Pool, double creationtime , double lifetime, double cycletime, double HMMass, double BurnUp); //} @@ -110,7 +113,8 @@ public : \param ChargeFactor effective charge of the reactor. */ Reactor(LogFile* log, FuelDataBank* fueltypeDB, - FabricationPlant* fabricationplant, Pool* Pool, +// FabricationPlant* fabricationplant, Pool* Pool, + FabricationPlant* fabricationplant, CLASSBackEnd* Pool, double creationtime , double lifetime, double Power, double HMMass, double BurnUp, double ChargeFactor); //} @@ -129,7 +133,8 @@ public : \param BurnUp Burnup reach by the fuel at the end of the cycle \param ChargeFactor effective charge of the reactor. */ - Reactor(LogFile* log, EvolutionData evolutivedb, Pool* Pool, + Reactor(LogFile* log, EvolutionData evolutivedb, CLASSBackEnd* Pool, +// Reactor(LogFile* log, EvolutionData evolutivedb, Pool* Pool, double creationtime, double lifetime, double power, double HMMass, double BurnUp, double ChargeFactor = 1); //} @@ -160,7 +165,8 @@ public : EvolutionData GetEvolutionDB() const { return fEvolutionDB; } //!< Return the Evolution database of the Fuel FuelDataBank* GetFuelType() const { return fFuelTypeDB; } //!< Return the Fuel Type DB of the reactor - Pool* GetAssociedPool() const { return fAssociedPool; } //!< Return the pointer to Associeted TF +// Pool* GetAssociedPool() const { return fAssociedPool; } //!< Return the pointer to Associeted Pool + CLASSBackEnd* GetOutBackEndFacility() const { return fOutBackEndFacility; } //!< Return the pointer to Associeted BackEnd Facility FabricationPlant* GetFabricationPlant() const { return fFabricationPlant; } //!< Return the Pointer to the FabricationPlant bool IsFuelFixed() const { return fFixedFuel; } //!< True if using fixed Fuel, False otherwise @@ -179,20 +185,22 @@ public : \name Set Method */ //@{ - - void SetStorage(Storage* storage) { fStorage = storage; fIsStorage = true;} //!< Set the Pointer to the Storage + void SetOutBackEndFacility(CLASSBackEnd* pool) { fOutBackEndFacility = pool; } //!< Return the pointer to Associeted TF +// void SetAssociedPool(Pool* pool) { fAssociedPool = pool; } //!< Return the pointer to Associeted TF + + void SetStorage(Storage* storage) { fStorage = storage; fIsStorage = true;} //!< Set the Pointer to the Storage - void SetIVReactor(IsotopicVector isotopicvector) { fInsideIV = isotopicvector; } //!< Set the IV inside the Reactor Core - void SetIVBeginCycle(IsotopicVector isotopicvector) { fIVBeginCycle = isotopicvector; } //!< Set the IV at the Beginging of the Reactor Cycle - void SetIVOutCycle(IsotopicVector isotopicvector) { fIVOutCycle = isotopicvector; } //!< Set the IV Going Out at the End of the Cycle - void SetIVInCycle(IsotopicVector isotopicvector) { fIVInCycle = isotopicvector; } //!< Set the IV Coming In at the Beginning of the Cycle + void SetIVReactor(IsotopicVector isotopicvector) { fInsideIV = isotopicvector; } //!< Set the IV inside the Reactor Core + void SetIVBeginCycle(IsotopicVector isotopicvector) { fIVBeginCycle = isotopicvector; } //!< Set the IV at the Beginging of the Reactor Cycle + void SetIVOutCycle(IsotopicVector isotopicvector) { fIVOutCycle = isotopicvector; } //!< Set the IV Going Out at the End of the Cycle + void SetIVInCycle(IsotopicVector isotopicvector) { fIVInCycle = isotopicvector; } //!< Set the IV Coming In at the Beginning of the Cycle - void SetCycleTime(double cycletime); //!< Set the Power time (Cycle of the loading Plan) + void SetCycleTime(double cycletime); //!< Set the Power time (Cycle of the loading Plan) - void SetEvolutionDB(EvolutionData evolutionDB); //!< Set the Pointer to the DB Evolution of the Reactor - void SetPower(double Power); //!< Set the Power - void SetHMMass(double Mass) {fHeavyMetalMass = Mass;} //!< Set the HeavyMetal Mass in the Core at the begining of the cycle - void SetBurnUp(double BU) {fBurnUp = BU;} //!< Set the the Burn Up of the Fuel at the end of the cycle + void SetEvolutionDB(EvolutionData evolutionDB); //!< Set the Pointer to the DB Evolution of the Reactor + void SetPower(double Power); //!< Set the Power + void SetHMMass(double Mass) {fHeavyMetalMass = Mass;} //!< Set the HeavyMetal Mass in the Core at the begining of the cycle + void SetBurnUp(double BU) {fBurnUp = BU;} //!< Set the the Burn Up of the Fuel at the end of the cycle //@} @@ -219,7 +227,8 @@ protected : bool fIsStorage; //!< true if a storage has been define (to approximate the reprocessing using fixed fuel) //********* Internal Parameter *********// - Pool* fAssociedPool; //!< Pointer to the TF which collect the spend fuel +// Pool* fAssociedPool; //!< Pointer to the TF which collect the spend fuel + CLASSBackEnd* fOutBackEndFacility; //!< Pointer to the TF which collect the spend fuel Storage* fStorage; //!< Pointer to the Stock EvolutionData fEvolutionDB; //!< Pointer to the Evolution DataBase diff --git a/source/trunk/include/Storage.hxx b/source/trunk/include/Storage.hxx index 6a9a8fd7a038d6dc6742cd3e4251cf7b79565860..aac247b85bb42185051152f287b7ae07729c1f01 100644 --- a/source/trunk/include/Storage.hxx +++ b/source/trunk/include/Storage.hxx @@ -9,7 +9,7 @@ #include <vector> -#include "CLSSFacility.hxx" +#include "CLASSBackEnd.hxx" #include "IsotopicVector.hxx" @@ -32,7 +32,7 @@ class DecayDataBank; -class Storage : public CLSSFacility +class Storage : public CLASSBackEnd { public : @@ -80,23 +80,15 @@ public : \name Set Method */ //@{ - void SetStock(vector<IsotopicVector> IVsstock) { fIVStock = IVsstock; } //!< Set The Storage isotopicVector - //@} - - //********* Get Method *********// /*! \name Get Method */ //@{ - - vector<IsotopicVector> GetStock() const { return fIVStock; } //!< Return the Storage IsotopicVector - IsotopicVector GetFullStock() const { return GetInsideIV(); } //!< Return the Full Storage - //@} @@ -108,17 +100,15 @@ public : \name Storage specific Method */ //@{ - - void ClearStock(); //!< Empty the stock removing all fuel stored - - void AddToStock(ZAI zai, double quantity) { AddToStock(zai*quantity); } //!< Add a ZAI*quantity to the Storage - void AddToStock(IsotopicVector isotopicvector); //!< Add an Isotopicvector to the Storage - void AddToFullStock(ZAI zai, double quantity) { fInsideIV += zai*quantity; } //!< Add a ZAI*quantity to the Storage + void AddToFullStock(IsotopicVector isotopicvector) { fInsideIV += isotopicvector; } //!< Add a IsotopicVector to the Storage void TakeFractionFromStock(int IVId,double fraction); //!< Take a part from an IV in sotck; void TakeFromStock(IsotopicVector isotopicvector); //!< + + void AddIV(IsotopicVector isotopicvector); //!< Add an Isotopicvector to the IVArray + //@} @@ -135,9 +125,6 @@ public : //@} - - - //********* In/Out Method *********// /*! @@ -161,9 +148,6 @@ protected : //********* Isotopic Quantity *********// -//---------- Storage ----------// - vector<IsotopicVector> fIVStock; ///< Vector containning all the fuel stored. - //********* Private Method *********// diff --git a/source/trunk/src/CLASS.cxx b/source/trunk/src/CLASS.cxx index 152a4dc90ae2d14f456f345fe1feff4fdc080db6..567b0dbcae15d86bacfe5afe818b0193f4a33315 100755 --- a/source/trunk/src/CLASS.cxx +++ b/source/trunk/src/CLASS.cxx @@ -2,6 +2,7 @@ #include "Storage.hxx" #include "Reactor.hxx" +#include "CLASSBackEnd.hxx" #include "Pool.hxx" #include "FabricationPlant.hxx" #include "LogFile.hxx" @@ -16,14 +17,14 @@ #include <algorithm> #include <omp.h> - //________________________________________________________________________ - // - // CLASS - // - // - // - // - //________________________________________________________________________ +//________________________________________________________________________ +// +// CLASS +// +// +// +// +//________________________________________________________________________ @@ -43,18 +44,18 @@ string dtoa(double num) - //________________________________________________________________________ +//________________________________________________________________________ CLASS::CLASS() { - - + + fNewTtree = true; fPrintStep = (cSecond)(3600*24*365.25); // One Step per Year fAbsoluteTime = 0; fStartingTime = 0; - + fStockManagement = true; - + fOutputFileName = "CLASS_Default.root"; fOutputTreeName = "Data"; fOutFile = 0; @@ -62,38 +63,38 @@ CLASS::CLASS() SetLog(new LogFile("CLASS.log")); fParcPower = 0; - - - // Warning - + + + // Warning + cout << "!!INFO!! !!!CLASS!!! A Parc has been define :" << endl; cout << "\t Print set at : " << (double)(fPrintStep/3600/24/365.25) << " year" << endl; cout << "\t Absolute Time set at " << (double)(fAbsoluteTime/3600/24/365.25) << " year" << endl; cout << "\t StockManagement set at : true" << endl; cout << "\t OutPut will be in \"" << fOutputFileName << "\" File and \"" << fOutputTreeName << "\" TTree" << endl; cout << "\t Log will be in " << GetLog()->GetLogFileName() << endl << endl; - + GetLog()->fLog << "!!INFO!! !!!CLASS!!! Parc has been define :" << endl; GetLog()->fLog << "\t Print set at : " << (double)(fPrintStep/3600/24/365.25) << " year" << endl; GetLog()->fLog << "\t StockManagement set at : true" << endl; GetLog()->fLog << "\t OutPut will be in \"" << fOutputFileName << "\" File and \"" << fOutputTreeName << "\" TTree" << endl; GetLog()->fLog << "\t Log will be in " << GetLog()->GetLogFileName() << endl << endl; - - - + + + } - //________________________________________________________________________ +//________________________________________________________________________ CLASS::CLASS(LogFile* Log) { - - + + fNewTtree = true; fPrintStep = (cSecond)(3600*24*365.25); // One Step per Year fAbsoluteTime = 0; fStartingTime = 0; - + fStockManagement = true; - + fOutputFileName = "CLASS_Default.root"; fOutputTreeName = "Data"; fOutFile = 0; @@ -101,37 +102,37 @@ CLASS::CLASS(LogFile* Log) SetLog(Log); fParcPower = 0; - - - // Warning - + + + // Warning + cout << "!!INFO!! !!!CLASS!!! A Parc has been define :" << endl; cout << "\t Print set at : " << (double)(fPrintStep/3600/24/365.25) << " year" << endl; cout << "\t Absolute Time set at " << (double)(fAbsoluteTime/3600/24/365.25) << " year" << endl; cout << "\t StockManagement set at : true" << endl; cout << "\t OutPut will be in \"" << fOutputFileName << "\" File and \"" << fOutputTreeName << "\" TTree" << endl; cout << "\t Log will be in " << GetLog()->GetLogFileName() << endl << endl; - + GetLog()->fLog << "!!INFO!! !!!CLASS!!! Parc has been define :" << endl; GetLog()->fLog << "\t Print set at : " << (double)(fPrintStep/3600/24/365.25) << " year" << endl; GetLog()->fLog << "\t StockManagement set at : true" << endl; GetLog()->fLog << "\t OutPut will be in \"" << fOutputFileName << "\" File and \"" << fOutputTreeName << "\" TTree" << endl; GetLog()->fLog << "\t Log will be in " << GetLog()->GetLogFileName() << endl << endl; - - - + + + } - //________________________________________________________________________ +//________________________________________________________________________ CLASS::CLASS(double abstime) { - + fNewTtree = true; fPrintStep = (cSecond)(3600*24*365.25); // One Step per Year fAbsoluteTime = (cSecond)abstime; fStartingTime = fAbsoluteTime; - + fStockManagement = true; - + fOutputFileName = "CLASS_Default.root"; fOutputTreeName = "Data"; fOutFile = 0; @@ -139,132 +140,322 @@ CLASS::CLASS(double abstime) SetLog(new LogFile("CLASS.log")); fParcPower = 0; - - - - - // Warning - + + + + + // Warning + cout << "!!INFO!! !!!CLASS!!! A Parc has been define :" << endl; cout << "\t Print set at : " << (double)(fPrintStep/3600/24/365.25) << " year" << endl; cout << "\t StockManagement set at : true" << endl; cout << "\t OutPut will be in \"" << fOutputFileName << "\" File and \"" << fOutputTreeName << "\" TTree" << endl; cout << "\t Log will be in " << GetLog()->GetLogFileName() << endl; - + GetLog()->fLog << "!!INFO!! !!!CLASS!!! Parc has been define :" << endl; GetLog()->fLog << "\t Print set at : " << (double)(fPrintStep/3600/24/365.25) << " year" << endl; GetLog()->fLog << "\t StockManagement set at : true" << endl; GetLog()->fLog << "\t OutPut will be in \"" << fOutputFileName << "\" File and \"" << fOutputTreeName << "\" TTree" << endl; GetLog()->fLog << "\t Log will be in " << GetLog()->GetLogFileName() << endl << endl; - - - + + + } - //________________________________________________________________________ +//________________________________________________________________________ CLASS::~CLASS() { - + #pragma omp single {CloseOutputTree();} - + } - //________________________________________________________________________ +//________________________________________________________________________ void CLASS::AddPool(Pool* Pool) { - - + + fPool.push_back(Pool); fPool.back()->SetParc(this); fPool.back()->SetDecayDataBank( (*this).GetDecayDataBase() ); fPool.back()->SetLog(GetLog()); fPool.back()->SetId((int)fPool.size()-1); - - - if(fNewTtree == false) + + + if(!fNewTtree) { string Pool_name = "Pool"; Pool_name += dtoa(fPool.back()->GetId()); Pool_name += "."; fOutT->Branch(Pool_name.c_str(), "Pool", &fPool.back()); } - + } - //________________________________________________________________________ +//________________________________________________________________________ void CLASS::AddReactor(Reactor* reactor) { - + fReactor.push_back(reactor); fReactor.back()->SetParc(this); fReactor.back()->SetLog(GetLog()); fReactor.back()->SetId((int)fReactor.size()-1); - if(fReactor.back()->IsFuelFixed() == false) + if(!fReactor.back()->IsFuelFixed()) fReactor.back()->GetFabricationPlant()->AddReactor( (int)fReactor.size()-1,fReactor.back()->GetCreationTime() ); - - - - if(fNewTtree == false) + + + + if(!fNewTtree) { string Reactor_name = "Reactor"; Reactor_name += dtoa(fReactor.back()->GetId()); Reactor_name += "."; fOutT->Branch(Reactor_name.c_str(), "Reactor", &fReactor.back()); } - - + + } - //________________________________________________________________________ +//________________________________________________________________________ void CLASS::AddStorage(Storage* storage) { - + fStorage.push_back(storage); fStorage.back()->SetParc(this); fStorage.back()->SetDecayDataBank( (*this).GetDecayDataBase() ); fStorage.back()->SetLog(GetLog()); fStorage.back()->SetId((int)fStorage.size()-1); - - if(fNewTtree == false) + + if(!fNewTtree) { string Storage_name = "Storage"; Storage_name += dtoa(fStorage.back()->GetId()); Storage_name += "."; fOutT->Branch(Storage_name.c_str(), "Storage", &fStorage.back()); } - - + + } - //________________________________________________________________________ +//________________________________________________________________________ void CLASS::AddFabricationPlant(FabricationPlant* fabricationplant) { - + fFabricationPlant.push_back(fabricationplant); fFabricationPlant.back()->SetParc(this); fFabricationPlant.back()->SetDecayDataBank( (*this).GetDecayDataBase() ); fFabricationPlant.back()->SetLog(GetLog()); fFabricationPlant.back()->SetId((int)fStorage.size()-1); - - if(fNewTtree == false) + + if(!fNewTtree) { string FabricationPlant_name = "FabricationPlant"; FabricationPlant_name += dtoa(fFabricationPlant.back()->GetId()); FabricationPlant_name += "."; fOutT->Branch(FabricationPlant_name.c_str(), "FabricationPlant", &fFabricationPlant.back()); } - - + + } +//________________________________________________________________________ +map<cSecond,int> CLASS::GetTheBackEndTimePath(Reactor* reactor) +{ + cSecond step = 0; + map<cSecond, int> TheBackEndTimePath; + + { + pair< map<cSecond, int>::iterator, bool > IResult; +// IResult = TheBackEndTimePath.insert(pair<cSecond, double> ( step,reactor->GetFacilityType() ) ); +// if( !IResult.second ) IResult.first->second |= reactor->GetFacilityType(); + + } + - //________________________________________________________________________ + + vector<CLASSBackEnd*> BackEndPath; + BackEndPath.push_back(reactor->GetOutBackEndFacility()); + while (!BackEndPath.back()->GetStorageType()) + { + step += BackEndPath.back()->GetCycleTime(); + int FacilityType = BackEndPath.back()->GetFacilityType(); + pair< map<cSecond, int>::iterator, bool > IResult = TheBackEndTimePath.insert(pair<cSecond,int> (step, FacilityType)); + if( !IResult.second ) IResult.first->second |= FacilityType; + + BackEndPath.push_back(BackEndPath[BackEndPath.size()-1]->GetOutBackEndFacility()); + + } + + return TheBackEndTimePath; +} + +//________________________________________________________________________ void CLASS::BuildTimeVector(cSecond t) { fTimeStep.clear(); - fTimeStep.insert( pair<double ,int>(t,1) ); - //********* Printing Step *********// + fTimeStep.insert( pair<cSecond ,int>(t,1) ); + //********* Printing Step *********// + { + cSecond step = fStartingTime; + + if(step >= fAbsoluteTime ) + fTimeStep.insert( pair<cSecond ,int>(step,1) ); + step += fPrintStep; + do + { + + if(step >= fAbsoluteTime ) + fTimeStep.insert( pair<cSecond ,int>(step,1) ); + step += fPrintStep; + } + while( step < t ); + } + + + for(int i = 0; i < (int)fReactor.size();i++) + { + cSecond ReactorStaringTime = fReactor[i]->GetCreationTime(); + cSecond ReactorShutDownTime = fReactor[i]->GetCreationTime() + fReactor[i]->GetLifeTime(); + cSecond ReactorCycleTime = fReactor[i]->GetCycleTime(); + cSecond FabricationCycleTime = 0; + int ReactorFacilityType = fReactor[i]->GetFacilityType(); + + cSecond step = ReactorStaringTime; + + map< cSecond, int > BackEndTimePath = GetTheBackEndTimePath(fReactor[i]); + if(!fReactor[i]->IsFuelFixed()) + FabricationCycleTime = fReactor[i]->GetFabricationPlant()->GetCycleTime(); + + + //********* Reactor Evolution Step *********// + // ShutDown of a reactor + + // Test if the sutdown of the reactor is after the actual time (AbsolutreTime) and before the end of the evolution (t) + if( ReactorShutDownTime < t ) + { + //********* Reactor Shutdown *********// + if( ReactorShutDownTime > fAbsoluteTime) + { + pair< map<cSecond, int>::iterator, bool > IResult; + IResult = fTimeStep.insert( pair<cSecond ,int>(ReactorShutDownTime, 2) ); + if( !IResult.second ) + IResult.first->second |= 2; + } + + map< cSecond, int >::iterator TV_it; // the time vector iterator + //********* BackEnd fuel Cycle after reactor Shutdown *********// + for(TV_it = BackEndTimePath.begin(); TV_it != BackEndTimePath.end(); TV_it++) // Loop on the BackEnd fuel Cycle Time path + { + // Test if each step of the Fuel Cycle BackEnd is after the actual time (AbsolutreTime) and before the end of the evolution (t) + if( ReactorShutDownTime + (*TV_it).first >= fAbsoluteTime && ReactorShutDownTime + (*TV_it).first <= t) + { + pair< map<cSecond, int>::iterator, bool > IResult; + IResult = fTimeStep.insert( pair<cSecond ,int>(ReactorShutDownTime + (*TV_it).first, (*TV_it).second) ); + if( !IResult.second ) + IResult.first->second |= (*TV_it).second; + } + } + + + } + + // Start the reactor and the Fuel Fabrication + if(step >= fAbsoluteTime && step <= t && step < ReactorShutDownTime) + { + pair< map<cSecond, int>::iterator, bool > IResult; + IResult = fTimeStep.insert( pair<cSecond ,int>(ReactorStaringTime, ReactorFacilityType) ); + if( !IResult.second ) + IResult.first->second |= ReactorFacilityType; + } + + + //********* FabricationPlant Evolution Step *********// + if(!fReactor[i]->IsFuelFixed()) + { + if( (step - FabricationCycleTime) >= fAbsoluteTime && (step - FabricationCycleTime) <= t ) + { + pair< map<cSecond, int>::iterator, bool > IResult; + IResult = fTimeStep.insert( pair<cSecond ,int>(step - FabricationCycleTime,16) ); + if( !IResult.second ) + IResult.first->second |= 16; + } + else if( step - FabricationCycleTime < fStartingTime ) + { + cout << "!!Warning!! !!!CLASS!!! Can't Build Fuel before Scenario's start\"\n" << endl; + GetLog()->fLog << "!!Warning!! !!!CLASS!!! Can't Build Fuel before Scenario's start\"\n" << endl; + exit(1); + } + } + + if (fReactor[i]->GetCycleTime() !=0) + { + step += fReactor[i]->GetCycleTime(); + do + { + //********* FabricationPlant Evolution Step *********// + if(!fReactor[i]->IsFuelFixed()) + if(step - FabricationCycleTime >= fAbsoluteTime && step - FabricationCycleTime <= t && step < ReactorShutDownTime) + { // Set End of reactor cycle + pair< map<cSecond, int>::iterator, bool > IResult; + IResult = fTimeStep.insert( pair<cSecond ,int>(step - FabricationCycleTime,16) ); + if( !IResult.second ) IResult.first->second |= 16; + } + + if(step > fAbsoluteTime && step <= t && step < ReactorShutDownTime) + { // Set End of reactor cycle + pair< map<cSecond, int>::iterator, bool > IResult = fTimeStep.insert( pair<cSecond ,int>(step,4) ); + if( !IResult.second ) IResult.first->second |= 4; + } + + //********* End/Start Of Reactor Cycle Step *********// + map< cSecond, int >::iterator TV_it; // the time vector iterator + //********* BackEnd fuel Cycle *********// + for(TV_it = BackEndTimePath.begin(); TV_it != BackEndTimePath.end(); TV_it++) // Loop on the BackEnd fuel Cycle Time path + { + // Test if each step of the Fuel Cycle BackEnd is after the actual time (AbsolutreTime) and before the end of the evolution (t) + if( step + (*TV_it).first >= fAbsoluteTime && step + (*TV_it).first <= t) + { + pair< map<cSecond, int>::iterator, bool > IResult; + IResult = fTimeStep.insert( pair<cSecond ,int>(step + (*TV_it).first, (*TV_it).second) ); + if( !IResult.second ) + IResult.first->second |= (*TV_it).second; + } + } + step += ReactorCycleTime; + } + while(step <= t && step <= ReactorShutDownTime ); + } + else + { + cout << "!!Warning!! !!!Reactor!!! Be carefull a reactor cycletime is set to 0 second....\"\n" << endl; + GetLog()->fLog << "!!Warning!! !!!Reactor!!! Be carefull a reactor cycletime is set to 0 second....\"\n" << endl; + } + + } + + + + + //****** Print the Time Index ******// + ofstream TimeStepfile("CLASS_TimeStep", ios_base::app); // Open the File + + if(!TimeStepfile) + { + cout << "!!Warning!! !!!CLASS!!! Can't open \" CLASS_TimeStep \"\n" << endl; + GetLog()->fLog << "!!Warning!! !!!CLASS!!! Can't open \" CLASS_TimeStep \"\n" << endl; + } + map<cSecond ,int >::iterator it; + for( it = fTimeStep.begin(); it != fTimeStep.end(); it++) + TimeStepfile << (double)((*it).first/3600/24./365.25) << " " << (*it).second << endl; + +} +//________________________________________________________________________ +void CLASS::OldBuildTimeVector(cSecond t) +{ + fTimeStep.clear(); + fTimeStep.insert( pair<cSecond ,int>(t,1) ); + //********* Printing Step *********// { cSecond step = 0; if(fAbsoluteTime == fStartingTime) @@ -278,57 +469,57 @@ void CLASS::BuildTimeVector(cSecond t) step += fPrintStep; do { - + if(step >= fAbsoluteTime ) fTimeStep.insert( pair<cSecond ,int>(step,1) ); step += fPrintStep; } while( step < t ); } - + for(int i = 0; i < (int)fReactor.size();i++) { double step = fReactor[i]->GetCreationTime(); - double coolingstep = fReactor[i]->GetAssociedPool()->GetCoolingTime(); + double coolingstep = fReactor[i]->GetOutBackEndFacility()->GetCycleTime(); double fabricationstep = 0; - - if(fReactor[i]->IsFuelFixed() == false) + + if(!fReactor[i]->IsFuelFixed()) fabricationstep = fReactor[i]->GetFabricationPlant()->GetCycleTime(); - - - //********* Reactor Evolution Step *********// - // set destruction of a reactor + + + //********* Reactor Evolution Step *********// + // set destruction of a reactor if( (fReactor[i]->GetCreationTime() + fReactor[i]->GetLifeTime() > fAbsoluteTime) && (fReactor[i]->GetCreationTime() + fReactor[i]->GetLifeTime() < t) ) { - //********* Reactor Shutdown *********// + //********* Reactor Shutdown *********// pair< map<cSecond, int>::iterator, bool > IResult = fTimeStep.insert( pair<cSecond ,int>(fReactor[i]->GetCreationTime() + fReactor[i]->GetLifeTime(),2) ); - if( IResult.second == false ) IResult.first->second |= 2; - - //********* End of Cooling after reactor Shutdown *********// + if( !IResult.second ) IResult.first->second |= 2; + + //********* End of Cooling after reactor Shutdown *********// if(fReactor[i]->GetCreationTime() + fReactor[i]->GetLifeTime()+coolingstep >= fAbsoluteTime && fReactor[i]->GetCreationTime() + fReactor[i]->GetLifeTime()+coolingstep <= t) { pair< map<cSecond, int>::iterator, bool > IResult = fTimeStep.insert( pair<cSecond ,int>(fReactor[i]->GetCreationTime() + fReactor[i]->GetLifeTime()+coolingstep,8) ); - if( IResult.second == false ) IResult.first->second |= 8; + if( !IResult.second ) IResult.first->second |= 8; } } - - - //********* Start Of Reactor First Cycle *********// + + + //********* Start Of Reactor First Cycle *********// if(step >= fAbsoluteTime && step <= t && step < fReactor[i]->GetCreationTime() + fReactor[i]->GetLifeTime()) { pair< map<cSecond, int>::iterator, bool > IResult = fTimeStep.insert( pair<cSecond ,int>(step,4) ); - if( IResult.second == false ) IResult.first->second |= 4; + if( !IResult.second ) IResult.first->second |= 4; } - - //********* FabricationPlant Evolution Step *********// - if(fReactor[i]->IsFuelFixed() == false) + + //********* FabricationPlant Evolution Step *********// + if(!fReactor[i]->IsFuelFixed()) { if(step > fAbsoluteTime && step - fabricationstep <= t && step < fReactor[i]->GetCreationTime() + fReactor[i]->GetLifeTime() ) { pair< map<cSecond, int>::iterator, bool > IResult = fTimeStep.insert( pair<cSecond ,int>(step -fabricationstep,16) ); - if( IResult.second == false ) IResult.first->second |= 16; + if( !IResult.second ) IResult.first->second |= 16; } else if(step - fabricationstep < fStartingTime) { @@ -337,67 +528,65 @@ void CLASS::BuildTimeVector(cSecond t) exit(1); } } - - - //********* Reactor related Step *********// + + + //********* Reactor related Step *********// step += fReactor[i]->GetCycleTime(); if (fReactor[i]->GetCycleTime() !=0) { do { - - - //********* FabricationPlant Evolution Step *********// - if(fReactor[i]->IsFuelFixed() == false) + + + //********* FabricationPlant Evolution Step *********// + if(!fReactor[i]->IsFuelFixed()) if(step > fAbsoluteTime && step - fabricationstep <= t && step < fReactor[i]->GetCreationTime() + fReactor[i]->GetLifeTime()) { // Set End of reactor cycle pair< map<cSecond, int>::iterator, bool > IResult = fTimeStep.insert( pair<cSecond ,int>(step -fabricationstep,16) ); - if( IResult.second == false ) IResult.first->second |= 16; + if( !IResult.second ) IResult.first->second |= 16; } - - - //********* End/Start Of Reactor Cycle Step *********// + + + //********* End/Start Of Reactor Cycle Step *********// if(step > fAbsoluteTime && step <= t && step < fReactor[i]->GetCreationTime() + fReactor[i]->GetLifeTime()) { // Set End of reactor cycle pair< map<cSecond, int>::iterator, bool > IResult = fTimeStep.insert( pair<cSecond ,int>(step,4) ); - if( IResult.second == false ) IResult.first->second |= 4; + if( !IResult.second ) IResult.first->second |= 4; } - - //********* End of Cooling Step *********// + + //********* End of Cooling Step *********// if(step >= fAbsoluteTime && step + coolingstep <= t) // Set End of Cooling { pair< map<cSecond, int>::iterator, bool > IResult = fTimeStep.insert( pair<cSecond ,int>(step+coolingstep,8) ); - if( IResult.second == false ) IResult.first->second |= 8; + if( !IResult.second ) IResult.first->second |= 8; } step += fReactor[i]->GetCycleTime(); } while(step <= t && step <= fReactor[i]->GetCreationTime() + fReactor[i]->GetLifeTime() ); } } - - - //*** In Case of Evolution Restart ****// + + + //*** In Case of Evolution Restart ****// for(int i =0; i < (int)fPool.size(); i++) { - - - //********* End of Cooling Step *********// - for(int j = 0; j<(int)fPool[i]->GetIVCooling().size(); j++ )// Set End of Cooling + //********* End of Cooling Step *********// + for(int j = 0; j<(int)fPool[i]->GetIVArray().size(); j++ )// Set End of Cooling { - if(fPool[i]->GetCoolingStartingTime()[j] + fPool[i]->GetCoolingTime() > fAbsoluteTime ) + if(fPool[i]->GetCoolingStartingTime()[j] + fPool[i]->GetCycleTime() > fAbsoluteTime ) { pair< map<cSecond, int>::iterator, bool > IResult; - IResult = fTimeStep.insert( pair<cSecond ,int>(fPool[i]->GetCoolingStartingTime()[j] + fPool[i]->GetCoolingTime(),8) ); - if( IResult.second == false ) IResult.first->second |= 8; + IResult = fTimeStep.insert( pair<cSecond ,int>(fPool[i]->GetCoolingStartingTime()[j] + fPool[i]->GetCycleTime(),8) ); + if( !IResult.second ) IResult.first->second |= 8; } } } - - - - //****** Print the Time Index ******// + + + + //****** Print the Time Index ******// ofstream TimeStepfile("CLASS_TimeStep", ios_base::app); // Open the File - + if(!TimeStepfile) { cout << "!!Warning!! !!!CLASS!!! Can't open \" CLASS_TimeStep \"\n" << endl; @@ -406,14 +595,14 @@ void CLASS::BuildTimeVector(cSecond t) map<cSecond ,int >::iterator it; for( it = fTimeStep.begin(); it != fTimeStep.end(); it++) TimeStepfile << (double)((*it).first/3600/24./365.25) << " " << (*it).second << endl; - + } - //________________________________________________________________________ - //___________________________ Evolution Method ___________________________ - //________________________________________________________________________ +//________________________________________________________________________ +//___________________________ Evolution Method ___________________________ +//________________________________________________________________________ void CLASS::PoolEvolution() { @@ -421,10 +610,10 @@ void CLASS::PoolEvolution() #pragma omp parallel for for(int i = 0; i < (int) fPool.size();i++) fPool[i]->Evolution(fAbsoluteTime); - + for(int i = 0; i < (int) fPool.size();i++) fPool[i]->Dump(); - + } void CLASS::StorageEvolution() @@ -433,21 +622,21 @@ void CLASS::StorageEvolution() #pragma omp parallel for for(int i = 0; i < (int) fStorage.size();i++) fStorage[i]->Evolution(fAbsoluteTime); - + } void CLASS::FabricationPlantEvolution() { -//#pragma omp parallel for + //#pragma omp parallel for for(int i = 0; i < (int) fFabricationPlant.size();i++) fFabricationPlant[i]->Evolution(fAbsoluteTime); - + } - //________________________________________________________________________ +//________________________________________________________________________ void CLASS::ReactorEvolution() { @@ -455,33 +644,33 @@ void CLASS::ReactorEvolution() #pragma omp parallel for for(int i = 0; i < (int)fReactor.size(); i++) fReactor[i]->Evolution(fAbsoluteTime); - - + + for(int i = 0; i < (int)fReactor.size(); i++) fReactor[i]->Dump(); - + } - //________________________________________________________________________ +//________________________________________________________________________ void CLASS::Evolution(double t) { - - + + BuildTimeVector( (cSecond)t ); - - if(fNewTtree == true) + + if(fNewTtree ) { OpenOutputTree(); OutAttach(); UpdateParc(); fOutT->Fill(); } - + map<cSecond ,int >::iterator it; for(it = fTimeStep.begin(); it != fTimeStep.end(); it++) { - + fAbsoluteTime = (*it).first; @@ -506,19 +695,19 @@ void CLASS::Evolution(double t) ProgressPrintout( (cSecond)t); } } - + } cout << endl; - - + + } void CLASS::ProgressPrintout(cSecond t) { - + double Time = (fAbsoluteTime-fStartingTime)/3600/24/365.25 ; double Total = (t-fStartingTime)/3600/24/365.25; - + cout << " " << flush ; cout << "\r["; for(int i = 0; i < (int)(Time/Total*100.0); i++) @@ -526,70 +715,70 @@ void CLASS::ProgressPrintout(cSecond t) for(int i = 100; i >= (int)(Time/Total*100.0); i--) cout << "-"; cout << "] "; - + cout << " Processed "; if (Time < 10) cout << " "; if (Time < 100) cout << " "; cout << (int)Time << " / " << (int)Total << " Years \r" << flush; - - + + GetLog()->fLog << "Proccessed"; if (Time < 10) GetLog()->fLog << " "; if (Time < 100) GetLog()->fLog << " "; GetLog()->fLog << (int)Time << " / " << (int)Total << " Years \r" << endl; - + } - //________________________________________________________________________ - //______________________________ Out Method ______________________________ - //________________________________________________________________________ +//________________________________________________________________________ +//______________________________ Out Method ______________________________ +//________________________________________________________________________ void CLASS::UpdateParc() { - + ResetQuantity(); - + for(int i =0; i < (int)fFabricationPlant.size(); i++) fFuelFabrication += fFabricationPlant[i]->GetFullFabrication(); - + for(int i = 0; i < (int) fPool.size();i++) - fTotalCooling += fPool[i]->GetFullCooling(); - + fTotalCooling += fPool[i]->GetInsideIV(); + for(int i = 0; i < (int)fStorage.size(); i++) - fTotalStorage += fStorage[i]->GetFullStock(); - + fTotalStorage += fStorage[i]->GetInsideIV(); + for(int i = 0; i < (int)fReactor.size(); i++) fTotalInReactor += fReactor[i]->GetIVReactor(); - + fIVTotal = fWaste + fTotalStorage + fTotalCooling + fFuelFabrication + fTotalInReactor; fIVInCycleTotal = fTotalStorage + fTotalCooling + fFuelFabrication + fTotalInReactor; - - + + } void CLASS::ResetQuantity() { - - + + fTotalInReactor.Clear(); fTotalStorage.Clear(); fTotalCooling.Clear(); fFuelFabrication.Clear(); fIVInCycleTotal.Clear(); fIVTotal.Clear(); - + } - //________________________________________________________________________ +//________________________________________________________________________ void CLASS::OpenOutputTree() { - - + + cout << "Opening OutPut File ...\t"; GetLog()->fLog << "Opening : " << fOutputFileName << " ...\t"; fOutFile = new TFile(fOutputFileName.c_str(),"UPDATE"); - + if(!fOutFile) { cout << "\nCould not open " << fOutputFileName <<endl; @@ -597,8 +786,8 @@ void CLASS::OpenOutputTree() exit(-1); } cout << "\t ...OK!" << endl; - - + + fOutT = new TTree(fOutputTreeName.c_str(), "Data Tree"); cout << "Creating Data Tree ...\t"; GetLog()->fLog << "Creating Data Tree ...\t"; @@ -611,17 +800,17 @@ void CLASS::OpenOutputTree() fNewTtree = false; cout << "\t ...OK!" << endl; GetLog()->fLog << "\t ...OK!" << endl; - + } void CLASS::CloseOutputTree() { - - + + fOutFile->ls(); cout << "Writing outTree " << fOutputFileName << endl; GetLog()->fLog << "Writing outTree " << fOutputFileName << endl; fOutFile->Write(); - + if(fOutFile->IsOpen()) { cout << "Deleting outTree : " << endl; GetLog()->fLog << "Deleting outTree : " << endl; @@ -636,42 +825,42 @@ void CLASS::CloseOutputTree() exit(-1); } } - //________________________________________________________________________ +//________________________________________________________________________ void CLASS::OutAttach() { - + ResetQuantity(); - //Branch Absolut Time + //Branch Absolut Time fOutT->Branch("AbsTime",&fAbsoluteTime,"AbsoluteTime/L"); - //Branch The Power installed in the Parc + //Branch The Power installed in the Parc fOutT->Branch("ParcPower",&fParcPower,"ParcPower/D"); - - - - // Branch the Sum IV - - + + + + // Branch the Sum IV + + fOutT->Branch("STOCK.", "IsotopicVector", &fTotalStorage); fOutT->Branch("FUELFABRICATION.", "IsotopicVector", &fFuelFabrication); fOutT->Branch("COOLING.", "IsotopicVector", &fTotalCooling); fOutT->Branch("REACTOR.", "IsotopicVector", &fTotalInReactor); fOutT->Branch("INCYCLE.", "IsotopicVector", &fIVInCycleTotal); fOutT->Branch("TOTAL.", "IsotopicVector", &fIVTotal); - + fOutT->Branch("GOD.", "IsotopicVector", &fGod); fOutT->Branch("WASTE.", "IsotopicVector", &fWaste); - - // Branch the separate object - + + // Branch the separate object + for(int i = 0; i < (int)fStorage.size(); i++) { string Storage_name = "Storage"; Storage_name += dtoa(i); Storage_name += "."; - + fOutT->Branch(Storage_name.c_str(), "Storage", &fStorage[i]); } - + for(int i = 0; i < (int)fPool.size(); i++) { string TF_name = "Pool"; @@ -679,7 +868,7 @@ void CLASS::OutAttach() TF_name += "."; fOutT->Branch(TF_name.c_str(), "Pool", &fPool[i]); } - + for(int i = 0; i < (int)fReactor.size(); i++) { string R_name = "Reactor"; @@ -694,34 +883,34 @@ void CLASS::OutAttach() FP_name += "."; fOutT->Branch(FP_name.c_str(), "FabricationPlant", &fFabricationPlant[i]); } - + } - //________________________________________________________________________ +//________________________________________________________________________ void CLASS::Write() { - - - - + + + + } - //________________________________________________________________________ +//________________________________________________________________________ void CLASS::Print() { - + for(int i = 0; i < (int) fPool.size();i++) { cout << "!!!!!!!!!STEP : " << fAbsoluteTime/(int)(3600*24*365.25) << endl; cout << "Pool : " << endl; cout << "Cooling "; - cout << fPool[i]->GetIVCooling().size()<< endl; + cout << fPool[i]->GetIVArray().size()<< endl; } - + for(int i = 0; i < (int)fReactor.size(); i++) { cout << "Reactor" << endl; fReactor[i]->GetIVReactor().Print(); } - + } diff --git a/source/trunk/src/CLASSBackEnd.cxx b/source/trunk/src/CLASSBackEnd.cxx new file mode 100644 index 0000000000000000000000000000000000000000..ae7dcad88b7a86bf468f453274f40a64915b0ff4 --- /dev/null +++ b/source/trunk/src/CLASSBackEnd.cxx @@ -0,0 +1,69 @@ +#include "CLASSBackEnd.hxx" + +#include "DecayDataBank.hxx" +#include "CLASS.hxx" +#include "LogFile.hxx" + + +#include <sstream> +#include <string> +#include <iostream> +#include <cmath> +#include <algorithm> + +//________________________________________________________________________ +// +// CLASSBackEnd +// +// +// +// +//________________________________________________________________________ +ClassImp(CLASSBackEnd) + +CLASSBackEnd::CLASSBackEnd():CLASSFacility() +{ + fDecayDataBase = 0; +} + +//________________________________________________________________________ +void CLASSBackEnd::ClearIVArray() +{ + + IsotopicVector EmptyIV; + fInsideIV = EmptyIV; + fIVArray.clear(); +} + +//________________________________________________________________________ +void CLASSBackEnd::AddIV(IsotopicVector isotopicvector) +{ + + AddCumulativeIVIn(isotopicvector); + + fIVArray.push_back(isotopicvector); + +} + +//________________________________________________________________________ +// Get Decay +//________________________________________________________________________ +IsotopicVector CLASSBackEnd::GetDecay(IsotopicVector isotopicvector, cSecond t) +{ + + IsotopicVector IV; + + map<ZAI ,double> isotopicquantity = isotopicvector.GetIsotopicQuantity(); + map<ZAI ,double >::iterator it; + for( it = isotopicquantity.begin(); it != isotopicquantity.end(); it++) + { + if((*it).second > 0) + { + IsotopicVector ivtmp = fDecayDataBase->Evolution(it->first, t) * (*it).second ; + IV += ivtmp; + } + } + + return IV; + +} diff --git a/source/trunk/src/CLASSFacility.cxx b/source/trunk/src/CLASSFacility.cxx new file mode 100644 index 0000000000000000000000000000000000000000..dbb18cdd2947cc57f24d8530a7baea4f16942863 --- /dev/null +++ b/source/trunk/src/CLASSFacility.cxx @@ -0,0 +1,26 @@ +#include "CLASSFacility.hxx" +#include "CLASS.hxx" + +using namespace std; + + //________________________________________________________________________ + // + // CLASSFacility + // + // + // + // + //________________________________________________________________________ + +ClassImp(CLASSFacility) + + +CLASSFacility::CLASSFacility():CLASSObject() +{ + fParc = 0; + fInternalTime = 0; + fInCycleTime = 0; + fCycleTime = 0; +} + + diff --git a/source/trunk/src/CLASSObject.cxx b/source/trunk/src/CLASSObject.cxx new file mode 100644 index 0000000000000000000000000000000000000000..904d2d90ee857eedfc60a229dc356ca8162c1cd1 --- /dev/null +++ b/source/trunk/src/CLASSObject.cxx @@ -0,0 +1,23 @@ +#include "CLASSObject.hxx" + +#include "LogFile.hxx" + +using namespace std; + + //________________________________________________________________________ + // + // CLASSObject + // + // + // + // + //________________________________________________________________________ + +ClassImp(CLASSObject) + +CLASSObject::CLASSObject() +{ + fLog = 0; + fIsLog = false; +} + diff --git a/source/trunk/src/DataBank.cxx b/source/trunk/src/DataBank.cxx index ffbcc6ba50b3eafdaef3cb1f38dc86f0ca5869e5..1fb6f8fcfd74510fe5f2f91d56b5b7c3f0fdabfc 100755 --- a/source/trunk/src/DataBank.cxx +++ b/source/trunk/src/DataBank.cxx @@ -145,7 +145,7 @@ IsotopicVector DataBank<ZAI>::Evolution(const ZAI& zai, double dt) } } - if(zaifind == false) + if(!zaifind) { GetLog()->fLog << "!!Warning!! !!!EVOLUTIVE DB!!! Oups... Can't Find the ZAI : " ; GetLog()->fLog << zai.Z() << " " << zai.A() << " " << zai.I() << "!!! It will be considered as stable !!" << endl; @@ -800,7 +800,7 @@ void DataBank<IsotopicVector>::SetFissionEnergy(ZAI zai, double E) { pair<map<ZAI, double>::iterator, bool> IResult; IResult = fFissionEnergy.insert( pair<ZAI ,double>(zai, E)); - if(IResult.second == false) + if(!IResult.second) IResult.first->second = E; } @@ -856,7 +856,7 @@ map< ZAI,IsotopicVector > DataBank<IsotopicVector>::ReadFPYield(string Yield) { pair<map<ZAI, IsotopicVector>::iterator, bool> IResult; IResult = Yield_map.insert(pair<ZAI,IsotopicVector>(ZAI(Z,A,I),EmptyIV) ); - if (IResult.second == false) + if(!IResult.second) { cout << "!!Error!! !!!DataBank!!! Many accurance of ZAI " << Z << " " << A; cout << " in " << Yield << " file!! Please Check it !!!" << endl; diff --git a/source/trunk/src/DecayDataBank.cxx b/source/trunk/src/DecayDataBank.cxx index 44c32f7a08076b22d5d663660ffa7788589f8d11..793af24b2b1fda632a2bb1e6952fb881393ffc03 100644 --- a/source/trunk/src/DecayDataBank.cxx +++ b/source/trunk/src/DecayDataBank.cxx @@ -26,7 +26,7 @@ // //________________________________________________________________________ -DecayDataBank::DecayDataBank() +DecayDataBank::DecayDataBank():CLASSObject() { } @@ -106,7 +106,7 @@ IsotopicVector DecayDataBank::Evolution(const ZAI& zai, double dt) } } - if(zaifind == false) + if(!zaifind) { GetLog()->fLog << "!!Warning!! !!!EVOLUTIVE DB!!! Oups... Can't Find the ZAI : " ; GetLog()->fLog << zai.Z() << " " << zai.A() << " " << zai.I() << "!!! It will be considered as stable !!" << endl; diff --git a/source/trunk/src/DynamicalSystem.cxx b/source/trunk/src/DynamicalSystem.cxx index a2f0efad124a22b7d2254cce8571749665ef0ab3..5ec1540526b4dd0bdc994bd0f23268f9c2cc87d1 100644 --- a/source/trunk/src/DynamicalSystem.cxx +++ b/source/trunk/src/DynamicalSystem.cxx @@ -136,10 +136,10 @@ void DynamicalSystem::RK4(double *y, double *dydx, double x, double h, double * yout[i]=y[i]+h6*(dydx[i]+dyt[i]+2.0*dym[i]); if(!fIsNegativeValueAllowed && yout[i]<0) { - cout << "Material composition is negative " - <<"i="<<i<<" ("/*<<fEvolvingMaterial->GetComposition()[i]->GetZAI()->PrintName() - */<<") old proportion="<<y[i]<<" new="<<yout[i] - <<". Setting to 0." << endl; + //cout << "Material composition is negative " + //<<"i="<<i<<" ("/*<<fEvolvingMaterial->GetComposition()[i]->GetZAI()->PrintName() + // */<<") old proportion="<<y[i]<<" new="<<yout[i] + //<<". Setting to 0." << endl; yout[i]=0.; } } diff --git a/source/trunk/src/EvolutionData.cxx b/source/trunk/src/EvolutionData.cxx index c3c4bc4a8fefd7da5e4dc3c5975db6edd46f74de..fd44aca893a08bf3eea2866b77cb1ca267c35232 100755 --- a/source/trunk/src/EvolutionData.cxx +++ b/source/trunk/src/EvolutionData.cxx @@ -342,7 +342,7 @@ EvolutionData Sum(EvolutionData const& evol1, EvolutionData const& evol2) ClassImp(EvolutionData) -EvolutionData::EvolutionData() +EvolutionData::EvolutionData():CLASSObject() { fIsCrossSection = false; fPower = 0; diff --git a/source/trunk/src/FabricationPlant.cxx b/source/trunk/src/FabricationPlant.cxx index 2c17f49a0d97246f256b55e174a28fc9af59f3ed..7feba6bc41a6e8b3a48a336d76dd32ea26ca60a1 100644 --- a/source/trunk/src/FabricationPlant.cxx +++ b/source/trunk/src/FabricationPlant.cxx @@ -45,13 +45,15 @@ ClassImp(FabricationPlant) FabricationPlant::FabricationPlant() { + SetFacilityType(16); fStorage = 0; fReUsable = 0; } FabricationPlant::FabricationPlant(LogFile* log) { - + SetFacilityType(16); + SetLog(log); fChronologicalTimePriority = false; SetCycleTime(-1); @@ -73,7 +75,8 @@ FabricationPlant::FabricationPlant(LogFile* log) FabricationPlant::FabricationPlant(LogFile* log, Storage* storage, Storage* reusable, double fabircationtime) { - + SetFacilityType(16); + SetLog(log); fChronologicalTimePriority = false; @@ -119,7 +122,7 @@ void FabricationPlant::AddValorisableIV(ZAI zai, double factor) if(factor > 0) { IResult = fValorisableIV.insert( pair<ZAI ,double>(zai, factor)); - if(IResult.second == false) + if(!IResult.second) IResult.first->second = factor; } @@ -223,14 +226,14 @@ void FabricationPlant::BuildFuelForReactor(int ReactorId) EvolutionData evolutiondb; pair<map<int, EvolutionData>::iterator, bool> IResult; IResult = fReactorFuturDB.insert( pair<int, EvolutionData>(ReactorId,evolutiondb) ); - if(IResult.second == false) + if(!IResult.second) IResult.first->second = evolutiondb; } { IsotopicVector EmptyIV; pair<map<int, IsotopicVector>::iterator, bool> IResult; IResult = fReactorFuturIV.insert( pair<int, IsotopicVector>(ReactorId,EmptyIV) ); - if(IResult.second == false) + if(!IResult.second) IResult.first->second = EmptyIV; } } @@ -240,14 +243,14 @@ void FabricationPlant::BuildFuelForReactor(int ReactorId) EvolutionData evolutiondb = fSubstitutionEvolutionData* HMmass; pair<map<int, EvolutionData>::iterator, bool> IResult; IResult = fReactorFuturDB.insert( pair<int, EvolutionData>(ReactorId,evolutiondb) ); - if(IResult.second == false) + if(!IResult.second) IResult.first->second = evolutiondb; } { IsotopicVector IV = fSubstitutionEvolutionData.GetIsotopicVectorAt(0)* HMmass; pair<map<int, IsotopicVector>::iterator, bool> IResult; IResult = fReactorFuturIV.insert( pair<int, IsotopicVector>(ReactorId, IV) ); - if(IResult.second == false) + if(!IResult.second) IResult.first->second = IV; } @@ -298,7 +301,7 @@ void FabricationPlant::BuildFuelForReactor(int ReactorId) double N3 = -FuelType->GetFuelParameter()[0] * Na / (cZAIMass.fZAIMass.find( ZAI(92,238,0) )->second*0.997 + cZAIMass.fZAIMass.find( ZAI(92,235,0) )->second*0.003 ) * (HMmass*1e6 - MPu_0*1e6); double D1 = Sum_AlphaI_nPuI; - double D2 = -FuelType->GetFuelParameter()[0] * MPu_1*1e6 * Na / (cZAIMass.fZAIMass.find( ZAI(92,238,0) )->second*0.997 + cZAIMass.fZAIMass.find( ZAI(92,235,0) )->second*0.003 ) ; + double D2 = - FuelType->GetFuelParameter()[0] * MPu_1*1e6 * Na / (cZAIMass.fZAIMass.find( ZAI(92,238,0) )->second*0.997 + cZAIMass.fZAIMass.find( ZAI(92,235,0) )->second*0.003 ) ; StockFactionToUse = (N1 + N2 + N3) / (D1 + D2); @@ -332,31 +335,28 @@ void FabricationPlant::BuildFuelForReactor(int ReactorId) GetParc()->AddGodIncome( U8, U8_Quantity*0.997 ); GetParc()->AddGodIncome( U5, U8_Quantity*0.003 ); - + + for(int i = (int)fFractionToTake.size()-1; i >= 0; i--) { - IVBeginCycle += fStorage->GetStock()[fFractionToTake[i].first].GetSpeciesComposition(94)*( fFractionToTake[i].second ); - fReUsable->AddToStock(fStorage->GetStock()[fFractionToTake[i].first]*(fFractionToTake[i].second) - - fStorage->GetStock()[fFractionToTake[i].first].GetSpeciesComposition(94)*(fFractionToTake[i].second)); - - fStorage->TakeFractionFromStock(fFractionToTake[i].first,fFractionToTake[i].second); - + IVBeginCycle += fStorage->GetIVArray()[fFractionToTake[i].first].GetSpeciesComposition(94)*( fFractionToTake[i].second ); } - fFractionToTake.clear(); - + + DumpStock(); + IVBeginCycle += U8_Quantity*U8*0.997 + U8_Quantity*U5*0.003; EvolutionData evolutiondb = BuildEvolutiveDB(ReactorId, IVBeginCycle); { pair<map<int, EvolutionData>::iterator, bool> IResult; IResult = fReactorFuturDB.insert( pair<int, EvolutionData>(ReactorId,evolutiondb) ); - if(IResult.second == false) + if(!IResult.second) IResult.first->second = evolutiondb; } { pair<map<int, IsotopicVector>::iterator, bool> IResult; IResult = fReactorFuturIV.insert( pair<int, IsotopicVector>(ReactorId,IVBeginCycle) ); - if(IResult.second == false) + if(!IResult.second) IResult.first->second = IVBeginCycle; AddCumulativeIVIn(IVBeginCycle); @@ -453,13 +453,14 @@ IsotopicVector FabricationPlant::GetStockToRecycle() IsotopicVector NextStock; int IdToTake = -1; - if(fChronologicalTimePriority == true) + if(fChronologicalTimePriority ) IdToTake = (int)( fFractionToTake.size() ); else - IdToTake = (int)( fStorage->GetStock().size() -1 - fFractionToTake.size() ); - if(0 <= IdToTake && IdToTake <= (int)fStorage->GetStock().size()-1) + IdToTake = (int)( fStorage->GetIVArray().size() -1 - fFractionToTake.size() ); + + if(0 <= IdToTake && IdToTake < (int)fStorage->GetIVArray().size()) { - NextStock = fStorage->GetStock()[IdToTake]; + NextStock = fStorage->GetIVArray()[IdToTake]; fFractionToTake.push_back( pair<int,double>(IdToTake,0.) ); } else NextStock += ZAI(-1,-1,-1) *1; @@ -481,10 +482,31 @@ void FabricationPlant::RecycleStock(double fraction) //________________________________________________________________________ void FabricationPlant::DumpStock() { - - - - + + for(int i = (int)fFractionToTake.size()-1; i >= 0; i--) + { + + pair<IsotopicVector, IsotopicVector> SeparatedIV; + IsotopicVector IV_in_Stock_i = fStorage->GetIVArray()[fFractionToTake[i].first]; + double Fraction_Taken_from_Stock_i = fFractionToTake[i].second ; + + SeparatedIV = Separation( Fraction_Taken_from_Stock_i * ( IV_in_Stock_i - IV_in_Stock_i.GetSpeciesComposition(94) ) ); + + fReUsable->AddIV(SeparatedIV.first); + GetParc()->AddWaste(SeparatedIV.second); + + + + + fStorage->TakeFractionFromStock(fFractionToTake[i].first,fFractionToTake[i].second); + + + } + fFractionToTake.clear(); + + + + } //________________________________________________________________________ @@ -505,7 +527,11 @@ pair<IsotopicVector, IsotopicVector> FabricationPlant::Separation(IsotopicVector IVTmp.first.Add( (*it).first, (*it).second * (*it2).second ); //re-use IVTmp.second.Add( (*it).first, (*it).second * (1-(*it2).second) ); //waste } - else IVTmp.second.Add( (*it).first, (*it).second ); //waste + else + { + IVTmp.first.Add( (*it).first, (*it).second ); //re-use +// IVTmp.second.Add( (*it).first, (*it).second * (1-(*it2).second) ); //waste -> Empty + } } return IVTmp; @@ -513,6 +539,28 @@ pair<IsotopicVector, IsotopicVector> FabricationPlant::Separation(IsotopicVector +//________________________________________________________________________ +// Get Decay +//________________________________________________________________________ +IsotopicVector FabricationPlant::GetDecay(IsotopicVector isotopicvector, cSecond t) +{ + + IsotopicVector IV; + + map<ZAI ,double> isotopicquantity = isotopicvector.GetIsotopicQuantity(); + map<ZAI ,double >::iterator it; + for( it = isotopicquantity.begin(); it != isotopicquantity.end(); it++) + { + if((*it).second > 0) + { + IsotopicVector ivtmp = fDecayDataBase->Evolution(it->first, t) * (*it).second ; + IV += ivtmp; + } + } + + return IV; + +} diff --git a/source/trunk/src/FuelDataBank.cxx b/source/trunk/src/FuelDataBank.cxx index 0321e0e18d98d31c7e021de1f86014c962cdbf48..d4b6f70340f656a4d836a9c8c430c063a47a876b 100644 --- a/source/trunk/src/FuelDataBank.cxx +++ b/source/trunk/src/FuelDataBank.cxx @@ -70,7 +70,7 @@ double ReactionRateWeightedDistance(EvolutionData DB, IsotopicVector IV1 ) //________________________________________________________________________ -FuelDataBank::FuelDataBank():DynamicalSystem() +FuelDataBank::FuelDataBank(): CLASSObject(), DynamicalSystem() { fTheNucleiVector = 0; fTheMatrix = 0; @@ -664,7 +664,7 @@ void FuelDataBank::SetFissionEnergy(ZAI zai, double E) { pair<map<ZAI, double>::iterator, bool> IResult; IResult = fFissionEnergy.insert( pair<ZAI ,double>(zai, E)); - if(IResult.second == false) + if(!IResult.second) IResult.first->second = E; } @@ -718,7 +718,7 @@ map< ZAI,IsotopicVector > FuelDataBank::ReadFPYield(string Yield) { pair<map<ZAI, IsotopicVector>::iterator, bool> IResult; IResult = Yield_map.insert(pair<ZAI,IsotopicVector>(ZAI(Z,A,I),EmptyIV) ); - if (IResult.second == false) + if(!IResult.second) { cout << "!!Error!! !!!FuelDataBank!!! Many accurance of ZAI " << Z << " " << A; cout << " in " << Yield << " file!! Please Check it !!!" << endl; diff --git a/source/trunk/src/IsotopicVector.cxx b/source/trunk/src/IsotopicVector.cxx index 51f5f37cfeab26e7832276d8cf6fbe2be5fac8ff..91ce8d042a76dce1c35447fdca16f5c9bd04d966 100755 --- a/source/trunk/src/IsotopicVector.cxx +++ b/source/trunk/src/IsotopicVector.cxx @@ -389,7 +389,7 @@ void IsotopicVector::Need(const ZAI& zai, double quantity) if(quantity > 0) { IResult = fIsotopicQuantityNeeded.insert( pair<ZAI ,double>(zai, quantity)); - if(IResult.second == false) + if(!IResult.second) IResult.first->second += quantity; } diff --git a/source/trunk/src/Makefile b/source/trunk/src/Makefile index c9c61a12530c6db273a2d76a57f5f3884015e134..b13a3c235ebdd3d9d906547ffed532aa0a6b434f 100755 --- a/source/trunk/src/Makefile +++ b/source/trunk/src/Makefile @@ -14,8 +14,9 @@ ROOTGLIBS = `root-config --glibs` INCLUDES = $(LOCALINC)/*.hxx LIBNAME = CLASSpkg OBJS = CLASS.o \ - CLSSObject.o CLSSObjectDict.o\ - CLSSFacility.o CLSSFacilityDict.o\ + CLASSObject.o CLASSObjectDict.o\ + CLASSFacility.o CLASSFacilityDict.o\ + CLASSBackEnd.o CLASSBackEndDict.o\ Storage.o StorageDict.o\ FabricationPlant.o FabricationPlantDict.o \ PWR_THU_FabricationPlant.o \ @@ -30,8 +31,9 @@ OBJS = CLASS.o \ EvolutionData.o EvolutionDataDict.o \ LogFile.o -ROOTOBJS = CLSSObject.o CLSSObjectDict.o\ - CLSSFacility.o CLSSFacilityDict.o\ +ROOTOBJS = CLASSObject.o CLASSObjectDict.o\ + CLASSFacility.o CLASSFacilityDict.o\ + CLASSBackEnd.o CLASSBackEndDict.o\ Storage.o StorageDict.o\ Pool.o PoolDict.o\ Reactor.o ReactorDict.o \ @@ -58,10 +60,13 @@ all: $(OBJS) -CLSSObjectDict.cxx: $(LOCALINC)/CLSSObject.hxx +CLASSObjectDict.cxx: $(LOCALINC)/CLASSObject.hxx rootcint -f $@ -c $^ -CLSSFacilityDict.cxx: $(LOCALINC)/CLSSFacility.hxx +CLASSFacilityDict.cxx: $(LOCALINC)/CLASSFacility.hxx + rootcint -f $@ -c $^ + +CLASSBackEndDict.cxx: $(LOCALINC)/CLASSBackEnd.hxx rootcint -f $@ -c $^ StorageDict.cxx: $(LOCALINC)/Storage.hxx diff --git a/source/trunk/src/PWR_THPU_FabricationPlant.cxx b/source/trunk/src/PWR_THPU_FabricationPlant.cxx index ca1973507378d623b4bb3b630f913ef6310cfbc7..cb392152700e51cfc2c9056538c00509c6345276 100644 --- a/source/trunk/src/PWR_THPU_FabricationPlant.cxx +++ b/source/trunk/src/PWR_THPU_FabricationPlant.cxx @@ -41,13 +41,14 @@ template <class T> T random(T a, T b) //peak random numebr between a and b -PWR_THPU_FabricationPlant::PWR_THPU_FabricationPlant() +PWR_THPU_FabricationPlant::PWR_THPU_FabricationPlant():FabricationPlant() { } PWR_THPU_FabricationPlant::PWR_THPU_FabricationPlant(LogFile* log) { - + SetFacilityType(16); + SetLog(log); fChronologicalTimePriority = false; SetCycleTime(-1); @@ -69,7 +70,8 @@ PWR_THPU_FabricationPlant::PWR_THPU_FabricationPlant(LogFile* log) PWR_THPU_FabricationPlant::PWR_THPU_FabricationPlant(LogFile* log, Storage* storage, Storage* reusable, double fabircationtime) { - + SetFacilityType(16); + SetLog(log); fChronologicalTimePriority = false; @@ -153,14 +155,14 @@ void PWR_THPU_FabricationPlant::BuildFuelForReactor(int ReactorId) EvolutionData evolutiondb; pair<map<int, EvolutionData>::iterator, bool> IResult; IResult = fReactorFuturDB.insert( pair<int, EvolutionData>(ReactorId,evolutiondb) ); - if(IResult.second == false) + if(!IResult.second) IResult.first->second = evolutiondb; } { IsotopicVector EmptyIV; pair<map<int, IsotopicVector>::iterator, bool> IResult; IResult = fReactorFuturIV.insert( pair<int, IsotopicVector>(ReactorId,EmptyIV) ); - if(IResult.second == false) + if(!IResult.second) IResult.first->second = EmptyIV; } } @@ -170,14 +172,14 @@ void PWR_THPU_FabricationPlant::BuildFuelForReactor(int ReactorId) EvolutionData evolutiondb = fSubstitutionEvolutionData* HMmass; pair<map<int, EvolutionData>::iterator, bool> IResult; IResult = fReactorFuturDB.insert( pair<int, EvolutionData>(ReactorId,evolutiondb) ); - if(IResult.second == false) + if(!IResult.second) IResult.first->second = evolutiondb; } { IsotopicVector IV = fSubstitutionEvolutionData.GetIsotopicVectorAt(0)* HMmass; pair<map<int, IsotopicVector>::iterator, bool> IResult; IResult = fReactorFuturIV.insert( pair<int, IsotopicVector>(ReactorId, IV) ); - if(IResult.second == false) + if(!IResult.second) IResult.first->second = IV; } @@ -269,9 +271,9 @@ void PWR_THPU_FabricationPlant::BuildFuelForReactor(int ReactorId) for(int i = (int)fFractionToTake.size()-1; i >= 0; i--) { - IVBeginCycle += fStorage->GetStock()[fFractionToTake[i].first].GetSpeciesComposition(94)*( fFractionToTake[i].second ); - fReUsable->AddToStock(fStorage->GetStock()[fFractionToTake[i].first]*(fFractionToTake[i].second) - - fStorage->GetStock()[fFractionToTake[i].first].GetSpeciesComposition(94)*(fFractionToTake[i].second)); + IVBeginCycle += fStorage->GetIVArray()[fFractionToTake[i].first].GetSpeciesComposition(94)*( fFractionToTake[i].second ); + fReUsable->AddIV(fStorage->GetIVArray()[fFractionToTake[i].first]*(fFractionToTake[i].second) + - fStorage->GetIVArray()[fFractionToTake[i].first].GetSpeciesComposition(94)*(fFractionToTake[i].second)); fStorage->TakeFractionFromStock(fFractionToTake[i].first,fFractionToTake[i].second); @@ -284,13 +286,13 @@ void PWR_THPU_FabricationPlant::BuildFuelForReactor(int ReactorId) { pair<map<int, EvolutionData>::iterator, bool> IResult; IResult = fReactorFuturDB.insert( pair<int, EvolutionData>(ReactorId,evolutiondb) ); - if(IResult.second == false) + if(!IResult.second) IResult.first->second = evolutiondb; } { pair<map<int, IsotopicVector>::iterator, bool> IResult; IResult = fReactorFuturIV.insert( pair<int, IsotopicVector>(ReactorId,IVBeginCycle) ); - if(IResult.second == false) + if(!IResult.second) IResult.first->second = IVBeginCycle; AddCumulativeIVIn(IVBeginCycle); diff --git a/source/trunk/src/PWR_THU_FabricationPlant.cxx b/source/trunk/src/PWR_THU_FabricationPlant.cxx index 62ecb8a04fca818d8adfb16c3cfe118e0cdb804d..fec48037ff389b4dd3a085a9bc4afef1cb75681e 100644 --- a/source/trunk/src/PWR_THU_FabricationPlant.cxx +++ b/source/trunk/src/PWR_THU_FabricationPlant.cxx @@ -38,14 +38,15 @@ template <class T> T random(T a, T b) //peak random numebr between a and b return (T)a + (T)(b-a)*rand()/range; } -PWR_THU_FabricationPlant::PWR_THU_FabricationPlant() +PWR_THU_FabricationPlant::PWR_THU_FabricationPlant():FabricationPlant() { } PWR_THU_FabricationPlant::PWR_THU_FabricationPlant(LogFile* log) { - + SetFacilityType(16); + SetLog(log); fChronologicalTimePriority = false; SetCycleTime(-1); @@ -67,7 +68,8 @@ PWR_THU_FabricationPlant::PWR_THU_FabricationPlant(LogFile* log) PWR_THU_FabricationPlant::PWR_THU_FabricationPlant(LogFile* log, Storage* storage, Storage* reusable, double fabircationtime) { - + SetFacilityType(16); + SetLog(log); fChronologicalTimePriority = false; @@ -150,14 +152,14 @@ void PWR_THU_FabricationPlant::BuildFuelForReactor(int ReactorId) EvolutionData evolutiondb; pair<map<int, EvolutionData>::iterator, bool> IResult; IResult = fReactorFuturDB.insert( pair<int, EvolutionData>(ReactorId,evolutiondb) ); - if(IResult.second == false) + if(!IResult.second) IResult.first->second = evolutiondb; } { IsotopicVector EmptyIV; pair<map<int, IsotopicVector>::iterator, bool> IResult; IResult = fReactorFuturIV.insert( pair<int, IsotopicVector>(ReactorId,EmptyIV) ); - if(IResult.second == false) + if(!IResult.second) IResult.first->second = EmptyIV; } } @@ -167,14 +169,14 @@ void PWR_THU_FabricationPlant::BuildFuelForReactor(int ReactorId) EvolutionData evolutiondb = fSubstitutionEvolutionData* HMmass; pair<map<int, EvolutionData>::iterator, bool> IResult; IResult = fReactorFuturDB.insert( pair<int, EvolutionData>(ReactorId,evolutiondb) ); - if(IResult.second == false) + if(!IResult.second) IResult.first->second = evolutiondb; } { IsotopicVector IV = fSubstitutionEvolutionData.GetIsotopicVectorAt(0)* HMmass; pair<map<int, IsotopicVector>::iterator, bool> IResult; IResult = fReactorFuturIV.insert( pair<int, IsotopicVector>(ReactorId, IV) ); - if(IResult.second == false) + if(!IResult.second) IResult.first->second = IV; } @@ -265,9 +267,9 @@ void PWR_THU_FabricationPlant::BuildFuelForReactor(int ReactorId) for(int i = (int)fFractionToTake.size()-1; i >= 0; i--) { - IVBeginCycle += fStorage->GetStock()[fFractionToTake[i].first].GetSpeciesComposition(92)*( fFractionToTake[i].second ); - fReUsable->AddToStock(fStorage->GetStock()[fFractionToTake[i].first]*(fFractionToTake[i].second) - - fStorage->GetStock()[fFractionToTake[i].first].GetSpeciesComposition(92)*(fFractionToTake[i].second)); + IVBeginCycle += fStorage->GetIVArray()[fFractionToTake[i].first].GetSpeciesComposition(92)*( fFractionToTake[i].second ); + fReUsable->AddIV(fStorage->GetIVArray()[fFractionToTake[i].first]*(fFractionToTake[i].second) + - fStorage->GetIVArray()[fFractionToTake[i].first].GetSpeciesComposition(92)*(fFractionToTake[i].second)); fStorage->TakeFractionFromStock(fFractionToTake[i].first,fFractionToTake[i].second); @@ -280,13 +282,13 @@ void PWR_THU_FabricationPlant::BuildFuelForReactor(int ReactorId) { pair<map<int, EvolutionData>::iterator, bool> IResult; IResult = fReactorFuturDB.insert( pair<int, EvolutionData>(ReactorId,evolutiondb) ); - if(IResult.second == false) + if(!IResult.second) IResult.first->second = evolutiondb; } { pair<map<int, IsotopicVector>::iterator, bool> IResult; IResult = fReactorFuturIV.insert( pair<int, IsotopicVector>(ReactorId,IVBeginCycle) ); - if(IResult.second == false) + if(!IResult.second) IResult.first->second = IVBeginCycle; AddCumulativeIVIn(IVBeginCycle); diff --git a/source/trunk/src/Pool.cxx b/source/trunk/src/Pool.cxx index 984a502f0ce9a68d872e869a7cd7a6c055d906aa..d534710123bbb8a0e6e48db14825be84a3d40871 100755 --- a/source/trunk/src/Pool.cxx +++ b/source/trunk/src/Pool.cxx @@ -22,14 +22,17 @@ //________________________________________________________________________ ClassImp(Pool) -Pool::Pool() +Pool::Pool():CLASSBackEnd() { - fStorage = 0; + fOutBackEndFacility = 0; + SetFacilityType(8); } Pool::Pool(LogFile* log) { - + + SetFacilityType(8); + SetLog(log); fCycleTime = 5*3600.*24.*365.25; @@ -38,7 +41,7 @@ Pool::Pool(LogFile* log) SetCreationTime( 0 ); fCoolingLastIndex = 0; - fStorage = 0; + fOutBackEndFacility = 0; cout << "!!INFO!! !!!Pool!!! A new Pool has been define :" << endl; @@ -57,6 +60,8 @@ Pool::Pool(LogFile* log) Pool::Pool(LogFile* log, double creation, double coolingtime) { + SetFacilityType(8); + SetLog(log); fCycleTime = (cSecond)coolingtime; SetCreationTime( (cSecond)creation ); @@ -64,7 +69,7 @@ Pool::Pool(LogFile* log, double creation, double coolingtime) fPutToWaste = true; fCoolingLastIndex = 0; - fStorage = 0; + fOutBackEndFacility = 0; cout << "!!INFO!! !!!Pool!!! A new Pool has been define :" << endl; @@ -81,12 +86,16 @@ Pool::Pool(LogFile* log, double creation, double coolingtime) } //________________________________________________________________________ -Pool::Pool(LogFile* log, Storage* storage, double creation, double coolingtime) +Pool::Pool(LogFile* log, CLASSBackEnd* storage, double creation, double coolingtime) { + SetFacilityType(8); + SetLog(log); fCycleTime = (cSecond)coolingtime; - fStorage = storage; + fOutBackEndFacility = storage; + SetIsStorageType(false); + SetCreationTime( (cSecond)creation ); fIsStarted = false; fPutToWaste = false; @@ -113,18 +122,31 @@ Pool::~Pool() } +//________________________________________________________________________ +//________________________________________________________________________ +void Pool::SetIVArray(vector<IsotopicVector> ivarray) +{ + cout << "this method as no effect !!!" << endl; + cout << "Use SetIVArray(vector<IsotopicVector> ivarray, vector<cSecond>n timearray) unstead!!!!"<<endl; +} +//________________________________________________________________________ +void Pool::SetIVArray(vector<IsotopicVector> ivarray, vector<cSecond> timearray) +{ + fIVArray = ivarray; + fCoolingStartingTime = timearray; +} //________________________________________________________________________ // Add Temporary IV : // Cooling // //________________________________________________________________________ -void Pool::AddIVCooling(IsotopicVector IV) +void Pool::AddIV(IsotopicVector IV) { - fIVCooling.push_back(IV); + fIVArray.push_back(IV); fInsideIV += IV; fCoolingStartingTime.push_back(fInternalTime); fCoolingLastIndex++; @@ -138,9 +160,9 @@ void Pool::AddIVCooling(IsotopicVector IV) //________________________________________________________________________ void Pool::RemoveIVCooling(int i) //!< Remove a Cooling IsotopicVector { - AddCumulativeIVOut(fIVCooling[i]); + AddCumulativeIVOut(fIVArray[i]); - fIVCooling.erase(fIVCooling.begin()+i); + fIVArray.erase(fIVArray.begin()+i); fCoolingStartingTime.erase(fCoolingStartingTime.begin()+i); fCoolingIndex.erase(fCoolingIndex.begin()+i); @@ -170,7 +192,7 @@ void Pool::CoolingEvolution(cSecond t) fInsideIV = IsotopicVector(); #pragma omp parallel for - for ( int i = 0 ; i < (int)fIVCooling.size() ; i++) + for ( int i = 0 ; i < (int)fIVArray.size() ; i++) { if ( abs(t - fCoolingStartingTime[i] - fCycleTime) < 3600 ) // ">" should not append, only "=" is normal... { @@ -186,7 +208,7 @@ void Pool::CoolingEvolution(cSecond t) RemainingCoolingTime = fCycleTime - (fInternalTime - fCoolingStartingTime[i]); //Cooling Decay - fIVCooling[i] = GetDecay( fIVCooling[i], RemainingCoolingTime); + fIVArray[i] = GetDecay( fIVArray[i], RemainingCoolingTime); #pragma omp critical(DeleteCoolingIVPB) @@ -195,8 +217,8 @@ void Pool::CoolingEvolution(cSecond t) } else if ( fCoolingStartingTime[i] != t ) { - fIVCooling[i] = GetDecay( fIVCooling[i] , EvolutionTime); - fInsideIV += fIVCooling[i]; + fIVArray[i] = GetDecay( fIVArray[i] , EvolutionTime); + fInsideIV += fIVArray[i]; } } #pragma omp critical(DeleteCoolingIVPB) @@ -213,7 +235,7 @@ void Pool::Evolution(cSecond t) if(t<GetCreationTime()) return; if(t == fInternalTime && t!=0) return; - if(fInternalTime == 0 && fIsStarted == false) + if(fInternalTime == 0 && !fIsStarted) { fInternalTime = GetCreationTime(); fIsStarted = true; @@ -239,10 +261,10 @@ void Pool::Dump() int idx = fCoolingEndOfCycle[i]; // Get Index number - if(fPutToWaste == false) - fStorage->AddToStock(fIVCooling[idx]); + if(!fPutToWaste) + fOutBackEndFacility->AddIV(fIVArray[idx]); else - GetParc()->AddWaste(fIVCooling[idx]); + GetParc()->AddWaste(fIVArray[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 e89b1b6bf929b42040385de1e7960caeddf889b3..052b0e558c09c46d80b69101b4c4f225c113870d 100755 --- a/source/trunk/src/Reactor.cxx +++ b/source/trunk/src/Reactor.cxx @@ -29,34 +29,37 @@ ClassImp(Reactor) Reactor::Reactor() { - fAssociedPool = 0; + fOutBackEndFacility = 0; fStorage = 0; fFuelTypeDB = 0; fFabricationPlant = 0; + SetFacilityType(4); } Reactor::Reactor(LogFile* log) { SetLog(log); - fAssociedPool = 0; + fOutBackEndFacility = 0; fStorage = 0; fFuelTypeDB = 0; fFabricationPlant = 0; + SetFacilityType(4); } Reactor::Reactor(LogFile* log, FuelDataBank* fueltypeDB, FabricationPlant* fabricationplant, - Pool* Pool, + CLASSBackEnd* Pool, double creationtime, double lifetime) { + SetFacilityType(4); SetLog(log); fIsStarted = false; - fShutDown = false; - fEndOfCycle = false; + fIsShutDown = false; + fIsAtEndOfCycle = false; fFabricationPlant = fabricationplant; fFixedFuel = false; @@ -64,7 +67,7 @@ Reactor::Reactor(LogFile* log, FuelDataBank* fueltypeDB, fHeavyMetalMass = -1.; fStorage = 0; - fAssociedPool = Pool; + fOutBackEndFacility = Pool; fFuelTypeDB = fueltypeDB; @@ -91,22 +94,23 @@ Reactor::Reactor(LogFile* log, FuelDataBank* fueltypeDB, } -Reactor::Reactor(LogFile* log, FuelDataBank* fueltypeDB, FabricationPlant* fabricationplant, Pool* Pool, +Reactor::Reactor(LogFile* log, FuelDataBank* fueltypeDB, FabricationPlant* fabricationplant, CLASSBackEnd* Pool, double creationtime, double lifetime, double Power, double HMMass, double BurnUp, double ChargeFactor) { + SetFacilityType(4); SetLog(log); fStorage = 0; fIsStarted = false; - fShutDown = false; - fEndOfCycle = false; + fIsShutDown = false; + fIsAtEndOfCycle = false; fFabricationPlant = fabricationplant; fFixedFuel = false; - fAssociedPool = Pool; + fOutBackEndFacility = Pool; fFuelTypeDB = fueltypeDB; @@ -147,16 +151,17 @@ Reactor::Reactor(LogFile* log, FuelDataBank* fueltypeDB, FabricationPlant* fabri Reactor::Reactor(LogFile* log, FuelDataBank* fueltypeDB, FabricationPlant* fabricationplant, - Pool* Pool, + CLASSBackEnd* Pool, double creationtime, double lifetime, double cycletime, double HMMass, double BurnUp) { + SetFacilityType(4); SetLog(log); fIsStarted = false; - fShutDown = false; - fEndOfCycle = false; + fIsShutDown = false; + fIsAtEndOfCycle = false; fStorage = 0; @@ -165,7 +170,7 @@ Reactor::Reactor(LogFile* log, FuelDataBank* fueltypeDB, fBurnUp = BurnUp; fHeavyMetalMass = HMMass; - fAssociedPool = Pool; + fOutBackEndFacility = Pool; fFuelTypeDB = fueltypeDB; @@ -201,17 +206,18 @@ Reactor::Reactor(LogFile* log, FuelDataBank* fueltypeDB, Reactor::Reactor(LogFile* log, EvolutionData evolutivedb, - Pool* Pool, + CLASSBackEnd* Pool, double creationtime, double lifetime, double power, double HMMass, double BurnUp, double ChargeFactor ) { + SetFacilityType(4); SetLog(log); fIsStarted = false; - fShutDown = false; - fEndOfCycle = false; + fIsShutDown = false; + fIsAtEndOfCycle = false; fStorage = 0; fFuelTypeDB = 0; @@ -220,7 +226,7 @@ Reactor::Reactor(LogFile* log, EvolutionData evolutivedb, fFixedFuel = true; fIsStorage = false; - fAssociedPool = Pool; + fOutBackEndFacility = Pool; SetCreationTime( (cSecond)creationtime ); SetLifeTime( (cSecond)lifetime ); @@ -333,7 +339,7 @@ void Reactor::Evolution(cSecond t) { - if( fShutDown == true || t < GetCreationTime() ) return; // Reactor stop or not started... + if( fIsShutDown || t < GetCreationTime() ) return; // Reactor stop or not started... if(Norme(fInsideIV)!=0) { @@ -353,28 +359,28 @@ void Reactor::Evolution(cSecond t) - if(fInternalTime == 0 && fIsStarted == false) // Start of the Reactor + if(fInternalTime == 0 && !fIsStarted) // Start of the Reactor { - fEndOfCycle = true; + fIsAtEndOfCycle = true; fInsideIV = fIVBeginCycle; fInternalTime = t; } // Check if the Reactor if started ... - if(fIsStarted == false) return; // If the reactor just start don't need to make Fuel evolution + if(!fIsStarted) return; // If the reactor just start don't need to make Fuel evolution cSecond EvolutionTime = t - fInternalTime; // Calculation of the evolution time (relativ) if( EvolutionTime + fInCycleTime == fCycleTime ) //End of Cycle { - fEndOfCycle = true; + fIsAtEndOfCycle = true; fInternalTime += EvolutionTime; // Update Internal Time fInCycleTime += EvolutionTime; // Update InCycleTime if(t >= GetCreationTime() + GetLifeTime()) // if the Next Cycle don't 'Exist... - fShutDown = true; + fIsShutDown = true; } else if(EvolutionTime + fInCycleTime < fCycleTime ) // During Cycle @@ -384,7 +390,7 @@ void Reactor::Evolution(cSecond t) fInCycleTime += EvolutionTime; // Update InCycleTime fInsideIV = fEvolutionDB.GetIsotopicVectorAt( (cSecond)(fInCycleTime/fEvolutionDB.GetPower()*fPower) ); // update the fuel composition - if(t>=GetCreationTime() + GetLifeTime()) fShutDown = true; + if(t>=GetCreationTime() + GetLifeTime()) fIsShutDown = true; } else { @@ -408,29 +414,29 @@ void Reactor::Dump() if(fInternalTime < GetCreationTime()) return; - if(fShutDown == true && fIsStarted == false) return; // Reactor stopped... + if(fIsShutDown && !fIsStarted) return; // Reactor stopped... - if(fFixedFuel == true) + if(fFixedFuel ) { - if(fEndOfCycle == true && fShutDown == false ) + if(fIsAtEndOfCycle && !fIsShutDown ) { - fEndOfCycle = false; + fIsAtEndOfCycle = false; - if(fIsStarted == true ) // A Cycle has already been done + if(fIsStarted ) // A Cycle has already been done { - fAssociedPool->AddIVCooling(fInsideIV); + fOutBackEndFacility->AddIV(fInsideIV); AddCumulativeIVOut(fInsideIV); } else fIsStarted = true; // Just start the first cycle - if(GetParc()->GetStockManagement() == false && fIsStorage == true) + if(!GetParc()->GetStockManagement() && fIsStorage ) { IsotopicVector BuildIVtmp ; IsotopicVector GodPart; //Get The Storage Compostion - BuildIVtmp.Add(fStorage->GetFullStock().GetIsotopicQuantity()); + BuildIVtmp.Add(fStorage->GetInsideIV().GetIsotopicQuantity()); //Get the rest after IVIn creation BuildIVtmp -= fIVInCycle; //Get the God part form this rest @@ -448,18 +454,18 @@ void Reactor::Dump() fInCycleTime = 0; } - else if (fEndOfCycle == true && fShutDown == true) //shutdown at end of Cycle + else if (fIsAtEndOfCycle && fIsShutDown ) //shutdown at end of Cycle { - fAssociedPool->AddIVCooling(fIVOutCycle); + fOutBackEndFacility->AddIV(fIVOutCycle); AddCumulativeIVOut(fIVOutCycle); fInsideIV.Clear(); fInCycleTime = 0; fIsStarted = false; // shut down the Reactor } - else if (fEndOfCycle == false && fShutDown == true) //shutdown during Cycle + else if (!fIsAtEndOfCycle && fIsShutDown ) //shutdown during Cycle { - fAssociedPool->AddIVCooling(fInsideIV); + fOutBackEndFacility->AddIV(fInsideIV); AddCumulativeIVOut(fInsideIV); fInsideIV.Clear(); fInCycleTime = 0; @@ -468,7 +474,7 @@ void Reactor::Dump() } else { - if(GetParc()->GetStockManagement() == false) + if(!GetParc()->GetStockManagement()) { cout << "!!Warning!! !!!Reactor!!! Can't have unfixedFuel without stock management'" << endl; GetLog()->fLog << "!!Warning!! !!!Reactor!!! Can't have unfixedFuel without stock management" << endl; @@ -476,13 +482,13 @@ void Reactor::Dump() } - if(fEndOfCycle == true && fShutDown == false ) + if(fIsAtEndOfCycle && !fIsShutDown ) { - fEndOfCycle = false; + fIsAtEndOfCycle = false; - if(fIsStarted == true ) // A Cycle has already been done + if(fIsStarted ) // A Cycle has already been done { - fAssociedPool->AddIVCooling(fIVOutCycle); + fOutBackEndFacility->AddIV(fIVOutCycle); AddCumulativeIVOut(fIVOutCycle); } else fIsStarted = true; // Just start the first cycle @@ -497,17 +503,17 @@ void Reactor::Dump() fInCycleTime = 0; } - else if (fEndOfCycle == true && fShutDown == true) //shutdown at end of Cycle + else if (fIsAtEndOfCycle && fIsShutDown ) //shutdown at end of Cycle { - fAssociedPool->AddIVCooling(fIVOutCycle); + fOutBackEndFacility->AddIV(fIVOutCycle); AddCumulativeIVOut(fIVOutCycle); fInsideIV.Clear(); fInCycleTime = 0; fIsStarted = false; // shut down the Reactor } - else if (fEndOfCycle == false && fShutDown == true) //shutdown during Cycle + else if (!fIsAtEndOfCycle && fIsShutDown ) //shutdown during Cycle { - fAssociedPool->AddIVCooling(fInsideIV); + fOutBackEndFacility->AddIV(fInsideIV); AddCumulativeIVOut(fInsideIV); fInsideIV.Clear(); fInCycleTime = 0; diff --git a/source/trunk/src/Storage.cxx b/source/trunk/src/Storage.cxx index 1f9e9cc09b49d511d453e68eb9bb14edef98632a..160db76de45484537010d6801bd1e1a93f1749e3 100644 --- a/source/trunk/src/Storage.cxx +++ b/source/trunk/src/Storage.cxx @@ -21,13 +21,18 @@ //________________________________________________________________________ ClassImp(Storage) -Storage::Storage() +Storage::Storage():CLASSBackEnd() { + SetFacilityType(-1); + SetIsStorageType(); + } Storage::Storage(LogFile* log) { - + SetFacilityType(-1); + SetIsStorageType(); + SetLog(log); cout << "!!INFO!! !!!Storage!!! A new Storage has been define." << endl; @@ -37,6 +42,8 @@ Storage::Storage(LogFile* log) //________________________________________________________________________ Storage::Storage(LogFile* log, DecayDataBank* evolutivedb) { + SetFacilityType(-1); + SetIsStorageType(); SetLog(log); SetDecayDataBank(evolutivedb); @@ -56,23 +63,13 @@ Storage::~Storage() } //________________________________________________________________________ -void Storage::ClearStock() -{ - - IsotopicVector EmptyIV; - fInsideIV = EmptyIV; - fIVStock.clear(); - -} - -//________________________________________________________________________ -void Storage::AddToStock(IsotopicVector isotopicvector) +void Storage::AddIV(IsotopicVector isotopicvector) { AddCumulativeIVIn(isotopicvector); - if(GetParc()->GetStockManagement() == true) - fIVStock.push_back(isotopicvector); + if(GetParc()->GetStockManagement() ) + fIVArray.push_back(isotopicvector); AddToFullStock(isotopicvector); } @@ -81,7 +78,7 @@ void Storage::AddToStock(IsotopicVector isotopicvector) void Storage::TakeFractionFromStock(int IVId,double fraction) { - if(GetParc()->GetStockManagement() == true) + if(GetParc()->GetStockManagement() ) { if(fraction > 1 || fraction < 0) { @@ -90,10 +87,10 @@ void Storage::TakeFractionFromStock(int IVId,double fraction) } else { - AddCumulativeIVOut(fIVStock[IVId]*fraction); + AddCumulativeIVOut(fIVArray[IVId]*fraction); - fInsideIV -= fIVStock[IVId]*fraction; - fIVStock[IVId] = fIVStock[IVId]*(1-fraction); + fInsideIV -= fIVArray[IVId]*fraction; + fIVArray[IVId] = fIVArray[IVId]*(1-fraction); } } @@ -134,9 +131,9 @@ void Storage::StorageEvolution(cSecond t) if(t == fInternalTime && t !=0 ) return; - for(int i = (int)fIVStock.size()-1 ; i >=0; i--) //Removing empty Stock - if(Norme(fIVStock[i]) == 0) - fIVStock.erase(fIVStock.begin()+i); + for(int i = (int)fIVArray.size()-1 ; i >=0; i--) //Removing empty Stock + if(Norme(fIVArray[i]) == 0) + fIVArray.erase(fIVArray.begin()+i); @@ -145,9 +142,9 @@ void Storage::StorageEvolution(cSecond t) fInsideIV = GetDecay(fInsideIV , EvolutionTime); #pragma omp parallel for - for (int i=0; i <(int) fIVStock.size() ; i++) + for (int i=0; i <(int) fIVArray.size() ; i++) { - fIVStock[i] = GetDecay(fIVStock[i] , EvolutionTime); + fIVArray[i] = GetDecay(fIVArray[i] , EvolutionTime); } @@ -173,10 +170,10 @@ void Storage::Evolution(cSecond t) void Storage::Write(string filename, cSecond date) { - for(int i=0;i < (int)fIVStock.size(); i++) + for(int i=0;i < (int)fIVArray.size(); i++) { - fIVStock[i].Write(filename, date); + fIVArray[i].Write(filename, date); } }