예제 #1
0
def query(c):
    """Lists decay heats of all nuclides with respect to time for all facilities.

    Args:
        c: connection cursor to sqlite database.
    """
    # gives avogadro's number with a kg to g conversion
    ACT_CONV = 1000 * 6.022e23
    # converts from MeV/s to MW
    Q_CONV = 1.602e-19

    # SQL query returns a table with the nuclides (and their masses) transacted from reactor
    sql = ("SELECT resources.TimeCreated, compositions.NucId,"
           "compositions.MassFrac*resources.Quantity ")
    sql += (
        "FROM resources "
        "INNER JOIN compositions ON resources.QualId = compositions.QualId "
        "INNER JOIN transactions ON resources.TimeCreated = transactions.Time "
        "WHERE transactions.SenderId=13 "
        "GROUP BY resources.TimeCreated, compositions.NucId "
        "ORDER BY resources.TimeCreated;")
    cur = c.execute(sql)
    results = cur.fetchall()

    alldecayheats = []

    # Calculates decay heat (MW) at each timestep
    for time_step, nuc, mass in results:
        act = ACT_CONV * mass * data.decay_const(nuc) / data.atomic_mass(nuc)
        dh = Q_CONV * act * data.q_val(nuc)
        row = (time_step, nuc, dh)
        alldecayheats.append(row)

    return alldecayheats
예제 #2
0
def query(c):
    """Lists decay heats of all nuclides with respect to time for all facilities.

    Args:
        c: connection cursor to sqlite database.
    """
    # gives avogadro's number with a kg to g conversion
    ACT_CONV = 1000*6.022e23
    # converts from MeV/s to MW
    Q_CONV = 1.602e-19
    
    # SQL query returns a table with the nuclides (and their masses) transacted from reactor
    sql = ("SELECT resources.TimeCreated, compositions.NucId," 
           "compositions.MassFrac*resources.Quantity ")
    sql += ("FROM resources "
            "INNER JOIN compositions ON resources.QualId = compositions.QualId "
            "INNER JOIN transactions ON resources.TimeCreated = transactions.Time "
            "WHERE transactions.SenderId=13 "
            "GROUP BY resources.TimeCreated, compositions.NucId "
            "ORDER BY resources.TimeCreated;")
    cur = c.execute(sql)
    results = cur.fetchall()

    alldecayheats = []

    # Calculates decay heat (MW) at each timestep
    for time_step, nuc, mass in results:
        act = ACT_CONV * mass * data.decay_const(nuc) / data.atomic_mass(nuc)
        dh = Q_CONV * act * data.q_val(nuc)
        row = (time_step, nuc, dh)
        alldecayheats.append(row)

    return alldecayheats
예제 #3
0
def decay_heat(series):
    """Decay heat metric returns the instantaneous decay heat of a nuclide 
    in a material (Q value * activity) indexed by the SimId, QualId, 
    ResourceId, ObjId, TimeCreated, and NucId.
    """
    tools.raise_no_pyne('DecayHeat could not be computed', HAVE_PYNE)
    act = series[0]
    dh = []
    for (simid, qual, res, obj, time, nuc), a in act.iteritems():
        val = (data.MeV_per_MJ * a * data.q_val(nuc))
        dh.append(val)
    dh = pd.Series(dh, index=act.index)
    dh.name = 'DecayHeat'
    rtn = dh.reset_index()
    return rtn
예제 #4
0
def decay_heat(series):
    """Decay heat metric returns the instantaneous decay heat of a nuclide 
    in a material (Q value * activity) indexed by the SimId, QualId, 
    ResourceId, ObjId, TimeCreated, and NucId.
    """
    tools.raise_no_pyne('DecayHeat could not be computed', HAVE_PYNE)
    act = series[0]
    dh = []
    for (simid, qual, res, obj, time, nuc), a in act.iteritems():
        val = (data.MeV_per_MJ * a * data.q_val(nuc))
        dh.append(val)
    dh = pd.Series(dh, index=act.index)
    dh.name = 'DecayHeat'
    rtn = dh.reset_index()
    return rtn
예제 #5
0
def inventories_decayheat(evaler, facilities=(), nucs=()):
    """
    Get a Inventory PDF including the decay heat of the inventory in the selected
    facilities. Applying nuclides selection when required.

    Parameters
    ----------
    evaler : evaler
    facilities :  of the facility
    nucs :  of nuclide to select.
    """

    if len(nucs) != 0:
        nucs = format_nucs(nucs)

    df = inventories_activity(evaler, facilities, nucs)
    for i, row in df.iterrows():
        val = data.MeV_per_MJ * \
            row['Activity'] * data.q_val(int(row['NucId']))
        df.set_value(i, 'DecayHeat', val)

    return df
예제 #6
0
파일: filters.py 프로젝트: cyclus/cymetric
def inventories_decayheat(evaler, facilities=(), nucs=()):
    """
    Get a Inventory PDF including the decay heat of the inventory in the selected
    facilities. Applying nuclides selection when required.

    Parameters
    ----------
    evaler : evaler
    facilities :  of the facility
    nucs :  of nuclide to select.
    """

    if len(nucs) != 0:
        nucs = format_nucs(nucs)

    df = inventories_activity(evaler, facilities, nucs)
    for i, row in df.iterrows():
        val = data.MeV_per_MJ * \
            row['Activity'] * data.q_val(int(row['NucId']))
        df.set_value(i, 'DecayHeat', val)

    return df
예제 #7
0
def test_q_val():
    assert_equal(data.q_val(110240001), 0.473)
    assert_equal(data.q_val("H1"), 0.0)
    assert_equal(data.q_val(92235), 4.674)
예제 #8
0
def test_q_val():
    assert_equal(data.q_val(110240001), 0.473)
    assert_equal(data.q_val('H1'), 0.0)
    assert_equal(data.q_val(92235), 4.674)