// Member Functions of the Class "CostingAccount"
// SiC Blanket

#include <cstdlib>
#include <iostream>
#include <iomanip>  // LCC added to manipulate output file format, such as using setw()
#include <fstream>
#include <math.h>
#include <string>
#include <time.h> // LCC for date/time printout

using std::string;
using namespace std;

#include "Part.h"
#include "DesignPoint.h"
#include "CostingAccount.h"

using std::string;
using namespace std;

// Declare global variables from Aries.cpp
extern string blanketmode, dispmode, manifold;

// Level of Safety Assurance (LSA)
// LSA was supposed to be removed??  LSA = 4 comes from Aries.cpp ~540
// and "[lsa-1] = 3, so cost_credit_factors are all = 1 from the tables
void CostingAccount::get_level_of_safety_assurance(int assurance) { lsa = assurance; }


// Cost Base Years for Inflation (table at bottom ~1945 replaced by input file)
// The reference year input is found in input file costing.data
void CostingAccount::get_cost_base_years(int costBaseYear, int costOutYear)
  { yearOrig = costBaseYear;
    yearNew  = costOutYear; } // eof


// HISTORY========================================================================================
// These costing accounts were updated ~Aug 2009 by L. Waganer and Z. Dragojlovic
// LCC subsequent updated 12/8/10 per "Algorithm comparison RevD (120910).xls" L. Waganer
// See also Ò20100121 - Waganer, Algorithm Comparison ASC Results Included.xlsÓ
// and      Ò20091215 - Dragoljlovic NewCostingAccounts.pdf"
// ===============================================================================================


// Acquire costs from outside information
// ===============================================================================================
// *** Account 20 - Land and Land Rights

void CostingAccount::get_account_20(DesignPoint * Machine)
{  double cost_credit_factors[4] = {1.00, 1.00, 1.00, 1.00};

// Set up fileout for printing the algorithms, this must be done for every account
   string filedir, filepath, extension; filedir = "./OutputParts/"; extension = ".data";
   time_t rawtime;	struct tm * timeinfo; time ( &rawtime );
   timeinfo = localtime ( &rawtime );
   filepath = filedir + "CostingAlgorithms" + extension; ofstream fileout(filepath.c_str());
   fileout << "Costing Algorithms with " << blanketmode << " Blanket:\n Every account is multiplied by an inflation factor (cost basis year in use/cost reference year) along with a cost credit factor \n";
   fileout << "Printed on " << asctime (timeinfo) << "\n\n";

// Get Names
   n_20[0] = "Land and Land Rights:	;";
   n_20[1] = "Land and Privilege Acquisition:	;";
   n_20[2] = "Relocation of Buildings, Utilities, Highways and Other Services:	;";
//cout << yearOrig << "	" << yearNew << "\n";

// Get Costs
   double Pe = (*Machine).net_electrical_power();
   c_20[1] = 20.0e6*pow(Pe/1000.0, 0.3)*inflation(yearOrig, yearNew)*cost_credit_factors[lsa-1];
   c_20[2] = (20.01e6)*0.2*inflation(yearOrig, yearNew)*cost_credit_factors[lsa-1];
   fileout << "c_20[1] = 20.0e6*pow(Pe/1000.0, 0.3) \n";
   fileout << "c_20[2] = (20.01e6)*0.2 \n";
   fileout << "	Pe = (*Machine).net_electrical_power() \n\n";

// Top Level Cost
   c_20[0] = 0.0;   for(int i=1; i<3; i++) c_20[0] = c_20[0] + c_20[i];
} // eof


// ===============================================================================================
// *** Account 21 - Structures and Site Facilities
void CostingAccount::get_account_21(DesignPoint * Machine)
{

// Get Names
   n_21[0]  = "Structures and Site Facilities:	;";
   n_21[1]  = "Site Improvements and Facilities:	;";
   n_21[2]  = "Power Core Building:	;";
   n_21[3]  = "Turbine - Generator Building:	;";
   n_21[4]  = "Heat Rejection Structures and Facilities:	;";
   n_21[5]  = "Electrical Equipment and Power Supply Building:	;";
   n_21[6]  = "Plant Auxiliary Systems Building (including Switchgear):	;";
   n_21[7]  = "Hot Cell Building (incl. Maintenance and Radioactive Material Storage and Reprocessing):	;";
   n_21[8]  = "Power Core Service Building (Non-Radioactive Service?):	;";
   n_21[9]  = "Service Water Building:	;";
   n_21[10] = "Fuel Handling and Storage Building:	;";
   n_21[11] = "Control Room Building:	;";
   n_21[12] = "On-Site A/C Power Supply Building:	;";
   n_21[13] = "Administration Building:	;";
   n_21[14] = "Site Service Building:	;";
   n_21[15] = "Cryogenics and Inert Gas Storage Building:	;";
   n_21[16] = "Security Building:	;";
   n_21[17] = "Ventilation Stack:	;";

// Get Costs, LCC updated 12/8/10
// ... cost credit factors ...
	double cost_credit_factors_A[4] = {0.60, 0.90, 0.96, 1.00}; // Power Core & Hot Cell Buildings 
	double cost_credit_factors_B[4] = {1.00, 1.00, 1.00, 1.00}; // Turbine - Generator Building  
	double cost_credit_factors_C[4] = {0.60, 0.67, 0.67, 1.00}; // Other Structures & Improvements 

// Set up fileout for printing the algorithms, this must be done for every account
// Add "ios::app" to ofstream to ADD content to printout.
   string filedir, filepath, extension; filedir = "./OutputParts/"; extension = ".data";
   filepath = filedir + "CostingAlgorithms" + extension; ofstream fileout(filepath.c_str(), ios::app);
   
// ... site improvements and facilities (21.1) ...
  double Asite = 1000.0; // Site area [acres]
  c_21[1] = 27.0e6*pow(Asite/1000.0, 0.2)*inflation(yearOrig, yearNew)*cost_credit_factors_B[lsa-1];
  fileout << "c_21[1] = 27.0e6*pow(Asite/1000.0, 0.2) \n";

// ... power core building (21.2) ... calculated from DP.cpp 58, Reactor Bldg Vol
  double Vrb = (*Machine).reactor_building_volume(); // power core building volume (structural vol)
  c_21[2] = 111.846e6*pow(Vrb/80.0e3, 0.62)*inflation(yearOrig, yearNew)*cost_credit_factors_A[lsa-1];
  fileout << "c_21[2] = 111.846e6*pow(Vrb/80.0e3, 0.62) \n";
//cout << "Machine volume (CA.cpp) = " << Vrb << "\n";
//cout << "cost credit factor B = " << cost_credit_factors_B[lsa-1] << "\n";

// ... turbine - generator building (21.3) ...
  double Pet = (*Machine).gross_electrical_power(); // gross electric power
  c_21[3] = 79.03e6*pow(Pet/1246.0, 0.5)*inflation(yearOrig, yearNew)*cost_credit_factors_B[lsa-1];
  fileout << "c_21[3] = 79.03e6*pow(Pet/1246.0, 0.5) \n";
//cout << "LSA turbine (CA.cpp) =" << lsa << "\n"; // LSA is used to determine the cost credit factor
//cout << "Turbine Gross Elec (CA.cpp) =" << Pet << "\n";

// ... heat rejection structures and facilities (21.4) ...
  double Pth = (*Machine).thermal_power(); // thermal power
  c_21[4] = 16.832e6*pow((Pth-Pet)/1860.0, 0.5)*inflation(yearOrig, yearNew)*cost_credit_factors_C[lsa-1];
  fileout << "c_21[4] = 16.832e6*pow((Pth-Pet)/1860.0, 0.5) \n";

// ... electrical equipment and power supply building (21.5) ---
  double Pe = (*Machine).net_electrical_power(); // net electric power
  c_21[5] = 22.96e6*pow(Pe/1000.0, 0.3)*inflation(yearOrig, yearNew)*cost_credit_factors_C[lsa-1];
  fileout << "c_21[5] = 22.96e6*pow(Pe/1000.0, 0.3) \n";

// ... plant auxiliary systems building (21.6) ...
   c_21[6] = 22.00e6*pow(Pet/1246.0, 0.3)*inflation(yearOrig, yearNew)*cost_credit_factors_C[lsa-1];
  fileout << "c_21[6] = 22.00e6*pow(Pet/1246.0, 0.3) \n";

// ... hot cell building (including maintenance and radioactive material storage and reprocessing) (21.7) ...
   c_21[7] = 0.34*c_21[2];
  fileout << "c_21[7] = 0.34*c_21[2] \n";

// ... power core service building (non-radioactive service?) (21.8) ...     
   c_21[8] = 4.316e6*pow(Pe/1000.0, 0.3)*inflation(yearOrig, yearNew)*cost_credit_factors_B[lsa-1];
  fileout << "c_21[8] = 4.316e6*pow(Pe/1000.0, 0.3) \n";

// ... service water building (21.9) ...
  c_21[9] = 1.515e6*pow(Pe/1000.0, 0.3)*inflation(yearOrig, yearNew)*cost_credit_factors_B[lsa-1]; 
  fileout << "c_21[9] = 1.515e6*pow(Pe/1000.0, 0.3) \n";

// ...  fuel handling and storage building (21.10) ...
   double Pfusion = (*Machine).fusion_power(); // fusion power
   c_21[10] = 25.0e6*pow(Pfusion/1759.0, 0.3)*inflation(yearOrig, yearNew)*cost_credit_factors_C[lsa-1]; 
   fileout << "c_21[10] = 25.0e6*pow(Pfusion/1759.0, 0.3) \n";

// ... control room building (21.11) ...
   c_21[11] = 7.12e6*inflation(yearOrig, yearNew)*cost_credit_factors_B[lsa-1];
   fileout << "c_21[11] = 7.12e6 \n";

// ... on-site a/c power supply building (21.12) ...
   c_21[12] = 4.71e6*pow(Pe/1000.0, 0.3)*inflation(yearOrig, yearNew)*cost_credit_factors_B[lsa-1];
   fileout << "c_21[12] = 4.71e6*pow(Pe/1000.0, 0.3) \n";

// ... administration building (21.13) ...
   c_21[13] = 2.00e6*inflation(yearOrig, yearNew)*cost_credit_factors_B[lsa-1];
   fileout << "c_21[13] = 2.00e6 \n";

// ... site service building (21.14) ...
   c_21[14] = 2.00e6*inflation(yearOrig, yearNew)*cost_credit_factors_B[lsa-1];
   fileout << "c_21[14] = 2.00e6 \n";

// ... cryogenics and inert gas storage building (21.15) ...
   c_21[15] = 2.09e6*inflation(yearOrig, yearNew)*cost_credit_factors_B[lsa-1];
   fileout << "c_21[15] = 2.09e6 \n";

// ... security building (21.16) ...
   c_21[16] = 0.71e6*inflation(yearOrig, yearNew)*cost_credit_factors_B[lsa-1];
   fileout << "c_21[16] = 0.71e6 \n";

// ... ventilation stack (21.17) ... 
   c_21[17] = 4.16e6*inflation(yearOrig, yearNew)*cost_credit_factors_C[lsa-1];
   fileout << "c_21[17] = 4.16e6 \n";
   fileout << "	Asite 	= 1000.0 [acres] \n";
   fileout << "	Pet 	= (*Machine).gross_electrical_power() \n";
   fileout << "	Pth 	= (*Machine).thermal_power() \n";
   fileout << "	Pfusion = (*Machine).fusion_power() \n";
   fileout << "	Vrb 	= (*Machine).volume() = " << Vrb << "\n";
   fileout << "	vol_reactor_bldg = (pow((ksihi + 9.0), 2.0)*6.0*etahi + 1.55e5)*cATfit \n";
   fileout << "	ksihi 	= (*Core).bounding_box(2, 'outer') \n";
   fileout << "	etahi 	= (*Core).bounding_box(3, 'outer') \n";
   fileout << "	cATfit 	= 138698.0/181655.0 \n\n";

// Top Level Cost
   c_21[0] = 0.0;
   for(int i=1; i<18; i++) c_21[0] = c_21[0] + c_21[i];
} // eof


// ===============================================================================================
// *** Account 22 - Power Core Equipment, Main Accounts

void CostingAccount::get_account_22(DesignPoint * Machine)
{

// Get Names
   n_22[0] = "Power Core Equipment:	;";
   n_22[1] = "Fusion Energy Capture and Conversion:	;";
   n_22[2] = "Plasma Confinement:	;";
   n_22[3] = "Plasma Formation and Sustainment:	;";
   n_22[4] = "Vacuum, Power Core:	;";
   n_22[5] = "Primary Structure and Support, Power Core:	;";
   n_22[6] = "Main Heat Transfer and Transport (MHTT):	;";
   n_22[7] = "Radioactive Materials Treatment and Management (off-line):	;";
   n_22[8] = "Fuel Handling and Storage (on-line):	;";
   n_22[9] = "Maintenance Equipment:	;";
   n_22[10] = "Instrumentation and Control:	;";
   n_22[11] = "Other Power Core Equipment:	;";
   n_22[12] = "Spare Parts Allowance (include in individual costs):	;";
   n_22[13] = "Contingency Allowance (include in Acct 96):	;";


// Get Costs, these are all calculated further down in the subaccounts 22.1[x]

// ... fusion energy capture and conversion (22.1) ...
   c_22[1] = c_22_1[0];

// ... plasma confinement (22.2) ...
   c_22[2] = c_22_2[0];

// ... plasma formation and sustainment (22.3) ... 
   c_22[3] = c_22_3[0]; 

// ... vacuum, power core (22.4) ...
   c_22[4] = c_22_4[0];

// ... primary structure and support, power core (22.5) ...
   c_22[5] = c_22_5[0];

// ... main heat transfer and transport (22.6) ...
   c_22[6] = c_22_6[0];

// ... radioactive materials treatment and management (off-line) (22.7) ...
   c_22[7] = c_22_7[0];

// ... fuel handling and storage (on-line) (22.8) ...
   c_22[8] = c_22_8[0];

// ... maintenance equipment (22.9) ... 
   c_22[9] = c_22_9[0];

// ... instrumentation and control (22.10) ...
   c_22[10] = c_22_10[0];

// ... other power core equipment ...
   c_22[11] = c_22_11[0];

// ... spare parts allowance (included in individual costs) (22.98) ...
   c_22[12] = 0.0;

// ... contingency allowance (included in acct 96) (22.99) ...
   c_22[13] = 0.0;


// Top Level Cost for ALL power core equipment (C_22)
   c_22[0] = 0.0;
   for(int i=1; i<14; i++) c_22[0] = c_22[0] + c_22[i];

} // eof


// ===============================================================================================
// *** *** Sub Account 22.1 - Fusion Energy Capture and Conversion

void CostingAccount::get_account_22_1(
		DesignPoint * Machine, 	    	Part * FWInboard,				Part * FWOutboard,      
		Part * BlanketInboard,			Part * BlanketOutboard,         Part * BlanketII,
		Part (*RepHTShield)[2],			Part (*HTShield)[2],			Part * TFCoil,
		Part * Window,					Part (*PoloFCoil)[36],			Part * BuckingCylinder,
		Part * UpperCap,				Part * LowerCap,				Part (*VVessel)[4],
		Part (*Div)[6],					Part * BackWallInboard,			Part * BackWallOutboard,
		Part * HTShieldDCLL,			Part * SkeletonRing,			Part (*VacuumVesselDCLL)[4],
		Part * Manifold)
        // added for DCLL: BackWallInboard on

{
// Get Names
   n_22_1[0] = "Fusion Energy Capture and Conversion:	;";
   n_22_1[1] = "First Wall and Blanket, replaceable, IB & OB:	;";
   n_22_1[2] = "Second Blanket, life of plant:	;";
   n_22_1[3] = "Divertor Assembly, upper and lower, replaceable:	;";
   n_22_1[4] = "High Temperature Shield and support structure, replaceable:	;";
   n_22_1[5] = "Low Temperature Shield, life of plant:	;";
   n_22_1[6] = "Penetration Shielding (low temperature, active and passive):	;";
   n_22_1[7] = "Shield cooling, low temperature:	;";

// Get Costs
// ... cost credit factors ...
	double cost_credit_factors_A[4] = {0.90, 0.95, 1.00, 1.00};
	double cost_credit_factors_B[4] = {0.60, 1.00, 1.00, 1.00};
	double cost_credit_factors_C[4] = {0.90, 1.00, 1.00, 1.00};
	double cost_credit_factors_D[4] = {0.85, 0.94, 0.94, 1.00};

   string filedir, filepath, extension; filedir = "./OutputParts/"; extension = ".data";
   filepath = filedir + "CostingAlgorithms" + extension; ofstream fileout(filepath.c_str(), ios::app);
 
// ... first wall and blanket, REPLACEABLE, IB+OB (22.1.1) ...
if (blanketmode == "dcll") { 
	c_22_1[1] = ((*FWInboard).cost() 			+ (*FWOutboard).cost() +
                 (*BlanketInboard).cost() 		+ (*BlanketOutboard).cost() + 
                 (*BackWallInboard).cost() 		+ (*BackWallOutboard).cost())*16.0*inflation(yearOrig, yearNew)*cost_credit_factors_A[lsa-1]; 
	fileout << "c_22_1[1] = ( (*FWInboard).cost() + (*FWOutboard).cost() + (*BlanketInboard).cost() + (*BlanketOutboard).cost() + (*BackWallInboard).cost() + (*BackWallOutboard).cost() )*16.0 \n"; }
else { c_22_1[1] = ((*FWInboard).cost() 		+ (*FWOutboard).cost() +
                	(*BlanketInboard).cost() 	+ (*BlanketOutboard).cost())*16.0*inflation(yearOrig, yearNew)*cost_credit_factors_A[lsa-1];
	fileout << "c_22_1[1] = ( (*FWInboard).cost() + (*FWOutboard).cost() + (*BlanketInboard).cost() + (*BlanketOutboard).cost() )*16.0 \n"; }
//cout << "c_22_1[1] = " << c_22_1[1] << "\n";

// ... second blanket, LIFE OF PLANT (i.e. permanent) (22.1.2) ...
if (blanketmode == "dcll") { 
	c_22_1[2] = 0.0*16.0*inflation(yearOrig, yearNew)*cost_credit_factors_A[lsa-1]; 
	fileout << "c_22_1[2] = 0.0*16.0 (No second blanket in DCLL model) \n"; }
else {
	c_22_1[2] = (*BlanketII).cost()*16.0*inflation(yearOrig, yearNew)*cost_credit_factors_A[lsa-1]; 
	fileout << "c_22_1[2] = (*BlanketII).cost()*16.0 \n"; }

// ... divertor assembly, upper and lower, replaceable (22.1.3) ... 
   double DivCost = 0.0;
   for(int i=0; i<6; i++) DivCost = DivCost + (*Div)[i].cost();
   c_22_1[3] = DivCost*16.0*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1];
   fileout << "c_22_1[3] = DivCost*16.0 \n";

// ... high temperature shielding/structure, outside of blanket and divertor, replaceable (22.1.4) ...
if (blanketmode == "dcll") {
c_22_1[4] = ( (*RepHTShield)[0].cost() + 
			  (*RepHTShield)[1].cost() +
              (*SkeletonRing).cost() ) *16.0*inflation(yearOrig, yearNew)*cost_credit_factors_A[lsa-1];
	fileout << "c_22_1[4] = ( (*RepHTShield)[0].cost() + (*RepHTShield)[1].cost() + (*SkeletonRing).cost() )*16.0 \n"; }
else if (manifold    == "on") {
	c_22_1[4] = ( (*RepHTShield)[0].cost() + 
				  (*RepHTShield)[1].cost() +
                  (*SkeletonRing).cost()   +
                  (*Manifold).cost() )     *16.0*inflation(yearOrig, yearNew)*cost_credit_factors_A[lsa-1];
	fileout << "c_22_1[4] = ( (*RepHTShield)[0].cost() + (*RepHTShield)[1].cost() + (*SkeletonRing).cost() + (*Manifold).cost() )*16.0 \n"; }

else {
	c_22_1[4] = ((*RepHTShield)[0].cost() + (*RepHTShield)[1].cost()) *
                16.0*inflation(yearOrig, yearNew)*cost_credit_factors_A[lsa-1];
	fileout << "c_22_1[4] = ( (*RepHTShield)[0].cost() + (*RepHTShield)[1].cost() )*16.0 \n"; }

// ... low temperature shielding, outside of high temperature shield, life of plant (22.1.5) ...
if (blanketmode == "dcll") {
	c_22_1[5] = ((*HTShieldDCLL).cost())*16.0*inflation(yearOrig, yearNew)*cost_credit_factors_A[lsa-1]; 
	fileout << "c_22_1[5] = ( (*HTShieldDCLL).cost() )*16.0 \n"; }
else {
	c_22_1[5] = ((*HTShield)[0].cost() + (*HTShield)[1].cost())*16.0*inflation(yearOrig, yearNew)*cost_credit_factors_A[lsa-1]; 
	fileout << "c_22_1[5] = ( (*HTShield)[0].cost() + (*HTShield)[1].cost() )*16.0 \n"; }

// ... penetration shielding (low temperature, active and passive) (22.1.6) ...
// NEW - Read in penetration shielding thickness (% of HT shield thickness) from powerflow.data input file, also DP ~755
	ifstream fin_ps;  fin_ps.open("InputData/powerflow.data");
	fin_ps.width(10); fin_ps.precision(2);
	fin_ps.setf(ios_base::uppercase, ios_base::scientific);
	int itxt_ps = 57; int inum_ps = 13; int iskip_ps = itxt_ps + inum_ps;
    double pen_shielding; fin_ps.seekg(43*iskip_ps + itxt_ps +1); fin_ps >> pen_shielding;
	fin_ps.close();

   c_22_1[6] = pen_shielding*c_22_1[5]*inflation(yearOrig, yearNew)*cost_credit_factors_A[lsa-1]; 
   fileout << "c_22_1[6] = pen_shielding*c_22_1[5] \n";

// ... shield cooling, low temperature (22.1.7) ... 
   c_22_1[7] = 0.0*inflation(yearOrig, yearNew)*cost_credit_factors_A[lsa-1]; 
   fileout << "c_22_1[7] = 0.0 \n";
   
   fileout << "	DivCost = for(int i=0; i<6; i++) { DivCost = DivCost + (*Div)[i].cost() } \n\n";

// Top Level Cost
   c_22_1[0] = 0.0;
   for(int i=1; i<8; i++) c_22_1[0] = c_22_1[0] + c_22_1[i];
//cout << c_22_1[0] << "\n";
} // eof


// ===============================================================================================
// *** *** Sub Account 22.2 - Plasma Confinement

void CostingAccount::get_account_22_2(
		DesignPoint * Machine, 		 Part * TFCoil,			Part * BuckingCylinder, 
		Part * UpperCap,    		 Part * LowerCap,		Part (*PoloFCoil)[36],
		Part * CryoDome)
{
// Get Names
   n_22_2[0] = "Plasma Confinement:	;";
   n_22_2[1] = "Toroidal Field Coils (conductor, case, bucking cyl, cryostat, struts, structure):	;";
   n_22_2[2] = "Poloidal Field Coils (central solenoid and outer poloidal), lower spares incl:	;";
   n_22_2[3] = "Feedback Control Coils (normal conducting):	;";
   n_22_2[4] = "Cryogenicics for Plasma Confinement (incl dewar vacuum pumping):	;";
   n_22_2[5] = "Power Supplies for Plasma Confinement:	;";

// Get Costs
// ... cost credit factors ...
	double cost_credit_factors_A[4] = {0.90, 0.95, 1.00, 1.00};
	double cost_credit_factors_B[4] = {0.60, 1.00, 1.00, 1.00};
	double cost_credit_factors_C[4] = {0.90, 1.00, 1.00, 1.00};
	double cost_credit_factors_D[4] = {0.85, 0.94, 0.94, 1.00};

   string filedir, filepath, extension; filedir = "./OutputParts/"; extension = ".data";
   filepath = filedir + "CostingAlgorithms" + extension; ofstream fileout(filepath.c_str(), ios::app);
 
// LCC cannot take out 16x here, it is applied to 22.2.1 accounts below, but the accounts are not added here
// ... toroidal field coils (conductor, case, bucking cylinder, cryostat, struts, structure) (22.2.1) ... 
   c_22_2[1] = ((*TFCoil).cost() + 
   				(*BuckingCylinder).cost() + 
                (*UpperCap).cost() + 
                (*LowerCap).cost() + 
                (*CryoDome).cost())*
                16.0*inflation(yearOrig,yearNew)*cost_credit_factors_A[lsa-1];
   fileout << "c_22_2[1] = ((*TFCoil).cost() + (*BuckingCylinder).cost() + (*UpperCap).cost() + (*LowerCap).cost() + (*CryoDome).cost())*16.0 \n";
   
// ... poloidal field coils (central solenoid and outer poloidal), lower spares included (22.2.2) ...
// 36 total PF coils = 14 top, 14 bottom, 8 central solenoid
// extra coils are not separate (#37-50), but rather #4-18
   double PFCoilCost = 0.0;
   for(int i=0; i<36; i++) PFCoilCost = PFCoilCost + (*PoloFCoil)[i].cost(); // 36 total PF coils
   for(int i=4; i<18; i++) PFCoilCost = PFCoilCost + (*PoloFCoil)[i].cost(); // include the 14 spare coils
   c_22_2[2] = PFCoilCost*16.0*inflation(yearOrig, yearNew)*cost_credit_factors_A[lsa-1];
   fileout << "c_22_2[2] = PFCoilCost*16.0 \n";

// ... feedback control coils (normal conducting) (22.2.3) ... 
   c_22_2[3] = 0.0*inflation(yearOrig, yearNew)*cost_credit_factors_A[lsa-1]; // not included at present
   fileout << "c_22_2[3] = 0.0 \n";

// ... cryogenicics for plasma confinement (including dewar vacuum pumping) (22.2.4) ...
   c_22_2[4] = 0.0*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1]; // not included at present
   fileout << "c_22_2[4] = 0.0 \n";

// ... power supplies for plasma confinement (22.2.5) ...
   c_22_2[5] = 0.0*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1]; // not included at present
   fileout << "c_22_2[5] = 0.0 \n";
   fileout << "	PFCoilCost (main):   for(int i=0; i<36; i++) { PFCoilCost = PFCoilCost + (*PoloFCoil)[i].cost() } \n";
   fileout << "	PFCoilCost (spares): for(int i=4; i<18; i++) { PFCoilCost = PFCoilCost + (*PoloFCoil)[i].cost() } \n\n";

// Top Level Cost
   c_22_2[0] = 0.0;
   for(int i=1; i<6; i++) c_22_2[0] = c_22_2[0] + c_22_2[i];
} // eof


// ===============================================================================================
// *** *** Sub Sub Account 22.2.1 - Toroidal Field Coils Complete

void CostingAccount::get_account_22_2_1(
		DesignPoint *Machine,		Part *TFCoil,		Part *BuckingCylinder, 
		Part *UpperCap,				Part *LowerCap,		Part *CryoDome)
{
// Get Names
   n_22_2_1[0] = "Toroidal Field Coils Complete (conductor, case, bucking cyl, cryostat, struts, structure):	;";
   n_22_2_1[1] = "Conductor and Cable:	;";
   n_22_2_1[2] = "Structural Coil Case:	;";
   n_22_2_1[3] = "Bucking Cylinder:	;";
   n_22_2_1[4] = "Cryostat and Thermal Shield:	;";
   n_22_2_1[5] = "Thermal Isolation Struts:	;";
   n_22_2_1[6] = "Anti-torque structure (upper + lower cap):	;";

// Get Costs
// ... cost credit factors ...
	double cost_credit_factors_A[4] = {0.90, 0.95, 1.00, 1.00};
	double cost_credit_factors_B[4] = {0.60, 1.00, 1.00, 1.00};
	double cost_credit_factors_C[4] = {0.90, 1.00, 1.00, 1.00};
	double cost_credit_factors_D[4] = {0.85, 0.94, 0.94, 1.00};

   string filedir, filepath, extension; filedir = "./OutputParts/"; extension = ".data";
   filepath = filedir + "CostingAlgorithms" + extension; ofstream fileout(filepath.c_str(), ios::app);
 
// ... conductor and cable (22.2.1.1) ...
   c_22_2_1[1] = (*TFCoil).sub_cost(0)*16.0*inflation(yearOrig, yearNew)*cost_credit_factors_A[lsa-1];
   fileout << "c_22_2_1[1] = (*TFCoil).sub_cost(0)*16.0 \n";

// ... structural coil case (22.2.1.2) ...
   c_22_2_1[2] = (*TFCoil).sub_cost(1)*16.0*inflation(yearOrig, yearNew)*cost_credit_factors_A[lsa-1];
   fileout << "c_22_2_1[2] = (*TFCoil).sub_cost(1)*16.0 \n";

// ... bucking cylinder  (22.2.1.3) ...  keep 16x factor
   c_22_2_1[3] = (*BuckingCylinder).cost()*16.0*inflation(yearOrig, yearNew)*cost_credit_factors_A[lsa-1];
   fileout << "c_22_2_1[3] = (*BuckingCylinder).cost()*16.0 \n";

// ... cryostat and thermal shield (22.2.1.4) ... // ~121 M$ complete
   c_22_2_1[4] = (*CryoDome).cost()*16.0*inflation(yearOrig, yearNew)*cost_credit_factors_A[lsa-1];
   fileout << "c_22_2_1[4] = (*CryoDome).cost()*16.0 \n";

// ... thermal isolation struts (22.2.1.5) ...
   c_22_2_1[5] = 0.0*16.0*inflation(yearOrig, yearNew)*cost_credit_factors_A[lsa-1];
   fileout << "c_22_2_1[5] = 0.0*16.0 \n";

// ... anti-torque structure (22.2.1.6) ...upper + lower cap, .... 16x factor
   c_22_2_1[6] = ((*UpperCap).cost() + (*LowerCap).cost())*16.0*inflation(yearOrig, yearNew)*cost_credit_factors_A[lsa-1];
   fileout << "c_22_2_1[6] = ((*UpperCap).cost() + (*LowerCap).cost())*16.0 \n";
   fileout << "	(*TFCoil).sub_cost(0) = " << (*TFCoil).sub_cost(0) << "\n";
   fileout << "	(*TFCoil).sub_cost(1) = " << (*TFCoil).sub_cost(1) << "\n\n";

// Top Level Cost
   c_22_2_1[0] = 0.0;
   for(int i=1; i<7; i++) c_22_2_1[0] = c_22_2_1[0] + c_22_2_1[i];
} // eof



// ===============================================================================================
// *** *** Sub Account 22.3 - Plasma Formation and Sustainment

void CostingAccount::get_account_22_3(DesignPoint * Machine)
{

// Get Names
   n_22_3[0] = "Plasma Formation and Sustainment:	;";
   n_22_3[1] = "Heating and Current Drive with power supplies (Primarily Steady State):	;";
   n_22_3[2] = "Startup subsystems with power supplies:	;";
   n_22_3[3] = "Stability Control subsystem with power supplies (Primarily Transient):	;";
   n_22_3[4] = "Plasma Fueling and Constituent Control:	;";


// Get Costs
// ... cost credit factors ...
	double cost_credit_factors_A[4] = {0.90, 0.95, 1.00, 1.00};
	double cost_credit_factors_B[4] = {0.60, 1.00, 1.00, 1.00};
	double cost_credit_factors_C[4] = {0.90, 1.00, 1.00, 1.00};
	double cost_credit_factors_D[4] = {0.85, 0.94, 0.94, 1.00};

   string filedir, filepath, extension; filedir = "./OutputParts/"; extension = ".data";
   filepath = filedir + "CostingAlgorithms" + extension; ofstream fileout(filepath.c_str(), ios::app);
 
// ... heating and current drive with power supplies (primarily steady state) (22.3.1) ...
   c_22_3[1] = (*Machine).cd_cost()*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1];
   fileout << "c_22_3[1] = (*Machine).cd_cost() \n";

// ... startup subsystems with power supplies (22.3.2) ... 
   c_22_3[2] = 7.0e6*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1]; 
   fileout << "c_22_3[2] = 7.0e6 \n"; // Aries-AT placeholder

// ... stability control subsystem with power supplies (primarily transient) (22.3.3) ...
   c_22_3[3] = 0.0*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1]; 
   fileout << "c_22_3[3] = 0.0 \n";

// ... plasma fueling and constituent control (22.3.4) ...
   c_22_3[4] = 16.0e6*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1]; 
   fileout << "c_22_3[4] = 16.0e6 \n\n"; // Aries-AT placeholder

// Top Level Cost
   c_22_3[0] = 0.0;
   for(int i=1; i<5; i++) c_22_3[0] = c_22_3[0] + c_22_3[i];
//cout << c_22_3[0] << "\n";
} // eof


// ===============================================================================================
// *** *** Sub Sub Account 22.3.1 - Heating and Current Drive with power supplies (Primarily Steady State)

void CostingAccount::get_account_22_3_1(DesignPoint * Machine)
{

// Get Names
   n_22_3_1[0] = "Heating and Current Drive with power supplies (Primarily Steady State):	;";
   n_22_3_1[1] = "Ion Cyclotron Resonance Frequency (ICRF) Fast Wave Heating and CD:	;";
   n_22_3_1[2] = "Lower Hybrid (LH) Wave Plasma Heating and Current Drive:	;";
   n_22_3_1[3] = "Electron Cyclotron Resonance Frequency (ECRF) Plasma Heating and CD:	;";
   n_22_3_1[4] = "Neutral Particle Beam Plasma Heating, Current Drive and Rotation:	;";

// Get Costs
// ... cost credit factors ...
	double cost_credit_factors_A[4] = {0.90, 0.95, 1.00, 1.00};
	double cost_credit_factors_B[4] = {0.60, 1.00, 1.00, 1.00};
	double cost_credit_factors_C[4] = {0.90, 1.00, 1.00, 1.00};
	double cost_credit_factors_D[4] = {0.85, 0.94, 0.94, 1.00};

   string filedir, filepath, extension; filedir = "./OutputParts/"; extension = ".data";
   filepath = filedir + "CostingAlgorithms" + extension; ofstream fileout(filepath.c_str(), ios::app);
 
// ... ion cyclotron resonance frequency (ICRF)Â fastÂ wave heating and current drive (22.3.1.1) ...
   c_22_3_1[1] = (*Machine).cd_fast_wave_cost()*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1];
   fileout << "c_22_3_1[1] = (*Machine).cd_fast_wave_cost() \n";

// ... lower hybrid (lh) wave plasma heating and current drive (22.3.1.2) ...
   c_22_3_1[2] = (*Machine).cd_lower_hybrid_cost()*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1];
   fileout << "c_22_3_1[2] = (*Machine).cd_lower_hybrid_cost() \n";

// ... Electron Cyclotron Resonance Frequency (ECRF) Plasma Heating and Current Drive
   c_22_3_1[3] = 0.0*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1]; // ??? TBD
   fileout << "c_22_3_1[3] = 0.0 \n";

// ... neutral particle beam plasma heating, current drive and rotation
// ... misc power supplies and cooling systems for CD and heating
   c_22_3_1[4] = (*Machine).cd_neutral_beam_cost()*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1];
   fileout << "c_22_3_1[4] = (*Machine).cd_neutral_beam_cost() \n\n";

// Top Level Cost
   c_22_3_1[0] = 0.0;
   for(int i=1; i<5; i++) c_22_3_1[0] = c_22_3_1[0] + c_22_3_1[i];
} // eof


// ===============================================================================================
// *** *** Sub Sub Account 22.3.2 - Startup subsystems with power supplies

void CostingAccount::get_account_22_3_2(DesignPoint * Machine)
{

// Get Names
   n_22_3_2[0] = "Startup subsystems with power supplies:	;";
   n_22_3_2[1] = "Electron Cyclotron Resonance Freq. (ECRF) Wave Plasma Breakdown:	;";
   n_22_3_2[2] = "Ion Cyclotron Resonance Freq. (ICRF) Wave Current Initiation, Ramp-Up:	;";
   n_22_3_2[3] = "Lower Hybrid (LH)  Wave Current Initiation and Ramp-Up:	;";

// Get Costs
// ... cost credit factors ...
	double cost_credit_factors_A[4] = {0.90, 0.95, 1.00, 1.00};
	double cost_credit_factors_B[4] = {0.60, 1.00, 1.00, 1.00};
	double cost_credit_factors_C[4] = {0.90, 1.00, 1.00, 1.00};
	double cost_credit_factors_D[4] = {0.85, 0.94, 0.94, 1.00};
	
	string filedir, filepath, extension; filedir = "./OutputParts/"; extension = ".data";
    filepath = filedir + "CostingAlgorithms" + extension; ofstream fileout(filepath.c_str(), ios::app);
 
// ... Electron Cyclotron Resonance Frequency (ECRF) Wave Plasma Breakdown
   c_22_3_2[1] = 0.0*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1]; // ??? TBD
   fileout << "c_22_3_2[1] = 0.0 \n";

// ... Ion Cyclotron Resonance Frequency (ICRF) Wave Current Initiation and Ramp-Up
    c_22_3_2[2] = 0.0*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1]; // ??? TBD
   fileout << "c_22_3_2[2] = 0.0 \n";

// ... Lower Hybrid (LH)  Wave Current Initiation and Ramp-Up
    c_22_3_2[3] = 0.0*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1];  // ??? TBD
   fileout << "c_22_3_2[3] = 0.0 \n\n";

// Top Level Cost
   c_22_3_2[0] = 0.0;
   for(int i=1; i<4; i++) c_22_3_2[0] = c_22_3_2[0] + c_22_3_2[i];
} // eof



// ===============================================================================================
// *** *** Sub Sub Account 22.3.3 - Stability Control subsystem with power supplies (Primarily Transient)

void CostingAccount::get_account_22_3_3(DesignPoint * Machine)
{

// Get Names
   n_22_3_3[0] = "Stability Control subsystem with power supplies (Primarily Transient):	;";
   n_22_3_3[1] = "Electron Cyclotron Resonance Frequency (ECRF) Wave Plasma Control:	;";
   n_22_3_3[2] = "Neutral Particle Beam Plasma Control:	;";

// Get Costs
// ... cost credit factors ...
	double cost_credit_factors_A[4] = {0.90, 0.95, 1.00, 1.00};
	double cost_credit_factors_B[4] = {0.60, 1.00, 1.00, 1.00};
	double cost_credit_factors_C[4] = {0.90, 1.00, 1.00, 1.00};
	double cost_credit_factors_D[4] = {0.85, 0.94, 0.94, 1.00};
	
	string filedir, filepath, extension; filedir = "./OutputParts/"; extension = ".data";
    filepath = filedir + "CostingAlgorithms" + extension; ofstream fileout(filepath.c_str(), ios::app);
 
// ... Electron Cyclotron Resonance Frequency (ECRF) Wave Plasma Control
   c_22_3_3[1] = 0.0*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1]; // ??? TBD
   fileout << "c_22_3_3[1] = 0.0 \n";

// ... Neutral Particle Beam Plasma Control
    c_22_3_3[2] = 0.0*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1]; // ??? TBD
   fileout << "c_22_3_3[2] = 0.0 \n\n";

// Top Level Cost
   c_22_3_3[0] = 0.0;
   for(int i=1; i<3; i++) c_22_3_3[0] = c_22_3_3[0] + c_22_3_3[i];
} // eof


// ===============================================================================================
// *** *** Sub Sub Account 22.3.4 - Plasma Fueling and Constituent Control

void CostingAccount::get_account_22_3_4(DesignPoint * Machine)
{

// Get Names
   n_22_3_4[0] = "Plasma Fueling and Constituent Control:	;";
   n_22_3_4[1] = "Pellet Injection Fueling and Constituent Control:	;";
   n_22_3_4[2] = "Neutral (Particle) Beam Injection (NBI) Fueling and Constituent Control:	;";

// Get Costs
// ... cost credit factors ...
	double cost_credit_factors_A[4] = {0.90, 0.95, 1.00, 1.00};
	double cost_credit_factors_B[4] = {0.60, 1.00, 1.00, 1.00};
	double cost_credit_factors_C[4] = {0.90, 1.00, 1.00, 1.00};
	double cost_credit_factors_D[4] = {0.85, 0.94, 0.94, 1.00};
	
	string filedir, filepath, extension; filedir = "./OutputParts/"; extension = ".data";
    filepath = filedir + "CostingAlgorithms" + extension; ofstream fileout(filepath.c_str(), ios::app);
 
// ... Electron Cyclotron Resonance Frequency (ECRF) Wave Plasma Control
   c_22_3_4[1] = 0.0*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1]; // ??? TBD
   fileout << "c_22_3_4[1] = 0.0 \n";

// ... Neutral Particle Beam Plasma Control
   c_22_3_4[2] = 0.0*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1]; // ??? TBD
   fileout << "c_22_3_4[2] = 0.0 \n";

// Top Level Cost
   for(int i=1; i<3; i++) c_22_3_4[0] = c_22_3_4[0] + c_22_3_4[i];
   // Les: use # of beams*unit cost, not 16M$
   c_22_3_4[0] = 16.0e6*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1]; // need documentation
   fileout << "c_22_3_4[0] = 16.0e6 \n\n"; 
} // eof


// ===============================================================================================
// *** *** Sub Account 22.4 - Vacuum, Power Core

void CostingAccount::get_account_22_4(
		DesignPoint *Machine, 		Part (*VacuumVessel)[4],		Part *MPort,   
		Part (*Duct)[3], 			Part (*VacuumVesselDCLL)[4])
{
// Get Names
   n_22_4[0] = "Vacuum, Power Core:	;";
   n_22_4[1] = "Vacuum Vessel:	;";
   n_22_4[2] = "Helium Liquefier-Refrigerators:	;";
   n_22_4[3] = "Primary Vacuum Pumps (cryocondensation, cryosorption, cryodiffusion, and/or turbo-molecular):	;";
   n_22_4[4] = "Roughing or Backing Pumps:	;";
   n_22_4[5] = "Vacuum Pumping Ducts (vac duct shielding in 22.01.06):	;";
   n_22_4[6] = "Plumbing, Cryogenic:	;";

// Get Costs
	double cost_credit_factors_A[4] = {0.90, 0.95, 1.00, 1.00};
	double cost_credit_factors_B[4] = {0.60, 1.00, 1.00, 1.00};
	double cost_credit_factors_C[4] = {0.90, 1.00, 1.00, 1.00};
	double cost_credit_factors_D[4] = {0.85, 0.94, 0.94, 1.00};   
	
	string filedir, filepath, extension; filedir = "./OutputParts/"; extension = ".data";
    filepath = filedir + "CostingAlgorithms" + extension; ofstream fileout(filepath.c_str(), ios::app);
 
// ... Vacuum Vessel Costs ...
double cVV;
if (blanketmode == "dcll") { 
	   cVV = (*VacuumVesselDCLL)[0].cost() + (*VacuumVesselDCLL)[1].cost() +
			 (*VacuumVesselDCLL)[2].cost() + (*VacuumVesselDCLL)[3].cost(); }
else { cVV = (*VacuumVessel)[0].cost() + (*VacuumVessel)[1].cost(); } // VV IB+OB, 1/16th, Cost.cpp ~118
	double cMP   = (*MPort).cost();      	  // maintenance port cost, Cost.cpp ~232
	double cDuct = (*Duct)[0].cost() +   	  // bottom
				   (*Duct)[1].cost() +   	  // top
			   2.0*(*Duct)[3].cost();    	  // 2 sides, Cost.cpp ~242

// VV Vacuum Vessel Mass...(just print out for now)
double VV_mass_IB, VV_mass_OB, VV_mass_Top, VV_mass_Bot, VV_mass_total;
if (blanketmode == "dcll") { 
	VV_mass_IB  = (*VacuumVesselDCLL)[0].mass()*16.0;  // ~k kg
	VV_mass_OB  = (*VacuumVesselDCLL)[1].mass()*16.0;  // ~k kg
	VV_mass_Top = (*VacuumVesselDCLL)[2].mass()*16.0;  // ~99k kg
	VV_mass_Bot = (*VacuumVesselDCLL)[3].mass()*16.0;  // ~k kg	
	VV_mass_total = VV_mass_IB + VV_mass_OB + VV_mass_Top + VV_mass_Bot; } // ~807k kg
else {
	VV_mass_IB  = (*VacuumVessel)[0].mass()*16.0;  // ~975k kg
	VV_mass_OB  = (*VacuumVessel)[1].mass()*16.0;  // ~528k kg
	VV_mass_total = VV_mass_IB + VV_mass_OB; }
	double MP_mass   = (*MPort).mass()*16.0;
	double Duct_mass = ((*Duct)[0].mass() + (*Duct)[1].mass() + 2.0*(*Duct)[3].mass())*16.0;
	
//cout << "VV mass IB (tonne) = " << VV_mass_IB/1000. << "\n";
//cout << "VV mass OB (tonne) = " << VV_mass_OB/1000. << "\n";
//cout << "VV mass IB+OB (tonne) = " << (VV_mass_IB + VV_mass_OB)/1000. << "\n"; // 1504 tonnes
//cout << "VV ports and ducts = " << (MP_mass + Duct_mass)/1000. << "\n";

// ... total cost of the vacuum vessel, maintenance port and the upper vacuum duct
// (There are 16 maintenance ports on the VV), 1 tonne = 1000 kg
// should be = $43.44/kg x mass VV incl all ports and doors + shielding unit cost x mass
   c_22_4[1] = (cVV + cMP)*16.0*inflation(yearOrig, yearNew);
   fileout << "c_22_4[1] = (cVV + cMP)*16.0 \n";
//cout << c_22_4[1] << "\n";

// ... Helium Liquefier-Refrigerators ...
   c_22_4[2] = 15.0e6*inflation(yearOrig, yearNew); // need documentation
   fileout << "c_22_4[2] = 15.0e6 \n";

// ... Primary Vacuum Pumps (cryocondensation, cryosorption, cryodiffusion, and/or turbo-molecular) ...
   c_22_4[3] = 0.0*inflation(yearOrig, yearNew); // ??? TBD
   fileout << "c_22_4[3] = 0.0 \n";

// ... Roughing or Backing Pumps ...
   c_22_4[4] = 0.0*inflation(yearOrig, yearNew); // ??? TBD
   fileout << "c_22_4[4] = 0.0 \n";

// ... Vacuum Pumping Ducts (vac duct shielding in 22.01.06) ...
// should be = 28.07 M$/kg x mass of pumping ducts + shielding unit cost x mass
   c_22_4[5] = cDuct*16.0*inflation(yearOrig, yearNew); // there are 16 vacuum pumping ducts
   fileout << "c_22_4[5] = cDuct*16.0 \n";

// ... Plumbing, Cryogenic ...
   c_22_4[6] = 0.0*inflation(yearOrig, yearNew); // ??? TBD
   fileout << "c_22_4[6] = 0.0 \n";
if (blanketmode == "dcll") fileout << "	cVV = (*VacuumVesselDCLL)[0].cost() + (*VacuumVesselDCLL)[1].cost() + (*VacuumVesselDCLL)[2].cost() + (*VacuumVesselDCLL)[3].cost() \n"; 
else fileout << "	cVV = (*VacuumVessel)[0].cost() + (*VacuumVessel)[1].cost() \n"; 
   fileout << "	cMP   = (*MPort).cost() \n";
   fileout << "	cDuct = (*Duct)[0].cost() + (*Duct)[1].cost() + 2.0*(*Duct)[3].cost() \n\n";

// Top Level Cost
   c_22_4[0] = 0.0;
   for(int i=1; i<7; i++) c_22_4[0] = c_22_4[0] + c_22_4[i];
} // eof


// ===============================================================================================
// *** *** Sub Account 22.5 Primary Structure and Support, Power Core
// See ~62 DP.cpp, vol_reactor_bldg => gives ~141,339 m^3
void CostingAccount::get_account_22_5(DesignPoint *Machine) {

// Get Names
   n_22_5[0] = "Primary Structure and Support, Power Core:	;";
   n_22_5[1] = "Carry-Through Structure:	;";
   n_22_5[2] = "Structural Pedestal:	;";
   n_22_5[3] = "Equipment Support Structure:	;";

// Get Costs
	double cost_credit_factors_A[4] = {0.90, 0.95, 1.00, 1.00};
	double cost_credit_factors_B[4] = {0.60, 1.00, 1.00, 1.00};
	double cost_credit_factors_C[4] = {0.90, 1.00, 1.00, 1.00};
	double cost_credit_factors_D[4] = {0.85, 0.94, 0.94, 1.00};    
	
	string filedir, filepath, extension; filedir = "./OutputParts/"; extension = ".data";
    filepath = filedir + "CostingAlgorithms" + extension; ofstream fileout(filepath.c_str(), ios::app);
 
// ... Carry-Through Structure ...placeholder until better defined
   c_22_5[1] = 0.0*inflation(yearOrig, yearNew); // ??? TBD
   fileout << "c_22_5[1] = 0.0 \n";

// ... Structural Pedestal - supports the entire power core, placeholder
   c_22_5[2] = 0.0*inflation(yearOrig, yearNew); // ??? TBD
   fileout << "c_22_5[2] = 0.0 \n";

// ... Equipment Support Structure - supports ancillary elements, placeholder
   c_22_5[3] = 0.0*inflation(yearOrig, yearNew); // ??? TBD
   fileout << "c_22_5[3] = 0.0 \n";

// Top Level Cost - Support Structure
// Laila - AT was 15-20% of FPC volume for support structure cost
// SHOULD use mass*unit material cost. Material is 304 SS large welded.  Using volumes is unclear - solid or void?
// LW - for AT $0.200M * volume of the primary structure (outside dimensions) 
// Aries-AT: struc vol ~150 m3, so cost ~$29M
// Xueren claculated from AT: FPC drained weigth 4.0e6 kg. Support for FPC 320e3 kg
// Support for TF coils 63e3 kg, center solenoid 30e3 kg. Total = 413e3 kg.

	//c_22_5[0] = 0.0; // placeholder for adding up
	//for(int i=1; i<4; i++) c_22_5[0] = c_22_5[0] + c_22_5[i]; // placeholder


	//double Power_blanket = (*Machine).P_pump_blanket(); // test
	double fusion_power_core_vol    = (*Machine).fpc_vol(); // calc in DP.cpp ~780
	double support_structure_volume = 0.20*fusion_power_core_vol; // 20% of FPC      
   
  c_22_5[0] = support_structure_volume*0.20e6*inflation(yearOrig, yearNew); // costing 0.20 M$/m3
  fileout << "c_22_5[0] = support_structure_volume*0.20e6 \n";
  fileout << "	support_structure_volume = 0.20*fpc_vol \n";
  fileout << "	fpc_vol = ((*FWInboard).volume() + (*FWOutboard).volume() + (*BlanketInboard).volume() + (*BlanketOutboard).volume() + (*BlanketII).volume() + (*RepHTShield)[0].volume() + (*RepHTShield)[1].volume() + 1.1*((*HTShield)[0].volume() + (*HTShield)[1].volume()) + (*VacuumVessel)[0].volume() + (*VacuumVessel)[1].volume() + DivVol + (*TFCoil).volume() + PoloFCVolume + PoloFCVolumeSpares) *16.0 \n";
  fileout << "	DivVol:             for(int i=0; i<6; i++)  { DivVol = DivVol + (*Div)[i].volume(); } \n";
  fileout << "	PoloFCVolume:       for(int i=0; i<36; i++) { PoloFCVolume = PoloFCVolume + (*PoloFCoil)[i].volume() } \n";
  fileout << "	PoloFCVolumeSpares: for(int i=4; i<18; i++) { PoloFCVolumeSpares = PoloFCVolumeSpares + (*PoloFCoil)[i].volume() } \n\n";
  
//cout << "fpc_vol (CA.cpp) = " << fusion_power_core_vol << "\n";
//cout << "support_structure_volume (CA.cpp) = " << support_structure_volume << "\n";
//cout << "C22.5 (CA.cpp) = " << c_22_5[0] << "\n"; // ~31 M$	
} // eof


// ===============================================================================================
// *** *** Sub Account 22.6 Main Heat Transfer and Transport (MHTT)
// i.e. everything in VV

void CostingAccount::get_account_22_6(DesignPoint * Machine)
{

// Get Names
   n_22_6[0] = "Main Heat Transfer and Transport:	;";
   n_22_6[1] = "Primary (PbLi) Heat Transfer Loop: servicing FW, blanket & HT shield:	;"; // was "Primary (Water or LM) Heat Transfer Loop (Servicing FW, Blanket, and HT shield)"
   n_22_6[2] = "Primary (Helium) Heat Transfer Loop: servicing FW, blanket, HT shield, divertor & Nb IHX):	;";
   n_22_6[3] = "Limiter or Divertor Primary Heat Transfer Loop (may tie into same IHX, SG):	;";
   n_22_6[4] = "Intermediate Heat Transfer Loop (Sodium or Helium):	;";

// Get Costs
	double cost_credit_factors_A[4] = {0.90, 0.95, 1.00, 1.00};
	double cost_credit_factors_B[4] = {0.60, 1.00, 1.00, 1.00};
	double cost_credit_factors_C[4] = {0.90, 1.00, 1.00, 1.00};
	double cost_credit_factors_D[4] = {0.85, 0.94, 0.94, 1.00};    
	double Pth = (*Machine).thermal_power();

	string filedir, filepath, extension; filedir = "./OutputParts/"; extension = ".data";
    filepath = filedir + "CostingAlgorithms" + extension; ofstream fileout(filepath.c_str(), ios::app);
 
// LCC Costs updated 12/8/10
// If a dual-coolant blanket DCLL is used, both helium and LM primary systems will be used
// SiC also uses He, but only in divertors
// Do not include the helium gas since it is added at startup - this is costed in account 27

// ... NEW Dual-Coolant algorithm by LW, Laila, 3/28/11 (broke up into 22.6.1 and .2)
// Heat load fractions:	SiC blanket:  80% PbLi, 20% He
// 						DCLL blanket: 50% PbLi, 50% He
double f_PbLi, f_He;
if (blanketmode == "dcll") { f_PbLi = 0.5;  f_He = 0.5; }// should be input parameters
else 					   { f_PbLi = 0.8;  f_He = 0.2; }

// ... Primary (PbLi) Heat Transfer Loop: servicing FW, blanket & HT shield:
	c_22_6[1] = 125.0e6*pow(Pth*f_PbLi/2000, 0.55) + 0.01e6*Pth*f_PbLi;
	fileout << "c_22_6[1] = 125.0e6*pow(Pth*f_PbLi/2000, 0.55) + 0.01e6*Pth*f_PbLi \n";

// ... Primary (Helium) Heat Transfer Loop: servicing FW, blanket, HT shield, divertor & Nb IHX):
// LCC does this need Pth_div?
	c_22_6[2] = 110.0e6*pow(Pth*f_He/2000, 0.55);
	fileout << "c_22_6[2] = 110.0e6*pow(Pth*f_He/2000, 0.55) \n";


// old... Primary (water or liquid metals) Heat Transfer Loop (Servicing first wall, blanket, and HT shield) ...
//   For liquid metal coolant, includes Nb IHX adder
	//c_22_6[1] = (125.0e6*pow(Pth/2000.0, 0.55)+0.01e6*Pth)*inflation(yearOrig, yearNew);
	//fileout << "c_22_6[1] = (125.0e6*pow(Pth/2000.0, 0.55)+0.01e6*Pth) \n";
     
// old... For water or organic coolant
//  c_22_6[1] = 50.0e6*pow(Pth/2000.0, 0.55)*inflation(yearOrig, yearNew);

// old... Primary (Helium) Heat Transfer Loop  (Servicing first wall, blanket, and HT shield) (if used) ...
	//c_22_6[2] = 110.0e6*pow(Pth/2000.0, 0.55)*inflation(yearOrig, yearNew); // Helium
	//fileout << "c_22_6[2] = 110.0e6*pow(Pth/2000.0, 0.55) \n";


// ... Limiter or Divertor Primary Heat Transfer Loop (May tie into same IHX, SG) ...
	//c_22_6[3] = 125.0e6*pow(Pth/2000.0, 0.55)*inflation(yearOrig, yearNew); // Liquid Metal or helium
	//fileout << "c_22_6[3] = 125.0e6*pow(Pth/2000.0, 0.55) \n";

    c_22_6[3] = 0.0; // turned off in this model
	fileout << "c_22_6[3] = 0.0 \n";

// ... Intermediate Heat Transfer Loop (IHX) ...
	//c_22_6[4] = 50.0e6*pow(Pth/2000.0, 0.55)*inflation(yearOrig, yearNew); // Sodium or Helium
	//fileout << "c_22_6[4] = 50.0e6*pow(Pth/2000.0, 0.55) \n";

    c_22_6[4] = 0.0; // turned off in this model
    fileout << "c_22_6[4] = 0.0 \n";
if (blanketmode == "dcll") { fileout << "	f_PbLi = 0.5 \n";	fileout << "	f_He   = 0.5 \n\n"; }
else 					   { fileout << "	f_PbLi = 0.8 \n";	fileout << "	f_He   = 0.2 \n\n";	}
	
// Top Level Cost
	c_22_6[0] = 0.0;
	for(int i=1; i<5; i++) c_22_6[0] = c_22_6[0] + c_22_6[i];
} // eof



// ===============================================================================================
// *** *** Sub Account 22.7 Radioactive Materials Treatment and Management (off-line)

void CostingAccount::get_account_22_7(DesignPoint * Machine)
{

// Get Names
   n_22_7[0] = "Radioactive Materials Treatment and Management (off-line):	;";
   n_22_7[1] = "Liquid Materials Processing Equipment  (including final detritiation):	;";
   n_22_7[2] = "Gaseous Materials Processing Equipment (including final detritiation):	;";
   n_22_7[3] = "Solid Materials Processing Equipment   (including detritiation):	;";

// Get Costs
	double cost_credit_factors_A[4] = {0.90, 0.95, 1.00, 1.00};
	double cost_credit_factors_B[4] = {0.60, 1.00, 1.00, 1.00};
	double cost_credit_factors_C[4] = {0.90, 1.00, 1.00, 1.00};
	double cost_credit_factors_D[4] = {0.85, 0.94, 0.94, 1.00};  
	double Pfusion = (*Machine).fusion_power(); // fusion power

	string filedir, filepath, extension; filedir = "./OutputParts/"; extension = ".data";
    filepath = filedir + "CostingAlgorithms" + extension; ofstream fileout(filepath.c_str(), ios::app);
 
// ... Liquid Materials Processing Equipment (including final detritiation)
	c_22_7[1] = 0.0*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1]; // ??? TBD
	fileout << "c_22_7[1] = 0.0 \n";

// ... Gaseous Materials Processing Equipment (including final detritiation)
	c_22_7[2] = 0.0*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1]; // ??? TBD
	fileout << "c_22_7[2] = 0.0 \n";

// ... Solid Materials Processing Equipment (including detrititation)
	c_22_7[3] = 0.0*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1]; // ??? TBD
	fileout << "c_22_7[3] = 0.0 \n";

// Top Level Cost
	c_22_7[0] = 15.0e6*pow(Pfusion/1758.0, 0.8)*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1]; 
	// (normalized to ARIES-AT )
	fileout << "c_22_7[0] = 15.0e6*pow(Pfusion/1758.0, 0.8) \n\n";
} // eof



// ===============================================================================================
// *** *** Sub Account 22.8 Fuel Handling and Storage

void CostingAccount::get_account_22_8(DesignPoint * Machine)
{

// Get Names
   n_22_8[0] = "Fuel Handling and Storage (on-line):	;";
   n_22_8[1] = "Chamber Exhaust Gas Handling and Processing Equipment:	;";
   n_22_8[2] = "Purge and Cover Gas Handling Processing Equipment:	;";
   n_22_8[3] = "Primary Coolant Stream Handling and Processing Equip. (incl. on-line adj. of Li enrichment):	;";
   n_22_8[4] = "Other Liquid and Gaseous Coolant Stream Handling and Processing Equipment:	;";
   n_22_8[5] = "Purification and Isotope Separation Equipment:	;";
   n_22_8[6] = "Tritium, Deuterium, and DT Storage Equipment:	;";
   n_22_8[7] = "Atmospheric Tritium Recovery Equipment (Power Core, Hot Cell, Fuel Handling Bldgs.):	;";

// Get Costs
	double cost_credit_factors_A[4] = {0.90, 0.95, 1.00, 1.00};
	double cost_credit_factors_B[4] = {0.60, 1.00, 1.00, 1.00};
	double cost_credit_factors_C[4] = {0.90, 1.00, 1.00, 1.00};
	double cost_credit_factors_D[4] = {0.85, 0.94, 0.94, 1.00};   
	double Pfusion = (*Machine).fusion_power(); // fusion power

	string filedir, filepath, extension; filedir = "./OutputParts/"; extension = ".data";
    filepath = filedir + "CostingAlgorithms" + extension; ofstream fileout(filepath.c_str(), ios::app);
 
// ... Chamber Exhaust Gas Handling and Processing  Equipment
	c_22_8[1] = 0.0*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1]; // ??? TBD
	fileout << "c_22_8[1] = 0.0 \n";

// ... Purge and Cover Gas Handling Processing Equipment
	c_22_8[2] = 0.0*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1]; // ??? TBD
	fileout << "c_22_8[2] = 0.0 \n";

// ... Primary Coolant Stream Handling and Processing Equipment (including on-line adjustment of Li enrichment)
	c_22_8[3] = 0.0*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1]; // ??? TBD
	fileout << "c_22_8[3] = 0.0 \n";

// ... Other Liquid and Gaseous Coolant Stream Handling and Processing Equipment
	c_22_8[4] = 0.0*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1]; // ??? TBD
	fileout << "c_22_8[4] = 0.0 \n";

// ... Purification and Isotope Separation Equipment
	c_22_8[5] = 0.0*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1]; // ??? TBD
	fileout << "c_22_8[5] = 0.0 \n";

// ... Tritium, Deuterium, and DT Storage Equipment
	c_22_8[6] = 0.0*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1]; // ??? TBD
	fileout << "c_22_8[6] = 0.0 \n";

// ... Atmospheric Tritium Recovery Equipment (Power Core, Hot Cell, Fuel Handling Buildings)
	c_22_8[7] = 0.0*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1]; // ??? TBD
	fileout << "c_22_8[7] = 0.0 \n";

// Top Level Cost
	c_22_8[0] = 70.0e6*pow(Pfusion/1758.0, 0.8)*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1]; 
	// normalized to ARIES-AT
	fileout << "c_22_8[0] = 70.0e6*pow(Pfusion/1758.0, 0.8) \n\n";
} // eof



// ===============================================================================================
// *** *** Sub Account 22.9 Maintenance Equipment

void CostingAccount::get_account_22_9(DesignPoint * Machine)
{

// Get Names
   n_22_9[0] = "Maintenance Equipment:	;";
   n_22_9[1] = "Power Core Maintenance Equipment:	;";
   n_22_9[2] = "Hot Cell Maintenance Equipment:	;";
   n_22_9[3] = "Fuel Handling Maintenace Equipment:	;";
   n_22_9[4] = "Other Plant Equipment Maintenance Equipment:	;";
   
// Get Costs
	double cost_credit_factors_A[4] = {0.90, 0.95, 1.00, 1.00};
	double cost_credit_factors_B[4] = {0.60, 1.00, 1.00, 1.00};
	double cost_credit_factors_C[4] = {0.90, 1.00, 1.00, 1.00};
	double cost_credit_factors_D[4] = {0.85, 0.94, 0.94, 1.00};    
	double Pe = (*Machine).net_electrical_power(); // Net Electric Power

	string filedir, filepath, extension; filedir = "./OutputParts/"; extension = ".data";
    filepath = filedir + "CostingAlgorithms" + extension; ofstream fileout(filepath.c_str(), ios::app);
 
// ... Power Core Maintenance Equipment
   c_22_9[1] = 0.0*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1]; // ??? TBD
   fileout << "c_22_9[1] = 0.0 \n";

// ... Hot Cell Maintenance Equipment
   c_22_9[2] = 0.0*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1]; // ??? TBD
   fileout << "c_22_9[2] = 0.0 \n";

// ... Fuel Handling Maintennace Equipment
   c_22_9[3] = 0.0*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1]; // ??? TBD
   fileout << "c_22_9[3] = 0.0 \n";

// ... Other Plant Equipment Maintenance Equipment
   c_22_9[4] = 0.0*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1]; // ??? TBD
   fileout << "c_22_9[4] = 0.0 \n";

// Top Level Cost
   c_22_9[0] = 100.0e6*pow(Pe/1000.0, 0.8)*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1];  
   fileout << "c_22_9[0] = 100.0e6*pow(Pe/1000.0, 0.8) \n\n";
   // normalized to ARIES-AT
} // eof



// ===============================================================================================
// *** *** Sub Account 22.10 Instrumentation and Control

void CostingAccount::get_account_22_10(DesignPoint * Machine)
{

// Get Names
   n_22_10[0] = "Instrumentation and Control:	;";
   n_22_10[1] = "Power Core Instrumentation & Control Equipment:	;";
   n_22_10[2] = "Radiation Monitoring Equipment:	;";
   n_22_10[3] = "Isolated Indicating & Recording Equipment:	;";
   n_22_10[4] = "Data Acquisition and Recording Equipment:	;";
   n_22_10[5] = "Communications Equipment:	;";
   
// Get Costs
	double cost_credit_factors_A[4] = {0.90, 0.95, 1.00, 1.00};
	double cost_credit_factors_B[4] = {0.60, 1.00, 1.00, 1.00};
	double cost_credit_factors_C[4] = {0.90, 1.00, 1.00, 1.00};
	double cost_credit_factors_D[4] = {0.85, 0.94, 0.94, 1.00};    

	string filedir, filepath, extension; filedir = "./OutputParts/"; extension = ".data";
    filepath = filedir + "CostingAlgorithms" + extension; ofstream fileout(filepath.c_str(), ios::app);
 
// ... Power Core Instrumentation & Control Equipment
   c_22_10[1] = 0.0*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1]; // ??? TBD
   fileout << "c_22_10[1] = 0.0 \n";

// ... Radiation Monitoring Equipment
   c_22_10[2] = 0.0*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1]; // ??? TBD
   fileout << "c_22_10[2] = 0.0 \n";

// ... Isolated Indicating & Recording Equipment
   c_22_10[3] = 0.0*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1]; // ??? TBD
   fileout << "c_22_10[3] = 0.0 \n";

// ... Data Acquisition and Recording Equipment
   c_22_10[4] = 0.0*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1]; // ??? TBD
   fileout << "c_22_10[4] = 0.0 \n";

// ... Communications Equipment
   c_22_10[5] = 0.0*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1]; // ??? TBD
   fileout << "c_22_10[5] = 0.0 \n";

// Top Level Cost
   c_22_10[0] = 60.0e6*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1]; // constant
   fileout << "c_22_10[0] = 60.0e6 \n\n";
} // eof



// ===============================================================================================
// *** *** Sub Account 22.11 Other Power Core Equipment

void CostingAccount::get_account_22_11(DesignPoint * Machine)
{

// Get Names
   n_22_11[0] = "Other Power Core Equipment:	;";
   n_22_11[1] = "Special Heating Equipment:	;";
   n_22_11[2] = "Special Cooling Equipment (low temp shield, vacuum vessel, other structures):	;";
   n_22_11[3] = "Coolant Receiving, Storage and Makeup Equipment:	;";
   n_22_11[4] = "Gas Systems Equipment:	;";
   n_22_11[5] = "Inert Atmosphere Equipment (Power Core, Hot Cell, and Fuel Handling Buildings):	;";

// Get Costs
	double cost_credit_factors_A[4] = {0.90, 0.95, 1.00, 1.00};
	double cost_credit_factors_B[4] = {0.60, 1.00, 1.00, 1.00};
	double cost_credit_factors_C[4] = {0.90, 1.00, 1.00, 1.00};
	double cost_credit_factors_D[4] = {0.85, 0.94, 0.94, 1.00};    
   	double Pe = (*Machine).net_electrical_power();

	string filedir, filepath, extension; filedir = "./OutputParts/"; extension = ".data";
    filepath = filedir + "CostingAlgorithms" + extension; ofstream fileout(filepath.c_str(), ios::app);
 
// ... Special Heating Equipment
   c_22_11[1] = 0.0*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1]; // ??? TBD
   fileout << "c_22_11[1] = 0.0 \n";

// ... Special Cooling Equipment (low temp shield, vacuum vessel, other structures)
   c_22_11[2] = 0.0*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1]; // ??? TBD
   fileout << "c_22_11[2] = 0.0 \n";

// ... Coolant Receiving, Storage and Makeup Equipment
   c_22_11[3] = 0.0*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1]; // ??? TBD
   fileout << "c_22_11[3] = 0.0 \n";

// ... Gas Systems Equipment
   c_22_11[4] = 0.0*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1]; // ??? TBD
   fileout << "c_22_11[4] = 0.0 \n";

// ... Inert Atmosphere Equipment (Power Core,Hot Cell, and Fuel Handling Buildings)
   c_22_11[5] = 0.0*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1]; // ??? TBD
   fileout << "c_22_11[5] = 0.0 \n";

// Top Level Cost
   c_22_11[0] = 8.0e6*pow(Pe/1000.0, 0.8)*inflation(yearOrig, yearNew)*cost_credit_factors_D[lsa-1]; 
   fileout << "c_22_11[0] = 8.0e6*pow(Pe/1000.0, 0.8) \n\n";
} // eof


// ===============================================================================================
// *** Account 23 Turbine - Generator Equipment
// Being developed by General Atomics (Ken Shultz), timeframe???  Moreso by L. Waganer

void CostingAccount::get_account_23(DesignPoint * Machine)
{

// Get Names
   n_23[0] = "Turbine - Generator Equipment:	;";
   n_23[1] = "Turbine - Generators:	;";
   n_23[2] = "Main Steam or other Main Heat Transfer Fluid System:	;";
   n_23[3] = "Condensing or Heat Sink Heat Exchanger Systems:	;";
   n_23[4] = "Feedwater Heating or Heat Recovery System:	;";
   n_23[5] = "Other Turbine Plant Equipment:	;";
   n_23[6] = "Turbine Plant Instrumentation & Control:	;";
   n_23[7] = "Spare Parts Allowance (include in individual costs):	;";
   n_23[8] = "Contingency Allowance (include in Acct 96):	;";

// Get Costs
    double cost_credit_factors[4] = {1.00, 1.00, 1.00, 1.00};
	string filedir, filepath, extension; filedir = "./OutputParts/"; extension = ".data";
    filepath = filedir + "CostingAlgorithms" + extension; ofstream fileout(filepath.c_str(), ios::app);
 
// ... Turbine - Generators
   // $333M for 4 turbines at 2440 MWth, 48% effic, 850C inlet T, see LW April 2011 pres
   // confirms above algorithm, do not enter here
   c_23[1] = 0.0;
   fileout << "c_23[1] = 0.0 \n";

// ... Main Steam or other Main Heat Transfer Fluid System
   c_23[2] = 0.0; // ??? TBD
   fileout << "c_23[2] = 0.0 \n";

// ... Condensing  or Heat Sink Heat Exhanger Systems
   c_23[3] = 0.0; // ??? TBD
   fileout << "c_23[3] = 0.0 \n";

// ... Feedwater Heating or Heat Recovery System
   c_23[4] = 0.0; // ??? TBD
   fileout << "c_23[4] = 0.0 \n";

// ... Other Turbine Plant Equipment
   c_23[5] = 0.0; // ??? TBD
   fileout << "c_23[5] = 0.0 \n";

// ... Turbine Plant Instrumentation & Control
   c_23[6] = 0.0; // ??? TBD
   fileout << "c_23[6] = 0.0 \n";

// ... Spare Parts Allowance (include in individual costs)
   c_23[7] = 0.0; // ??? TBD
   fileout << "c_23[7] = 0.0 \n";

// ... Contingency Allowance (include in Acct 96)
   c_23[8] = 0.0; // ??? TBD
   fileout << "c_23[8] = 0.0 \n";

// Top Level Cost
// LCC updated 12/8/10 from L. Waganer per "Algorithm Comparison RevC (112510).xls"
// c_23[0] = 350e6*pow(P_thermal/2620,0.70) // if Rankine cycle is used
   
   double Pth   	  = (*Machine).thermal_power(); // in MW
   double eta_brayton = (*Machine).gross_electrical_power()/Pth;
//cout << "eta_brayton cycle efficicncy (CA.cpp) = " << eta_brayton << "\n";
//cout << "P_thermal (CA.cpp) = " << Pth << "\n";   
   
   c_23[0] = 360.0e6*pow(Pth/2000,0.8)*(eta_brayton/0.6)*
   			 inflation(yearOrig, yearNew)*cost_credit_factors[lsa-1];
   			    			 
// Brayton cycle ~58% efficient in SiC blanket, ~44% for DCLL
   fileout << "c_23[0] = 360.0e6*pow(P_thermal/2000,0.8)*(eta_brayton/0.6) \n";
   fileout << "	eta_brayton = (*Machine).gross_electrical_power()/Pth \n\n";

// OLD double Pet = (*Machine).gross_electrical_power();
// OLD c_23[0] = 243.34e6*pow(Pet/1200.0, 0.83)*inflation(yearOrig, yearNew)*cost_credit_factors[lsa-1]; 
} // eof


// ===============================================================================================
// *** Account 24 Electric Plant Equipment

void CostingAccount::get_account_24(DesignPoint * Machine)
{

// Get Names
   n_24[0] = "Electric Plant Equipment:	;";
   n_24[1] = "Switchgear:	;";
   n_24[2] = "Station Service Equipment:	;";
   n_24[3] = "Switchboards:	;";
   n_24[4] = "Protective Equipment:	;";
   n_24[5] = "Electrical Structures and Wiring Containers:	;";
   n_24[6] = "Power and Control Wiring:	;";
   n_24[7] = "Electrical Lighting:	;";
   n_24[8] = "Spare Parts Allowance (include in individual costs):	;";
   n_24[9] = "Contingency Allowance (include in Acct 96):	;";

	string filedir, filepath, extension; filedir = "./OutputParts/"; extension = ".data";
    filepath = filedir + "CostingAlgorithms" + extension; ofstream fileout(filepath.c_str(), ios::app);
 
// ... Switchgear ...
   c_24[1] = 0.0;
   fileout << "c_24[1] = 0.0 \n";

// ... Station Service Equipment ...
   c_24[2] = 0.0;
   fileout << "c_24[2] = 0.0 \n";

// ... Switchboards ...
   c_24[3] = 0.0;
   fileout << "c_24[3] = 0.0 \n";

// ... Protective equipment ...
   c_24[4] = 0.0;
   fileout << "c_24[4] = 0.0 \n";

// ... Electrical structures and wiring containers ...
   c_24[5] = 0.0;
   fileout << "c_24[5] = 0.0 \n";

// ... Power and control wiring ...
   c_24[6] = 0.0;
   fileout << "c_24[6] = 0.0 \n";

// ... Electrical lighting ...
   c_24[7] = 0.0;
   fileout << "c_24[7] = 0.0 \n";

// ... Spare Parts Allowance (include in individual costs) ...
   c_24[8] = 0.0;
   fileout << "c_24[8] = 0.0 \n";

// ... Contingency Allowance (include in Acct 96) ...
   c_24[9] = 0.0;
   fileout << "c_24[9] = 0.0 \n";

// Top Level Cost, LCC updated 12/8/10
   double Pet = (*Machine).gross_electrical_power();
   c_24[0] = 187.0e6*pow(Pet/1200.0, 0.5)*inflation(yearOrig, yearNew);
   fileout << "c_24[0] = 187.0e6*pow(Pet/1200.0, 0.5) \n\n";
} // eof


// ===============================================================================================
// *** Account 25 Heat Rejection Equipment

void CostingAccount::get_account_25(DesignPoint * Machine)
{

// Get Names
   n_25[0] = "Heat Rejection Equipment:	;";
   n_25[1] = "Water Intake Common Facilities:	;";
   n_25[2] = "Circulating Water Systems:	;";
   n_25[3] = "Cooling Towers:	;";
   n_25[4] = "Other Heat Rejection Systems:	;";
   n_25[5] = "Spare Parts Allowance (incl. in individual costs):	;";
   n_25[6] = "Contingency Allowance (incl. in Acct 96):	;";

	string filedir, filepath, extension; filedir = "./OutputParts/"; extension = ".data";
    filepath = filedir + "CostingAlgorithms" + extension; ofstream fileout(filepath.c_str(), ios::app);
 
// ... Water Intake Common Facilities ...
   c_25[1] = 0.0;
   fileout << "c_25[1] = 0.0 \n";

// ... Circulating Water Systems ...
   c_25[2] = 0.0;
   fileout << "c_25[2] = 0.0 \n";

// ... Cooling Towers ...
   c_25[3] = 0.0;
   fileout << "c_25[3] = 0.0 \n";

// ... Other Heat Rejection Systems ...
   c_25[4] = 0.0;
   fileout << "c_25[4] = 0.0 \n";

// ... Spare Parts Allowance (include in individual costs) ...
   c_25[5] = 0.0;
   fileout << "c_25[5] = 0.0 \n";

// ... Contingency Allowance (include in Acct 96) ...
   c_25[6] = 0.0;
   fileout << "c_25[6] = 0.0 \n";

// Top Level Cost, LCC updated 12/8/10
   double Pet = (*Machine).gross_electrical_power();
   double Pth = (*Machine).thermal_power();
   c_25[0] 	  = 89.17e6*((Pth-Pet)/2300.0)*inflation(yearOrig, yearNew);
   fileout << "c_25[0] = 89.17e6*((Pth-Pet)/2300.0) \n\n";
} // eof


// ===============================================================================================
// *** Account 26 Miscelaneous Plant Equipment

void CostingAccount::get_account_26(DesignPoint * Machine)
{

// Get Names
    n_26[0] = "Miscellaneous Plant Equipment:	;";
    n_26[1] = "Transportation and Lifting Equipment:	;";
    n_26[2] = "Air and Water Service Systems:	;";
    n_26[3] = "Communications Equipment:	;";
    n_26[4] = "Furnishings and Fixtures:	;";
    n_26[5] = "Spare Parts Allowance (incl. in individual costs):	;";
    n_26[6] = "Contingency Allowance (incl. in Acct 96):	;";

	string filedir, filepath, extension; filedir = "./OutputParts/"; extension = ".data";
    filepath = filedir + "CostingAlgorithms" + extension; ofstream fileout(filepath.c_str(), ios::app);
 
// Get Costs
// ... Transportation and Lifting Equipment ...
   c_26[1] = 0.0;
   fileout << "c_26[1] = 0.0 \n";

// ... Air and Water Service Systems ...
   c_26[2] = 0.0;
   fileout << "c_26[2] = 0.0 \n";

// ... Communications Equipment ...
   c_26[3] = 0.0;
   fileout << "c_26[3] = 0.0 \n";

// ... Furnishings and Fixtures ...
   c_26[4] = 0.0;
   fileout << "c_26[4] = 0.0 \n";

// ... Spare Parts Allowance (include in individual costs) ...
   c_26[5] = 0.0;
   fileout << "c_26[5] = 0.0 \n";

// ... Contingency Allowance (include in Acct 96) ...
   c_26[6] = 0.0;
   fileout << "c_26[6] = 0.0 \n";

// Top Level Cost
   double Pet = (*Machine).gross_electrical_power();
   c_26[0] = 85.0e6*pow(Pet/1200.0, 0.6)*inflation(yearOrig, yearNew);
   fileout << "c_26[0] = 85.0e6*pow(Pet/1200.0, 0.6) \n\n";

} // eof



// ===============================================================================================
// *** Account 27 Special Materials

// These materials are "loaded just before startup" and are not included in capital costs (LW)
void CostingAccount::get_account_27(
		DesignPoint * Machine,		Part * FWInboard,			Part * FWOutboard,
		Part * BlanketInboard,		Part * BlanketOutboard,		Part * BlanketII,
		Part (*Div)[6],				Part (*RepHTShield)[2],		Part (*HTShield)[2],
		Part * BackWallInboard,		Part * BackWallOutboard,	Part * HTShieldDCLL,
        Part * SkeletonRing,		Part * Manifold)
{
// Get Names
   n_27[0] = "Special Materials:	;";
   n_27[1] = "Primary coolant (PbLi) w/ 2.5x BOP factor:	;";
   n_27[2] = "Divertor coolant (Helium) incl. storage & pressurization subsystem:	;";
   n_27[3] = "Intermediate Loop Coolant:	;";
   n_27[4] = "Turbine cycle Working Fluids:	;";
   n_27[5] = "Other Special Materials:	;";
   n_27[6] = "Argon Power Core Cover Gas:	;";

	string filedir, filepath, extension; filedir = "./OutputParts/"; extension = ".data";
    filepath = filedir + "CostingAlgorithms" + extension; ofstream fileout(filepath.c_str(), ios::app);
 
// Account for all PbLi
// 1. reactor liquid-metal coolant/breeder for FW+blanket, for 1/16th section in kg
double m_LM;
if (blanketmode == "dcll") {
	m_LM = (*BlanketInboard).liquid_metal_mass() +
           (*BlanketOutboard).liquid_metal_mass(); } // 1/16th section
else {
	m_LM = (*FWInboard).liquid_metal_mass() +
           (*FWOutboard).liquid_metal_mass() +
           (*BlanketInboard).liquid_metal_mass() +
           (*BlanketOutboard).liquid_metal_mass() +
           (*BlanketII).liquid_metal_mass(); } // 1/16th section                

// 2. liquid mass of divertor plates (div), for 1/16th section in kg
// LCC should be 0 for both blankets since He cools divertor
    double m_LM_div = 0.0; // placeholder
    for(int i=0; i<6; i++) m_LM_div = m_LM_div + (*Div)[i].liquid_metal_mass();

// 3. liquid mass of replaceable heat transfer shield (rhts), for 1/16th section in kg
    double m_LM_rhts = 0.0;
    for(int i=0; i<2; i++) m_LM_rhts = m_LM_rhts + (*RepHTShield)[i].liquid_metal_mass();

// 4. liquid mass of heat transfer shield (hts), for 1/16th section in kg
    double m_LM_hts = 0.0;
if (manifold == "on") {
	for(int i=0; i<2; i++) m_LM_hts = m_LM_hts + (*HTShield)[i].liquid_metal_mass();
    m_LM_hts = m_LM_hts + (*Manifold).liquid_metal_mass(); 
//cout << "m_LM_manifold  = " << (*Manifold).liquid_metal_mass() << "\n"; 
}
else
	for(int i=0; i<2; i++) m_LM_hts = m_LM_hts + (*HTShield)[i].liquid_metal_mass();
   
// 5. Total liquid metal mass (*2.5 BOP, *16 segments, /1000 kg/tonne convert here)
// "2.5 x power core vol = total coolant vol", L. Waganer, Total PbLi mass = mass of PbLi in FPC x 2.5
    double BOP = 2.5; // 2.5x factor for balance-of-plant including piping
    double m_LM_total = BOP*(m_LM + m_LM_div + m_LM_rhts + m_LM_hts)*16.0/1000.0;  // total LM mass in tonnes for all, ~6312

//cout << "m_LM_div  = " << m_LM_div << "\n"; 
//cout << "m_LM_rhts = " << m_LM_rhts << "\n";
//cout << "m_LM_hts  = " << m_LM_hts << "\n"; 
//cout << "m_LM      = " << m_LM << "\n"; 


// ... Primary coolant costing (AT was PbLi-only, 5269 tonnes total, 2108 in FWBS)
// Li-17,Pb-83, liquid, 90% enriched, L. Waganer
   double PbLi_cost = (*FWOutboard).cost_unit_mass("PbLi"); // dummy 'FWOutboard' just to get cost for PbLi
   c_27[1] = (PbLi_cost/1000.0)*m_LM_total*1.0e6*inflation(yearOrig, yearNew);  // BOP removed from here, already above
   fileout << "c_27[1] = (PbLi_cost/1000.0)*m_LM_total*1.0e6 \n";


// ... Divertor Coolant 
// AT div coolant was in primary, now we have He-cooled divertor ONLY ...
// Need to use volume of He in div, not m_LM_div from above.

// NEW - Read in penetration shielding thickness (% of HT shield thickness) from powerflow.data input file
	ifstream fin_ps;  fin_ps.open("InputData/powerflow.data");
	fin_ps.width(10); fin_ps.precision(2);
	fin_ps.setf(ios_base::uppercase, ios_base::scientific);
	int itxt_ps = 57; int inum_ps = 13; int iskip_ps = itxt_ps + inum_ps;
    double pen_shielding; fin_ps.seekg(43*iskip_ps + itxt_ps +1); fin_ps >> pen_shielding;
	fin_ps.close();
	
// Main Heat Transfer and Transport (MHTT) volume for Helium costing (NOT for SiC module, which is PbLi only)
double mhtt_vol, he_vol_in_mhtt; // i.e. everything in VV
if (blanketmode == "dcll") { mhtt_vol = (
   		(*FWInboard).volume() 		+ (*FWOutboard).volume() +
		(*BlanketInboard).volume() 	+ (*BlanketOutboard).volume() +
		(*BackWallInboard).volume() + (*BackWallOutboard).volume() +
		(*SkeletonRing).volume() 	+ (*RepHTShield)[0].volume() +
		(*RepHTShield)[1].volume() 	+ pen_shielding*((*HTShieldDCLL).volume()) )*16.0*BOP; }
else { mhtt_vol = (
   		(*FWInboard).volume() 		+ (*FWOutboard).volume() +
		(*BlanketInboard).volume() 	+ (*BlanketOutboard).volume() +
		(*BlanketII).volume() 		+ (*RepHTShield)[0].volume() +
		(*RepHTShield)[1].volume() 	+
		pen_shielding*((*HTShield)[0].volume() + (*HTShield)[1].volume()) )*16.0*BOP; }
//cout << mhtt_vol << "\n"; // ~1100 kg

// LW: Calculate the volume in the power core plumbing and then multiple by a factor 
// of 2.5 for BOP including piping to determine the total MHTT volume.


// Divertor volume for He calculations (both blanket designs)
	double div_vol = 0.0;
    for(int i=0; i<6; i++) div_vol = div_vol + (*Div)[i].volume(); // 1/16th section, believe this is shell vol
//cout << "(*Div)[0].volume() = " << 16.0*(*Div)[0].volume() << "\n"; // Div #1
//cout << "divertor volume = " << div_vol*16.0 << "\n";


// He ~$70/kg, 0.1786 kg/m3 at STP, 8.231 at 700C 15 MPa, rho_ave = 4.215 kg/m3. See materials.data input file
// Need to ADD these constants to input file.......
   double rho_ave 			= 4.215; // ave He density rho_ave
   double he_frac_div 		= 0.526; // 52.6% He frac of div vol, rest is W, Rafs, void (SiC only, DCLL 53.3%), Ref: see Cost.cpp div plates
   double he_vol_in_div 	= div_vol*16.0*BOP*he_frac_div;
   double he_cost 			= (*Div)[0].cost_unit_mass("He"); // dummy part to get He cost
if (blanketmode == "dcll") 					 // (DCLL only, see Legend spreadsheet), no He in SiC MHTT   
		  he_vol_in_mhtt 	= mhtt_vol*0.15; // 15% He frac of MHTT total vol, ref?				 
   double he_vol_in_storage = he_vol_in_div*0.10; // Guess for now, include some % for storage and pressurization subsystem
//cout << "he_vol_in_div = " << he_vol_in_div << "\n";

   c_27[2] = (he_vol_in_div + he_vol_in_mhtt + he_vol_in_storage)*he_cost*rho_ave*inflation(yearOrig, yearNew); 
   fileout << "c_27[2] = (he_vol_in_div + he_vol_in_mhtt + he_vol_in_storage)*he_cost*rho_ave \n";
//cout << "total He vol = " << (he_vol_in_div + he_vol_in_mhtt + he_vol_in_storage) << "\n";
//cout << "total He cost = " << c_27[2] << "\n"; // ~$6500


// ... Intermediate Loop Coolant
// LCC use Brayton cycle? Or direct cycle to turbine - this has tritium contamination issues.
// LCC found IHX was ~40x MORE than primary loop pumping power... is this right?
   c_27[3] = 0.0; // NEED something here, some % of MHTT vol?
   fileout << "c_27[3] = 0.0 \n";
// Baccaglini, Guido from GA- "The helium mass inventory at 100% power for a 600 MWt (core power) gas turbine reactor is 4830 kg.
// Can't differentiate from their 1st and 2nd He loops...


// ... Turbine Cycle Working Fluids
// LW: "Since the length of the piping is much shorter, and the turbines are relatively small,
// it might be fraction of the  MHTT fluid. I might ask Said." ...TBD
   c_27[4] = 0.0; // could be some % of MHTT cost or a set cost, placeholder
   fileout << "c_27[4] = 0.0 \n";


// ... Other Special Materials
   double Pe = (*Machine).net_electrical_power();
   c_27[5] = 0.6e6*pow(Pe/1000.0, 0.8)*inflation(yearOrig, yearNew); 
   fileout << "c_27[5] = 0.6e6*pow(Pe/1000.0, 0.8) \n";


// ... Argon Power Core Cover Gas
   c_27[6] = 0.4e6*pow(Pe/1000.0, 0.8)*inflation(yearOrig, yearNew);
   fileout << "c_27[6] = 0.4e6*pow(Pe/1000.0, 0.8) \n";
   fileout << "	rho_ave = 4.215 kg/m3 = ave He density between STP and 700C, 15 MPa \n";
   fileout << "	he_cost = (*Div)[0].cost_unit_mass('He') \n";
   fileout << "	m_LM_total = BOP*(m_LM + m_LM_div + m_LM_rhts + m_LM_hts)*16.0/1000.0 \n";
if (blanketmode == "dcll")
     fileout << "	m_LM = (*BlanketInboard).liquid_metal_mass() + (*BlanketOutboard).liquid_metal_mass() \n";
else fileout << "	m_LM = (*FWInboard).liquid_metal_mass() + (*FWOutboard).liquid_metal_mass() + (*BlanketInboard).liquid_metal_mass() + (*BlanketOutboard).liquid_metal_mass() + (*BlanketII).liquid_metal_mass() \n";
   fileout << "	m_LM_div:  for(int i=0; i<6; i++) { m_LM_div  = m_LM_div  + (*Div)[i].liquid_metal_mass() } \n";
   fileout << "	m_LM_rhts: for(int i=0; i<2; i++) { m_LM_rhts = m_LM_rhts + (*RepHTShield)[i].liquid_metal_mass() } \n";
   fileout << "	m_LM_hts:  for(int i=0; i<2; i++) { m_LM_hts  = m_LM_hts  + (*HTShield)[i].liquid_metal_mass() } \n";
   fileout << "	BOP factor = 2.5 \n";
//   fileout << "	he_vol_in_mhtt    = mhtt_vol*0.15 \n";
   fileout << "	he_vol_in_div = div_vol*16.0*BOP*he_frac_div \n";
   fileout << " he_frac_div = 0.526 \n";
   fileout << "	div_vol: for(int i=0; i<6; i++) { div_vol = div_vol + (*Div)[i].volume(); } \n";
   fileout << "	he_vol_in_storage = he_vol_in_div*0.10 \n";
if (blanketmode == "dcll") 
	 fileout << "	mhtt_vol = ((*FWInboard).volume() + (*FWOutboard).volume() + (*BlanketInboard).volume() + (*BlanketOutboard).volume() + (*BackWallInboard).volume() + (*BackWallOutboard).volume() + (*SkeletonRing).volume() + (*RepHTShield)[1].volume() + pen_shielding*((*HTShieldDCLL).volume()) )*16.0*BOP \n\n";
else fileout << "	mhtt_vol = ((*FWInboard).volume() + (*FWOutboard).volume() + (*BlanketInboard).volume() + (*BlanketOutboard).volume() + (*BlanketII).volume() + (*RepHTShield)[0].volume() + (*RepHTShield)[1].volume() + pen_shielding*((*HTShield)[0].volume() + (*HTShield)[1].volume()) )*16.0*BOP \n\n";


// Top Level Cost
   c_27[0] = 0.0;
   for(int i=1; i<7; i++) c_27[0] = c_27[0] + c_27[i];

} // eof


// ===============================================================================================
// *** Account 90 Total Direct Cost

void CostingAccount::get_account_90()
{
// Get Name
    n_90 = "Total Direct Cost:	;";

// Get Cost
    c_90 = c_20[0] + c_21[0] + c_22[0] + c_23[0] + c_24[0] + c_25[0] + c_26[0] + c_27[0];
} 
// eof


// ===============================================================================================
// *** Account 91 Construction Facilities, Equipment and Services

void CostingAccount::get_account_91()
{
// Get Names
    n_91[0] = "Construction Facilities, Equipment and Services:	;";
    n_91[1] = "Temporary Facilities:	;";
    n_91[2] = "Construction Equipment:	;";
    n_91[3] = "Construction Services:	;";

	string filedir, filepath, extension; filedir = "./OutputParts/"; extension = ".data";
    filepath = filedir + "CostingAlgorithms" + extension; ofstream fileout(filepath.c_str(), ios::app);
 
// Get Costs
// ... Temporary Facilities ...
   c_91[1] = 0.0;
   fileout << "c_90 = c_20[0] + c_21[0] + c_22[0] + c_23[0] + c_24[0] + c_25[0] + c_26[0] + c_27[0] \n\n";
   fileout << "c_91[1] = 0.0 \n";

// ... Construction Equipment ...
   c_91[2] = 0.0;
   fileout << "c_91[2] = 0.0 \n";

// ... Construction Services ...
   c_91[3] = 0.0;
   fileout << "c_91[3] = 0.0 \n";

// Total Cost
   c_91[0] = 0.1130*c_90;
   fileout << "c_91[0] = 0.1130*c_90 \n\n";

} // eof


// ===============================================================================================
// *** Account 92 Home Office Engineering and Services

void CostingAccount::get_account_92()
{
// Get Names
    n_92[0] = "Home Office Engineering and Services:	;";
    n_92[1] = "Systems Engineering:	;";
    n_92[2] = "Management Services:	;";
    n_92[3] = "Quality Assurance:	;";
    n_92[4] = "Safety and Environmental Engineering:	;";

	string filedir, filepath, extension; filedir = "./OutputParts/"; extension = ".data";
    filepath = filedir + "CostingAlgorithms" + extension; ofstream fileout(filepath.c_str(), ios::app);
 
// Get Costs
// ... Systems Engineering ...
   c_92[1] = 0.0;
   fileout << "c_92[1] = 0.0 \n";

// ... Management Services ...
   c_92[2] = 0.0;
   fileout << "c_92[2] = 0.0 \n";

// ... Quality Assurance ...
   c_92[3] = 0.0;
   fileout << "c_92[3] = 0.0 \n";

// ... Safety and Environmental Engineering ...
   c_92[4] = 0.0;
   fileout << "c_92[4] = 0.0 \n";

// Total Cost
   c_92[0] = 0.052*c_90;
   fileout << "c_92[0] = 0.052*c_90 \n\n";

} // eof


// ===============================================================================================
// *** Account 93 Field Office Engineering and Services

void CostingAccount::get_account_93()
{
// Get Names
    n_93[0] = "Field Office Engineering and Services:	;";
    n_93[1] = "Construction Management:	;";
    n_93[2] = "Inspection:	;";
    n_93[3] = "Pre-Operational Training:	;";

	string filedir, filepath, extension; filedir = "./OutputParts/"; extension = ".data";
    filepath = filedir + "CostingAlgorithms" + extension; ofstream fileout(filepath.c_str(), ios::app);
 
// Get Costs
// ... Construction Management ...
   c_93[1] = 0.0;
   fileout << "c_93[1] = 0.0 \n";

// ... Inspection ...
   c_93[2] = 0.0;
   fileout << "c_93[2] = 0.0 \n";

// ... Pre-Operational Training ...
   c_93[3] = 0.0;
   fileout << "c_93[3] = 0.0 \n";

// Total Cost
   c_93[0] = 0.052*c_90;
   fileout << "c_93[0] = 0.052*c_90 \n\n";

} // eof


// ===============================================================================================
// *** Account 94 Owner's Cost

void CostingAccount::get_account_94()
{
// Get Names
    n_94[0] = "Owner's Cost:	;";
    n_94[1] = "Project Administration:	;";
    n_94[2] = "Staff Training and Plant Startup:	;";
    n_94[3] = "Inventories and Spares Administration:	;";

	string filedir, filepath, extension; filedir = "./OutputParts/"; extension = ".data";
    filepath = filedir + "CostingAlgorithms" + extension; ofstream fileout(filepath.c_str(), ios::app);
 
// ... Project Administration ...
   c_94[1] = 0.0;
   fileout << "c_94[1] = 0.0 \n";

// ... Staff Training and Plant Startup ...
   c_94[2] = 0.0;
   fileout << "c_94[2] = 0.0 \n";

// ... Inventories and Spares Administration ...
   c_94[3] = 0.0;
   fileout << "c_94[3] = 0.0 \n";

// Total Cost = (Total Direct Cost + subtotal of prior Indirect costs (91-93)) x 0.15
   c_94[0] = 0.15*(c_90 + c_91[0] + c_92[0] + c_93[0]);
      fileout << "c_94[0] = 0.15*(c_90 + c_91[0] + c_92[0] + c_93[0]) \n\n";

} // eof


// ===============================================================================================
// *** Account 95 Process (design) Contingency

void CostingAccount::get_account_95()
{
// Get Name
    n_95 = "Process (design) Contingency:	;";

// Get Cost, Assumed to be zero due to 10th-of-a-kind maturity
    c_95 = 0.0*c_90;
    
} // eof


// ===============================================================================================
// *** Account 96 Project Contingency

void CostingAccount::get_account_96()
{
// Get Name
    n_96 = "Project Contingency:	;";
    
// Get Cost = (Total Direct Cost + subtotal of prior Indirect costs (91-95)) x 0.1465
    c_96 = 0.1465*(c_90 + c_91[0] + c_92[0] + c_93[0] + c_94[0] + c_95);

} // eof


// ===============================================================================================
// *** Account 97 Interest During Construction (IDC)

void CostingAccount::get_account_97()
{
// Get Name
    n_97 = "Interest During Construction (IDC):	;";

// Get Cost
    double fidc = 0.1303; // constant year dollar analysis, # from Waganer
    c_97 = fidc*(c_90 + c_91[0] + c_92[0] + c_93[0] + c_94[0] + c_95 + c_96);
    
} // eof


// ===============================================================================================
// *** Account 98 Escalation During Construction (EDC)

void CostingAccount::get_account_98()
{
// Get Name
    n_98 = "Escalation During Construction (EDC):	;";

// Get Cost
    double fedc = 0.0; // why?
    c_98 = fedc*c_90;
    
} // eof


// ===============================================================================================
// *** Account 99 Total Project Capital Cost

void CostingAccount::get_account_99()
{
	string filedir, filepath, extension; filedir = "./OutputParts/"; extension = ".data";
    filepath = filedir + "CostingAlgorithms" + extension; ofstream fileout(filepath.c_str(), ios::app);
 
// Get Name
    n_99 = "Total Project Capital Cost:	;";
    c_99 = c_90 + c_91[0] + c_92[0] + c_93[0] + c_94[0] + c_95 + c_96 + c_97 + c_98;
    fileout << "c_95 = 0.0*c_90 \n\n";
    fileout << "c_96 = 0.1465*(c_90 + c_91[0] + c_92[0] + c_93[0] + c_94[0] + c_95) \n\n";    
    fileout << "c_97 = fidc*(c_90 + c_91[0] + c_92[0] + c_93[0] + c_94[0] + c_95 + c_96) \n";
    fileout << "	fidc = 0.1303 \n\n";
    fileout << "c_98 = fedc*c_90 \n";
    fileout << "	fedc = 0.0 \n\n";
    fileout << "c_99 = c_90 + c_91[0] + c_92[0] + c_93[0] + c_94[0] + c_95 + c_96 + c_97 + c_98 \n\n";
} // eof


// ===============================================================================================
// ===============================================================================================
// Get Cost of Electricity (See Cost of Electricity.doc)

void CostingAccount::get_cost_of_electricity(DesignPoint * Machine)
{

// Open the "costing.data" INPUT file to read the costing parameters:
ifstream fin_coe; fin_coe.open("InputData/costing.data");
  fin_coe.width(10); fin_coe.precision(2);
  fin_coe.setf(ios_base::uppercase, ios_base::scientific);
  int itxt_coe = 57;  // LCC length of first line of costing.data
  int inum_coe = 13;  // LCC the number called is 13 letters long
  int iskip_coe = itxt_coe + inum_coe;

// This writes the pertinent parameters to CostingAlgorithms.data	
  string filedir, filepath, extension; filedir = "./OutputParts/"; extension = ".data";
  filepath = filedir + "CostingAlgorithms" + extension; ofstream fileout(filepath.c_str(), ios::app);

// Annual Capital Cost Charge
// ... real discount rate  // LCC first line of costing.data file read in
   double Xrdr; fin_coe.seekg(0*iskip_coe + itxt_coe +1); fin_coe >> Xrdr;

// ... economic life of plant (years)
   double Lecon; fin_coe.seekg(1*iskip_coe + itxt_coe +1); fin_coe >> Lecon;
   double fcr = Xrdr/( 1.0 - pow(1.0+Xrdr, -Lecon)); // Fixed charge rate = 0.05828
   double c_AC = fcr*c_99;  // c_99 calculated previously
   
// Annual Operations and Maintenance Cost
   double Pe   = (*Machine).net_electrical_power(); 
   double c_OM = 80.0e6*pow(Pe/1200.0, 0.5)*inflation(yearOrig, yearNew);
    
    
// Annual Scheduled Component Replacement Cost
// ... Neutronics Data for Silicon Carbide
// ... neutron fluence life, 1.8e7 Wy/m2
   double neutron_fluence_life; fin_coe.seekg(2*iskip_coe + itxt_coe +1); fin_coe >> neutron_fluence_life;
    
// ... maximum neutron wall load
   double nwlmax   = (*Machine).neutron_wall_load("maximum"); // in W/m2
   double FWB_life = neutron_fluence_life/nwlmax; // replaceable FW and blanket lifetime
  
//  Annual Fuel Cost
// ... annual escalation rate
   double y; 	fin_coe.seekg(3*iskip_coe + itxt_coe +1); fin_coe >> y;

// ... construction period
   double Y; 	fin_coe.seekg(4*iskip_coe + itxt_coe +1); fin_coe >> Y;

// ... plant capacity factor, ~availability
   double pf; 	fin_coe.seekg(5*iskip_coe + itxt_coe +1); fin_coe >> pf;

// ... annual fuel cost
   double c_F; 	fin_coe.seekg(6*iskip_coe + itxt_coe +1); fin_coe >> c_F;
   
// Decontamination and Decommissioning Allowance
   double c_DD; fin_coe.seekg(7*iskip_coe + itxt_coe +1); fin_coe >> c_DD;


// Total cost of replaceable components divided by FW and blanket lifetime
   double c_SCR = (c_22_1[1] + c_22_1[3] + c_22_1[4] + c_22_3_1[0] + c_22_3_4[0] + c_22_4[5]) / 
   				  (FWB_life/pf); // now in years, not full power years

// Cost of Electricity Equation
    cost_Of_Electricity = (c_AC + (c_OM + c_SCR + c_F) * pow(1.0 + y,Y)) /
                          (8760.0*Pe*pf) + c_DD;                         

// Subcosts of COE normalized to mills/kWh
   coe_subcost[0] = c_AC                 /(8760.0*Pe*pf); // capital return 
   coe_subcost[1] = c_OM  *pow(1.0+y, Y) /(8760.0*Pe*pf); // operation and maintenance
   coe_subcost[2] = c_SCR *pow(1.0+y, Y) /(8760.0*Pe*pf); // component replacement
   coe_subcost[3] = c_F   *pow(1.0+y, Y) /(8760.0*Pe*pf); // fuel cost
   coe_subcost[4] = c_DD; // decontamination and decommissioning

fileout << "cost_Of_Electricity = (c_AC + (c_OM + c_SCR + c_F) * pow(1.0 + y,Y)) / (8760.0*Pe*pf) + c_DD \n";
fileout << "** See input file costing.data for input parameters: Xrdr, Lecon, neutron_fluence_life, y, Y, pf, c_F, c_DD. \n";
fileout << "fcr = Xrdr/( 1.0 - pow(1.0+Xrdr, -Lecon)) \n";
fileout << "c_AC = fcr*c_99 \n";
fileout << "Pe = (*Machine).net_electrical_power() \n";
fileout << "c_OM = 80.0e6*pow(Pe/1200.0, 0.5) \n";
fileout << "FWB_life = neutron_fluence_life/nwlmax \n";
fileout << "nwlmax = (*Machine).neutron_wall_load('maximum') \n";
fileout << "c_SCR = (c_22_1[1] + c_22_1[3] + c_22_1[4] + c_22_3_1[0] + c_22_3_4[0] + c_22_4[5]) / (FWB_life/pf) \n";
fileout << "c_AC = fcr*c_99 \n\n";
fileout << "coe_subcost[0] = c_AC                /(8760.0*Pe*pf) \n";
fileout << "coe_subcost[1] = c_OM*pow(1.0+y, Y)  /(8760.0*Pe*pf) \n";
fileout << "coe_subcost[2] = c_SCR*pow(1.0+y, Y) /(8760.0*Pe*pf) \n";
fileout << "coe_subcost[3] = c_F*pow(1.0+y, Y)   /(8760.0*Pe*pf) \n";
fileout << "coe_subcost[4] = c_DD \n\n";

fin_coe.close();
} // eof


// =======================================================================================
// Display costs

double CostingAccount::account(string aid, int j)
{    if(aid=="20") 		return c_20[j];
else if(aid=="21") 		return c_21[j];
else if(aid=="22") 		return c_22[j];
else if(aid=="22.1") 	return c_22_1[j];
else if(aid=="22.2") 	return c_22_2[j];
else if(aid=="22.2.1")	return c_22_2_1[j];
else if(aid=="22.3") 	return c_22_3[j];
else if(aid=="22.3.1") 	return c_22_3_1[j];
else if(aid=="22.3.2") 	return c_22_3_2[j];
else if(aid=="22.3.3") 	return c_22_3_3[j];
else if(aid=="22.3.4") 	return c_22_3_4[j];
else if(aid=="22.4") 	return c_22_4[j];
else if(aid=="22.5") 	return c_22_5[j];
else if(aid=="22.6") 	return c_22_6[j];
else if(aid=="22.7") 	return c_22_7[j];
else if(aid=="22.8") 	return c_22_8[j];
else if(aid=="22.9") 	return c_22_9[j];
else if(aid=="22.10") 	return c_22_10[j];
else if(aid=="22.11") 	return c_22_11[j];
else if(aid=="22.98") 	return c_22[12];
else if(aid=="22.99") 	return c_22[13];
else if(aid=="23") 		return c_23[j];
else if(aid=="24") 		return c_24[j];
else if(aid=="25") 		return c_25[j];
else if(aid=="26") 		return c_26[j];
else if(aid=="27") 		return c_27[j];
else if(aid=="90") 		return c_90;
else if(aid=="91") 		return c_91[j];
else if(aid=="92") 		return c_92[j];
else if(aid=="93") 		return c_93[j];
else if(aid=="94") 		return c_94[j];
else if(aid=="95") 		return c_95;
else if(aid=="96") 		return c_96;
else if(aid=="97") 		return c_97;
else if(aid=="98") 		return c_98;
else if(aid=="99") 		return c_99;
else
 { cout << "CostingAccount::account - wrong account number. \n";
   return 1.e39;
 } } // eof


string CostingAccount::title( string aid, int j)
{     if(aid=="20") 	return n_20[j];     
 else if(aid=="21") 	return n_21[j];   
 else if(aid=="22") 	return n_22[j]; 
 else if(aid=="22.1") 	return n_22_1[j]; 
 else if(aid=="22.2") 	return n_22_2[j];
 else if(aid=="22.2.1") return n_22_2_1[j];
 else if(aid=="22.3") 	return n_22_3[j];
 else if(aid=="22.3.1") return n_22_3_1[j];
 else if(aid=="22.3.2") return n_22_3_2[j];
 else if(aid=="22.3.3") return n_22_3_3[j];
 else if(aid=="22.3.4") return n_22_3_4[j];
 else if(aid=="22.4") 	return n_22_4[j]; 
 else if(aid=="22.5") 	return n_22_5[j];
 else if(aid=="22.6") 	return n_22_6[j];
 else if(aid=="22.7") 	return n_22_7[j];
 else if(aid=="22.8") 	return n_22_8[j];
 else if(aid=="22.9") 	return n_22_9[j];
 else if(aid=="22.10") 	return n_22_10[j];
 else if(aid=="22.11") 	return n_22_11[j];
 else if(aid=="22.98") 	return n_22[12];
 else if(aid=="22.99") 	return n_22[13]; 
 else if(aid=="23") 	return n_23[j]; 
 else if(aid=="24") 	return n_24[j]; 
 else if(aid=="25") 	return n_25[j];
 else if(aid=="26") 	return n_26[j];
 else if(aid=="27") 	return n_27[j];
 else if(aid=="90") 	return n_90;
 else if(aid=="91") 	return n_91[j];
 else if(aid=="92") 	return n_92[j];
 else if(aid=="93") 	return n_93[j];
 else if(aid=="94") 	return n_94[j];
 else if(aid=="95") 	return n_95;
 else if(aid=="96") 	return n_96;
 else if(aid=="97") 	return n_97;
 else if(aid=="98") 	return n_98;
 else if(aid=="99") 	return n_99;
 else return "CostingAccount::title - wrong account number. \n";
} // eof


// ==================================================================================
// Inflation Factors (also in Part.cpp line ~960)
// To Do: would like to read file just once, then read year,factor[j] from memory...how to do this?

double CostingAccount::inflation(int yearFrom, int yearTo)
{
// NEW - Read GDP inflation factors from inflationfactors.data input file
	ifstream fin_mat;  fin_mat.open("InputData/inflationfactors.data");
	fin_mat.width(10); fin_mat.precision(2);
	fin_mat.setf(ios_base::uppercase, ios_base::scientific);
	int next = 15;  // next line
	int year[42]; double factor[85];

// Read the data from the input file
for(int i=3, j=0; i<86; j++)
    { fin_mat.seekg(i*next);     fin_mat >> year[j];   // year
      fin_mat.seekg((i+1)*next); fin_mat >> factor[j]; // factor
//      cout << year[j] << " " << factor[j] << "\n";
      i=i+2; } 

// Calculate ratio from given input years
	double cf_from, cf_to;
	for(int i=0; i<42; i++)
		{ if(yearFrom == year[i]) cf_from = factor[i]; 
	 	  if(yearTo   == year[i]) cf_to   = factor[i]; }
//cout << "inflation ratio = " << cf_from/cf_to << "\n";

return cf_to/cf_from;
fin_mat.close(); // function returns this ratio
} //eof


// ==================================================================================

double CostingAccount::cost_of_electricity()
//cout << "COE = " << cost_of_electricity() << "\n";
{ return cost_Of_Electricity; } 

double CostingAccount::cost_of_electricity_component(int j)
{ return coe_subcost[j]; }



// =================================================================================
// =================================================================================
// Print out detailed costing accounts in "/OutputParts/CostingAccounts.data"

void CostingAccount::show()
{  string filedir, filepath, extension;
   filedir = "./OutputParts/"; extension = ".data";
   filepath = filedir + "CostingAccounts" + extension;
   ofstream fileout(filepath.c_str());
   time_t rawtime;	struct tm * timeinfo; time ( &rawtime );
   timeinfo = localtime ( &rawtime );

// try fileout << setw(12);  setprecision(5), cout.width(10), fileout.width(15)

// Begin CostingAccounts.data Printout
fileout << "Costing Accounts with " << blanketmode << " Blanket:\n";
fileout << "Costs are M$ in " << yearNew << "$ \n";
fileout << "Printed on " << asctime (timeinfo) << "\n\n";

// 20 --------------------------------------------------------------------
fileout <<setw(7)<<left<< "20.0   " <<  title("20", 0) << " " << account("20", 0)/1.e6 << "\n";
fileout <<setw(7)<<left<< "     20.1   " << title("20", 1) << " " << account("20", 1)/1.e6 << "\n";
fileout <<setw(7)<<left<< "     20.2   " << title("20", 2) << " " << account("20", 2)/1.e6 << "\n"; 
fileout << "\n";


// 21 --------------------------------------------------------------------
for(int i=0; i<18; i++)
{ if(i==0) fileout << "21." << i << "   "       << title("21",i) << " " << account("21",i)/1.e6 << "\n";
  if(i>0)  fileout << "     21." << i << "   "  << title("21",i) << " " << account("21",i)/1.e6 << "\n"; }
fileout << "\n";


// 22 --------------------------------------------------------------------
fileout << "22." << 0 << "   "  << title("22",0) << " " << account("22",0)/1.e6 << "\n";

for(int i=0; i<8; i++)
{ if(i==0) fileout << "     22.1." << i << "   "       << title("22.1",i) << " " << account("22.1",i)/1.e6 << "\n";
  if(i>0)  fileout << "          22.1." << i << "   "  << title("22.1",i) << " " << account("22.1",i)/1.e6 << "\n"; }


for(int i=0; i<6; i++)
{ if(i==0) fileout << "     22.2." << i << "   "       << title("22.2",i) << " " << account("22.2",i)/1.e6 << "\n";
  if(i>0)  fileout << "          22.2." << i << "   "  << title("22.2",i) << " " << account("22.2",i)/1.e6 << "\n";
                       
if(i==1)
{ for(int j=1; j<7; j++) fileout << "                    22.2.1." << j << "   "  << 
  title("22.2.1",j) << " " << account("22.2.1",j)/1.e6 << "\n";
} }


for(int i=3; i<14; i++)
{ if(i==12) fileout << "     22.98.0   "  << title("22",i) << " " << account("22",i)/1.e6 << "\n";
  if(i==13) fileout << "     22.99.0   "  << title("22",i) << " " << account("22",i)/1.e6 << "\n";
  if(i!=12 && i!=13) fileout << "     22." << i << ".0   "  << title("22",i) << " " << account("22",i)/1.e6 << "\n";

if(i==3)
{ for(int j=1; j<5; j++) 
{ fileout << "          22.3." << j << "   "  << 
  title("22.3",j)   << " " << account("22.3",j)/1.e6 << "\n";

if(j==1) for(int k=1; k<5; k++) fileout << "                    22.3.1." << k << "   "  << 
title("22.3.1",k) << " " << account("22.3.1",k)/1.e6 << "\n";

if(j==2) for(int k=1; k<4; k++) fileout << "                    22.3.2." << k << "   "  << 
title("22.3.2",k) << " " << account("22.3.2",k)/1.e6 << "\n";

if(j==3) for(int k=1; k<3; k++) fileout << "                    22.3.3." << k << "   "  << 
title("22.3.3",k) << " " << account("22.3.3",k)/1.e6 << "\n";

if(j==4) for(int k=1; k<3; k++) fileout << "                    22.3.4." << k << "   "  << 
title("22.3.4",k) << " " << account("22.3.4",k)/1.e6 << "\n";
} }

if(i==4) 
{ for(int j=1; j<7; j++) fileout << "          22.4." << j << "   "  << 
  title("22.4",j) << " " << account("22.4",j)/1.e6 << "\n"; }

if(i==5) 
{ for(int j=1; j<4; j++) fileout << "          22.5." << j << "   "  << 
  title("22.5",j) << " " << account("22.5",j)/1.e6 << "\n"; }

if(i==6) 
{ for(int j=1; j<5; j++) fileout << "          22.6." << j << "   "  << 
  title("22.6",j) << " " << account("22.6",j)/1.e6 << "\n"; }

if(i==7) 
{ for(int j=1; j<4; j++) fileout << "          22.7." << j << "   "  << 
  title("22.7",j) << " " << account("22.7",j)/1.e6 << "\n"; }

if(i==8) 
{ for(int j=1; j<8; j++) fileout << "          22.8." << j << "   "  << 
  title("22.8",j) << " " << account("22.8",j)/1.e6 << "\n"; }

if(i==9) 
{ for(int j=1; j<5; j++) fileout << "          22.9." << j << "   "  << 
  title("22.9",j) << " " << account("22.9",j)/1.e6 << "\n"; }

if(i==10) 
{ for(int j=1; j<6; j++) fileout << "          22.10." << j << "   "  << 
  title("22.10",j) << " " << account("22.10",j)/1.e6 << "\n"; }

if(i==11) 
{ for(int j=1; j<6; j++) fileout << "          22.11." << j << "   "  << 
  title("22.11",j) << " " << account("22.11",j)/1.e6 << "\n"; } }
fileout << "\n";


// 23 --------------------------------------------------------------------
fileout << "23." << 0 << "   "         << title("23",0) << " " << account("23",0)/1.e6 << "\n";
for(int i=1; i<9; i++)
{ if(i==7) fileout << "     23.98.0   "  << title("23",i) << " " << account("23",i)/1.e6 << "\n";
  if(i==8) fileout << "     23.99.0   "  << title("23",i) << " " << account("23",i)/1.e6 << "\n";
  if(i!=7 && i!=8) fileout << "     23." << i << ".0   "  << title("23",i) << " " << account("23",i)/1.e6 << "\n"; }
fileout << "\n";


// 24 --------------------------------------------------------------------
fileout << "24." << 0 << "   "         << title("24",0) << " " << account("24",0)/1.e6 << "\n";
for(int i=1; i<10; i++)
{ if(i==8) fileout << "     24.98.0   "  << title("24",i) << " " << account("24",i)/1.e6 << "\n";
  if(i==9) fileout << "     24.99.0   "  << title("24",i) << " " << account("24",i)/1.e6 << "\n";
  if(i!=8 && i!=9) fileout << "     24." << i << ".0   "  << title("24",i) << " " << account("24",i)/1.e6 << "\n"; }
fileout << "\n";


// 25 --------------------------------------------------------------------
fileout << "25." << 0 << "   "         << title("25",0) << " " << account("25",0)/1.e6 << "\n";
for(int i=1; i<7; i++)
{ if(i==5) fileout << "     25.98.0   "  << title("25",i) << " " << account("25",i)/1.e6 << "\n";
  if(i==6) fileout << "     25.99.0   "  << title("25",i) << " " << account("25",i)/1.e6 << "\n";
  if(i!=5 && i!=6) fileout << "     25." << i << ".0   "  << title("25",i) << " " << account("25",i)/1.e6 << "\n"; }
fileout << "\n";


// 26 --------------------------------------------------------------------
fileout << "26." << 0 << "   "         << title("26",0) << " " << account("26",0)/1.e6 << "\n";
for(int i=1; i<7; i++)
{ if(i==5) fileout << "     26.98.0   "  << title("26",i) << " " << account("26",i)/1.e6 << "\n";
  if(i==6) fileout << "     26.99.0   "  << title("26",i) << " " << account("26",i)/1.e6 << "\n";
  if(i!=5 && i!=6) fileout << "     26." << i << ".0   "  << title("26",i) << " " << account("26",i)/1.e6 << "\n"; }
fileout << "\n";


// 27 --------------------------------------------------------------------
fileout << "27." << 0 << "   "         << title("27",0) << " " << account("27",0)/1.e6 << "\n";
for(int i=1; i<7; i++)
{ if(i==5) fileout << "     27.98.0   "  << title("27",i) << " " << account("27",i)/1.e6 << "\n";
  if(i==6) fileout << "     27.99.0   "  << title("27",i) << " " << account("27",i)/1.e6 << "\n";
  if(i!=5 && i!=6) fileout << "     27." << i << ".0   "  << title("27",i) << " " << account("27",i)/1.e6 << "\n"; }
fileout << "\n\n";


// 90 --------------------------------------------------------------------
	fileout << "90." << 0 << "   "         << title("90",0) << " " << account("90",0)/1.e6 << "\n";
	fileout << "\n";


// 91 --------------------------------------------------------------------
	fileout << "91." << 0 << "   "         << title("91",0) << " " << account("91",0)/1.e6 << "\n";
	for(int i=1; i<4; i++)
	{ fileout << "     91." << i << ".0   "  << title("91",i) << " " << account("91",i)/1.e6 << "\n"; }
	fileout << "\n";


// 92 --------------------------------------------------------------------
fileout << "92." << 0 << "   "         << title("92",0) << " " << account("92",0)/1.e6 << "\n";
for(int i=1; i<5; i++)
{ fileout << "     92." << i << ".0   "  << title("92",i) << " " << account("92",i)/1.e6 << "\n"; }
fileout << "\n";


// 93 --------------------------------------------------------------------
fileout << "93." << 0 << "   "         << title("93",0) << " " << account("93",0)/1.e6 << "\n";
for(int i=1; i<4; i++)
{ fileout << "     93." << i << ".0   "  << title("93",i) << " " << account("93",i)/1.e6 << "\n"; }
fileout << "\n";


// 94 --------------------------------------------------------------------
fileout << "94." << 0 << "   "         << title("94",0) << " " << account("94",0)/1.e6 << "\n";
for(int i=1; i<4; i++)
{ fileout << "     94." << i << ".0   "  << title("94",i) << " " << account("94",i)/1.e6 << "\n"; }
fileout << "\n";


// 95 --------------------------------------------------------------------
fileout << "95." << 0 << "   "         << title("95",0) << " " << account("95",0)/1.e6 << "\n";
fileout << "\n";


// 96 --------------------------------------------------------------------
fileout << "96." << 0 << "   "         << title("96",0) << " " << account("96",0)/1.e6 << "\n";
fileout << "\n";


// 97 --------------------------------------------------------------------
fileout << "97." << 0 << "   "         << title("97",0) << " " << account("97",0)/1.e6 << "\n";
fileout << "\n";


// 98 --------------------------------------------------------------------
fileout << "98." << 0 << "   "         << title("98",0) << " " << account("98",0)/1.e6 << "\n";
fileout << "\n";


// 99 --------------------------------------------------------------------
fileout << "99." << 0 << "   "         << title("99",0) << " " << account("99",0)/1.e6 << "\n\n";
fileout << "\n";


fileout << "Cost of Electricity (COE) [mills/kWh]:	;" 		<< cost_of_electricity() << "\n\n";
fileout << " Subcosts of COE normalized to mills/kWh: \n";
fileout << "... capital return:	;" 							<< cost_of_electricity_component(0) << "\n";
fileout << "... operation and maintenance:	;" 				<< cost_of_electricity_component(1) << "\n";
fileout << "... component replacement:	;" 					<< cost_of_electricity_component(2) << "\n";
fileout << "... fuel cost:	;" 								<< cost_of_electricity_component(3) << "\n";
fileout << "... decontamination and decommissioning:	;"	<< cost_of_electricity_component(4) << "\n";
                       
} // eof

// =======================================================================================

