def test_swu(): xf, xp, xt = 0.0072, 0.05, 0.0025 feed, prod, tails = 15.1596, 1.5, 13.6596 swu = 11765.0 / 1e3 exp = swu obs = enr.swu(xf, xp, xt, feed=feed) assert_almost_equal(obs, exp, places=3) obs = enr.swu(xf, xp, xt, product=prod) assert_almost_equal(obs, exp, places=3) obs = enr.swu(xf, xp, xt, tails=tails) assert_almost_equal(obs, exp, places=3)
def fco_swu(series): """FcoSwu metric returns the separative work units required for each year in a simulation. This is written for simulations that use the Bright-lite Fuel Fab (i.e., the U235 and U238 are given separately in the FCO simulations, and the filtering is archetype-specific). """ tools.raise_no_pyne('SWU Required could not be computed', HAVE_PYNE) mass = pd.merge(series[0].reset_index(), series[1].reset_index(), on=['ResourceId'], how='inner').set_index(['ObjId', 'TimeCreated', 'NucId']) swu = [] prods = {} mass235 = {} m = mass[mass['Commodity'] == 'LWR Fuel'] for (obj, _, nuc), value in m.iterrows(): if 922320000 <= nuc <= 922390000: prods[obj] = prods.get(obj, 0.0) + value['Mass'] if nuc == 922350000: mass235[obj] = value['Mass'] x_feed = 0.0072 x_tails = 0.0025 for obj, m235 in mass235.items(): x_prod = m235 / prods[obj] swu0 = enr.swu(x_feed, x_prod, x_tails, product=prods[obj]) / 1e6 swu.append(swu0) m = m.groupby(level=['ObjId', 'TimeCreated'])['Mass'].sum() m = m.reset_index() # sum by years (12 time steps) swu = pd.DataFrame(data={'Year': m.TimeCreated.apply(lambda x: x//12), 'SWU': swu}, columns=['Year', 'SWU']) swu = swu.groupby('Year').sum() rtn = swu.reset_index() return rtn
def fco_swu(series): """FcoSwu metric returns the separative work units required for each year in a 200-yr simulation. This is written for FCO databases that use the Bright-lite (i.e., the U235 and U238 are given separately in the FCO simulations). """ tools.raise_no_pyne('SWU Required could not be computed', HAVE_PYNE) mass = pd.merge(series[0].reset_index(), series[1].reset_index(), on=['ResourceId'], how='inner').set_index(['ObjId', 'TimeCreated', 'NucId']) swu = [] prods = {} mass235 = {} m = mass[mass['Commodity'] == 'LWR Fuel'] for (obj, _, nuc), value in m.iterrows(): if 922320000 <= nuc <= 922390000: prods[obj] = prods.get(obj, 0.0) + value['Mass'] if nuc == 922350000: mass235[obj] = value['Mass'] x_feed = 0.0072 x_tails = 0.0025 for obj, m235 in mass235.items(): x_prod = m235 / prods[obj] swu0 = enr.swu(x_feed, x_prod, x_tails, product=prods[obj]) / 1e6 swu.append(swu0) m = m.groupby(level=['ObjId', 'TimeCreated'])['Mass'].sum() m = m.reset_index() # sum by years (12 time steps) swu = pd.DataFrame(data={'Year': m.TimeCreated.apply(lambda x: x//12), 'SWU': swu}, columns=['Year', 'SWU']) swu = swu.groupby('Year').sum() rtn = swu.reset_index() return rtn
def __call__(self, qty, enr, commod=None): return enrichment.swu(0.0072, enr / 100., 0.0025, product=qty)