Exemple #1
0
def test_feed():
    xf, xp, xt = 0.0072, 0.05, 0.0025
    feed, prod, tails = 15.1596, 1.5, 13.6596
    swu = 11765.0
        
    exp = feed
    obs = enr.feed(xf, xp, xt, product=prod)
    assert_almost_equal(obs, exp, places=4)
    obs = enr.feed(xf, xp, xt, tails=tails)
    assert_almost_equal(obs, exp, places=4)
Exemple #2
0
def test_feed():
    xf, xp, xt = 0.0072, 0.05, 0.0025
    feed, prod, tails = 15.1596, 1.5, 13.6596
    swu = 11765.0

    exp = feed
    obs = enr.feed(xf, xp, xt, product=prod)
    assert_almost_equal(obs, exp, places=4)
    obs = enr.feed(xf, xp, xt, tails=tails)
    assert_almost_equal(obs, exp, places=4)
Exemple #3
0
def fco_u_mined(series):
    """FcoUMined metric returns the uranium mined in tonnes 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('U_Mined 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'])
    u = []
    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]
        feed = enr.feed(x_feed, x_prod, x_tails, product=prods[obj]) / 1000
        u.append(feed)
    m = m.groupby(level=['ObjId', 'TimeCreated'])['Mass'].sum()
    m = m.reset_index()
    # sum by years (12 time steps)
    u = pd.DataFrame(data={'Year': m.TimeCreated.apply(lambda x: x//12), 
                           'UMined': u}, columns=['Year', 'UMined'])
    u = u.groupby('Year').sum()
    rtn = u.reset_index()
    return rtn
Exemple #4
0
def fco_u_mined(series):
    """FcoUMined metric returns the uranium mined in tonnes for each year 
    in a 200-yr simulation. This is written for FCO databases that use the 
    Bright-lite Fuel Fab(i.e., the U235 and U238 are given separately in the 
    FCO simulations)."""
    mass = pd.merge(series[0].reset_index(), series[1].reset_index(), 
            on=['ResourceId'], how='inner').set_index(['ObjId', 
                'TimeCreated', 'NucId'])
    u = []
    prods = {}
    mass235 = {}
    m = mass[mass['Commodity'] == 'LWR Fuel']
    for (obj, _, nuc), value in m.iterrows():
        prods[obj] = prods.get(obj, 0.0) + value['Mass']
        if nuc==922350000:
            mass235[obj] = value['Mass']
    for obj, m235 in mass235.items():
        x_prod = m235 / prods[obj]
        feed = enr.feed(0.0072, x_prod, 0.0025, product=prods[obj]) / 1000
        u.append(feed)
    m = m.groupby(level=['ObjId', 'TimeCreated'])['Mass'].sum()
    m = m.reset_index()
    # sum by years (12 time steps)
    u = pd.DataFrame(data={'Year': m.TimeCreated.apply(lambda x: x//12), 
                           'FcoUMined': u}, columns=['Year', 'FcoUMined'])
    u = u.groupby('Year').sum()
    rtn = u.reset_index()
    return rtn
Exemple #5
0
def fco_u_mined(series):
    """FcoUMined metric returns the uranium mined in tonnes for each year 
    in a 200-yr simulation. This is written for FCO databases that use the 
    Bright-lite Fuel Fab(i.e., the U235 and U238 are given separately in the 
    FCO simulations)."""
    mass = pd.merge(series[0].reset_index(),
                    series[1].reset_index(),
                    on=['ResourceId'],
                    how='inner').set_index(['ObjId', 'TimeCreated', 'NucId'])
    u = []
    prods = {}
    mass235 = {}
    m = mass[mass['Commodity'] == 'LWR Fuel']
    for (obj, _, nuc), value in m.iterrows():
        prods[obj] = prods.get(obj, 0.0) + value['Mass']
        if nuc == 922350000:
            mass235[obj] = value['Mass']
    for obj, m235 in mass235.items():
        x_prod = m235 / prods[obj]
        feed = enr.feed(0.0072, x_prod, 0.0025, product=prods[obj]) / 1000
        u.append(feed)
    m = m.groupby(level=['ObjId', 'TimeCreated'])['Mass'].sum()
    m = m.reset_index()
    # sum by years (12 time steps)
    u = pd.DataFrame(data={
        'Year': m.TimeCreated.apply(lambda x: x // 12),
        'FcoUMined': u
    },
                     columns=['Year', 'FcoUMined'])
    u = u.groupby('Year').sum()
    rtn = u.reset_index()
    return rtn
Exemple #6
0
def fco_u_mined(mats, trans):
    """FcoUMined metric returns the uranium mined in tonnes 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('U_Mined could not be computed', HAVE_PYNE)
    mass = pd.merge(mats, trans, on=['ResourceId'], how='inner')
    mass = mass.set_index(['ObjId', 'TimeCreated', 'NucId'])
    u = []
    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]
        feed = enr.feed(x_feed, x_prod, x_tails, product=prods[obj]) / 1000
        u.append(feed)
    m = m.groupby(level=['ObjId', 'TimeCreated'])['Mass'].sum()
    m = m.reset_index()
    # sum by years (12 time steps)
    u = pd.DataFrame(data={'Year': m.TimeCreated.apply(lambda x: x//12),
                           'UMined': u}, columns=['Year', 'UMined'])
    u = u.groupby('Year').sum()
    rtn = u.reset_index()
    return rtn
Exemple #7
0
 def __call__(self, qty, enr, commod=None):
     return enrichment.feed(0.0072, enr / 100., 0.0025, product=qty)