Newer
Older
#include "Reactor.hxx"
#include "EvolutionData.hxx"
#include "Pool.hxx"
#include "FabricationPlant.hxx"
#include "Storage.hxx"
#include "Scenario.hxx"
#include "CLASSConstante.hxx"
#include <iostream>
#include <cmath>
#include <typeinfo>
//________________________________________________________________________
//
// Reactor
//
//
//
//
//________________________________________________________________________
ClassImp(Reactor)
Reactor::Reactor():CLASSFacility(4)
{
SetName("R_Reactor.");
fOutBackEndFacility = 0;
fStorage = 0;
fFabricationPlant = 0;

Baptiste LENIAU
committed
fReactorScheduler = 0;
//________________________________________________________________________
Reactor::Reactor(CLASSLogger* log):CLASSFacility(log, 4)
{
DBGL
fOutBackEndFacility = 0;
fStorage = 0;
fFabricationPlant = 0;

Baptiste LENIAU
committed
fReactorScheduler = 0;
SetName("R_Reactor.");
DBGL
}
//________________________________________________________________________
Reactor::Reactor(CLASSLogger* log,
CLASSBackEnd* Pool,
cSecond creationtime,
cSecond lifetime,
double power, double HMMass, double CapacityFactor ):CLASSFacility(log, creationtime, lifetime, 4)
{
DBGL
(*this).SetName("R_Reactor.");
fIsStarted = false;
fIsShutDown = false;
fIsAtEndOfCycle = false;
fStorage = 0;
fFabricationPlant = 0;
fFixedFuel = true;
fIsStorage = false;
fOutBackEndFacility = Pool;

Baptiste LENIAU
committed
fCapacityFactor = CapacityFactor;
fPower = power * fCapacityFactor;
fEfficiencyFactor = 0.33;
fElectricPower = fEfficiencyFactor*fPower;
fHeavyMetalMass = HMMass;
fBurnUp = -1;
fCycleTime = (-1);
fIVBeginCycle = fEvolutionDB.GetIsotopicVectorAt(0);
fIVInCycle = fEvolutionDB.GetIsotopicVectorAt(0);
fIVOutCycle = fEvolutionDB.GetIsotopicVectorAt( (cSecond)(fCycleTime/fEvolutionDB.GetPower()*fPower) );

Baptiste LENIAU
committed
fReactorScheduler = 0;
INFO << " A Reactor has been define :" << endl;
INFO << "\t Fuel Composition is fixed (for now)! " << endl;
INFO << "\t Creation time set at \t " << ((double)GetCreationTime())/((double)cYear) << " year" << endl;
INFO << "\t Life time (Operating's Duration) set at \t " << ((double)GetLifeTime())/((double)cYear) << " year" << endl;
INFO << "\t The Effective Thermal Power is \t " << (double)(fPower *1e-6) << " MW (with Full Power " << power << " and " << CapacityFactor << " capacity factor)" << endl;
INFO << "\t The Heavy Metal Mass in the Core set at " << (double)(fHeavyMetalMass) << " tons" << endl << endl;
DBGL
}
//________________________________________________________________________
Reactor::Reactor(CLASSLogger* log,
FabricationPlant* fabricationplant, CLASSBackEnd* Pool,
cSecond creationtime, cSecond lifetime,
double Power, double HMMass, double CapacityFactor):CLASSFacility(log, creationtime, lifetime, 4)
{
DBGL
(*this).SetName("R_Reactor.");
fStorage = 0;
fIsStarted = false;
fIsShutDown = false;
fIsAtEndOfCycle = false;
fFabricationPlant = fabricationplant;
fFixedFuel = false;
fOutBackEndFacility = Pool;
fBurnUp = -1;
fHeavyMetalMass = HMMass;

Baptiste LENIAU
committed
fCapacityFactor = CapacityFactor;
fPower = Power * fCapacityFactor;
fEfficiencyFactor = 0.33;
fElectricPower = fEfficiencyFactor*fPower;
fCycleTime = -1; //BU in GWd/t

Baptiste LENIAU
committed
fReactorScheduler = 0;
INFO << " A Reactor has been define :" << endl;
INFO << "\t Fuel Composition is not fixed (for now)! " << endl;
INFO << "\t Creation time set at \t " << ((double)GetCreationTime())/((double)cYear) << " year" << endl;
INFO << "\t Life time (Operating's Duration) set at \t " << ((double)GetLifeTime())/((double)cYear) << " year" << endl;
INFO << "\t The Effective Thermal Power is \t " << (double)(fPower *1e-6) << " MW (with Full Power " << Power << " and " << CapacityFactor << " capacity factor)" << endl;
INFO << "\t The Heavy Metal Mass in the Core set at " << (double)(fHeavyMetalMass) << " tons" << endl << endl;
DBGL
}
//________________________________________________________________________
Reactor::Reactor(CLASSLogger* log, PhysicsModels* fueltypeDB, FabricationPlant* fabricationplant, CLASSBackEnd* Pool,
cSecond creationtime, cSecond lifetime,
double Power, double HMMass, double BurnUp, double CapacityFactor):CLASSFacility(log, creationtime, lifetime, 4)
{
DBGL
(*this).SetName("R_Reactor.");
fStorage = 0;
fIsStarted = false;
fIsShutDown = false;
fIsAtEndOfCycle = false;
fFabricationPlant = fabricationplant;
fFixedFuel = false;
fOutBackEndFacility = Pool;
fBurnUp = BurnUp;
fHeavyMetalMass = HMMass;

Baptiste LENIAU
committed
fCapacityFactor = CapacityFactor;
fPower = Power * fCapacityFactor;
fEfficiencyFactor = 0.33;
fElectricPower = fEfficiencyFactor*fPower;
fCycleTime = (cSecond) (fBurnUp*1e9 / (fPower) * fHeavyMetalMass *3600*24); //BU in GWd/t

Baptiste LENIAU
committed
fReactorScheduler = new ReactorScheduler(log);
fReactorScheduler->AddEntry(creationtime, new ReactorModel(fueltypeDB), fBurnUp, fPower, fHeavyMetalMass);
fSchedulePowerEvolution.insert( pair<cSecond, double>(creationtime, fPower));
fScheduleHMMassEvolution.insert( pair<cSecond, double>(creationtime, fHeavyMetalMass));
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
INFO << " A Reactor has been define :" << endl;
INFO << "\t Fuel Composition is not fixed ! " << endl;
INFO << "\t Creation time set at \t " << (double)(GetCreationTime()/cYear) << " year" << endl;
INFO << "\t Life time (Operating's Duration) set at \t " << ((double)GetLifeTime())/((double)cYear) << " year" << endl;
INFO << "\t The Effective Thermal Power is \t " << (double)(fPower *1e-6) << " MW (with Full Power " << Power << " and " << CapacityFactor << " capacity factor)" << endl;
INFO << "\t Burn-Up at end of Cycle set at \t " << (double)(fBurnUp) << " GWj/t" << endl;
INFO << "\t The corresponding Cycle Time is\t " << ((double)fCycleTime)/((double)cYear) << " year" << endl;
INFO << "\t The Heavy Metal Mass in the Core set at " << (double)(fHeavyMetalMass) << " tons" << endl << endl;
DBGL
}
Reactor::Reactor(CLASSLogger* log, PhysicsModels* fueltypeDB,
FabricationPlant* fabricationplant,
CLASSBackEnd* Pool,
cSecond creationtime, cSecond lifetime, cSecond cycletime,
double HMMass, double BurnUp):CLASSFacility(log, creationtime, lifetime, cycletime, 4)
{
DBGL
(*this).SetName("R_Reactor.");
fIsStarted = false;
fIsShutDown = false;
fIsAtEndOfCycle = false;
fStorage = 0;
fFabricationPlant = fabricationplant;
fFixedFuel = false;
fBurnUp = BurnUp;
fHeavyMetalMass = HMMass;
fOutBackEndFacility = Pool;
fPower = BurnUp*3600.*24. / (fCycleTime) * HMMass *1e9; //BU in GWd/t
fEfficiencyFactor = 0.33;
fElectricPower = fEfficiencyFactor*fPower;

Baptiste LENIAU
committed
fReactorScheduler = new ReactorScheduler(log);
fReactorScheduler->AddEntry(creationtime, new ReactorModel(fueltypeDB), fBurnUp, fPower, fHeavyMetalMass);
fSchedulePowerEvolution.insert( pair<cSecond, double>(creationtime, fPower));
fScheduleHMMassEvolution.insert( pair<cSecond, double>(creationtime, fHeavyMetalMass));
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
INFO << " A Reactor has been define :" << endl;
INFO << "\t Fuel Composition is not fixed ! " << endl;
INFO << "\t Creation time set at \t " << ((double)GetCreationTime())/((double)cYear) << " year" << endl;
INFO << "\t Life time (Operating's Duration) set at \t " << ((double)GetCreationTime())/((double)cYear) << " year" << endl;
INFO << "\t The Cycle Time set at\t " << ((double)fCycleTime)/((double)cYear) << " year" << endl;
INFO << "\t Burn-Up at end of Cycle set at \t " << (double)(fBurnUp) << " GWj/t" << endl;
INFO << "\t The corresponding Effective Thermal Power is \t " << (double)(fPower *1e-6) << " MW" << endl;
INFO << "\t The Heavy Metal Mass in the Core set at " << (double)(fHeavyMetalMass) << " tons" << endl << endl;
DBGL
}
Reactor::Reactor(CLASSLogger* log, EvolutionData* evolutivedb,
CLASSBackEnd* Pool,
cSecond creationtime,
cSecond lifetime,
double power, double HMMass, double BurnUp, double CapacityFactor ):CLASSFacility(log, creationtime, lifetime, 4)
{
DBGL
(*this).SetName("R_Reactor.");
fIsStarted = false;
fIsShutDown = false;
fIsAtEndOfCycle = false;
fStorage = 0;
fFabricationPlant = 0;
fFixedFuel = true;
fIsStorage = false;
fOutBackEndFacility = Pool;

Baptiste LENIAU
committed
fCapacityFactor = CapacityFactor;
fPower = power * fCapacityFactor;
fEfficiencyFactor = 0.33;
fElectricPower = fEfficiencyFactor*fPower;
fHeavyMetalMass = HMMass;
double M0 = cZAIMass.GetMass( evolutivedb->GetIsotopicVectorAt(0.).GetActinidesComposition() );
fEvolutionDB = (*evolutivedb) * (fHeavyMetalMass/M0);
fBurnUp = BurnUp;
fCycleTime = (cSecond) (fBurnUp*1e9 / (fPower) * fHeavyMetalMass *3600*24);
fIVBeginCycle = fEvolutionDB.GetIsotopicVectorAt(0);
fIVInCycle = fEvolutionDB.GetIsotopicVectorAt(0);
fIVOutCycle = fEvolutionDB.GetIsotopicVectorAt( (cSecond)(fCycleTime/fEvolutionDB.GetPower()*fPower) );

Baptiste LENIAU
committed
fReactorScheduler = new ReactorScheduler(log);
fReactorScheduler->AddEntry(creationtime, new ReactorModel(evolutivedb), fBurnUp, fPower, fHeavyMetalMass);
fSchedulePowerEvolution.insert( pair<cSecond, double>(creationtime, fPower));
fScheduleHMMassEvolution.insert( pair<cSecond, double>(creationtime, fHeavyMetalMass));

Baptiste LENIAU
committed
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
INFO << " A Reactor has been define :" << endl;
INFO << "\t Fuel Composition is fixed ! " << endl;
INFO << "\t Creation time set at \t " << (double)(GetCreationTime()/cYear) << " year" << endl;
INFO << "\t Life time (Operating's Duration) set at \t " << ((double)GetLifeTime())/((double)cYear) << " year" << endl;
INFO << "\t The Cycle Time set at\t " << ((double)fCycleTime)/((double)cYear) << " year" << endl;
INFO << "\t The Effective Thermal Power is \t " << (double)(fPower *1e-6) << " MW (with Full Power " << power << " and " << CapacityFactor << " capacity factor)" << endl;
INFO << "\t The Heavy Metal Mass in the Core set at " << (double)(fHeavyMetalMass) << " tons" << endl << endl;
DBGL
}
Reactor::Reactor(CLASSLogger* log, EvolutionData* evolutivedb,
CLASSBackEnd* Pool,
cSecond creationtime, cSecond lifetime, cSecond cycletime,
double HMMass, double BurnUp ):CLASSFacility(log, creationtime, lifetime, cycletime, 4)
{
DBGL
(*this).SetName("R_Reactor.");
fIsStarted = false;
fIsShutDown = false;
fIsAtEndOfCycle = false;
fStorage = 0;
fFabricationPlant = 0;
fFixedFuel = true;
fIsStorage = false;
fOutBackEndFacility = Pool;
fPower = BurnUp*3600.*24. / (fCycleTime) * HMMass *1e9; //BU in GWd/t

Baptiste LENIAU
committed
fCapacityFactor = 1;
fEfficiencyFactor = 0.33;
fElectricPower = fEfficiencyFactor*fPower;
fHeavyMetalMass = HMMass;
double M0 = cZAIMass.GetMass( evolutivedb->GetIsotopicVectorAt(0.).GetActinidesComposition() );
fEvolutionDB = (*evolutivedb) * (fHeavyMetalMass/M0);
fBurnUp = BurnUp;
fIVBeginCycle = fEvolutionDB.GetIsotopicVectorAt(0);
fIVInCycle = fEvolutionDB.GetIsotopicVectorAt(0);
fIVOutCycle = fEvolutionDB.GetIsotopicVectorAt( (cSecond)(fCycleTime/fEvolutionDB.GetPower()*fPower) );

Baptiste LENIAU
committed
fReactorScheduler = new ReactorScheduler(log);
fReactorScheduler->AddEntry(creationtime, new ReactorModel(evolutivedb), fBurnUp, fPower, fHeavyMetalMass);
fSchedulePowerEvolution.insert( pair<cSecond, double>(creationtime, fPower));
fScheduleHMMassEvolution.insert( pair<cSecond, double>(creationtime, fHeavyMetalMass));
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
INFO << " A Reactor has been define :" << endl;
INFO << "\t Fuel Composition is fixed ! " << endl;
INFO << "\t Creation time set at \t " << ((double)GetCreationTime())/((double)cYear) << " year" << endl;
INFO << "\t Life time (Operating's Duration) set at \t " << ((double)GetLifeTime())/((double)cYear) << " year" << endl;
INFO << "\t The Cycle Time set at\t " << ((double)fCycleTime)/((double)cYear) << " year" << endl;
INFO << "\t The Effective Thermal Power is \t " << (double)(fPower *1e-6) << " MW (with Full Power " << fPower << endl;
INFO << "\t The Heavy Metal Mass in the Core set at " << (double)(fHeavyMetalMass) << " tons" << endl << endl;
DBGL
}
//________________________________________________________________________
Reactor::~Reactor()
{
}
//________________________________________________________________________
void Reactor::SetCycleTime(double cycletime)
{
fCycleTime = (cSecond)cycletime;
if(fFixedFuel == true)
{
fIVOutCycle = fEvolutionDB.GetIsotopicVectorAt(fCycleTime/fEvolutionDB.GetPower()*fPower);
fBurnUp = fPower*fCycleTime/3600./24./fHeavyMetalMass;
}
else
{
fBurnUp = fPower*fCycleTime/3600./24./fHeavyMetalMass;
}
}
//________________________________________________________________________
void Reactor::SetPower(double Power)
{
fPower = Power;
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); //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);
}
//________________________________________________________________________
void Reactor::SetEvolutionDB(EvolutionData evolutionDB)
{
DBGL
//fEvolutionDB.DeleteEvolutionDataCopy();
double M0 = cZAIMass.GetMass( evolutionDB.GetIsotopicVectorAt(0.).GetActinidesComposition() );
fEvolutionDB = evolutionDB * (fHeavyMetalMass/M0);
fIVOutCycle = fEvolutionDB.GetIsotopicVectorAt( (cSecond)(fCycleTime/fEvolutionDB.GetPower()*fPower) );
fIVBeginCycle = fEvolutionDB.GetIsotopicVectorAt(0);
DBGL
}
//________________________________________________________________________
void Reactor::SetNewFuel(EvolutionData ivdb)
{
DBGL
SetEvolutionDB(ivdb);
DBGL
}
//________________________________________________________________________
void Reactor::Evolution(cSecond t)
{
DBGL
if( fIsShutDown || t < GetCreationTime() ) return; // Reactor stop or not started...
if(Norme(fInsideIV) != 0 && fIsStarted)
{
#pragma omp critical(ParcPowerUpdate)
{GetParc()->AddToPower(fPower, fElectricPower);}
}
else if(fIsStarted)
{
WARNING << " Reactor should be working but have no Heavy Nucleus Inside. It's not working so have a zero power..."
<< " Time : " << t/cYear << " years" << endl;
}
if( t < fInternalTime ) return;
if( t == fInternalTime && t != GetCreationTime() ) return;
if( t == GetCreationTime() && !fIsStarted) // Start of the Reactor
{
fIsAtEndOfCycle = true;
fInsideIV = fIVBeginCycle;
fInternalTime = t;
fInCycleTime = 0;
}
// Check if the Reactor if started ...
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)
{
fIsAtEndOfCycle = true;
fInternalTime += EvolutionTime; // Update Internal Time
fInCycleTime += EvolutionTime; // Update InCycleTime

Baptiste LENIAU
committed
fInsideIV = fEvolutionDB.GetIsotopicVectorAt( (cSecond)(fInCycleTime/fEvolutionDB.GetPower()*fPower) ); // update the fuel composition
if(t >= GetCreationTime() + GetLifeTime()) fIsShutDown = true; // if the Next Cycle don't 'Exist...
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
}
else if(EvolutionTime + fInCycleTime < fCycleTime ) // During Cycle
{
fInternalTime += EvolutionTime; // Update Internal Time
fInCycleTime += EvolutionTime; // Update InCycleTime
fInsideIV = fEvolutionDB.GetIsotopicVectorAt( (cSecond)(fInCycleTime/fEvolutionDB.GetPower()*fPower) ); // update the fuel composition
if(t>= GetCreationTime() + GetLifeTime()) fIsShutDown = true;
}
else
{
// Evolution goes after the end of cycle.... check it
ERROR << " " << (*this).GetName() << endl;
ERROR << " Evolution Time is " << t << endl;
ERROR << " Evolution is too long! There is a problem in Reactor evolution at " << t/cYear << endl;
ERROR << " This is too long of : " << EvolutionTime + fInCycleTime - fCycleTime << endl;
ERROR << " I have spend " << fInCycleTime +EvolutionTime << " and should have been " << fCycleTime << endl;
exit(1);
}
DBGL
}
//________________________________________________________________________
void Reactor::Dump()
{
DBGL
if(fInternalTime < GetCreationTime()) return;
if(fIsShutDown && !fIsStarted) return; // Reactor stopped...
if(!fIsAtEndOfCycle && !fIsShutDown) return;
// First trash the irradiated fuel
if(fIsAtEndOfCycle && !fIsShutDown )
{
if(fIsStarted ) // A Cycle has already been done
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
{
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
}
DBGL
// Get the new Fuel !
ScheduleEntry* NextFuel = fReactorScheduler->GetEntryAt(fInternalTime);
fPower = NextFuel->GetPower();
fHeavyMetalMass = NextFuel->GetHeavyMetalMass();
fElectricPower = fPower * fEfficiencyFactor;

Baptiste LENIAU
committed
SetBurnUp( NextFuel->GetBurnUp() );
fPowerEvolution.insert( pair<cSecond, double>(fInternalTime, fPower));
fHMMassEvolution.insert( pair<cSecond, double>(fInternalTime, fHeavyMetalMass));

Baptiste LENIAU
committed
if( NextFuel->GetReactorModel()->GetPhysicsModels() )
fFixedFuel = false;

Baptiste LENIAU
committed
else if( NextFuel->GetReactorModel()->GetEvolutionData() )
fFixedFuel = true;
else
{

Baptiste LENIAU
committed
ERROR << typeid(NextFuel->GetReactorModel()).name() << endl;
ERROR << "WRONG Fuel Format Correct it !! " << endl;
exit(1);
}
DBGL
if(fFixedFuel )
{
DBGL
if(fIsAtEndOfCycle && !fIsShutDown )
{

Baptiste LENIAU
committed
SetEvolutionDB( *(NextFuel->GetReactorModel()->GetEvolutionData()) );
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
fIsAtEndOfCycle = false;
if(!GetParc()->GetStockManagement() && fIsStorage )
{
IsotopicVector BuildIVtmp ;
IsotopicVector OutIncomePart;
//Get The Storage Compostion
BuildIVtmp.Add(fStorage->GetInsideIV().GetIsotopicQuantity());
//Get the rest after IVIn creation
BuildIVtmp -= fIVInCycle;
//Get the OutIncome part form this rest
OutIncomePart.Add(BuildIVtmp.GetIsotopicQuantityNeeded()) ;
//Take what you can from Storage...
fStorage->TakeFromStock( fIVInCycle - OutIncomePart);
//And Get the rest from OutIncome
GetParc()->AddOutIncome(OutIncomePart);
}
else GetParc()->AddOutIncome(fIVInCycle);
fInsideIV = fIVBeginCycle;
AddCumulativeIVIn(fIVBeginCycle);
fInCycleTime = 0;
}
DBGL
}
else
{
DBGL
if(!GetParc()->GetStockManagement())
{
ERROR << " Can't have unfixedFuel without stock management" << endl;

Baptiste LENIAU
committed
ERROR << " Add in your input : gCLASS->SetStockManagement(true);"<<endl;
exit(1);
}
if(fIsAtEndOfCycle && !fIsShutDown )
{
fIsAtEndOfCycle = false;
SetNewFuel(fFabricationPlant->GetReactorEvolutionDB(GetId()));
fFabricationPlant->TakeReactorFuel(GetId());
fInsideIV = fIVBeginCycle;
AddCumulativeIVIn(fIVBeginCycle);
fInCycleTime = 0;
}
}
DBGL
}
//________________________________________________________________________
cSecond Reactor::GetNextCycleTime(cSecond time)
{
DBGL
cSecond LastCycle = fInternalTime - fInCycleTime;
while ( LastCycle < time)
{

Baptiste LENIAU
committed
ScheduleEntry* entry = fReactorScheduler->GetEntryAt(LastCycle);
double BU = entry->GetBurnUp();
double Power = entry->GetPower();
double HMMass = entry->GetHeavyMetalMass();
cSecond cycletime = (cSecond)(BU *1e9 / (Power) * HMMass *3600*24);
LastCycle += cycletime;
}
DBGL
return LastCycle;
}

Baptiste LENIAU
committed
//________________________________________________________________________
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
void Reactor::CheckListConsistency(PhysicsModels* fueltypeDB, FabricationPlant* fabricationplant)
{
//Get Lists containers defined in EqM and FP
map < string , IsotopicVector> StreamList = fueltypeDB->GetEquivalenceModel()->GetAllStreamList();
map < string , vector <Storage*> > Stocks = fabricationplant->GetAllStorage();
vector <string> StreamListEqM;
vector <string> StreamListFP;
vector <bool> CheckOnLists;
bool AreListsConsistent = true;
//Iterators
map < string , vector <Storage*> >::iterator it_s_vS;
map < string , IsotopicVector>::iterator it_s_IV;
for( it_s_vS = Stocks.begin(); it_s_vS != Stocks.end(); it_s_vS++)
StreamListFP.push_back((*it_s_vS).first);
for( it_s_IV = StreamList.begin(); it_s_IV != StreamList.end(); it_s_IV++)
StreamListEqM.push_back((*it_s_IV).first);
if((int)StreamListEqM.size() != (int)StreamListFP.size())
{
WARNING <<" Not the same number of lists in FP and associated EqM"<< endl;
AreListsConsistent = false;
}
else
{
for(int i=0; i < (int)StreamListEqM.size(); i++)
{
CheckOnLists.push_back(false);
}
for(int i=0; i < (int)StreamListEqM.size(); i++)
{
for(int j=0; j < (int)StreamListFP.size(); j++)
{
if (StreamListEqM[i] == StreamListFP[j]) {CheckOnLists[i] = true;}
}
}
for(int i=0; i < (int)CheckOnLists.size(); i++)
{
if (!CheckOnLists[i]) {AreListsConsistent = false;}
}
}
if (!AreListsConsistent)
{
ERROR <<"Lists defined in Fabrication plant and in EqM are not the same."<< endl;
ERROR <<"Lists defined in Fabrication plant :"<< endl;
for(int j=0; j < (int)StreamListFP.size(); j++)
{
ERROR <<"-> "<<StreamListFP[j]<<" "<< endl;
}
ERROR <<"Lists defined in EqM :"<< endl;
for(int i=0; i < (int)StreamListEqM.size(); i++)
{
ERROR <<"-> "<<StreamListEqM[i]<<" "<< endl;
}
ERROR <<"Check in your scenario."<< endl;
exit(1);
}
}