diff --git a/source/branches/CLASSV3/include/CLASSFacility.hxx b/source/branches/CLASSV3/include/CLASSFacility.hxx index 0aa316dda0fccfa80b5aea7fcc6a7f71d7c616c9..ddd4b8bf25b808d5f04179655705c0a80199bfda 100644 --- a/source/branches/CLASSV3/include/CLASSFacility.hxx +++ b/source/branches/CLASSV3/include/CLASSFacility.hxx @@ -82,6 +82,7 @@ public : /// \li 8 end of Cooling, /// \li 16 fuel Fabrication using CLASSObject::SetName; + using CLASSObject::GetName; void SetInsideIV(IsotopicVector isotopicvector) { fInsideIV = isotopicvector; } //!< Set the IV inside the Facility Core diff --git a/source/branches/CLASSV3/include/CLASSFuel.hxx b/source/branches/CLASSV3/include/CLASSFuel.hxx new file mode 100644 index 0000000000000000000000000000000000000000..4f3783e171b712429306ea0834702c8b9bec45be --- /dev/null +++ b/source/branches/CLASSV3/include/CLASSFuel.hxx @@ -0,0 +1,60 @@ + +#ifndef _CLASSFUEL_HXX +#define _CLASSFUEL_HXX + + +/*! + \file + \brief Header file for CLASSFuel class. + + + @author BaM + @version 2.0 + */ + +#include <string> +#include <fstream> + +#include "CLASSObject.hxx" + +using namespace std; + +class EvolutionData; +class PhysicModels; +//-----------------------------------------------------------------------------// +/*! + Define a CLASS Object. + The aim of these class is synthetyse all the commum properties to all CLASS Fuel Element. + + + @author BaM + @version 2.0 + */ +//________________________________________________________________________ + + + +class CLASSFuel : public CLASSObject +{ + public : + ///< Normal Constructor. + CLASSFuel(); + CLASSFuel(CLASSLogger* log); + + + virtual CLASSFuel* Clone() { return new CLASSFuel(*this); } //!< Correct way to copy a CLASSFuel in case of derivation + + + virtual EvolutionData* GetEvolutionData() {return 0;} + virtual PhysicModels* GetPhysicModels() {return 0;} + using CLASSObject::SetName; + using CLASSObject::GetName; + protected : + + + private : + +}; + +#endif + diff --git a/source/branches/CLASSV3/include/CLASSFuelPlan.hxx b/source/branches/CLASSV3/include/CLASSFuelPlan.hxx new file mode 100644 index 0000000000000000000000000000000000000000..89b81c7d07454369e5e3e7e389ac8036ba45f6d3 --- /dev/null +++ b/source/branches/CLASSV3/include/CLASSFuelPlan.hxx @@ -0,0 +1,62 @@ + +#ifndef _CLASSFUELPLAN_HXX +#define _CLASSFUELPLAN_HXX + + +/*! + \file + \brief Header file for CLASSFuelPlan class. + + + @author BaM + @version 2.0 + */ + +#include <string> +#include <fstream> +#include <map> + +#include "CLASSObject.hxx" +#include "CLASSFuel.hxx" + +using namespace std; +typedef long long int cSecond; + + +//-----------------------------------------------------------------------------// +/*! + Define a CLASS Object. + The aim of these class is synthetyse all the commum properties to all CLASS Fuel Element. + + + @author BaM + @version 2.0 + */ +//________________________________________________________________________ + + + +class CLASSFuelPlan : public CLASSObject +{ + public : + ///< Normal Constructor. + CLASSFuelPlan(); + CLASSFuelPlan(CLASSLogger* log); + + void AddFuel(cSecond time, CLASSFuel fuel, double BurnUp); + + pair< CLASSFuel, double> GetFuelAt(cSecond t); + + using CLASSObject::SetName; + using CLASSObject::GetName; + protected : + + + private : + + map< cSecond, pair< CLASSFuel, double > > fLoadingPlan; ///< Loading PLan to change the EvolutionData (and the associetedBurnup) according to the Plan + +}; + +#endif + diff --git a/source/branches/CLASSV3/include/CLASSLogger.hxx b/source/branches/CLASSV3/include/CLASSLogger.hxx index af99f4a3eaae95647b89ae70654feb0e5d3958bb..621402068ab9b1c907080327b2601e9e65eb8d39 100755 --- a/source/branches/CLASSV3/include/CLASSLogger.hxx +++ b/source/branches/CLASSV3/include/CLASSLogger.hxx @@ -23,9 +23,9 @@ using namespace std; #ifndef __CINT__ -#define ERROR if(fLog)if(fLog->GetMaxOutPutLVL() >= 0) fLog->E() << "!!!ERROR!!! " << "[" << __FILE__ << ":" << __FUNCTION__ << "]" -#define WARNING if(fLog)if(fLog->GetMaxOutPutLVL() >= 1) fLog->W() << "!!WARNING!! " << "[" << __FILE__ << ":" << __FUNCTION__ << "]" -#define INFO if(fLog)if(fLog->GetMaxOutPutLVL() >= 2) fLog->I() << "!!!!INFO!!! " << "[" << __FILE__ << "]" +#define ERROR if(fLog)if(fLog->GetMaxOutPutLVL() >= 0) fLog->E() << "!!!ERROR!!! " << "[" << __FILE__ << ":" << __FUNCTION__ << "] " +#define WARNING if(fLog)if(fLog->GetMaxOutPutLVL() >= 1) fLog->W() << "!!WARNING!! " << "[" << __FILE__ << ":" << __FUNCTION__ << "] " +#define INFO if(fLog)if(fLog->GetMaxOutPutLVL() >= 2) fLog->I() << "!!!!INFO!!! " << "[" << __FILE__ << "] " #define DBGL if(fLog)if(fLog->GetMaxOutPutLVL() >= 3) fLog->D() << __FILE__ << " : " << __LINE__ << " [" << __FUNCTION__ << "]" << endl; #define DBGV(x) {if(fLog)if(fLog->GetMaxOutPutLVL() >= 3) fLog->D() << __FILE__ << " : " << __LINE__ << " [" << __FUNCTION__ << "]" << x << endl;} diff --git a/source/branches/CLASSV3/include/CLASSObject.hxx b/source/branches/CLASSV3/include/CLASSObject.hxx index 7509327a3457a72a04bdcfa6c2182192f419a081..4a71188615e453be116aa0e0da1b68bfc34ab1e6 100644 --- a/source/branches/CLASSV3/include/CLASSObject.hxx +++ b/source/branches/CLASSV3/include/CLASSObject.hxx @@ -51,6 +51,7 @@ public : using TNamed::SetName; + using TNamed::GetName; protected : #ifndef __CINT__ CLASSLogger* fLog; //!< Pointer to the Log diff --git a/source/branches/CLASSV3/include/EvolutionData.hxx b/source/branches/CLASSV3/include/EvolutionData.hxx index 5b4dc8c15c8114cbab20fb9f5f0ad72e149e0014..2e0c29cced137db5d66f6ec4b781d41d24306c5e 100755 --- a/source/branches/CLASSV3/include/EvolutionData.hxx +++ b/source/branches/CLASSV3/include/EvolutionData.hxx @@ -11,7 +11,7 @@ #include <map> #include "IsotopicVector.hxx" -#include "CLASSObject.hxx" +#include "CLASSFuel.hxx" #include "ZAI.hxx" #include "TMatrix.h" @@ -49,7 +49,7 @@ double Distance(EvolutionData Evd1, IsotopicVector IV1 ); -class EvolutionData : public CLASSObject +class EvolutionData : public CLASSFuel { public : @@ -124,7 +124,7 @@ public : void SetCycleTime(cSecond cycletime) { fCycleTime = cycletime; } ///< Set cycletime of the EvolutionData (double) - void SetEvolutionData(map<ZAI, TGraph*> maptoinsert) { fEvolutionData = maptoinsert;}///< Set EvolutionData map + void SetInventoryEvolution(map<ZAI, TGraph*> maptoinsert) { fInventoryEvolution = maptoinsert;}///< Set EvolutionData map void SetFissionXS(map<ZAI, TGraph*> maptoinsert) { fFissionXS = maptoinsert;} ///< Set fission cross section map void SetCaptureXS(map<ZAI, TGraph*> maptoinsert) { fCaptureXS = maptoinsert;} ///< Set capture cross section map void Setn2nXS(map<ZAI, TGraph*> maptoinsert) { fn2nXS = maptoinsert;} ///< Set (n,2n) cross section map @@ -142,7 +142,8 @@ public : //@{ #ifndef __CINT__ - map<ZAI ,TGraph* > GetEvolutionData() const { return fEvolutionData; } //!< return the EvolutionData map + EvolutionData* GetEvolutionData() {return this;} + map<ZAI ,TGraph* > GetInventoryEvolution() const { return fInventoryEvolution; } //!< return the EvolutionData map map<ZAI ,TGraph* > GetFissionXS() const { return fFissionXS; } //!< return the fission cross section map map<ZAI ,TGraph* > GetCaptureXS() const { return fCaptureXS; } //!< return the capture cross section map map<ZAI ,TGraph* > Getn2nXS() const { return fn2nXS; } //!< return the (n,2n) cross section map @@ -207,7 +208,7 @@ protected : #ifndef __CINT__ - map<ZAI ,TGraph* > fEvolutionData; //!< evolution map + map<ZAI ,TGraph* > fInventoryEvolution; //!< evolution map map<ZAI ,TGraph* > fFissionXS; //!< fission cross section map map<ZAI ,TGraph* > fCaptureXS; //!< capture cross section map map<ZAI ,TGraph* > fn2nXS; //!< (n,2n) cross section map diff --git a/source/branches/CLASSV3/include/FabricationPlant.hxx b/source/branches/CLASSV3/include/FabricationPlant.hxx index 1b67dce8756f03c9966d6a65c9e490dc85cede9c..472274632f496ef920c11b1949341e199c64e1f5 100644 --- a/source/branches/CLASSV3/include/FabricationPlant.hxx +++ b/source/branches/CLASSV3/include/FabricationPlant.hxx @@ -153,7 +153,7 @@ public : void BuildFertileArray(); #ifndef __CINT__ - void BuildFuelForReactor(int ReactorId); //!< Build a Fuel for the reactor ReactorId + void BuildFuelForReactor(int ReactorId, cSecond t); //!< Build a Fuel for the reactor ReactorId #endif void SortArray(int i); diff --git a/source/branches/CLASSV3/include/PhysicModels.hxx b/source/branches/CLASSV3/include/PhysicModels.hxx index 19def55433f0ad7ef67e39c57cb23c35e233c227..a27c2c1af3647b89dd8a5d47502b6e5c745cd22d 100644 --- a/source/branches/CLASSV3/include/PhysicModels.hxx +++ b/source/branches/CLASSV3/include/PhysicModels.hxx @@ -11,7 +11,7 @@ @authors BLG,BaM @version 1.0 */ -#include "CLASSObject.hxx" +#include "CLASSFuel.hxx" #include "EquivalenceModel.hxx" #include "XSModel.hxx" #include "IrradiationModel.hxx" @@ -42,7 +42,7 @@ typedef long long int cSecond; //________________________________________________________________________ -class PhysicModels : public CLASSObject +class PhysicModels : public CLASSFuel { public : @@ -52,6 +52,7 @@ class PhysicModels : public CLASSObject */ //@{ + PhysicModels(); PhysicModels(XSModel* XS, EquivalenceModel* EM, IrradiationModel* IM ); PhysicModels(CLASSLogger* log, XSModel* XS, EquivalenceModel* EM, IrradiationModel* IM ); @@ -63,6 +64,8 @@ class PhysicModels : public CLASSObject XSModel* GetXSModel() {return fXSModel;} EquivalenceModel* GetEquivalenceModel() {return fEquivalenceModel;} IrradiationModel* GetIrradiationModel() {return fIrradiationModel;} + + PhysicModels* GetPhysicModels() {return this;} diff --git a/source/branches/CLASSV3/include/Reactor.hxx b/source/branches/CLASSV3/include/Reactor.hxx index 52fe9cd25478705ef7dfc10fda0eaca0fc5b1e32..2df32dcfe18e5de98d2aa4f0b0e8b4704edb82a8 100755 --- a/source/branches/CLASSV3/include/Reactor.hxx +++ b/source/branches/CLASSV3/include/Reactor.hxx @@ -12,15 +12,15 @@ #include "CLASSFacility.hxx" #include "IsotopicVector.hxx" #include "EvolutionData.hxx" +#include "PhysicModels.hxx" +#include "CLASSFuelPlan.hxx" using namespace std; typedef long long int cSecond; class CLASSBackEnd; -//class Pool; class EvolutionData; -class PhysicModels; class FabricationPlant; class Storage; class CLASSLogger; @@ -61,21 +61,6 @@ public : Reactor(CLASSLogger* log); //} - //{ - /// Special Constructor for reprocessed fuel. - /*! - Make a new reactor - \param CLASSLogger CLASSLogger used for the log... - \param fueltypeDB Databank describing the evolution of the fuel - \param CLASSBAckEnd Pool used facility wich get the fuel after iradiation - \param creationtime creation time - \param lifetime working time duration. - */ - Reactor(CLASSLogger* log, PhysicModels* fueltypeDB, - FabricationPlant* fabricationplant, CLASSBackEnd* Pool, - cSecond creationtime , cSecond lifetime); - //} - //{ /// Special Constructor for reprocessed fuel using cycletime and Burn-Up. /*! @@ -89,7 +74,7 @@ public : \param HMMass Mass of Heavy Metal in the Reactor \param BurnUp Burnup reach by the fuel at the end of the cycle */ - Reactor(CLASSLogger* log, PhysicModels* fueltypeDB, + Reactor(CLASSLogger* log, PhysicModels fueltypeDB, FabricationPlant* fabricationplant, CLASSBackEnd* Pool, cSecond creationtime , cSecond lifetime, cSecond cycletime, double HMMass, double BurnUp); @@ -109,7 +94,7 @@ public : \param BurnUp Burnup reach by the fuel at the end of the cycle \param ChargeFactor effective charge of the reactor. */ - Reactor(CLASSLogger* log, PhysicModels* fueltypeDB, + Reactor(CLASSLogger* log, PhysicModels fueltypeDB, FabricationPlant* fabricationplant, CLASSBackEnd* Pool, cSecond creationtime , cSecond lifetime, double Power, double HMMass, double BurnUp, double ChargeFactor); @@ -166,16 +151,12 @@ public : #ifndef __CINT__ EvolutionData GetEvolutionDB() const { return fEvolutionDB; } //!< Return the Evolution database of the Fuel - PhysicModels* GetFuelType() const { return fFuelTypeDB; } //!< Return the Fuel Type DB of the reactor CLASSBackEnd* GetOutBackEndFacility() const { return fOutBackEndFacility; } //!< Return the pointer to Associeted BackEnd Facility FabricationPlant* GetFabricationPlant() const { return fFabricationPlant; } //!< Return the Pointer to the FabricationPlant - map<cSecond, pair<EvolutionData, double> > GetLoadingPlan() const - { return fLoadingPlan; } //!< return the LoadingPlan - map<cSecond, pair<EvolutionData, double> >::iterator GetNextPlan() const - { return fNextPlan; } //!< return the next fuel in the Plan + CLASSFuelPlan* GetFuelPlan() const { return fFuelPlan; } //!< return the LoadingPlan #endif //@} @@ -213,13 +194,10 @@ public : void SetOutBackEndFacility(CLASSBackEnd* pool) { fOutBackEndFacility = pool; } //!< Return the pointer to OutBackEnd Facility void SetStorage(Storage* storage) { fStorage = storage; fIsStorage = true;} //!< Set the Pointer to the Storage void SetEvolutionDB(EvolutionData evolutionDB); //!< Set the Pointer to the DB Evolution of the Reactor - - void SetLoadingPlan(map<cSecond, pair<EvolutionData, double> > loadingplan) - { fLoadingPlan = loadingplan; fNextPlan = fLoadingPlan.begin(); } - //!< Set a LaodingPlan to change the Fuel after some cycle #endif using CLASSFacility::SetName; + using CLASSFacility::GetName; //@} @@ -255,16 +233,18 @@ protected : IsotopicVector fIVOutCycle; ///< IV wich get out at the End of a Cycle #ifndef __CINT__ - EvolutionData fEvolutionDB; //!< Pointer to the Evolution DataBase - PhysicModels* fFuelTypeDB; //! Pointer to a Fuel Type Database + EvolutionData fEvolutionDB; //!< Pointer to the Actual Evolution DataBase CLASSBackEnd* fOutBackEndFacility; //!< Pointer to the BackEnd Facility which collect the spend fuel - Storage* fStorage; //!< Pointer to the Stock (only for reprocessing fuel in fixed base...) - map<cSecond, pair<EvolutionData, double> > fLoadingPlan; ///< Loading PLan to change the EvolutionData (and the associetedBurnup) according to the Plan - map<cSecond, pair<EvolutionData, double> >::iterator fNextPlan; ///< Next EvolutionData, and time until it should be load (at the end of the last cycle) + + + CLASSFuelPlan* fFuelPlan; FabricationPlant* fFabricationPlant; //!< Poitner to the FabricationPlant + Storage* fStorage; //!< Pointer to the Stock (only for reprocessing fuel in fixed base...) + + #endif //********* Unfixed Fuel Parameter *********// diff --git a/source/branches/CLASSV3/include/Scenario.hxx b/source/branches/CLASSV3/include/Scenario.hxx index c22f026434be01a194eb92c1bdf773f8814d6c4b..382a4c512a7b31bf49aee1d680113c31140162ca 100755 --- a/source/branches/CLASSV3/include/Scenario.hxx +++ b/source/branches/CLASSV3/include/Scenario.hxx @@ -180,7 +180,7 @@ public : /// \li 8 end of Cooling, /// \li 16 fuel Fabrication - void Evolution(double t); ///< Perform the Evolution + void Evolution(cSecond t); ///< Perform the Evolution void PoolEvolution(); ///< Perform TF Evolution void ReactorEvolution(); ///< Perform the Reactor Evolution void FabricationPlantEvolution(); ///< Perform the FabricationPlant Evolution diff --git a/source/branches/CLASSV3/src/CLASSFacility.cxx b/source/branches/CLASSV3/src/CLASSFacility.cxx index bf110feaca4a9256f5e6a920e7b229816bb8a8e9..9759b0d3f28b797190322037066d83748d5075b3 100644 --- a/source/branches/CLASSV3/src/CLASSFacility.cxx +++ b/source/branches/CLASSV3/src/CLASSFacility.cxx @@ -20,9 +20,7 @@ ClassImp(CLASSFacility) CLASSFacility::CLASSFacility(int type):CLASSObject() { fParc = 0; - fFacilityType = type; - fInternalTime = 0; fInCycleTime = 0; fCycleTime = -1; @@ -43,12 +41,11 @@ CLASSFacility::CLASSFacility(CLASSLogger* log, int type):CLASSObject(log) CLASSFacility::CLASSFacility(CLASSLogger* log, cSecond cycletime, int type):CLASSObject(log) { fParc = 0; - fFacilityType = type; - fInternalTime = 0; fInCycleTime = 0; fCycleTime = cycletime; + } CLASSFacility::CLASSFacility(CLASSLogger* log, cSecond creationtime, cSecond lifetime, int type):CLASSObject(log) diff --git a/source/branches/CLASSV3/src/CLASSFuel.cxx b/source/branches/CLASSV3/src/CLASSFuel.cxx new file mode 100644 index 0000000000000000000000000000000000000000..7c84ea8009b637e4cf2d2c369fec174fd3c70f19 --- /dev/null +++ b/source/branches/CLASSV3/src/CLASSFuel.cxx @@ -0,0 +1,22 @@ +#include "CLASSFuel.hxx" + +#include "CLASSLogger.hxx" + +using namespace std; + +//________________________________________________________________________ +// +// CLASSFuel +// +// +// +// +//________________________________________________________________________ + +CLASSFuel::CLASSFuel():CLASSObject() +{ +} + +CLASSFuel::CLASSFuel(CLASSLogger* log):CLASSObject(log) +{ +} \ No newline at end of file diff --git a/source/branches/CLASSV3/src/CLASSFuelPlan.cxx b/source/branches/CLASSV3/src/CLASSFuelPlan.cxx new file mode 100644 index 0000000000000000000000000000000000000000..8f37661ed1249873251fbadb09aa687454d9296b --- /dev/null +++ b/source/branches/CLASSV3/src/CLASSFuelPlan.cxx @@ -0,0 +1,63 @@ +#include "CLASSFuelPlan.hxx" + +#include "CLASSLogger.hxx" + +using namespace std; + +//________________________________________________________________________ +// +// CLASSFuelPlan +// +// +// +// +//________________________________________________________________________ + +CLASSFuelPlan::CLASSFuelPlan():CLASSObject() +{ +} + +CLASSFuelPlan::CLASSFuelPlan(CLASSLogger* log):CLASSObject(log) +{ +} + +void CLASSFuelPlan::AddFuel(cSecond time, CLASSFuel fuel, double BurnUp) +{ + fLoadingPlan.insert(pair< cSecond, pair< CLASSFuel, double > >(time, pair< CLASSFuel, double > (fuel, BurnUp)) ); +} + +pair< CLASSFuel, double > CLASSFuelPlan::GetFuelAt(cSecond t) +{ + + pair< CLASSFuel, double > FuelAtT = fLoadingPlan.begin()->second; + + map< cSecond, pair< CLASSFuel, double > >::iterator it; + + bool AfterPrevious = false; + bool AfterNext = true; + for (it = fLoadingPlan.begin(); it != fLoadingPlan.end(); it++ ) + { + if (t < (*it).first ) + AfterNext = false; + else + AfterNext = true; + + if (AfterPrevious && !AfterNext) + { + return FuelAtT; + } + else if (!AfterPrevious && !AfterNext) + { + WARNING << "The time asked is before the first laoding time..."<< endl; + WARNING << "The first Fuel will be loaded... Check your FuelPLan!!!!!" << endl; + return FuelAtT; + } + else + { + FuelAtT = (*it).second; + AfterPrevious = true; + } + } + + return FuelAtT; +} diff --git a/source/branches/CLASSV3/src/EvolutionData.cxx b/source/branches/CLASSV3/src/EvolutionData.cxx index 91a80723693a6da2a3b860ec7a736857b19a14fc..54760ecc5b4d714471dfacf4e85ce10e70f7fb58 100755 --- a/source/branches/CLASSV3/src/EvolutionData.cxx +++ b/source/branches/CLASSV3/src/EvolutionData.cxx @@ -63,9 +63,13 @@ double Distance(IsotopicVector IV1, EvolutionData Evd1 ) for( it = IVtmpIsotopicQuantity.begin(); it != IVtmpIsotopicQuantity.end(); it++) { - double Z1 = IV1.GetZAIIsotopicQuantity( (*it).first ); - double Z2 = IV2.GetZAIIsotopicQuantity( (*it).first ); - double XS = Evd1.GetXSForAt(0., (*it).first, 1) + double Z1 = 0.0; + double Z2 = 0.0; + double XS = 0.0; + + Z1 = IV1.GetZAIIsotopicQuantity( (*it).first ); + Z2 = IV2.GetZAIIsotopicQuantity( (*it).first ); + XS = Evd1.GetXSForAt(0., (*it).first, 1) + Evd1.GetXSForAt(0., (*it).first, 2) + Evd1.GetXSForAt(0., (*it).first, 3); @@ -89,7 +93,7 @@ EvolutionData operator*(EvolutionData const& evol, double F) EvolutionData evoltmp; - map<ZAI ,TGraph* > EvolutionData = evol.GetEvolutionData(); + map<ZAI ,TGraph* > EvolutionData = evol.GetInventoryEvolution(); map<ZAI ,TGraph* >::iterator it; for(it = EvolutionData.begin(); it != EvolutionData.end(); it++) { @@ -133,7 +137,7 @@ EvolutionData Multiply(EvolutionData const& evol, double F) { EvolutionData evoltmp; - map<ZAI ,TGraph* > EvolutionData = evol.GetEvolutionData(); + map<ZAI ,TGraph* > EvolutionData = evol.GetInventoryEvolution(); map<ZAI ,TGraph* >::iterator it; for(it = EvolutionData.begin(); it != EvolutionData.end(); it++) { @@ -217,8 +221,8 @@ EvolutionData Multiply(double F, EvolutionData const& evol) EvolutionData Sum(EvolutionData const& evol1, EvolutionData const& evol2) { EvolutionData EvolSum = evol1; - map<ZAI ,TGraph* > EvolutionData1 = EvolSum.GetEvolutionData(); - map<ZAI ,TGraph* > EvolutionData2 = evol2.GetEvolutionData(); + map<ZAI ,TGraph* > EvolutionData1 = EvolSum.GetInventoryEvolution(); + map<ZAI ,TGraph* > EvolutionData2 = evol2.GetInventoryEvolution(); map<ZAI ,TGraph* >::iterator it; for(it = EvolutionData2.begin(); it != EvolutionData2.end(); it++) @@ -244,7 +248,7 @@ EvolutionData Sum(EvolutionData const& evol1, EvolutionData const& evol2) } } - EvolSum.SetEvolutionData(EvolutionData1); + EvolSum.SetInventoryEvolution(EvolutionData1); EvolutionData1 = evol1.GetFissionXS(); @@ -344,7 +348,7 @@ ClassImp(EvolutionData) -EvolutionData::EvolutionData():CLASSObject() +EvolutionData::EvolutionData():CLASSFuel() { fIsCrossSection = false; fPower = 0; @@ -354,7 +358,7 @@ EvolutionData::EvolutionData():CLASSObject() } //________________________________________________________________________ -EvolutionData::EvolutionData(CLASSLogger* log):CLASSObject(log) +EvolutionData::EvolutionData(CLASSLogger* log):CLASSFuel(log) { fIsCrossSection = false; @@ -367,7 +371,7 @@ EvolutionData::EvolutionData(CLASSLogger* log):CLASSObject(log) } //________________________________________________________________________ -EvolutionData::EvolutionData(CLASSLogger* log, string DB_file, bool oldread, ZAI zai):CLASSObject(log) +EvolutionData::EvolutionData(CLASSLogger* log, string DB_file, bool oldread, ZAI zai):CLASSFuel(log) { fIsCrossSection = false; @@ -398,7 +402,7 @@ void EvolutionData::DeleteEvolutionData() map<ZAI ,TGraph* >::iterator it_del; - for( it_del = fEvolutionData.begin(); it_del != fEvolutionData.end(); it_del++) + for( it_del = fInventoryEvolution.begin(); it_del != fInventoryEvolution.end(); it_del++) { delete (*it_del).second; (*it_del).second = 0; @@ -423,7 +427,7 @@ void EvolutionData::DeleteEvolutionData() delete fKeff; delete fFlux; - fEvolutionData.clear(); + fInventoryEvolution.clear(); fFissionXS.clear(); fCaptureXS.clear(); fn2nXS.clear(); @@ -438,7 +442,7 @@ bool EvolutionData::NucleiInsert(pair<ZAI, TGraph*> zaitoinsert) { pair<map<ZAI, TGraph*>::iterator, bool> IResult; - IResult = fEvolutionData.insert( zaitoinsert); + IResult = fInventoryEvolution.insert( zaitoinsert); return IResult.second; } @@ -477,7 +481,7 @@ void EvolutionData::AddAsStable(ZAI zai) double time[2] = {0, (500*365.25*3600*24)}; double quantity[2] = {1., 1.}; - fEvolutionData.insert(pair<ZAI ,TGraph* >(zai, new TGraph(2, time, quantity) ) ); + fInventoryEvolution.insert(pair<ZAI ,TGraph* >(zai, new TGraph(2, time, quantity) ) ); } @@ -494,9 +498,9 @@ Double_t EvolutionData::Interpolate(double t, TGraph& EvolutionGraph) TGraph* EvolutionData::GetEvolutionTGraph(const ZAI& zai) { - map<ZAI ,TGraph *>::iterator it = GetEvolutionData().find(zai) ; + map<ZAI ,TGraph *>::iterator it = GetInventoryEvolution().find(zai) ; - if ( it != GetEvolutionData().end() ) + if ( it != GetInventoryEvolution().end() ) return it->second; else return new TGraph(); @@ -510,7 +514,7 @@ IsotopicVector EvolutionData::GetIsotopicVectorAt(double t) IsotopicVector IsotopicVectorTmp; map<ZAI ,TGraph* >::iterator it; - for( it = fEvolutionData.begin(); it != fEvolutionData.end(); it++ ) + for( it = fInventoryEvolution.begin(); it != fInventoryEvolution.end(); it++ ) { IsotopicVectorTmp.Add( (*it).first, Interpolate(t, *((*it).second)) ); } @@ -762,7 +766,7 @@ void EvolutionData::ReadInv(string line, double* time, int NTimeStep) i++; } // Add the TGraph - fEvolutionData.insert(pair<ZAI ,TGraph* >(ZAI(Z,A,I), new TGraph(NTimeStep, time, Inv) ) ); + fInventoryEvolution.insert(pair<ZAI ,TGraph* >(ZAI(Z,A,I), new TGraph(NTimeStep, time, Inv) ) ); } @@ -1002,7 +1006,7 @@ void EvolutionData::OldReadDB(string DBfile) } TGraph* tgraphtmp = new TGraph((int)vTime.size()-1, Time, DPQuantity); - fEvolutionData.insert(pair<ZAI ,TGraph* >(zaitmp, tgraphtmp) ); + fInventoryEvolution.insert(pair<ZAI ,TGraph* >(zaitmp, tgraphtmp) ); } getline(DecayDB, line); diff --git a/source/branches/CLASSV3/src/FabricationPlant.cxx b/source/branches/CLASSV3/src/FabricationPlant.cxx index b13f11bc179a47e13af0b383acc718d5f879ce6d..c32492ece2c035d422845540d1cc9ac7afbefcfe 100644 --- a/source/branches/CLASSV3/src/FabricationPlant.cxx +++ b/source/branches/CLASSV3/src/FabricationPlant.cxx @@ -118,9 +118,18 @@ DBGL { if( (*it).second == t ) { + int ReactorId = (*it).first; + pair<CLASSFuel, double> R_Fuel = GetParc()->GetReactor()[ReactorId]->GetFuelPlan()->GetFuelAt( t + GetCycleTime() ); #pragma omp critical(FuelBuild) - {BuildFuelForReactor( (*it).first );} - (*it).second += GetParc()->GetReactor()[ (*it).first ]->GetCycleTime(); + { + if( typeid(R_Fuel.first) == typeid(PhysicModels) ) + BuildFuelForReactor( (*it).first, t ); + } + + double R_BU = R_Fuel.second; + double R_Power = GetParc()->GetReactor()[ReactorId]->GetPower(); + double R_HMMass = GetParc()->GetReactor()[ReactorId]->GetHeavyMetalMass(); + (*it).second += (cSecond) (R_BU / R_Power * R_HMMass * 1e9 *3600*24); } else if ( (*it).second - GetParc()->GetReactor()[ (*it).first ]->GetCycleTime() + GetCycleTime() > t ) { @@ -139,7 +148,7 @@ DBGL //________________________________________________________________________ -void FabricationPlant::BuildFuelForReactor(int ReactorId) +void FabricationPlant::BuildFuelForReactor(int ReactorId, cSecond t) { DBGV( " IN"<< "in "); if(fFissileStorage.size() == 0) @@ -153,17 +162,18 @@ void FabricationPlant::BuildFuelForReactor(int ReactorId) double R_HM_Mass = GetParc()->GetReactor()[ ReactorId ]->GetHeavyMetalMass(); - double R_BU = GetParc()->GetReactor()[ ReactorId ]->GetBurnUp(); double R_CycleTime = GetParc()->GetReactor()[ ReactorId ]->GetCycleTime(); double R_Power = GetParc()->GetReactor()[ ReactorId ]->GetPower(); - PhysicModels* FuelType = GetParc()->GetReactor()[ReactorId]->GetFuelType(); + pair<CLASSFuel, double > FuelBU = GetParc()->GetReactor()[ReactorId]->GetFuelPlan()->GetFuelAt(t+GetCycleTime()) ; + PhysicModels FuelType = *FuelBU.first.GetPhysicModels(); + double R_BU = FuelBU.second; - fFissileList = FuelType->GetEquivalenceModel()->GetFissileList(); + fFissileList = FuelType.GetEquivalenceModel()->GetFissileList(); BuildFissileArray(); - fFertileList = FuelType->GetEquivalenceModel()->GetFertileList(); + fFertileList = FuelType.GetEquivalenceModel()->GetFertileList(); if(fFertileStorage.size() != 0) // If the fertile need to be taken in stock @@ -173,13 +183,13 @@ void FabricationPlant::BuildFuelForReactor(int ReactorId) fFertileArray.push_back( fFertileList / fFertileList.GetTotalMass() * R_HM_Mass ); } - vector<double> LambdaArray = FuelType->GetEquivalenceModel()->BuildFuel(R_BU, R_HM_Mass, fFissileArray, fFertileArray); + vector<double> LambdaArray = FuelType.GetEquivalenceModel()->BuildFuel(R_BU, R_HM_Mass, fFissileArray, fFertileArray); if(LambdaArray[0] != -1) { IsotopicVector IV = BuildFuelFromEqModel(LambdaArray); - EvolutionData EvolDB = FuelType->GenerateEvolutionData( GetDecay(IV,fCycleTime), R_CycleTime, R_Power); + EvolutionData EvolDB = FuelType.GenerateEvolutionData( GetDecay(IV,fCycleTime), R_CycleTime, R_Power); { pair<map<int, IsotopicVector>::iterator, bool> IResult; @@ -463,7 +473,7 @@ DBGL int IV_N = fFissileArrayAdress[i].second; pair<IsotopicVector, IsotopicVector> Separated_Lost; - Separated_Lost = Separation( fFissileStorage[Stor_N]->GetIVArray()[IV_N]*LambdaArray[i], fFissileList); + Separated_Lost = Separation( fFertileArray[Stor_N]->GetIVArray()[IV_N]*LambdaArray[i], fFertileList); BuildedFuel += Separated_Lost.first; Lost += Separated_Lost.second; } diff --git a/source/branches/CLASSV3/src/Makefile b/source/branches/CLASSV3/src/Makefile index ffe89ae587b7da888d9044f5b86b26f3d54ea04a..1a9ce3f879851c4507e3d9d2ca2aba8e7c1e7fe7 100755 --- a/source/branches/CLASSV3/src/Makefile +++ b/source/branches/CLASSV3/src/Makefile @@ -31,11 +31,13 @@ OBJS = CLASSLogger.o \ Pool.o PoolDict.o\ DecayDataBank.o \ DynamicalSystem.o\ - EvolutionData.o EvolutionDataDict.o \ IrradiationModel.o \ EquivalenceModel.o \ XSModel.o \ + CLASSFuel.o\ PhysicModels.o \ + EvolutionData.o EvolutionDataDict.o \ + CLASSFuelPlan.o\ Scenario.o OBJMODEL = $(EQM)/EQM_MLP_PWR_MOX.o $(EQM)/EQM_QUAD_PWR_MOX.o $(EQM)/EQM_LIN_PWR_MOX.o \ @@ -56,7 +58,9 @@ ROOTOBJS = CLASSLogger.o \ Pool.o PoolDict.o\ DecayDataBank.o \ DynamicalSystem.o\ + CLASSFuel.o\ EvolutionData.o EvolutionDataDict.o \ + CLASSFuelPlan.o\ PhysicModels.o diff --git a/source/branches/CLASSV3/src/PhysicModels.cxx b/source/branches/CLASSV3/src/PhysicModels.cxx index f8a6dd4636c532a69a1b3e26e5a20b0f097d32eb..422ee74151fa9dc3bfe2383bacb0b3ecd2200d32 100644 --- a/source/branches/CLASSV3/src/PhysicModels.cxx +++ b/source/branches/CLASSV3/src/PhysicModels.cxx @@ -8,17 +8,30 @@ // // //________________________________________________________________________ -PhysicModels::PhysicModels(XSModel* XS, EquivalenceModel* EM, IrradiationModel* IM ):CLASSObject() + + + +PhysicModels::PhysicModels():CLASSFuel() +{ + + fXSModel = 0; + fEquivalenceModel = 0; + fIrradiationModel = 0; + + +} +//________________________________________________________________________ +PhysicModels::PhysicModels(XSModel* XS, EquivalenceModel* EM, IrradiationModel* IM ):CLASSFuel() { - fXSModel = XS; - fEquivalenceModel = EM; - fIrradiationModel = IM; + fXSModel = XS; + fEquivalenceModel = EM; + fIrradiationModel = IM; } //________________________________________________________________________ -PhysicModels::PhysicModels(CLASSLogger* log, XSModel* XS, EquivalenceModel* EM, IrradiationModel* IM ):CLASSObject(log) +PhysicModels::PhysicModels(CLASSLogger* log, XSModel* XS, EquivalenceModel* EM, IrradiationModel* IM ):CLASSFuel(log) { fXSModel = XS; diff --git a/source/branches/CLASSV3/src/Reactor.cxx b/source/branches/CLASSV3/src/Reactor.cxx index 3d2b03c8b508f093fb6d96e4588944708934ed12..a50579a71565d9efa68a009953bcad453d19e046 100755 --- a/source/branches/CLASSV3/src/Reactor.cxx +++ b/source/branches/CLASSV3/src/Reactor.cxx @@ -1,7 +1,6 @@ #include "Reactor.hxx" #include "EvolutionData.hxx" -#include "PhysicModels.hxx" #include "Pool.hxx" #include "FabricationPlant.hxx" #include "Storage.hxx" @@ -13,6 +12,7 @@ #include <iostream> #include <cmath> #include <omp.h> +#include <typeinfo> //________________________________________________________________________ // @@ -35,11 +35,8 @@ Reactor::Reactor():CLASSFacility(4) fOutBackEndFacility = 0; fStorage = 0; - fFuelTypeDB = 0; fFabricationPlant = 0; - - fNextPlan = fLoadingPlan.begin(); } Reactor::Reactor(CLASSLogger* log):CLASSFacility(log, 4) @@ -47,51 +44,13 @@ Reactor::Reactor(CLASSLogger* log):CLASSFacility(log, 4) fOutBackEndFacility = 0; fStorage = 0; - fFuelTypeDB = 0; fFabricationPlant = 0; - (*this).SetName("R_Reactor."); - fNextPlan = fLoadingPlan.begin(); + SetName("R_Reactor."); } -Reactor::Reactor(CLASSLogger* log, PhysicModels* fueltypeDB, - FabricationPlant* fabricationplant, - CLASSBackEnd* Pool, - cSecond creationtime, cSecond lifetime):CLASSFacility(log, creationtime, lifetime, 4) -{ - - (*this).SetName("R_Reactor."); - - - fIsStarted = false; - fIsShutDown = false; - fIsAtEndOfCycle = false; - - fFabricationPlant = fabricationplant; - fFixedFuel = false; - fBurnUp = -1.; - fHeavyMetalMass = -1.; - fStorage = 0; - - fOutBackEndFacility = Pool; - - fFuelTypeDB = fueltypeDB; - - fPower = -1.; - - fNextPlan = fLoadingPlan.begin(); - - INFO << " A Reactor has been define :" << endl; - INFO << "\t Fuel Composition is not fixed ! "<< endl; - INFO << "\t Creation time set at \t " << (double)(GetCreationTime()/3600/24/365.25) << " year" << endl; - INFO << "\t Life time (Operating's Duration) set at \t " << (double)(GetLifeTime()/3600/24/365.25) << " year" << endl; - - WARNING << " You need to set Burn-up/Power/CycleTime (2 of 3) & Heavy Metal Mass Manualy !! " << endl; - -} - -Reactor::Reactor(CLASSLogger* log, PhysicModels* fueltypeDB, FabricationPlant* fabricationplant, CLASSBackEnd* Pool, +Reactor::Reactor(CLASSLogger* log, PhysicModels fueltypeDB, FabricationPlant* fabricationplant, CLASSBackEnd* Pool, cSecond creationtime, cSecond lifetime, double Power, double HMMass, double BurnUp, double ChargeFactor):CLASSFacility(log, creationtime, lifetime, 4) { @@ -108,15 +67,13 @@ Reactor::Reactor(CLASSLogger* log, PhysicModels* fueltypeDB, FabricationPlant* f fOutBackEndFacility = Pool; - fFuelTypeDB = fueltypeDB; - - fBurnUp = BurnUp; fHeavyMetalMass = HMMass; fPower = Power*ChargeFactor; fCycleTime = (cSecond) (fBurnUp*1e9 / (fPower) * fHeavyMetalMass *3600*24); //BU in GWd/t - fNextPlan = fLoadingPlan.begin(); + fFuelPlan->AddFuel(creationtime, fueltypeDB, fBurnUp); + INFO << " A Reactor has been define :" << endl; @@ -132,7 +89,7 @@ Reactor::Reactor(CLASSLogger* log, PhysicModels* fueltypeDB, FabricationPlant* f } -Reactor::Reactor(CLASSLogger* log, PhysicModels* fueltypeDB, +Reactor::Reactor(CLASSLogger* log, PhysicModels fueltypeDB, FabricationPlant* fabricationplant, CLASSBackEnd* Pool, cSecond creationtime, cSecond lifetime, cSecond cycletime, @@ -153,12 +110,10 @@ Reactor::Reactor(CLASSLogger* log, PhysicModels* fueltypeDB, fHeavyMetalMass = HMMass; fOutBackEndFacility = Pool; - - fFuelTypeDB = fueltypeDB; - fPower = BurnUp*3600.*24. / (fCycleTime) * HMMass *1e9; //BU in GWd/t - fNextPlan = fLoadingPlan.begin(); + fFuelPlan->AddFuel(creationtime, fueltypeDB, fBurnUp); + INFO << " A Reactor has been define :" << endl; INFO << "\t Fuel Composition is not fixed ! "<< endl; @@ -188,7 +143,6 @@ Reactor::Reactor(CLASSLogger* log, EvolutionData evolutivedb, fIsAtEndOfCycle = false; fStorage = 0; - fFuelTypeDB = 0; fFabricationPlant = 0; fFixedFuel = true; @@ -216,8 +170,7 @@ Reactor::Reactor(CLASSLogger* log, EvolutionData evolutivedb, fIVOutCycle = fEvolutionDB.GetIsotopicVectorAt( (cSecond)(fCycleTime/fEvolutionDB.GetPower()*fPower) ); - - fNextPlan = fLoadingPlan.begin(); + fFuelPlan->AddFuel(creationtime, evolutivedb, fBurnUp); INFO << " A Reactor has been define :" << endl; INFO << "\t Fuel Composition is fixed ! "<< endl; @@ -372,7 +325,9 @@ DBGL else { // This is so bad!! You will probably unsynchronize all the reactor.... + ERROR << " " << (*this).GetName()<< endl; ERROR << " Evolution is too long! There is a problem in Reactor evolution at " << t/365.25/3600/24 << endl; + ERROR << " This is too long of : " << EvolutionTime + fInCycleTime - fCycleTime << endl; exit(1); } @@ -388,18 +343,62 @@ DBGL if(fInternalTime < GetCreationTime()) return; if(fIsShutDown && !fIsStarted) return; // Reactor stopped... + +// First trash the irradiated fuel + if(fIsAtEndOfCycle && !fIsShutDown ) + { + if(fIsStarted ) // A Cycle has already been done + { + fOutBackEndFacility->AddIV(fInsideIV); + AddCumulativeIVOut(fInsideIV); + } + else fIsStarted = true; // Just start the first cycle + + } + else if (fIsAtEndOfCycle && fIsShutDown ) //shutdown at end of Cycle + { + + fOutBackEndFacility->AddIV(fIVOutCycle); + AddCumulativeIVOut(fIVOutCycle); + fInsideIV.Clear(); + fInCycleTime = 0; + fIsStarted = false; // shut down the Reactor + } + else if (!fIsAtEndOfCycle && fIsShutDown ) //shutdown during Cycle + { + fOutBackEndFacility->AddIV(fInsideIV); + AddCumulativeIVOut(fInsideIV); + fInsideIV.Clear(); + fInCycleTime = 0; + fIsStarted = false; // shut down the Reactor + } + + + + +// Get the new Fuel ! + + pair<CLASSFuel, double> NextFuel = fFuelPlan->GetFuelAt(fInternalTime); + SetBurnUp((NextFuel).second); + + if( typeid(NextFuel.first) == typeid(PhysicModels) ) + fFixedFuel = false; + else if( typeid(NextFuel.first) == typeid(EvolutionData) ) + fFixedFuel = true; + else + { + ERROR << "WRONG Fuel Format Correct it !! " << endl; + exit(1); + } + if(fFixedFuel ) { if(fIsAtEndOfCycle && !fIsShutDown ) { + SetEvolutionDB( *NextFuel.first.GetEvolutionData() ); + fIsAtEndOfCycle = false; - if(fIsStarted ) // A Cycle has already been done - { - fOutBackEndFacility->AddIV(fInsideIV); - AddCumulativeIVOut(fInsideIV); - } - else fIsStarted = true; // Just start the first cycle if(!GetParc()->GetStockManagement() && fIsStorage ) { @@ -421,37 +420,12 @@ DBGL else GetParc()->AddGod(fIVInCycle); - if(fNextPlan != fLoadingPlan.end()) // Check if the Fuel change - { - if(fInternalTime >= (*fNextPlan).first) - { - SetEvolutionDB((*fNextPlan).second.first); - SetBurnUp((*fNextPlan).second.second); - fNextPlan++; - } - } fInsideIV = fIVBeginCycle; AddCumulativeIVIn(fIVBeginCycle); fInCycleTime = 0; } - else if (fIsAtEndOfCycle && fIsShutDown ) //shutdown at end of Cycle - { - fOutBackEndFacility->AddIV(fIVOutCycle); - AddCumulativeIVOut(fIVOutCycle); - fInsideIV.Clear(); - fInCycleTime = 0; - fIsStarted = false; // shut down the Reactor - } - else if (!fIsAtEndOfCycle && fIsShutDown ) //shutdown during Cycle - { - fOutBackEndFacility->AddIV(fInsideIV); - AddCumulativeIVOut(fInsideIV); - fInsideIV.Clear(); - fInCycleTime = 0; - fIsStarted = false; // shut down the Reactor - } } else { @@ -461,18 +435,10 @@ DBGL exit(1); } - if(fIsAtEndOfCycle && !fIsShutDown ) { fIsAtEndOfCycle = false; - if(fIsStarted ) // A Cycle has already been done - { - fOutBackEndFacility->AddIV(fIVOutCycle); - AddCumulativeIVOut(fIVOutCycle); - } - else fIsStarted = true; // Just start the first cycle - SetNewFuel(fFabricationPlant->GetReactorEvolutionDB(GetId())); fFabricationPlant->TakeReactorFuel(GetId()); @@ -483,22 +449,7 @@ DBGL fInCycleTime = 0; } - else if (fIsAtEndOfCycle && fIsShutDown ) //shutdown at end of Cycle - { - fOutBackEndFacility->AddIV(fIVOutCycle); - AddCumulativeIVOut(fIVOutCycle); - fInsideIV.Clear(); - fInCycleTime = 0; - fIsStarted = false; // shut down the Reactor - } - else if (!fIsAtEndOfCycle && fIsShutDown ) //shutdown during Cycle - { - fOutBackEndFacility->AddIV(fInsideIV); - AddCumulativeIVOut(fInsideIV); - fInsideIV.Clear(); - fInCycleTime = 0; - fIsStarted = false; // shut down the Reactor - } + diff --git a/source/branches/CLASSV3/src/Scenario.cxx b/source/branches/CLASSV3/src/Scenario.cxx index f34e6003fc7eaf95d6dcc303f7a67dc261768e83..f017f39d433cdad3ed4fcba19407cdaeb906abd7 100755 --- a/source/branches/CLASSV3/src/Scenario.cxx +++ b/source/branches/CLASSV3/src/Scenario.cxx @@ -67,7 +67,7 @@ Scenario::Scenario():CLASSObject(new CLASSLogger("CLASS_OUTPUT.log")) INFO << "\t StockManagement set at : true" << endl; INFO << "\t OutPut will be in \"" << fOutputFileName << "\" File and \"" << fOutputTreeName << "\" TTree" << endl; INFO << "\t Log will be in " << GetLog()->GetCLASSLoggerName() << endl; - + } @@ -95,7 +95,7 @@ Scenario::Scenario(cSecond abstime):CLASSObject(new CLASSLogger()) INFO << "\t StockManagement set at : true" << endl; INFO << "\t OutPut will be in \"" << fOutputFileName << "\" File and \"" << fOutputTreeName << "\" TTree" << endl; INFO << "\t Log will be in " << GetLog()->GetCLASSLoggerName() << endl; - + } @@ -213,8 +213,6 @@ void Scenario::AddReactor(Reactor* reactor) fReactor.back()->SetParc(this); fReactor.back()->SetLog(GetLog()); fReactor.back()->SetId((int)fReactor.size()-1); - if(!fReactor.back()->IsFuelFixed()) - fReactor.back()->GetFabricationPlant()->AddReactor( (int)fReactor.size()-1,fReactor.back()->GetCreationTime() ); string Reactor_name = fReactor.back()->GetName(); @@ -313,8 +311,8 @@ map<cSecond,int> Scenario::GetTheBackEndTimePath(Reactor* reactor) { pair< map<cSecond, int>::iterator, bool > IResult; -// IResult = TheBackEndTimePath.insert(pair<cSecond, double> ( step,reactor->GetFacilityType() ) ); -// if( !IResult.second ) IResult.first->second |= reactor->GetFacilityType(); + // IResult = TheBackEndTimePath.insert(pair<cSecond, double> ( step,reactor->GetFacilityType() ) ); + // if( !IResult.second ) IResult.first->second |= reactor->GetFacilityType(); } @@ -339,7 +337,7 @@ map<cSecond,int> Scenario::GetTheBackEndTimePath(Reactor* reactor) //________________________________________________________________________ void Scenario::BuildTimeVector(cSecond t) { -DBGL + DBGL fTimeStep.clear(); fTimeStep.insert( pair<cSecond ,int>(t,1) ); //********* Printing Step *********// @@ -362,43 +360,61 @@ DBGL 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 R_StartingTime = fReactor[i]->GetCreationTime(); + cSecond R_ShutDownTime = fReactor[i]->GetCreationTime() + fReactor[i]->GetLifeTime(); - cSecond step = ReactorStaringTime; + double R_Power = fReactor[i]->GetPower(); + double R_HMMass = fReactor[i]->GetHeavyMetalMass(); + pair<CLASSFuel, double> R_Fuel = fReactor[i]->GetFuelPlan()->GetFuelAt(R_StartingTime); - map< cSecond, int > BackEndTimePath = GetTheBackEndTimePath(fReactor[i]); - if(!fReactor[i]->IsFuelFixed()) - FabricationCycleTime = fReactor[i]->GetFabricationPlant()->GetCycleTime(); + double R_BU = R_Fuel.second; + cSecond R_CycleTime = (cSecond) (R_BU / R_Power * R_HMMass * 1e9 *3600*24); + if(R_CycleTime == 0) + { + ERROR << " Be carefull a reactor cycletime is set to 0 second....\"\n" << endl; + exit(1); + } + + int R_FacilityType = fReactor[i]->GetFacilityType(); + + + cSecond F_CycleTime = 0; + + + cSecond step = R_StartingTime; + + map< cSecond, int > R_BackEndTimePath = GetTheBackEndTimePath(fReactor[i]); + if( typeid(R_Fuel.first) == typeid(PhysicModels) ) + F_CycleTime = 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 ) + if( R_ShutDownTime < t ) { - //********* Reactor Shutdown *********// - if( ReactorShutDownTime > fAbsoluteTime) + // Shutdown + if( R_ShutDownTime > fAbsoluteTime) { pair< map<cSecond, int>::iterator, bool > IResult; - IResult = fTimeStep.insert( pair<cSecond ,int>(ReactorShutDownTime, 2) ); + IResult = fTimeStep.insert( pair<cSecond ,int>(R_ShutDownTime, 2) ); if( !IResult.second ) IResult.first->second |= 2; } + // BackEnd fuel Cycle after reactor Shutdown + 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 + + // Loop on the BackEnd fuel Cycle Time path + for(TV_it = R_BackEndTimePath.begin(); TV_it != R_BackEndTimePath.end(); TV_it++) { // 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) + if( R_ShutDownTime + (*TV_it).first >= fAbsoluteTime && R_ShutDownTime + (*TV_it).first <= t) { pair< map<cSecond, int>::iterator, bool > IResult; - IResult = fTimeStep.insert( pair<cSecond ,int>(ReactorShutDownTime + (*TV_it).first, (*TV_it).second) ); + IResult = fTimeStep.insert( pair<cSecond ,int>(R_ShutDownTime + (*TV_it).first, (*TV_it).second) ); if( !IResult.second ) IResult.first->second |= (*TV_it).second; } @@ -408,79 +424,91 @@ DBGL } // Start the reactor and the Fuel Fabrication - if(step >= fAbsoluteTime && step <= t && step < ReactorShutDownTime) + if(step >= fAbsoluteTime && step <= t && step < R_ShutDownTime) { pair< map<cSecond, int>::iterator, bool > IResult; - IResult = fTimeStep.insert( pair<cSecond ,int>(ReactorStaringTime, ReactorFacilityType) ); + IResult = fTimeStep.insert( pair<cSecond ,int>(step, R_FacilityType) ); if( !IResult.second ) - IResult.first->second |= ReactorFacilityType; + IResult.first->second |= R_FacilityType; } //********* FabricationPlant Evolution Step *********// - if(!fReactor[i]->IsFuelFixed()) + + + if( typeid(R_Fuel.first) == typeid(PhysicModels) ) { - if( (step - FabricationCycleTime) >= fAbsoluteTime && (step - FabricationCycleTime) <= t ) + + fReactor[i]->GetFabricationPlant()->AddReactor( i, fReactor[i]->GetCreationTime() ); + + + if( (step - F_CycleTime) >= fAbsoluteTime && (step - F_CycleTime) <= t ) { pair< map<cSecond, int>::iterator, bool > IResult; - IResult = fTimeStep.insert( pair<cSecond ,int>(step - FabricationCycleTime,16) ); + IResult = fTimeStep.insert( pair<cSecond ,int>(step - F_CycleTime,16) ); if( !IResult.second ) IResult.first->second |= 16; } - else if( step - FabricationCycleTime < fStartingTime ) + else if( step - F_CycleTime < fStartingTime ) { ERROR << " Can't Build Fuel before Scenario's start\"\n" << endl; exit(1); } } - map<cSecond, pair<EvolutionData, double> > ReactorLoadingPlan = fReactor[i]->GetLoadingPlan(); - map<cSecond, pair<EvolutionData, double> >::iterator ReactorNextPlan = ReactorLoadingPlan.begin(); + //Prepare the first Cycle + R_Fuel = fReactor[i]->GetFuelPlan()->GetFuelAt(step); + R_BU = fReactor[i]->GetFuelPlan()->GetFuelAt(step).second; + R_CycleTime = (cSecond) (R_BU / R_Power * R_HMMass * 1e9 *3600*24); + if(R_CycleTime == 0) + { + ERROR << " Be carefull a reactor cycletime is set to 0 second....\"\n" << endl; + exit(1); + } + step += R_CycleTime; - if (ReactorCycleTime !=0) + while(step <= t && step <= R_ShutDownTime ) { - step += ReactorCycleTime; - do + + // FabricationPlant Evolution Step + if( typeid(R_Fuel.first) == typeid(PhysicModels) ) { - if(ReactorNextPlan != ReactorLoadingPlan.end()) // Check if the Fuel change - { - if(step >= (*ReactorNextPlan).first) - { - ReactorCycleTime = (cSecond) ((*ReactorNextPlan).second.second * 1e9 - / (fReactor[i]->GetPower()) - * fReactor[i]->GetHeavyMetalMass() *3600*24); - ReactorNextPlan++; + F_CycleTime = fReactor[i]->GetFabricationPlant()->GetCycleTime(); - } + if(step - F_CycleTime >= fAbsoluteTime && + step - F_CycleTime <= t && + step < R_ShutDownTime) + { // Set End of reactor cycle + pair< map<cSecond, int>::iterator, bool > IResult; + IResult = fTimeStep.insert( pair<cSecond ,int>(step - F_CycleTime,16) ); + if( !IResult.second ) IResult.first->second |= 16; } - //********* 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) + if(step >= fAbsoluteTime && + step <= t && + step < R_ShutDownTime) { // 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 *********// + // 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 + // BackEnd fuel Cycle + // Loop on the BackEnd fuel Cycle Time path + for(TV_it = R_BackEndTimePath.begin(); TV_it != R_BackEndTimePath.end(); TV_it++) { - // 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) - { + + if(step + (*TV_it).first >= fAbsoluteTime && + step + (*TV_it).first <= t) + { // Test if each step of the Fuel Cycle BackEnd is after the actual time (AbsolutreTime) and before the end of the evolution (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; @@ -489,20 +517,26 @@ DBGL - step += ReactorCycleTime; + // Update to the next fuel + R_Fuel = fReactor[i]->GetFuelPlan()->GetFuelAt(step); + + R_BU = fReactor[i]->GetFuelPlan()->GetFuelAt(step).second; + R_CycleTime = (cSecond) (R_BU / R_Power * R_HMMass * 1e9 *3600*24); + if(R_CycleTime == 0) + { + ERROR << " Be carefull a reactor cycletime is set to 0 second....\"\n" << endl; + exit(1); + } + step += R_CycleTime; } - while(step <= t && step <= ReactorShutDownTime ); - } - else - { - WARNING << " 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 @@ -513,8 +547,10 @@ DBGL for( it = fTimeStep.begin(); it != fTimeStep.end(); it++) TimeStepfile << (*it).first << " " << (*it).second << endl; -DBGL + DBGL } + + //________________________________________________________________________ void Scenario::OldBuildTimeVector(cSecond t) { @@ -671,40 +707,40 @@ void Scenario::OldBuildTimeVector(cSecond t) void Scenario::PoolEvolution() { -DBGL + DBGL #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(); -DBGL + DBGL } void Scenario::StorageEvolution() { -DBGL + DBGL #pragma omp parallel for for(int i = 0; i < (int) fStorage.size();i++) fStorage[i]->Evolution(fAbsoluteTime); -DBGL + DBGL } void Scenario::FabricationPlantEvolution() { -DBGL + DBGL //#pragma omp parallel for for(int i = 0; i < (int) fFabricationPlant.size();i++) fFabricationPlant[i]->Evolution(fAbsoluteTime); -DBGL + DBGL } //________________________________________________________________________ void Scenario::ReactorEvolution() { -DBGL + DBGL fParcPower = 0; #pragma omp parallel for for(int i = 0; i < (int)fReactor.size(); i++) @@ -714,17 +750,17 @@ DBGL for(int i = 0; i < (int)fReactor.size(); i++) fReactor[i]->Dump(); -DBGL + DBGL } //________________________________________________________________________ -void Scenario::Evolution(double t) +void Scenario::Evolution(cSecond t) { -DBGL + DBGL - BuildTimeVector( (cSecond)t ); + BuildTimeVector(t); - if(fNewTtree ) + if(fNewTtree) { OpenOutputTree(); OutAttach(); @@ -764,7 +800,7 @@ DBGL } cout << endl; -DBGL + DBGL } void Scenario::ProgressPrintout(cSecond t) @@ -948,11 +984,11 @@ void Scenario::Print() INFO << "Cooling "; INFO << fPool[i]->GetIVArray().size()<< endl; } - + for(int i = 0; i < (int)fReactor.size(); i++) { INFO << "Reactor" << endl; fReactor[i]->GetIVReactor().Print(); } - + }