Example #1
0
 def setUp(self):
     fn = 'TestExternalPyStr.mo'
     sim = simulation.Simulator(fn)
     sim.compile_model()
     sim.compile_sim(args=['-s'])
     sim.simulate(start=0, stop=4, step=1)
     self.res = postproc.SimResult(sim.model + '_res.mat')
Example #2
0
 def setUp(self):
     fn = 'TestTMY3WeatherFileChecker.mo'
     sim = simulation.Simulator(fn)
     sim.compile_model()
     sim.compile_sim(args=['-s'])
     sim.simulate(start=0, stop=1, step=5)
     self.res = postproc.SimResult(sim.model + '_res.mat')
Example #3
0
 def setUp(self):
     fn = 'TestPolynomial.mo'
     sim = simulation.Simulator(fn)
     sim.compile_model()
     sim.compile_sim(args=['-s'])
     sim.simulate(start=0, stop=10, step=0.1)
     self.res = postproc.SimResult(sim.model + '_res.mat')
Example #4
0
 def setUp(self):
     fn = 'TestCatromOE.mo'
     sim = simulation.Simulator(fn)
     sim.compile_model()
     sim.compile_sim(args=['-s'])
     sim.simulate(start=0, stop='1y', step=300)
     self.res = postproc.SimResult(sim.model + '_res.mat')
 def setUp(self):
     fn = 'TestGraphiteProperty.mo'
     sim = simulation.Simulator(fn)
     sim.compile_model()
     sim.compile_sim(args=['-s'])
     sim.simulate(start=0, stop=3, step=0.01)
     self.res = postproc.SimResult(sim.model + '_res.mat')
	def setUp(self):
		fn = 'TestWeatherSource.mo'
		sim = simulation.Simulator(fn)
		sim.compile_model()
		sim.compile_sim(args=['-s'])
		sim.simulate(start=0, stop=86400, step=40)
		self.res = postproc.SimResult(sim.model + '_res.mat')
Example #7
0
	def setUp(self):
		fn = '../examples/Reference_2.mo'
		sim = simulation.Simulator(fn)
		sim.compile_model()
		sim.compile_sim(args=['-s'])
		sim.simulate(start=0, stop='1y', step='5m',solver='dassl', nls='newton')
		self.res = postproc.SimResultElec(sim.res_fn)
		self.perf = self.res.calc_perf()
	def setUp(self):
		fn = '../examples/SaltSCO2System.mo'
		sim = simulation.Simulator(fn)
		sim.compile_model()
		sim.compile_sim(args=['-s'])
		sim.simulate(start=0, stop='1y', step='300s',solver='dassl', nls='homotopy')
		self.res = postproc.SimResultElec(sim.res_fn)
		self.perf = self.res.calc_perf()
Example #9
0
 def setUp(self):
     #self.cwd = os.chdir(os.path.dirname(__file__))
     fn = 'TestSTTable.mo'
     sim = simulation.Simulator(fn)
     sim.compile_model()
     sim.compile_sim(args=['-s'])
     sim.simulate(start=0, stop=4, step=0.01)
     self.res = postproc.SimResult(sim.model + '_res.mat')
 def setUp(self):
     fn = 'TestSolarPosition.mo'
     sim = simulation.Simulator(fn)
     sim.compile_model()
     sim.compile_sim(args=['-s'])
     # One year ~500 intervals per day:
     sim.simulate(start=0, stop=31536000, step=170)
     self.res = postproc.SimResult(sim.model + '_res.mat')
 def setUp(self):
     fn = '../examples/SolarFuelSystem.mo'
     sim = simulation.Simulator(fn)
     sim.compile_model()
     sim.compile_sim(args=['-s'])
     sim.simulate(start=0, stop='1y', step='5m')
     self.res = postproc.SimResultFuel(sim.res_fn)
     self.perf = self.res.calc_perf()
Example #12
0
 def setUp(self):
     print("RUNNING SETUP")
     fn = 'TestCatromOE.mo'
     sim = simulation.Simulator(fn)
     print("COMPILING MODEL")
     sim.compile_model()
     sim.compile_sim(args=['-s'])
     sim.simulate(start=0, stop='1y', step=300)
     self.res = postproc.SimResult(sim.model + '_res.mat')
Example #13
0
 def setUp(self):
     fn = 'TestOptimisation.mo'
     model = 'AO'
     sim = simulation.Simulator(fn, model=model)
     # For some reason won't compile with Modelica library
     sim.compile_model(libs=[], args=['-g=Optimica'])
     sim.compile_sim(args=['-s'])
     sim.simulate(start=0, stop=1, step=0.02, solver='optimization')
     self.res = postproc.SimResult(sim.model + '_res.mat')
Example #14
0
    def setUp(self):
        if os.path.isfile('TestCommandTouched'):
            os.remove('TestCommandTouched')

        fn = 'TestCommand.mo'
        sim = simulation.Simulator(fn)
        sim.compile_model()
        sim.compile_sim(args=['-s'])
        sim.simulate(start=0, stop=1, step=0.1)
        self.res = postproc.SimResult(sim.model + '_res.mat')
Example #15
0
	def setUp(self):
		if os.path.isfile('resources/tests/weatherfile2.motab'):
			os.remove('resources/tests/weatherfile2.motab')

		fn = 'TestWeatherFileChecker.mo'
		sim = simulation.Simulator(fn)
		sim.compile_model()
		sim.compile_sim(args=['-s'])
		sim.simulate(start=0, stop=1, step=0.01)
		self.res = postproc.SimResult(sim.model + '_res.mat')
Example #16
0
 def __init__(self, moname, modir, simdir):
     self.moname = moname
     self.simdir = simdir
     self.modir = modir
     fnmo = "%s/%s.mo" % (self.modir, self.moname)
     shutil.copy(fnmo, self.simdir)
     os.chdir(self.simdir)
     self.sim = simulation.Simulator("%s.mo" % (self.moname), suffix="0")
     self.sim.compile_model()
     self.sim.compile_sim()
Example #17
0
	def setUp(self):

		fn = '../examples/Reference_2.mo'
		res_fn='./Reference_2_res.mat'
		xml_fn='./Reference_2_init.xml'
		self.sm=2.8
		self.t_storage=9

		sim = simulation.Simulator(fn)
		sim.compile_model()
		self.pxml=ProcesXML(xml_fn)
		self.pxml.write_par(par_n=['SM', 't_storage'], par_v=[self.sm, self.t_storage],one=False)
		sim.compile_sim(args=['-s'])
		sim.simulate(start=0, stop=10, step=0.1)		
		self.mat=DyMat.DyMatFile(res_fn)
Example #18
0
def test_modelica():
    """
	Run the modelica test of STMotab.
	"""
    fn = './TestSTMotab.mo'
    sim = simulation.Simulator(fn)
    sim.compile_model()
    sim.compile_sim(args=['-s'])
    sim.simulate(start=0, stop='1y', step='5m', solver='dassl', nls='homotopy')

    res = DyMat.DyMatFile('TestSTMotab_res.mat')
    assert res.data("t1")[0] == 31500000.
    assert res.data("dnival")[0] == 976.
    assert res.data("dnicol")[0] == 2.

    cleantest.clean('TestSTMotab')
Example #19
0
def test_optimum():
    from solartherm import simulation
    from solartherm import postproc
    import cleantest
    fn = 'TestOptimisation.mo'
    model = 'AO'
    sim = simulation.Simulator(fn, model=model)
    # For some reason won't compile with Modelica library
    sim.compile_model(libs=[], args=['-g=Optimica'])
    sim.compile_sim(args=['-s'])
    sim.simulate(start=0, stop=1, step=0.02, solver='optimization')
    res = postproc.SimResult(sim.model + '_res.mat')

    assert abs(res.interpolate('x1', 0) - 1.0) / 1.0 < 0.01
    assert abs(res.interpolate('x2', 0) - 0.0) < 0.01
    assert abs(res.interpolate('u', 1) - 2.48) / 2.48 < 0.01

    cleantest.clean('AO')
Example #20
0
def test_system():
    fn = '../examples/SimpleSystemOptimalDispatch.mo'
    sim = simulation.Simulator(fn)
    sim.compile_model()
    sim.compile_sim(args=['-s'])
    sim.simulate(start=0, stop='1y', step='5m', solver='dassl', nls='newton')
    res = postproc.SimResultElec(sim.res_fn)
    perf = res.calc_perf(peaker=True)

    # Note these are set to the values for what is thought to be a working
    # version.  They are not validated against anything or independently
    # calculated.
    print('index, epy (MWh/year),lcoe peaker ($/MWh),capf (%),srev ($')
    print(perf)
    assert abs(perf[0] - 300.757) / 300.757 < 0.01  # epy
    assert abs(perf[1] - 38.798) / 38.798 < 0.01  # LCOE peaker
    assert abs(perf[2] - 100.09) / 100.09 < 0.01  # Capacity factor
    cleantest.clean('SimpleSystemOptimalDispatch')
def test_ref2solstice():
    fn = '../examples/Reference_2_solstice.mo'
    sim = simulation.Simulator(fn)
    sim.compile_model()
    sim.compile_sim(args=['-s'])
    sim.update_pars(['n_row_oelt', 'n_col_oelt'],
                    ['3', '3'])  # reduce oelt resolution
    sim.simulate(start=0, stop='1y', step='5m', solver='dassl', nls='newton')
    res = postproc.SimResultElec(sim.res_fn)
    perf = res.calc_perf()

    # Note these are set to the values for what is thought to be a working
    # version.  They are not validated against anything or independently
    # calculated.

    assert abs(perf[0] - 393933.791) / 393933.791 < 0.1  # epy
    assert abs(perf[1] - 160.352) / 160.352 < 0.1  # LCOE
    assert abs(perf[2] - 44.969) / 44.969 < 0.1  # Capacity factor
    cleantest.clean('Reference_2_solstice')
Example #22
0
def gather_data(inputs):
    start = time.time()

    modelicavarname = [
        'T_in_ref_blk', 'p_high', 'PR', 'pinch_PHX', 'dTemp_HTF_PHX', 'load',
        'T_HTF_in', 'T_amb_input', 'eta_gross', 'eta_Q'
    ]

    #Reading input
    P_net = inputs["P_net"]
    T_in_ref_blk = inputs["T_in_ref_blk"]
    p_high = inputs["p_high"]
    PR = inputs["PR"]
    pinch_PHX = inputs["pinch_PHX"]
    dTemp_HTF_PHX = inputs["dTemp_HTF_PHX"]
    numdata = inputs["numdata"]
    dirres = inputs["dirres"]
    new_config = inputs["status_config"]
    SolarTherm_path = inputs["SolarTherm_path"]

    cwd = os.getcwd()
    resdir = "%s" % (dirres)
    simdir = "%s/simulation" % (cwd)

    #Writedown the PB design configuration
    configdir = "%s/configurations" % (cwd)
    fnconfig = "%s/config0.txt" % (configdir)
    index = 0

    if new_config == 1:
        while os.path.exists(fnconfig):
            index += 1
            fnconfig = "%s/config%s.txt" % (configdir, index)

        #Writing a new config file
        f = open(fnconfig, 'w')
        f.write('P_net,T_in_ref_blk,p_high,PR,pinch_PHX,dTemp_HTF_PHX\n')
        f.write('%s,%s,%s,%s,%s,%s\n' %
                (P_net, T_in_ref_blk, p_high, PR, pinch_PHX, dTemp_HTF_PHX))
        f.close()

    #Writing the resfile
    if not os.path.exists(resdir):
        os.makedirs(resdir)

    fntrain = "%s/training_data.csv" % (resdir)

    #Change dir to simulationdir
    os.chdir(simdir)
    mofile = 'sCO2PBCalculator_Using_JPidea'

    #Range of variables
    UB = [1.25, T_in_ref_blk + 20, 322.9]
    LB = [0.46, T_in_ref_blk - 30, 260.9]
    LHS = lib.generate_lhs(UB, LB, 3, numdata)

    #Copy the mofile to simulationdir
    shutil.copy("%s/Models/PowerBlocks/%s.mo" % (SolarTherm_path, mofile), ".")

    #Hack mo file to change the P_net
    lib.hackmofile(mofile, './', P_net, index=21)

    #Compile the mofile
    sim = simulation.Simulator("%s.mo" % mofile, suffix="0")
    sim.compile_model()
    sim.compile_sim()

    resultclass = postproc.SimResultElec

    #Gather training data
    simulation_engine(LHS, fntrain, modelicavarname, mofile, P_net,
                      T_in_ref_blk, p_high, PR, pinch_PHX, dTemp_HTF_PHX, sim)

    #Gather validation data
    datatrain = np.genfromtxt(fntrain, delimiter=',', skip_header=1)
    num = datatrain.shape[0]
    numval = int(0.3 * num)
    LHS = lib.generate_lhs(UB, LB, 3, numval)
    fnval = "%s/validation_data.csv" % (resdir)

    simulation_engine(LHS, fnval, modelicavarname, mofile, P_net, T_in_ref_blk,
                      p_high, PR, pinch_PHX, dTemp_HTF_PHX, sim)

    inputpreprocessing = {}
    inputpreprocessing["fntrain"] = fntrain
    inputpreprocessing["resdir"] = resdir

    processing_data(inputpreprocessing)

    #return back to CWD
    os.chdir(cwd)
Example #23
0
    def test1(self):
        global VERBOSE, RUNSIM, PLOTME
        file_name = 'PhysicalParticleCO21D'
        #file_name = 'PhysicalParticleSystem1D'
        fn = ('%s.mo' % (file_name, ))
        print "Modelica File Name = " + fn
        sim = simulation.Simulator(fn)
        resfn = sim.model + '_res.mat'
        print "Modelica File Result Name = " + resfn

        if VERBOSE: print "RUNNING SETUP"

        if RUNSIM == 1:
            if VERBOSE: print "COMPILING MODEL"
            sim.compile_model(args=['-d=bltdump'])
            if VERBOSE: print "COMPILING SIM"
            sim.compile_sim(args=['-s'])
            if VERBOSE: print "SOLVING MODEL"
            reporting_interval = 1800
            step_string = '%fs' % (reporting_interval)
            stop_time = 365 * 24 * 3600
            stop_string = '%fs' % (stop_time)
            sim.simulate(start=0,
                         stop=stop_string,
                         step=step_string,
                         maxStep='300s',
                         solver='dassl',
                         nls=None
                         #,lv='LOG_DEBUG,LOG_NLS,LOG_SOLVER'#,LOG_NLS_V'
                         )

        self.res = postproc.SimResult(resfn)

        resmatfile = '/home/philgun/solartherm/examples/%s' % (
            resfn)  #getting the res_mat file
        data = DyMat.DyMatFile(
            resmatfile)  #getting the value inside the resmat file
        data2 = DyMat.DyMatFile('/home/philgun/solartherm/examples/%s' %
                                ('PhysicalParticleCO21D_res.mat'))

        if file_name == 'PhysicalParticleSystem0D':
            rcv = 'receiver.'
        elif file_name == 'PhysicalParticleCO21D_v11':
            rcv = 'particleReceiver1D_v11.'
        else:
            rcv = 'particleReceiver1D.'
        pb = 'powerBlock.'

        if file_name == 'PhysicalParticleSystem1D' or file_name == 'PhysicalParticleCO21D':
            N = data.data(rcv +
                          'N')[1]  #getval(rcv + 'N') # getval('%s.N' %(rcv,))
            print 'Particle Receiver Discretization = %f cells' % (N)

        if VERBOSE:
            print("SYSTEM'S RESULTS %s" % (file_name))
            print ""

            name_var = 'A_field'
            var = data.data(name_var)
            print 'Heliostat Field Area (m.sq) = %f' % (var[1])

            name_var = 'E_elec'
            var = data.data(
                name_var)  #getval (name_var)   #('%s.%s' %(sys,name_var))
            print 'Energy Per Year (MWh/year) = %f' % (var[-1] * 2.778e-10)

            name_var = 'E_total_loses_optical'
            var = data.data('heliostatsField.E_total_loses_optical')[
                -1]  #getval (name_var)   #('%s.%s' %(sys,name_var))
            print 'Energy losses due to optical (MWh/year) = %f' % (var *
                                                                    2.778e-10)

            name_var = 'H_tower'
            var = data.data(name_var)
            print 'Tower height (m) = %f' % (var[1])

            print ""

            print "Receiver's Geometry"

            name_var = 'A_rcv'
            var = data.data(name_var)
            print 'Total receiver area (m.sq) = %f' % (var[1])

            name_var = 'H_rcv'
            var = data.data(name_var)
            print 'Receiver height (m) = %f' % (var[1])

            name_var = 'A_rcv'
            var = data.data(name_var)
            print 'Receiver aperture area (m.sq) = %f' % (var[1])
            print ""

            print "PLANT'S ANALYTICS"  #two type curtailments 1 shutdown the heliostat 2 defocusing
            print ""
            print "Energy Analytics"
            name_var = 'E_resource'
            var = data.data(name_var)
            print "Annual Sun's Energy coming to the heliostat field before cosine loses and curtailment  (MWh/year) = %f" % (
                var[-1] * 2.778e-10)

            name_var = 'E_helio_incident'
            var = data.data(name_var)[-1]
            print "Annual energy incident of the heliostat field after curtailment due to low DNI / high windspeed  (MWh/year) = %f" % (
                var * 2.778e-10)

            name_var = 'E_helio_raw'
            var = data.data(name_var)[-1]
            print "Annual energy delivered by the heliostat field before defocusing curtailment (MWh/year) = %f" % (
                var * 2.778e-10)

            name_var = 'E_helio_net'
            var = data.data(name_var)[-1]
            print "Annual energy delivered by the heliostat to the receiver after every curtailments (MWh/year) = %f" % (
                var * 2.778e-10)

            name_var = 'E_recv_incident'
            var = data.data(name_var)[-1]
            print "Annual energy delivered to the receiver by heliostat (MWh/year) = %f" % (
                var * 2.778e-10)

            name_var = 'E_recv_net'
            var = data.data(name_var)[-1]
            print "Annual energy absorbed by the working fluid in the receiver (MWh/year) = %f" % (
                var * 2.778e-10)

            name_var = 'E_pb_input'
            var = data.data(name_var)[-1]
            print "Annual energy delivered to the power block  (MWh/year) = %f" % (
                var * 2.778e-10)

            name_var = 'E_pb_gross'
            var = data.data(name_var)[-1]
            print "Annual energy produced by the turbine's shaft  (MWh/year) = %f" % (
                var * 2.778e-10)

            name_var = 'E_pb_net'
            var = data.data(name_var)[-1]
            print "Annual net energy produced by the system (MWh/year) = %f" % (
                var * 2.778e-10)
            print '#################################################################################################################'
            print ""
            print "Efficiency Analytics"

            name_var = 'eta_curtail_off'
            var = data.data(name_var)[-1]
            print "Annual Efficiency of the heliostat due to low DNI/high windspeed curtailment = %f" % (
                var)

            name_var = 'eta_optical'
            var = data.data(name_var)[-1]
            print "Annual Efficiency of the heliostat due to field efficiency = %f" % (
                var)

            name_var = 'he_av_design'
            var = data.data(name_var)[1]
            print "Annual Efficiency of the heliostat due availability = %f" % (
                var)

            name_var = 'eta_curtail_defocus'
            var = data.data(name_var)[-1]
            print "Annual Efficiency of the heliostat due to defocus curtailment = %f" % (
                var)

            if resfn == 'PhysicalParticleCO21D_res.mat' or resfn == 'PhysicalParticleSystem1D._res.mat':
                print "Annual Efficiency of the receiver due to absorption = %s" % (
                    'N/A')
            else:
                name_var = 'eta_recv_abs'
                var = data.data(name_var)[-1]
                print "Annual Efficiency of the receiver due to absorption = %s" % (
                    'N/A')

            name_var = 'eta_recv_thermal'
            var = data.data(name_var)[-1]
            print "Annual Efficiency of the receiver due to heat losses and physics phenomena in the receiver = %f" % (
                var)

            name_var = 'eta_storage'
            var = data.data(name_var)[-1]
            print "Annual Efficiency of the storage due to losses in the storage system = %f" % (
                var)

            name_var = 'eta_pb_gross'
            var = data.data(name_var)[-1]
            print "Annual Efficiency of the power block (ratio between power gross power block / heat input to the heat exchanger) = %f" % (
                var)

            name_var = 'eta_pb_net'
            var = data.data(name_var)[-1]
            print "Annual Efficiency of the power block (ratio between net power produced by power block sub system / power produced by turbine shaft)  = %f" % (
                var)

            name_var = 'eta_solartoelec'
            var = data.data(name_var)[-1]
            print "Annual Efficiency of system (solar energy / generated electrical energy) = %f" % (
                var)

            print '#################################################################################################################'
            print "TOTAL PLANT'S COST (million AUD) = %f " % (
                data.data('C_cap')[1] / 1e6)
            print "TOTAL EQUIPMENTS COST (million AUD) = %f " % (
                data.data('C_cap_total')[1] / 1e6)
            print "Contingency, indirect and construction cost constants = %f" % (
                (data.data('r_contg')[1] + 1) *
                (data.data('r_indirect')[1] + 1) *
                (data.data('r_cons')[1] + 1))
            print ""
            print "Annual OnM (million AUD) = %f " % (data.data('C_year')[1] /
                                                      1e6)

            print '#################################################################################################################'
            print ""

            print "Site's, land and heliostat field's cost (million AUD) = %f" % (
                (data.data('C_field')[1] + data.data('C_site')[1] +
                 data.data('C_land')[1]) / 1e6)

            name_var = 'C_field'
            var = data.data(name_var)[1]
            print 'Capital cost of the solar field (million AUD) = %f' % (
                (var) / 1e6)

            name_var = 'C_site'
            var = data.data(name_var)[1]
            print 'Capital cost of site improvement work (million AUD) = %f' % (
                (var) / 1e6)

            name_var = 'C_land'
            var = data.data(name_var)[1]
            print 'Capital cost of land (million AUD) = %f' % ((var) / 1e6)

            print '#################################################################################################################'
            print ""

            print "Falling particle receiver sub-system cost (million AUD)= %f" % (
                (data.data('C_receiver')[1]) / 1e6)

            name_var = 'C_tower'
            var = data.data(name_var)[1]
            print 'Capital cost of the tower (million AUD) = %f' % (
                (var) / 1e6)

            name_var = 'C_fpr'
            var = data.data(name_var)[1]
            print 'Capital cost of the falling particle receiver (million AUD) = %f' % (
                (var) / 1e6)

            name_var = 'C_lift_rec'
            var = data.data(name_var)[1]
            print 'Capital cost of the receiver lift (million AUD) = %f' % (
                (var) / 1e6)

            print '#################################################################################################################'
            print ""

            print 'Storage Tank / Bin costs (million AUD)= %f' % (
                (data.data('C_storage')[1]) / 1e6)

            name_var = 'C_bins'
            var = data.data(name_var)[1]
            print 'Total capital cost hot and cold storage bins (million AUD) = %f' % (
                (var) / 1e6)

            name_var = 'C_particles'
            var = data.data(name_var)[1]
            print 'Total capital cost of the particles (million AUD) = %f' % (
                (var) / 1e6)

            name_var = 'C_lift_hx'
            var = data.data(name_var)[1]
            print 'Capital cost of the heat exchanger lift (power block) (million AUD) = %f' % (
                (var) / 1e6)

            name_var = 'C_lift_cold'
            var = data.data(name_var)[1]
            print 'Capital cost of the cold storage lift (million AUD) = %f' % (
                (var) / 1e6)

            print '#################################################################################################################'

            if fn == 'PhysicalParticleSystem1D.mo' or fn == 'PhysicalParticleSystem0D.mo':

                print 'Power Block sub-system cost (million AUD)= %f' % (
                    (data.data('C_pb')[1]) / 1e6)

            else:

                print 'Power Block sub-system cost (million AUD)= %f' % (
                    (data.data('C_block')[1]) / 1e6)

                name_var = 'C_LTR'
                var = data.data(pb + name_var)[1]
                print 'Capital cost of the low temperature recuperator (million AUD) = %f' % (
                    (var) / 1e6)

                name_var = 'C_HTR'
                var = data.data(pb + name_var)[1]
                print 'Capital cost of the high temperature recuperator (million AUD) = %f' % (
                    (var) / 1e6)

                name_var = 'C_cooler'
                var = data.data(pb + name_var)[1]
                print 'Capital cost of the air-cooler CO2 (million AUD) = %f' % (
                    var / 1e6)

                name_var = 'C_exchanger'
                var = data.data(pb + name_var)[1]
                print 'Capital cost of the main heat exchager (between CO2 and Particle) (million AUD) = %f' % (
                    (var) / 1e6)

                name_var = 'C_generator'
                var = data.data(pb + name_var)[1]
                print 'Capital cost of the generator (million AUD) = %f' % (
                    (var) / 1e6)

                name_var = 'C_mainCompressor'
                var = data.data(pb + name_var)[1]
                print 'Capital cost of the main compressor (million AUD) = %f' % (
                    (var) / 1e6)

                name_var = 'C_reCompressor'
                var = data.data(pb + name_var)[1]
                print 'Capital cost of the recompressor (million AUD) = %f' % (
                    (var) / 1e6)

                name_var = 'C_turbine'
                var = data.data(pb + name_var)[1]
                print 'Capital cost of the turbine (million AUD) = %f' % (
                    (var) / 1e6)
            print '#################################################################################################################'
            print ""
        resultclass = postproc.SimResultElec  #calling the class of SimResultElec in postproc.py
        res = resultclass(
            resfn
        )  #passing the resmatfile into resultclass (postproc.SimResultElec)
        result = res.calc_perf(
        )  #calculating result by calling calc_perf function inside the resultclass class

        print '#################################################################################################################'
        print "Energy Per Year(MWh/year) = %f, LCOE(USD/MWh) = %f, Capacity Factor(%%)= %f, Spot Market Revenue(million USD/year) = %f" % (
            result[0], result[1], result[2], result[3] / 1e6
        )  #printing the postproc result

        #vl = ['N','T_s[1]','T_s[%d]'%(N+1,), 'mdot', 'q_solar','A_ap'
        #	,'eta_rec','eps_c[%d]'%(N,)
        #	,'H_drop','W_rcv','t_c_in']
        #for v in vl:
        #	print '%s = %f' %(v,getval('revOneDPGv2LookUpTable.%s'%(v,)))
        #for v in ['Qdot_rec','Qdot_inc']:
        #	print '%s = %f MW' %(v,getval('revOneDPGv2LookUpTable.%s'%(v,))/1e6)
        #for T in ['T_in','T_out']:
        #	#print '%s = %f°C'%(T,getval('revOneDPGv2LookUpTable.%s'%(T,))-273.15)
        #print 'T_in = %f°C'%(getval('revOneDPGv2LookUpTable.T_s[1]')-273.15)
        #print 'T_out= %f°C'%(getval('revOneDPGv2LookUpTable.T_s[%d]'%(N+1,))-273.15)

        if PLOTME:
            import matplotlib
            matplotlib.use('GTKCairo')
            import matplotlib.pyplot as pl
            #nr = 1; nc = 1; sp=0 #nr = number of row , nc = nuber of column, sp = space between plot
            time = data.abscissa(rcv + 'eta_rec', valuesOnly=True)
            eta_rec_v11 = data.data(rcv + 'eta_rec')
            eta_rec_v9 = data2.data('particleReceiver1D.' + 'eta_rec')
            Qdot_rec_v11 = data.data(rcv + 'Qdot_rec') * 100
            Qdot_rec_v9 = data2.data('particleReceiver1D.' + 'Qdot_rec') * 100
            #print type(y)
            #print np.shape(y)
            #print type(time)
            #print np.shape(time)
            #print '**********************************'
            #print ''

            fig = pl.figure()
            #sp+=1; ax1 = pl.subplot(nr,nc,sp)
            pl.xlim(170 * 24 * 3600, 173 * 24 * 3600)
            pl.plot(time, eta_rec_v11, label='v_11')
            pl.plot(time, eta_rec_v9, label='v_09')
            pl.legend(fontsize=20)
            pl.ylabel('Efficiency of the receiver', fontsize=40)
            pl.xlabel('Time', fontsize=40)
            pl.title('Receiver efficiency at day 170 to 172', fontsize=40)
            pl.show()

            pl.xlim(170 * 24 * 3600, 173 * 24 * 3600)
            pl.plot(time, Qdot_rec_v11, label='v_11')
            pl.plot(time, Qdot_rec_v9, label='v_09')
            pl.legend(fontsize=20)
            pl.ylabel('Energy (MW)', fontsize=40)
            pl.xlabel('Time', fontsize=40)
            pl.title('Energy absorbed by particle at day 170 to 172',
                     fontsize=40)
            pl.show()