def setUp(self): fn = '../examples/TroughWagner.mo' sim = simulation.Simulator(fn) sim.compile_model() sim.compile_sim(args=['-s']) sim.simulate(start=0, stop='1y', step='5m') self.res = postproc.SimResultElec(sim.res_fn) self.perf = self.res.calc_perf()
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()
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')