diff --git a/source/trunk/include/CLASS.hxx b/source/trunk/include/CLASS.hxx index 55127bbc77478c9a2999751945e87829187f9221..45eb760e5636068f2e7af86eba301e1471239d91 100755 --- a/source/trunk/include/CLASS.hxx +++ b/source/trunk/include/CLASS.hxx @@ -257,7 +257,7 @@ protected : TFile* fOutFile; ///< Pointer to the Root Output File string fOutputFileName; //! Name of the Output File - TTree* fOutT; ///< Pointer to the Root Output TTree + TTree* fOutT; ///< Pointer to the Root Output TTr3ee string fOutputTreeName; //! Name of the Output TTree string fOutputLogName; ///< Name of the Ouput log File diff --git a/source/trunk/include/CLASSBackEnd.hxx b/source/trunk/include/CLASSBackEnd.hxx index f829923aaa6358fe402ea4c4b5be5c53a162e7f4..6e6df7b834ad7a0d7dd78eb9eb21f9d67c4a9b4d 100644 --- a/source/trunk/include/CLASSBackEnd.hxx +++ b/source/trunk/include/CLASSBackEnd.hxx @@ -51,8 +51,11 @@ class CLASSBackEnd : public CLASSFacility DecayDataBank* GetDecayDataBank() { return fDecayDataBase;} //!< Return the pointer to the decay DataBank vector<IsotopicVector> GetIVArray() const { return fIVArray; } //!< Return the IsotopicVector Array + int GetIVNumber() const { return fIVArray.size();} bool GetStorageType() const { return fIsStorageType;} //!< Return the storageType CLASSBackEnd* GetOutBackEndFacility() const { return fOutBackEndFacility;} //!<Return the pointer to the OUtBackEndFacility + IsotopicVector GetIV(int i) const { if(i < (int)fIVArray.size()) return fIVArray[i]; + else return IsotopicVector(); } //@} //********* Set Method *********// diff --git a/source/trunk/include/FabricationPlant.hxx b/source/trunk/include/FabricationPlant.hxx index fca5b5e68dbb0a4c330c83908c50377c3b236415..5373ef8abece9253ecc6ee48c2a68570e8826a83 100644 --- a/source/trunk/include/FabricationPlant.hxx +++ b/source/trunk/include/FabricationPlant.hxx @@ -99,7 +99,7 @@ public : void SetUpdateReferenceDBatEachStep(bool val){ fUpdateReferenceDBatEachStep = val;} //!< Set fUpdateReferenceDBatEachStep variable void SetStorage(Storage* storage) { fStorage = storage; } //!< Set the Pointer to the Storage - void SetChronologicalTimePriority(bool bval) { fChronologicalTimePriority = bval;} //!< Set the chronological priority (true for chronological, false unstead) + void SetChronologicalTimePriority(bool bval = true) { fChronologicalTimePriority = bval;} //!< Set the chronological priority (true for chronological, false unstead) void SetSubstitutionFuel(EvolutionData fuel); //!< To use a subtition fuel if the fabrication fail (not enough material in stock) diff --git a/source/trunk/include/IsotopicVector.hxx b/source/trunk/include/IsotopicVector.hxx index f06efb3dbdf46d8f10942b09aee813ffd63177dd..07063d79ca81504dc6ef48e449cfc3a080fc9c4d 100755 --- a/source/trunk/include/IsotopicVector.hxx +++ b/source/trunk/include/IsotopicVector.hxx @@ -63,7 +63,7 @@ public : IsotopicVector GetActinidesComposition() const; //!< Return the Actinides composition of the "z" atom double GetZAIIsotopicQuantity(const ZAI& zai) const; ///< Return the quantity of the ZAI double GetZAIIsotopicQuantity(const int z, const int a, const int i) const; ///< Return the quantity of the ZAI - + vector<int> GetChemicalSpecies() const; //!< Return the Species Species contained int GetZAIQuantity() const {return fIsotopicQuantity.size(); } //!< Return the number of different ZAI in the IsotopicVector diff --git a/source/trunk/include/Reactor.hxx b/source/trunk/include/Reactor.hxx index 2c97e4d75035f6cbb117bd8eaff6e46063b3dea9..06c8ab9ce9f32338a39b1fc2b9ccfde66b0e32ed 100755 --- a/source/trunk/include/Reactor.hxx +++ b/source/trunk/include/Reactor.hxx @@ -74,7 +74,7 @@ public : */ Reactor(LogFile* log, FuelDataBank* fueltypeDB, FabricationPlant* fabricationplant, CLASSBackEnd* Pool, - double creationtime , double lifetime); + cSecond creationtime , cSecond lifetime); //} //{ @@ -92,7 +92,7 @@ public : */ Reactor(LogFile* log, FuelDataBank* fueltypeDB, FabricationPlant* fabricationplant, CLASSBackEnd* Pool, - double creationtime , double lifetime, double cycletime, + cSecond creationtime , cSecond lifetime, cSecond cycletime, double HMMass, double BurnUp); //} @@ -112,7 +112,7 @@ public : */ Reactor(LogFile* log, FuelDataBank* fueltypeDB, FabricationPlant* fabricationplant, CLASSBackEnd* Pool, - double creationtime , double lifetime, + cSecond creationtime , cSecond lifetime, double Power, double HMMass, double BurnUp, double ChargeFactor); //} @@ -131,7 +131,7 @@ public : \param ChargeFactor effective charge of the reactor. */ Reactor(LogFile* log, EvolutionData evolutivedb, CLASSBackEnd* Pool, - double creationtime, double lifetime, + cSecond creationtime, cSecond lifetime, double power, double HMMass, double BurnUp, double ChargeFactor = 1); //} @@ -169,6 +169,13 @@ public : double GetBurnUp() const { return fBurnUp; } //!< Return the Burn Up of the Fuel at the end of the cycle double GetPower() const { return fPower; } //!< Return the cycle time of the Reactor +#ifndef __CINT__ + 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 + +#endif //@} @@ -186,21 +193,29 @@ public : void SetStorage(Storage* storage) { fStorage = storage; fIsStorage = true;} //!< Set the Pointer to the Storage + void SetHMMass(double Mass) {fHeavyMetalMass = Mass;} //!< Set the HeavyMetal Mass in the Core at the begining of the cycle + void SetIVReactor(IsotopicVector isotopicvector) - { fInsideIV = isotopicvector; } //!< Set the IV inside the Reactor Core + { 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 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 SetCycleTime(double cycletime); //!< Set the Cycle time (Power fixed) + void SetPower(double Power); //!< Set the Power (BurnUp cte) + void SetBurnUp(double BU); //!< Set the BurnUp reach at end of cycle (Power cte) + + + + + void SetLoadingPlan(map<cSecond, pair<EvolutionData, double> > loadingplan) + { fLoadingPlan = loadingplan; fNextPlan = fLoadingPlan.begin(); } + //!< Set a LaodingPlan to change the Fuel after some cycle //@} @@ -239,7 +254,10 @@ protected : IsotopicVector fIVInCycle; ///< IVBegin add at the Beginning of the Cycle IsotopicVector fIVOutCycle; ///< IV wich get out at the End of a Cycle - +#ifndef __CINT__ + 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) +#endif //********* Unfixed Fuel Parameter *********// diff --git a/source/trunk/src/CLASS.cxx b/source/trunk/src/CLASS.cxx index 567b0dbcae15d86bacfe5afe818b0193f4a33315..28e7e4cec2ddcffa2321cdd98e294672b40c9172 100755 --- a/source/trunk/src/CLASS.cxx +++ b/source/trunk/src/CLASS.cxx @@ -185,14 +185,27 @@ void CLASS::AddPool(Pool* Pool) fPool.back()->SetId((int)fPool.size()-1); - if(!fNewTtree) + string Pool_name = fPool.back()->GetName(); + if(Pool_name == "P_Pool.") { - string Pool_name = "Pool"; + Pool_name = "P_Pool"; Pool_name += dtoa(fPool.back()->GetId()); Pool_name += "."; - fOutT->Branch(Pool_name.c_str(), "Pool", &fPool.back()); + fPool.back()->SetName(Pool_name.c_str()); + } + else + { + string name_tmp = Pool_name; + Pool_name = "P_"; + Pool_name += name_tmp; + Pool_name += "."; + fPool.back()->SetName(Pool_name.c_str()); } + if(!fNewTtree) + fOutT->Branch(fPool.back()->GetName(), "Pool", &fPool.back()); + + } //________________________________________________________________________ @@ -207,15 +220,26 @@ void CLASS::AddReactor(Reactor* reactor) fReactor.back()->GetFabricationPlant()->AddReactor( (int)fReactor.size()-1,fReactor.back()->GetCreationTime() ); - - if(!fNewTtree) + string Reactor_name = fReactor.back()->GetName(); + if(Reactor_name == "R_Reactor.") { - string Reactor_name = "Reactor"; + Reactor_name = "R_Reactor"; Reactor_name += dtoa(fReactor.back()->GetId()); Reactor_name += "."; - fOutT->Branch(Reactor_name.c_str(), "Reactor", &fReactor.back()); + fReactor.back()->SetName(Reactor_name.c_str()); + } + else + { + string name_tmp = Reactor_name; + Reactor_name = "R_"; + Reactor_name += name_tmp; + Reactor_name += "."; + fReactor.back()->SetName(Reactor_name.c_str()); } + if(!fNewTtree) + fOutT->Branch(fReactor.back()->GetName(), "Reactor", &fReactor.back()); + } @@ -229,14 +253,27 @@ void CLASS::AddStorage(Storage* storage) fStorage.back()->SetLog(GetLog()); fStorage.back()->SetId((int)fStorage.size()-1); - if(!fNewTtree) + string Storage_name = fStorage.back()->GetName(); + + if(Storage_name == "S_Storage.") { - string Storage_name = "Storage"; + Storage_name = "S_Storage"; Storage_name += dtoa(fStorage.back()->GetId()); Storage_name += "."; - fOutT->Branch(Storage_name.c_str(), "Storage", &fStorage.back()); + fStorage.back()->SetName(Storage_name.c_str()); + } + else + { + string name_tmp = Storage_name; + Storage_name = "S_"; + Storage_name += name_tmp; + Storage_name += "."; + fStorage.back()->SetName(Storage_name.c_str()); } + if(!fNewTtree) + fOutT->Branch(fStorage.back()->GetName(), "Storage", &fStorage.back()); + } //________________________________________________________________________ @@ -249,15 +286,26 @@ void CLASS::AddFabricationPlant(FabricationPlant* fabricationplant) fFabricationPlant.back()->SetLog(GetLog()); fFabricationPlant.back()->SetId((int)fStorage.size()-1); - if(!fNewTtree) + + string FP_name = fFabricationPlant.back()->GetName(); + if(FP_name == "F_FabricationPlant.") { - string FabricationPlant_name = "FabricationPlant"; - FabricationPlant_name += dtoa(fFabricationPlant.back()->GetId()); - FabricationPlant_name += "."; - fOutT->Branch(FabricationPlant_name.c_str(), "FabricationPlant", &fFabricationPlant.back()); + FP_name = "F_FabricationPlant"; + FP_name += dtoa(fFabricationPlant.back()->GetId()); + FP_name += "."; + fFabricationPlant.back()->SetName(FP_name.c_str()); + } + else + { + string name_tmp = FP_name; + FP_name = "F_"; + FP_name += name_tmp; + FP_name += "."; + fFabricationPlant.back()->SetName(FP_name.c_str()); } - + if(!fNewTtree) + fOutT->Branch(fFabricationPlant.back()->GetName(), "FabricationPlant", &fFabricationPlant.back()); } //________________________________________________________________________ map<cSecond,int> CLASS::GetTheBackEndTimePath(Reactor* reactor) @@ -388,11 +436,29 @@ void CLASS::BuildTimeVector(cSecond t) } } - if (fReactor[i]->GetCycleTime() !=0) + map<cSecond, pair<EvolutionData, double> > ReactorLoadingPlan = fReactor[i]->GetLoadingPlan(); + map<cSecond, pair<EvolutionData, double> >::iterator ReactorNextPlan = ReactorLoadingPlan.begin(); + + + + + if (ReactorCycleTime !=0) { - step += fReactor[i]->GetCycleTime(); + step += ReactorCycleTime; do { + 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++; + + } + } + //********* FabricationPlant Evolution Step *********// if(!fReactor[i]->IsFuelFixed()) if(step - FabricationCycleTime >= fAbsoluteTime && step - FabricationCycleTime <= t && step < ReactorShutDownTime) @@ -422,6 +488,9 @@ void CLASS::BuildTimeVector(cSecond t) IResult.first->second |= (*TV_it).second; } } + + + step += ReactorCycleTime; } while(step <= t && step <= ReactorShutDownTime ); @@ -447,7 +516,7 @@ 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; + TimeStepfile << (*it).first << " " << (*it).second << endl; } //________________________________________________________________________ @@ -594,7 +663,7 @@ void CLASS::OldBuildTimeVector(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; + TimeStepfile << (*it).first << " " << (*it).second << endl; } @@ -853,36 +922,19 @@ void CLASS::OutAttach() // 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]); - } + fOutT->Branch(fStorage[i]->GetName(), "Storage", &fStorage[i]); for(int i = 0; i < (int)fPool.size(); i++) - { - string TF_name = "Pool"; - TF_name += dtoa(i); - TF_name += "."; - fOutT->Branch(TF_name.c_str(), "Pool", &fPool[i]); - } + + fOutT->Branch(fPool[i]->GetName(), "Pool", &fPool[i]); for(int i = 0; i < (int)fReactor.size(); i++) - { - string R_name = "Reactor"; - R_name += dtoa(i); - R_name += "."; - fOutT->Branch(R_name.c_str(), "Reactor", &fReactor[i]); - } + + fOutT->Branch(fReactor[i]->GetName(), "Reactor", &fReactor[i]); + for(int i = 0; i < (int)fFabricationPlant.size(); i++) - { - string FP_name = "FabricationPlant"; - FP_name += dtoa(i); - FP_name += "."; - fOutT->Branch(FP_name.c_str(), "FabricationPlant", &fFabricationPlant[i]); - } + fOutT->Branch(fFabricationPlant[i]->GetName(), "FabricationPlant", &fFabricationPlant[i]); + } diff --git a/source/trunk/src/FabricationPlant.cxx b/source/trunk/src/FabricationPlant.cxx index 7feba6bc41a6e8b3a48a336d76dd32ea26ca60a1..a2b9bdc1272b6b4941ebf5ce7cc2563d66fbbbf7 100644 --- a/source/trunk/src/FabricationPlant.cxx +++ b/source/trunk/src/FabricationPlant.cxx @@ -46,6 +46,8 @@ ClassImp(FabricationPlant) FabricationPlant::FabricationPlant() { SetFacilityType(16); + SetName("F_FabricationPLant."); + fStorage = 0; fReUsable = 0; } @@ -53,6 +55,7 @@ FabricationPlant::FabricationPlant() FabricationPlant::FabricationPlant(LogFile* log) { SetFacilityType(16); + SetName("F_FabricationPLant."); SetLog(log); fChronologicalTimePriority = false; @@ -76,6 +79,7 @@ FabricationPlant::FabricationPlant(LogFile* log) FabricationPlant::FabricationPlant(LogFile* log, Storage* storage, Storage* reusable, double fabircationtime) { SetFacilityType(16); + SetName("F_FabricationPLant."); SetLog(log); @@ -301,7 +305,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); @@ -369,6 +373,8 @@ void FabricationPlant::BuildFuelForReactor(int ReactorId) } } + +//________________________________________________________________________ void FabricationPlant::SetSubstitutionFuel(EvolutionData fuel) { diff --git a/source/trunk/src/Pool.cxx b/source/trunk/src/Pool.cxx index d534710123bbb8a0e6e48db14825be84a3d40871..3fbcfa3034edc6733c3a62c1f5c62590c660f0b8 100755 --- a/source/trunk/src/Pool.cxx +++ b/source/trunk/src/Pool.cxx @@ -26,6 +26,7 @@ Pool::Pool():CLASSBackEnd() { fOutBackEndFacility = 0; SetFacilityType(8); + SetName("P_Pool."); } Pool::Pool(LogFile* log) @@ -42,6 +43,7 @@ Pool::Pool(LogFile* log) fCoolingLastIndex = 0; fOutBackEndFacility = 0; + SetName("P_Pool."); cout << "!!INFO!! !!!Pool!!! A new Pool has been define :" << endl; @@ -70,6 +72,7 @@ Pool::Pool(LogFile* log, double creation, double coolingtime) fCoolingLastIndex = 0; fOutBackEndFacility = 0; + SetName("P_Pool."); cout << "!!INFO!! !!!Pool!!! A new Pool has been define :" << endl; @@ -100,6 +103,7 @@ Pool::Pool(LogFile* log, CLASSBackEnd* storage, double creation, double coolingt fIsStarted = false; fPutToWaste = false; fCoolingLastIndex = 0; + SetName("P_Pool."); cout << "!!INFO!! !!!Pool!!! A new Pool has been define :" << endl; diff --git a/source/trunk/src/Reactor.cxx b/source/trunk/src/Reactor.cxx index 052b0e558c09c46d80b69101b4c4f225c113870d..8b0056e394f0e0530e88965ac9039df31e1d37c3 100755 --- a/source/trunk/src/Reactor.cxx +++ b/source/trunk/src/Reactor.cxx @@ -29,11 +29,18 @@ ClassImp(Reactor) Reactor::Reactor() { + + SetFacilityType(4); + SetName("R_Reactor."); + + fOutBackEndFacility = 0; fStorage = 0; fFuelTypeDB = 0; fFabricationPlant = 0; - SetFacilityType(4); + + + fNextPlan = fLoadingPlan.begin(); } Reactor::Reactor(LogFile* log) @@ -45,17 +52,21 @@ Reactor::Reactor(LogFile* log) fFuelTypeDB = 0; fFabricationPlant = 0; SetFacilityType(4); + SetName("R_Reactor."); + fNextPlan = fLoadingPlan.begin(); } Reactor::Reactor(LogFile* log, FuelDataBank* fueltypeDB, FabricationPlant* fabricationplant, CLASSBackEnd* Pool, - double creationtime, double lifetime) + cSecond creationtime, cSecond lifetime) { + SetLog(log); + SetFacilityType(4); + SetName("R_Reactor."); - SetLog(log); fIsStarted = false; fIsShutDown = false; @@ -75,7 +86,12 @@ Reactor::Reactor(LogFile* log, FuelDataBank* fueltypeDB, fCycleTime = -1.; //BU in GWd/t SetCreationTime( (cSecond)creationtime ); + fInternalTime = creationtime; SetLifeTime( (cSecond)lifetime ); + fInCycleTime = 0; + + + fNextPlan = fLoadingPlan.begin(); cout << "!!INFO!! !!!Reactor!!! A Reactor has been define :" << endl; cout << "\t Fuel Composition is not fixed ! "<< endl; @@ -95,12 +111,14 @@ Reactor::Reactor(LogFile* log, FuelDataBank* fueltypeDB, } Reactor::Reactor(LogFile* log, FuelDataBank* fueltypeDB, FabricationPlant* fabricationplant, CLASSBackEnd* Pool, - double creationtime, double lifetime, + cSecond creationtime, cSecond lifetime, double Power, double HMMass, double BurnUp, double ChargeFactor) { + SetLog(log); + SetFacilityType(4); + SetName("R_Reactor."); - SetLog(log); fStorage = 0; fIsStarted = false; @@ -121,8 +139,11 @@ Reactor::Reactor(LogFile* log, FuelDataBank* fueltypeDB, FabricationPlant* fabri fCycleTime = (cSecond) (fBurnUp*1e9 / (fPower) * fHeavyMetalMass *3600*24); //BU in GWd/t SetCreationTime( (cSecond)creationtime ); + fInternalTime = creationtime; SetLifeTime( (cSecond)lifetime ); + fInCycleTime = 0; + fNextPlan = fLoadingPlan.begin(); cout << "!!INFO!! !!!Reactor!!! A Reactor has been define :" << endl; @@ -152,12 +173,14 @@ Reactor::Reactor(LogFile* log, FuelDataBank* fueltypeDB, FabricationPlant* fabri Reactor::Reactor(LogFile* log, FuelDataBank* fueltypeDB, FabricationPlant* fabricationplant, CLASSBackEnd* Pool, - double creationtime, double lifetime, double cycletime, + cSecond creationtime, cSecond lifetime, cSecond cycletime, double HMMass, double BurnUp) { + SetLog(log); + SetFacilityType(4); + SetName("R_Reactor."); - SetLog(log); fIsStarted = false; fIsShutDown = false; @@ -176,9 +199,13 @@ Reactor::Reactor(LogFile* log, FuelDataBank* fueltypeDB, fCycleTime = (cSecond)cycletime; SetCreationTime( (cSecond)creationtime ); + fInternalTime = creationtime; SetLifeTime( (cSecond)lifetime ); + fInCycleTime = 0; + fPower = BurnUp*3600.*24. / (fCycleTime) * HMMass *1e9; //BU in GWd/t + fNextPlan = fLoadingPlan.begin(); cout << "!!INFO!! !!!Reactor!!! A Reactor has been define :" << endl; cout << "\t Fuel Composition is not fixed ! "<< endl; @@ -207,13 +234,15 @@ Reactor::Reactor(LogFile* log, FuelDataBank* fueltypeDB, Reactor::Reactor(LogFile* log, EvolutionData evolutivedb, CLASSBackEnd* Pool, - double creationtime, - double lifetime, + cSecond creationtime, + cSecond lifetime, double power, double HMMass, double BurnUp, double ChargeFactor ) { + SetLog(log); + SetFacilityType(4); + SetName("R_Reactor."); - SetLog(log); fIsStarted = false; fIsShutDown = false; @@ -229,7 +258,9 @@ Reactor::Reactor(LogFile* log, EvolutionData evolutivedb, fOutBackEndFacility = Pool; SetCreationTime( (cSecond)creationtime ); + fInternalTime = creationtime; SetLifeTime( (cSecond)lifetime ); + fInCycleTime = 0; fPower = power * ChargeFactor; @@ -251,6 +282,10 @@ Reactor::Reactor(LogFile* log, EvolutionData evolutivedb, fIVInCycle = fEvolutionDB.GetIsotopicVectorAt(0); fIVOutCycle = fEvolutionDB.GetIsotopicVectorAt( (cSecond)(fCycleTime/fEvolutionDB.GetPower()*fPower) ); + + + fNextPlan = fLoadingPlan.begin(); + cout << "!!INFO!! !!!Reactor!!! A Reactor has been define :" << endl; cout << "\t Fuel Composition is fixed ! "<< endl; cout << "\t Creation time set at \t " << (double)(GetCreationTime()/3600/24/365.25) << " year" << endl; @@ -281,31 +316,46 @@ Reactor::~Reactor() //________________________________________________________________________ void Reactor::SetCycleTime(double cycletime) { + fCycleTime = (cSecond)cycletime; + if(fFixedFuel==true) { - fCycleTime = (cSecond)cycletime; fIVOutCycle = fEvolutionDB.GetIsotopicVectorAt(fCycleTime/fEvolutionDB.GetPower()*fPower); fBurnUp = fPower*fCycleTime/3600./24./fHeavyMetalMass; } else { - fCycleTime = (cSecond)cycletime; - fPower = fBurnUp*3600*24 / (fCycleTime) * fHeavyMetalMass *1e9; //BU in GWd/t + fBurnUp = fPower*fCycleTime/3600./24./fHeavyMetalMass; } } //________________________________________________________________________ void Reactor::SetPower(double Power) { + fPower = Power; + if(fFixedFuel==true) { - fPower = Power; + fCycleTime = (cSecond) (fBurnUp*1e9 / (fPower) * fHeavyMetalMass *3600*24); fIVOutCycle = fEvolutionDB.GetIsotopicVectorAt( (cSecond)(fCycleTime/fEvolutionDB.GetPower()*fPower) ); } else - { - fPower = Power; fCycleTime = (cSecond)(fBurnUp*1e9 / (fPower) * fHeavyMetalMass *3600*24); //BU in GWd/t + + +} +//________________________________________________________________________ +void Reactor::SetBurnUp(double BU) +{ + + fBurnUp = BU; + + if(fFixedFuel==true) + { + fCycleTime = (cSecond) (fBurnUp*1e9 / (fPower) * fHeavyMetalMass *3600*24); + fIVOutCycle = fEvolutionDB.GetIsotopicVectorAt( (cSecond)(fCycleTime/fEvolutionDB.GetPower()*fPower) ); } + else + fCycleTime = (cSecond) (fBurnUp*1e9 / (fPower) * fHeavyMetalMass *3600*24); } @@ -354,16 +404,17 @@ void Reactor::Evolution(cSecond t) } - if( t == fInternalTime && t!=0 ) return; if( t < fInternalTime ) return; + if( t == fInternalTime && t!=GetCreationTime() ) return; - if(fInternalTime == 0 && !fIsStarted) // Start of the Reactor + if( t == GetCreationTime() && !fIsStarted) // Start of the Reactor { fIsAtEndOfCycle = true; fInsideIV = fIVBeginCycle; fInternalTime = t; + fInCycleTime = 0; } @@ -373,6 +424,7 @@ void Reactor::Evolution(cSecond t) cSecond EvolutionTime = t - fInternalTime; // Calculation of the evolution time (relativ) + if( EvolutionTime + fInCycleTime == fCycleTime ) //End of Cycle { fIsAtEndOfCycle = true; @@ -382,6 +434,7 @@ void Reactor::Evolution(cSecond t) if(t >= GetCreationTime() + GetLifeTime()) // if the Next Cycle don't 'Exist... fIsShutDown = true; + } else if(EvolutionTime + fInCycleTime < fCycleTime ) // During Cycle { @@ -399,6 +452,7 @@ void Reactor::Evolution(cSecond t) << " Evolution is too long! This is a Bad way to deal the evolution of the reactor..." << t/365.25/3600/24 << " :" << endl; + GetLog()->fLog << "!!Warning!! !!!Reactor!!!" << " Evolution is too long! This is a Bad way to deal the evolution of the reactor..." << t/365.25/3600/24 << " :" << endl; @@ -418,7 +472,6 @@ void Reactor::Dump() if(fFixedFuel ) { - if(fIsAtEndOfCycle && !fIsShutDown ) { fIsAtEndOfCycle = false; @@ -449,6 +502,16 @@ void Reactor::Dump() } 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); diff --git a/source/trunk/src/Storage.cxx b/source/trunk/src/Storage.cxx index 160db76de45484537010d6801bd1e1a93f1749e3..4222b21214c20353eeccfddbcc0d86912267790c 100644 --- a/source/trunk/src/Storage.cxx +++ b/source/trunk/src/Storage.cxx @@ -25,6 +25,7 @@ Storage::Storage():CLASSBackEnd() { SetFacilityType(-1); SetIsStorageType(); + SetName("S_Storage."); } @@ -33,6 +34,8 @@ Storage::Storage(LogFile* log) SetFacilityType(-1); SetIsStorageType(); + SetName("S_Storage."); + SetLog(log); cout << "!!INFO!! !!!Storage!!! A new Storage has been define." << endl; @@ -48,6 +51,8 @@ Storage::Storage(LogFile* log, DecayDataBank* evolutivedb) SetLog(log); SetDecayDataBank(evolutivedb); + SetName("S_Storage."); + cout << "!!INFO!! !!!Storage!!! A new Storage has been define." << endl; GetLog()->fLog << "!!INFO!! !!!Storage!!! A new Storage has been define." << endl;