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;
fFuelPlan = 0;
}
//________________________________________________________________________
Reactor::Reactor(CLASSLogger* log):CLASSFacility(log, 4)
{
DBGL
fOutBackEndFacility = 0;
fStorage = 0;
fFabricationPlant = 0;
fFuelPlan = 0;
SetName("R_Reactor.");
DBGL
}
//________________________________________________________________________
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
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;
fPower = power * CapacityFactor;
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) );
fFuelPlan = 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
}
//________________________________________________________________________
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
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;
fPower = Power*CapacityFactor;
fEfficiencyFactor = 0.33;
fElectricPower = fEfficiencyFactor*fPower;
fCycleTime = -1; //BU in GWd/t
fFuelPlan = 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
}
//________________________________________________________________________
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
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;
fPower = Power*CapacityFactor;
fEfficiencyFactor = 0.33;
fElectricPower = fEfficiencyFactor*fPower;
fCycleTime = (cSecond) (fBurnUp*1e9 / (fPower) * fHeavyMetalMass *3600*24); //BU in GWd/t
fFuelPlan = new CLASSFuelPlan(log);
fFuelPlan->AddFuel(creationtime, CLASSFuel(fueltypeDB), fBurnUp);
177
178
179
180
181
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
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;
fFuelPlan = new CLASSFuelPlan(log);
fFuelPlan->AddFuel(creationtime, CLASSFuel(fueltypeDB), fBurnUp);
223
224
225
226
227
228
229
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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
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
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
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
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;
fPower = power * CapacityFactor;
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) );
fFuelPlan = new CLASSFuelPlan(log);
fFuelPlan->AddFuel(creationtime, CLASSFuel(evolutivedb), fBurnUp);
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
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) );
fFuelPlan = new CLASSFuelPlan(log);
fFuelPlan->AddFuel(creationtime, CLASSFuel(evolutivedb), fBurnUp);
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)
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
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
523
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
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
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
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
{
fIsAtEndOfCycle = true;
fInternalTime += EvolutionTime; // Update Internal Time
fInCycleTime += EvolutionTime; // Update InCycleTime
if(t >= GetCreationTime() + GetLifeTime()) // if the Next Cycle don't 'Exist...
fIsShutDown = true;
}
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
{
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 !
pair<CLASSFuel, double> NextFuel = fFuelPlan->GetFuelAt(fInternalTime);
SetBurnUp((NextFuel).second);
if( NextFuel.first.GetPhysicsModels() )
fFixedFuel = false;
else if( NextFuel.first.GetEvolutionData() )
fFixedFuel = true;
else
{
ERROR << typeid(NextFuel.first).name() << endl;
ERROR << "WRONG Fuel Format Correct it !! " << endl;
exit(1);
}
DBGL
if(fFixedFuel )
{
DBGL
if(fIsAtEndOfCycle && !fIsShutDown )
{
SetEvolutionDB( *(NextFuel.first.GetEvolutionData()) );
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;
exit(1);
}
if(fIsAtEndOfCycle && !fIsShutDown )
{
fIsAtEndOfCycle = false;
SetNewFuel(fFabricationPlant->GetReactorEvolutionDB(GetId()));
fFabricationPlant->TakeReactorFuel(GetId());
fInsideIV = fIVBeginCycle;
AddCumulativeIVIn(fIVBeginCycle);
fInCycleTime = 0;
}
DBGL
}
DBGL
}
//________________________________________________________________________
cSecond Reactor::GetNextCycleTime(cSecond time)
{
DBGL
cSecond LastCycle = fInternalTime - fInCycleTime;
while ( LastCycle < time)
{
cSecond cycletime = (cSecond)(fFuelPlan->GetFuelAt(LastCycle).second*1e9 / (fPower) * fHeavyMetalMass *3600*24);
LastCycle += cycletime;
}
DBGL
return LastCycle;
}
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
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
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);
}
}