Skip to content
Snippets Groups Projects
Commit 2c92de75 authored by Nico's avatar Nico
Browse files

Merge branch 'AkhileshIsotopicError' into 'master'

Add possibility to use errors on EOC IV of reactors and propagate into the scenario

See merge request sens/CLASS!107
parents 8a79e1f6 cf71aaac
No related branches found
No related tags found
No related merge requests found
/*************************************************/
// DESCRIPTION
// Simple scenario :
// This park is constituted by a PWR UOX, a PWR MOx for PERMIS exo 1
// Pool, FP, and storage
// _______ _______ _______ _______ _______ _______
// | | | | | | | | | | | |
// |Reactor| =>| POOL | => | Stock | => |Reactor| => | POOL | =>| Stock |
// | UOX | | UOX | | UOX | FP | MOX | | MOX | | MOX |
// |_______| |_______| |_______| |_______| |_______| |_______|
//
//
// Some reactor and fleet parameters are in argument :
// Burn-Up UOX
// Burn-Up MOX
// Fraction of Reactor MOX in the fleet
// Cooling time in the pool
// Stock Management (1 = LIFO ; 2 FIFO ; 3 MIX ; 4 Random)
//
//
//@author Nico
/*************************************************/
#include "CLASSHeaders.hxx"
#include <sstream>
#include <iomanip>
#include <math.h>
#include <string>
#include "XSM_MLP.hxx"
#include "IM_RK4.hxx"
#include "EQ_OneParameter.hxx"
using namespace std;
int main(int argc, char** argv)
{
cSecond year = 3600*24.*365.25;
//##########################################################################################
//####### USE ##############################################################################
//##########################################################################################
/*if (argc != 6)
{
cout<<"#############################################"<<endl;
cout<<"#############################################"<<endl<<endl;
cout<<"USE : "<<endl<<endl;
cout<<"CLASS_Exec FractionMOX Pu238Error Pu239Error Pu240Error Pu241Error Pu242Error"<<endl<<endl;;
cout<<"EXAMPLE : "<<endl<<endl;
cout<<"CLASS_Exec 0.115 0.8 1.1 0.9 1.2 0.7"<<endl<<endl;;
cout<<"#############################################"<<endl<<endl;;
cout<<"#############################################"<<endl;
exit(1);
}*/
//##########################################################################################
//####### SCENARIO DATA ####################################################################
//##########################################################################################
cSecond d_TimeStep = year / 12.;
cSecond d_TimeScenario = 100.*year ;
string s_FileName = string("OUT.root");
//##########################################################################################
//####### PARAMETERS #######################################################################
//##########################################################################################
double BU_UOX = 45;
double BU_MOX = 45;;
double FractionMOX = 0.1;//atof(argv[1]);
cSecond TCooling = (cSecond)(5*year);
int StockManagment = 1;
StorageManagement SM;
if (StockManagment == 1) SM = kpLiFo;
else if (StockManagment == 2) SM = kpFiFo;
else if (StockManagment == 3) SM = kpMix;
else if (StockManagment == 4) SM = kpRand;
else {cout<<endl<<"StockManagement should be 1, 2, 3 or 4... EXIT"<<endl<<endl; exit(1);}
double LoadFactorUOx = 0.75;
double LoadFactorMOx = 0.75;
double KseuilUOx = 1.03;
double KseuilMOx = 1.03;
int NumberOfBatchesUOx = 3;
int NumberOfBatchesMOx = 3;
cSecond TFabMOX = (cSecond)(2*year);
double N_UOx = 1;
double HMMassUOx = 72.3 * N_UOx;
double PowerUOx = 2785e6 * N_UOx;
cSecond StartingTimeUOx = 0*year;
cSecond LifeTimeUOx = d_TimeScenario;
double N_MOx = FractionMOX;
double HMMassMOx = 72.3 * N_MOx;
double PowerMOx = 2785e6 * N_MOx;
cSecond TimeStartMox = 20.*year;
cSecond LifeTimeMOx = d_TimeScenario;
//##########################################################################################
//####### LOG MANAGEMENT ###################################################################
//##########################################################################################
int Std_output_level = 0;
int File_output_level = 2;
CLASSLogger *Logger = new CLASSLogger("CLASS_OUTPUT.log",Std_output_level,File_output_level);
//##########################################################################################
//####### SCENARIO #########################################################################
//##########################################################################################
Scenario *gCLASS=new Scenario(0*year,Logger);
gCLASS->SetStockManagement(true);
gCLASS->SetTimeStep(d_TimeStep);
gCLASS->SetOutputFileName(s_FileName);
gCLASS->SetZAIThreshold(82);
//##########################################################################################
//####### DATABASE #########################################################################
//##########################################################################################
string CLASS_PATH = getenv("CLASS_PATH");
string PATH_TO_DATA = CLASS_PATH + "/DATA_BASES/";
// DECAY
DecayDataBank* DecayDB = new DecayDataBank(gCLASS->GetLog(), PATH_TO_DATA + "DECAY/ALL/Decay.idx");
gCLASS->SetDecayDataBase(DecayDB);
// Bateman Solver
IM_RK4* IMRK4 = new IM_RK4(gCLASS->GetLog());
// REP UOX
XSM_MLP* XSMUOX = new XSM_MLP(gCLASS->GetLog(), PATH_TO_DATA + "PWR/UOX/XSModel/30Wg_FullUOX");
EQ_OneParameter* EQMPWRUOX = new EQ_OneParameter(gCLASS->GetLog(), PATH_TO_DATA + "PWR/UOX/EQModel/XML/PWR_UOX.xml", PATH_TO_DATA + "PWR/UOX/EQModel/NFO/PWR_UOX.nfo");
EQMPWRUOX->SetModelParameter("kThreshold",KseuilUOx);
EQMPWRUOX->SetModelParameter("NumberOfBatch",NumberOfBatchesUOx);
PhysicsModels* PMUOX = new PhysicsModels(XSMUOX, EQMPWRUOX, IMRK4);
// REP MOx
XSM_MLP* XSMMOX = new XSM_MLP(gCLASS->GetLog(), PATH_TO_DATA + "PWR/MOX/XSModel/30Wg_FullMOX");
EQ_OneParameter* EQMPWRMOX = new EQ_OneParameter(gCLASS->GetLog(), PATH_TO_DATA + "PWR/MOX/EQModel/XML/PWR_MOX.xml", PATH_TO_DATA + "PWR/MOX/EQModel/NFO/PWR_MOX.nfo");
EQMPWRMOX->SetModelParameter("kThreshold",KseuilMOx);
EQMPWRMOX->SetModelParameter("NumberOfBatch",NumberOfBatchesMOx);
PhysicsModels* PMMOX = new PhysicsModels(XSMMOX, EQMPWRMOX, IMRK4);
//##########################################################################################
//####### IV ###############################################################################
//##########################################################################################
//##########################################################################################
//####### STORAGE ##########################################################################
//##########################################################################################
Storage *StockUOx = new Storage(gCLASS->GetLog());
StockUOx->SetName("StockUOx");
gCLASS->Add(StockUOx);
Storage *StockMOx = new Storage(gCLASS->GetLog());
StockMOx->SetName("StockMOx");
gCLASS->Add(StockMOx);
//##########################################################################################
//####### SEPARATION PLANT #################################################################
//##########################################################################################
//##########################################################################################
//####### POOL #############################################################################
//##########################################################################################
Pool *PoolUOx = new Pool(gCLASS->GetLog(),StockUOx, TCooling);
PoolUOx->SetName("PoolUOx");
gCLASS->Add(PoolUOx);
Pool *PoolMOx = new Pool(gCLASS->GetLog(),StockMOx, 5*year);
PoolMOx->SetName("PoolMOx");
gCLASS->Add(PoolMOx);
//##########################################################################################
//####### FABRICATION PLANT #################################################################
//##########################################################################################
FabricationPlant *FP_UOX = new FabricationPlant(gCLASS->GetLog(), 0*year);
FP_UOX->SetName("Fab_UOX");
FP_UOX->AddInfiniteStorage("Fissile",0.02,0.06,1);
FP_UOX->AddFuelBuffer("Fertile");
gCLASS->AddFabricationPlant(FP_UOX);
FabricationPlant *FP_MOX = new FabricationPlant(gCLASS->GetLog(), 2.*year);
FP_MOX->SetName("FP_MOX");
FP_MOX->SetSeparationManagement(true);
FP_MOX->SetStorageManagement(SM);
FP_MOX->AddStorage("Fissile", StockUOx, 0.04, 0.16,1);
FP_MOX->AddFuelBuffer("Fertile");
gCLASS->AddFabricationPlant(FP_MOX);
//##########################################################################################
//####### REP UOX ##########################################################################
//##########################################################################################
double HMMass = HMMassUOx;
double Power = PowerUOx;
double BurnUp = BU_UOX;
double LoadFactor = LoadFactorUOx;
IsotopicVector myErrorIV;
double Pu238Error= 2;//atof(argv[2]);
double Pu239Error= 0.5;//atof(argv[3]);
double Pu240Error= 2;//atof(argv[4]);
double Pu241Error= 0.5;//atof(argv[5]);
double Pu242Error= 2;//atof(argv[6]);
myErrorIV.Add(94,238,0,Pu238Error);
myErrorIV.Add(94,239,0,Pu239Error);
myErrorIV.Add(94,240,0,Pu240Error);
myErrorIV.Add(94,241,0,Pu241Error);
myErrorIV.Add(94,242,0,Pu242Error);
myErrorIV.Print();
cSecond StartingTime = StartingTimeUOx;
cSecond LifeTime = LifeTimeUOx;
Reactor* PWR_UOX = new Reactor(gCLASS->GetLog(),PMUOX,FP_UOX,PoolUOx,StartingTime,LifeTime,Power,HMMass,BurnUp,LoadFactor);
PWR_UOX->AddScheduleEntry(TimeStartMox, PMUOX, BurnUp, Power*(1 - FractionMOX), HMMass*(1 - FractionMOX));
PWR_UOX->SetIVMultiplicativeError(myErrorIV);
PWR_UOX->SetName("PWR_UOx");
gCLASS->AddReactor(PWR_UOX);
//##########################################################################################
//####### REP MOX ##########################################################################
//##########################################################################################
HMMass = HMMassMOx;
Power = PowerMOx;
BurnUp = BU_MOX;
LoadFactor = LoadFactorMOx;
StartingTime = TimeStartMox;
LifeTime = LifeTimeMOx;
Reactor* PWR_MOX = new Reactor(gCLASS->GetLog(),PMMOX,FP_MOX,PoolMOx,StartingTime,LifeTime,Power,HMMass,BurnUp,LoadFactor);
PWR_MOX->SetName("PWR_MOX");
gCLASS->AddReactor(PWR_MOX);
//##########################################################################################
//####### EVOLUTION ########################################################################
//##########################################################################################
gCLASS->Evolution((double)d_TimeScenario);
//##########################################################################################
//####### OUTPUT ###########################################################################
//##########################################################################################
delete gCLASS;
}
//==========================================================================================
// Compilation
//==========================================================================================
/*
g++ -o CLASS_Exec Example_MultiplicativeError.cxx $CLASS_CFLAG
*/
......@@ -197,6 +197,9 @@ class Reactor : public CLASSFacility {
return fIVInCycle;
} //!< Return the In Cycle IV
//!< (Note : IVIn != IVBegin, only if using ReactorScheduler)
IsotopicVector GetIVMultiplicativeError() const {
return fIVMultiplicativeError;
} //!< Return the In Cycle IV
cSecond GetNextCycleTime(cSecond time);
......@@ -278,7 +281,7 @@ class Reactor : public CLASSFacility {
void SetIVInCycle(IsotopicVector isotopicvector) {
fIVInCycle = isotopicvector;
} //!< Set the IV coming In at the beginning of the cycle
void SetIVMultiplicativeError(IsotopicVector isotopicvector); //!< Set the IV by wich the fuel IV is multiplied just before leaving the facility. Aim to represent errors
#ifndef __ROOTCLING__
void SetOutBackEndFacility(CLASSBackEnd* pool) {
......@@ -378,6 +381,8 @@ class Reactor : public CLASSFacility {
IsotopicVector fIVBeginCycle; ///< Fuel IV at the beginning of a cycle
IsotopicVector fIVInCycle; ///< IVBegin add at the beginning of the cycle
IsotopicVector fIVOutCycle; ///< IV wich get out at the end of a cycle
IsotopicVector fIVMultiplicativeError; ///< IV by wich the fuel IV is multiplied just before leaving the facility. Aim to represent errors.
IsotopicVector fIVMultiplicativeError_with1s; ///!< like fIVMultiplicativeError but with only 1s inside.
#ifndef __ROOTCLING__
EvolutionData fEvolutionDB; //!< Pointer to the actual evolution DataBase
......
......@@ -443,7 +443,19 @@ void Reactor::SetNewFuel(EvolutionData ivdb) {
SetEvolutionDB(ivdb);
DBGL;
}
//________________________________________________________________________
void Reactor::SetIVMultiplicativeError(IsotopicVector isotopicvector) {
DBGL;
fIVMultiplicativeError = isotopicvector;
fIVMultiplicativeError_with1s=isotopicvector;
map<ZAI, double>::iterator it;
for (it = fIVMultiplicativeError_with1s.begin(); it != fIVMultiplicativeError_with1s.end(); ++it) {
it->second=1;
}
DBGL;
}
//________________________________________________________________________
void Reactor::Evolution(cSecond t) {
DBGL;
......@@ -528,6 +540,13 @@ void Reactor::Dump() {
if (fIsAtEndOfCycle && !fIsShutDown) {
if (fIsStarted) // A Cycle has already been done
{
//here change fInsideIV
if(fIVMultiplicativeError.GetZAIQuantity()>0){
double MassOfIVbeforeError=fInsideIV.GetTotalMass();
fInsideIV=fInsideIV+fIVMultiplicativeError*fInsideIV-fIVMultiplicativeError_with1s*fInsideIV;
double MassOfIVafterError=fInsideIV.GetTotalMass();
WARNING << " Taking into account multiplicative error on IV leaving the reactor lead to a change of the mass of the fuel :"<< MassOfIVafterError-MassOfIVbeforeError<<" tons"<< endl;
}
fOutBackEndFacility->AddIV(fInsideIV);
AddCumulativeIVOut(fInsideIV);
} else
......@@ -535,6 +554,13 @@ void Reactor::Dump() {
} else if (fIsAtEndOfCycle && fIsShutDown) // shutdown at end of Cycle
{
//here change fIVOutCycle
if(fIVMultiplicativeError.GetZAIQuantity()>0){
double MassOfIVbeforeError=fInsideIV.GetTotalMass();
fIVOutCycle=fIVOutCycle+fIVMultiplicativeError*fIVOutCycle-fIVMultiplicativeError_with1s*fIVOutCycle;
double MassOfIVafterError=fInsideIV.GetTotalMass();
WARNING << " Taking into account multiplicative error on IV leaving the reactor lead to a change of the mass of the fuel :"<< MassOfIVafterError-MassOfIVbeforeError<<" tons"<< endl;
}
fOutBackEndFacility->AddIV(fIVOutCycle);
AddCumulativeIVOut(fIVOutCycle);
fInsideIV.Clear();
......@@ -542,6 +568,13 @@ void Reactor::Dump() {
fIsStarted = false; // shut down the Reactor
} else if (!fIsAtEndOfCycle && fIsShutDown) // shutdown during Cycle
{
//here change fInsideIV
if(fIVMultiplicativeError.GetZAIQuantity()>0){
double MassOfIVbeforeError=fInsideIV.GetTotalMass();
fInsideIV=fInsideIV+fIVMultiplicativeError*fInsideIV-fIVMultiplicativeError_with1s*fInsideIV;
double MassOfIVafterError=fInsideIV.GetTotalMass();
WARNING << " Taking into account multiplicative error on IV leaving the reactor lead to a change of the mass of the fuel :"<< MassOfIVafterError-MassOfIVbeforeError<<" tons"<< endl;
}
fOutBackEndFacility->AddIV(fInsideIV);
AddCumulativeIVOut(fInsideIV);
fInsideIV.Clear();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment