armi.bookkeeping.historyTracker module

The History Tracker is a bookkeeping interface that accesses and reports time-dependent state information from the database.

At the end of a run, these write text files to show the histories for various follow-on mechanical analysis, fuel performance analysis, etc.

Other interfaces may find this useful as well, to get an assembly history for fuel performance analysis, etc. This is particularly useful in equilibrium runs, where the EqHistoryTrackerInterface will unravel the full history from a single equilibrium cycle.

Getting history information

Loop over blocks, keys, and timesteps of interest and use commands like this:

history.getBlockHistoryVal(armiBlock.getName(), key, ts)

Using the database-based history trackers

You can pre-load information before gathering it to get much better performance:

history.preloadBlockHistoryVals(blockNames, historyKeys, timeSteps)

This is essential for performance when history information is going to be accessed in loops over assemblies or blocks. Reading each param directly from the database individually in loops is paralyzingly slow.

Specifying parameters to add to the EOL history report

To add state parameters to the list of things that get their history reported, you need to define an interface method called getHistoryParams. It should return a list of block parameters that will become available. For example:

def getHistoryParams(self):
    return ['flux', 'percentBu']

When you’d like to access history information, you need to grab the history interface. The history interfaces is present by default in your interface stack. To get it, just call:

history = self.getInterface('history')

Now you can do a few things, such as:

# get some info about what's stored in the history
assemsWithHistory = history.getDetailAssemblies()
timeStepsAvailable = history.getTimeIndices()

# now go out and get some time-dependent block params:
fluxAtTimeStep3 = history.getBlockHistoryVal('B1003A', 'flux', 3)

Specifying blocks and assemblies to track

See Detail assemblies.

armi.bookkeeping.historyTracker.describeInterfaces(cs)[source]

Function for exposing interface(s) to other code.

class armi.bookkeeping.historyTracker.HistoryTrackerInterface(r, cs)[source]

Bases: Interface

Makes reports of the state that individual assemblies encounter.

Notes

This pre-dates the ARMI database system, and we would like to stop supporting this. Please don’t find new uses for this; use the databases.

Variables:
  • detailAssemblyNames (list) – List of detail assembly names in the reactor

  • time (list) – list of reactor time in years

HistoryTracker that uses the database to look up parameter history rather than storing them in memory.

Warning

If the current timestep history is requested and the database has not yet been written this timestep, the current value of the requested parameter is provided. It is possible that this is not the value that will be written to the database during this time step since many interfaces that change parameters may interact between this call and the database write.

name: Optional[str] = 'history'

The name of the interface. This is undefined for the base class, and must be overridden by any concrete class that extends this one.

interactBOL()[source]
interactBOC(cycle=None)[source]

Look for any new assemblies that are asked for and add them to tracking.

interactEOL()[source]

Generate the history reports.

addDetailAssembliesBOL()[source]

Find and activate assemblies that the user requested detailed treatment of.

addAllFuelAssems()[source]

Add all fuel assems as detail assems.

addDetailAssemsByAssemNums()[source]

Activate detail assemblies from input based on assembly number.

This is used to activate detail assembly tracking on assemblies that are not present in the core at BOL.

See also

addDetailAssembliesBOL

Similar but for BOL

getTrackedParams()[source]

Give the list of block parameters that are being tracked.

addDetailAssembly(a)[source]

Track the name of assemblies that are flagged for detailed treatment.

getDetailAssemblies()[source]

Returns the assemblies that have been signaled as detail assemblies.

getDetailBlocks()[source]

Get all blocks in all detail assemblies.

filterTimeIndices(timeIndices, boc=False, moc=False, eoc=False)[source]

Takes a list of time indices and filters them down to boc moc or eoc.

writeAssemHistory(a, fName='')[source]

Write the assembly history report to a text file.

preloadBlockHistoryVals(names, keys, timesteps)[source]

Pre-load block data so it can be more quickly accessed in the future.

Notes

Pre-loading has value because the database is organized in a fashion that is easy/inexpensive to look up data for many of time steps simultaneously. These can then be stored and provided when the specific timestep is requested. The method getBlockHistoryVal still looks at the database if the preloaded values don’t have the needed data, so the same results should be given if this method is not called.

unloadBlockHistoryVals()[source]

Remove all cached db reads.

getBlockHistoryVal(name: str, paramName: str, ts: Tuple[int, int])[source]

Use the database interface to return the parameter values for the supplied block names, and timesteps.

Notes

If the current timestep history is requested and the database has not yet been written this timestep, the current value of the requested parameter is returned.

Parameters:
  • name – name of block

  • paramName – parameter keys of interest

  • ts – cycle and node from which to load data

Raises:

KeyError – When param not found in database.

getTimeSteps(a=None)[source]

Return list of time steps values (in years) that are available.

Parameters:

a (Assembly object, optional) – An assembly object designated a detail assem. If passed, only timesteps where this assembly is in the core will be tracked.

Returns:

timeSteps – times in years that are available in the history

Return type:

list

See also

getTimeIndices

gets indices where an assembly is in the core