armi.operators.tests.test_operators module

Tests for operators.

class armi.operators.tests.test_operators.InterfaceA(r, cs)[source]

Bases: Interface

Construct an interface.

The r and cs arguments are required, but may be None, where appropriate for the specific Interface implementation.

Parameters:
  • r (Reactor) – A reactor to attach to

  • cs (Settings) – Settings object to use

Raises:

RuntimeError – Interfaces derived from Interface must define their name

function = 'A'

The function performed by an Interface. This is not required be be defined by implementations of Interface, but is used to form categories of interfaces.

name: str | None = 'First'

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

class armi.operators.tests.test_operators.InterfaceB(r, cs)[source]

Bases: InterfaceA

Dummy Interface that extends A.

Construct an interface.

The r and cs arguments are required, but may be None, where appropriate for the specific Interface implementation.

Parameters:
  • r (Reactor) – A reactor to attach to

  • cs (Settings) – Settings object to use

Raises:

RuntimeError – Interfaces derived from Interface must define their name

function = 'A'

The function performed by an Interface. This is not required be be defined by implementations of Interface, but is used to form categories of interfaces.

name: str | None = 'Second'

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

class armi.operators.tests.test_operators.InterfaceC(r, cs)[source]

Bases: Interface

Construct an interface.

The r and cs arguments are required, but may be None, where appropriate for the specific Interface implementation.

Parameters:
  • r (Reactor) – A reactor to attach to

  • cs (Settings) – Settings object to use

Raises:

RuntimeError – Interfaces derived from Interface must define their name

function = 'A'

The function performed by an Interface. This is not required be be defined by implementations of Interface, but is used to form categories of interfaces.

name: str | None = 'Third'

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

class armi.operators.tests.test_operators.OperatorTests(methodName='runTest')[source]

Bases: TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

test_operatorData()[source]

Test that the operator has input data, a reactor model.

Test Case: The Operator includes input data and the reactor data model. T_ARMI_OPERATOR_COMM
signature: test_operatorData
requirements: R_ARMI_OPERATOR_COMM
test_orderedInterfaces(interactAll)[source]

Test the default interfaces are in an ordered list, looped over at each time step.

Test Case: An ordered list of interfaces are run at each time step. T_ARMI_OPERATOR_INTERFACES
signature: test_orderedInterfaces
Test Case: Interfaces are run at BOC, EOC, and at time points between. T_ARMI_INTERFACE
signature: test_orderedInterfaces
requirements: R_ARMI_INTERFACE
Test Case: When users set the time discretization, it is enforced. T_ARMI_FW_HISTORY2
signature: test_orderedInterfaces
requirements: R_ARMI_FW_HISTORY
test_addInterfaceSubclassCollision()[source]
test_interfaceIsActive()[source]
test_getActiveInterfaces()[source]

Ensure that the right interfaces are returned for a given interaction state.

test_loadStateError()[source]

The loadTestReactor() test tool does not have any history in the DB to load from.

test_setStateToDefault()[source]
test_snapshotRequest(fakeDirList, fakeCopy)[source]
class armi.operators.tests.test_operators.TestCreateOperator(methodName='runTest')[source]

Bases: TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

test_createOperator()[source]

Test that an operator can be created from settings.

Test Case: Create an operator from settings. T_ARMI_OPERATOR_SETTINGS
signature: test_createOperator
class armi.operators.tests.test_operators.TestTightCoupling(methodName='runTest')[source]

Bases: TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

test_getStepLengths()[source]

Test the step lengths are correctly calculated, based on settings.

Test Case: Users can control time discretization of the simulation through settings. T_ARMI_FW_HISTORY0
signature: test_getStepLengths
requirements: R_ARMI_FW_HISTORY
test_couplingIsActive()[source]

Ensure that cs[CONF_TIGHT_COUPLING] controls couplingIsActive.

test_performTightCoupling_Inactive()[source]

Ensures no action by _performTightCoupling if cs[CONF_TIGHT_COUPLING] = false.

test_performTightCoupling_skip()[source]

Ensure that cycles within cs[CONF_CYCLES_SKIP_TIGHT_COUPLING_INTERACTION] are skipped.

test_performTightCoupling_notConverged()[source]

Ensure that the appropriate runLog.warning is addressed in tight coupling reaches max num of iters.

Test Case: The tight coupling logic can fail if there is no convergence. T_ARMI_OPERATOR_PHYSICS0
signature: test_performTightCoupling_notConverged
test_performTightCoupling_WriteDB()[source]

Ensure a tight coupling iteration accours and that a DB WILL be written if requested.

test_performTightCoupling_NoWriteDB()[source]

Ensure a tight coupling iteration accours and that a DB WILL NOT be written if requested.

dbWriteForCoupling(writeDB: bool)[source]
test_computeTightCouplingConvergence()[source]

Ensure that tight coupling convergence can be computed and checked.

Notes

  • Assertion #1: ensure that the convergence of Keff, eps, is greater than 1e-5 (the prescribed convergence criteria)

  • Assertion #2: ensure that eps is (prevIterKeff - currIterKeff)

class armi.operators.tests.test_operators.CyclesSettingsTests(methodName='runTest')[source]

Bases: TestCase

Check that we can correctly access the various cycle settings from the operator.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

detailedCyclesSettings = '\nmetadata:\n  version: uncontrolled\nsettings:\n  power: 1000000000.0\n  nCycles: 3\n  cycles:\n    - name: startup sequence\n      cumulative days: [1, 2, 3]\n      power fractions: [0.1, 0.2, 0.3]\n      availability factor: 0.1\n    - cycle length: 10\n      burn steps: 5\n      power fractions: [0.2, 0.2, 0.2, 0.2, 0]\n      availability factor: 0.5\n    - name: prepare for shutdown\n      step days: [3, R4]\n      power fractions: [0.3, R4]\n  runType: Standard\n'
test_getPowerFractions()[source]

Test that the power fractions are calculated correctly.

Test Case: Test the powerFractions are retrieved correctly for multiple cycles. T_ARMI_SETTINGS_POWER1
signature: test_getPowerFractions
requirements: R_ARMI_SETTINGS_POWER
test_getCycleNames()[source]
test_getAvailabilityFactors()[source]

Check that the “availability factor” is correctly set from the “cycles” setting.

Test Case: Users can manually control time discretization of the simulation. R_ARMI_FW_HISTORY3
signature: test_getAvailabilityFactors
requirements: R_ARMI_FW_HISTORY
test_getStepLengths()[source]

Test that the manually-set, detailed time steps are retrievable.

Test Case: Users can manually control time discretization of the simulation. T_ARMI_FW_HISTORY1
signature: test_getStepLengths
requirements: R_ARMI_FW_HISTORY
test_getCycleLengths()[source]

Check that the “cycle length” is correctly set from the “cycles” setting.

Test Case: Users can manually control time discretization of the simulation. R_ARMI_FW_HISTORY4
signature: test_getCycleLengths
requirements: R_ARMI_FW_HISTORY
test_getBurnSteps()[source]

Check that the “burn steps” is correctly set from the “cycles” setting.

Test Case: Users can manually control time discretization of the simulation. R_ARMI_FW_HISTORY5
signature: test_getBurnSteps
requirements: R_ARMI_FW_HISTORY
test_getMaxBurnSteps()[source]

Check that the max of the “burn steps” is correctly set from the “cycles” setting.

Test Case: Users can manually control time discretization of the simulation. R_ARMI_FW_HISTORY6
signature: test_getMaxBurnSteps
requirements: R_ARMI_FW_HISTORY
class armi.operators.tests.test_operators.TestInterfaceAndEventHeaders(methodName='runTest')[source]

Bases: TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

test_expandCycleAndTimeNodeArgs_Empty()[source]

When cycleNodeInfo should be an empty string.

test_expandCycleAndTimeNodeArgs_Cycle()[source]

When cycleNodeInfo should return only the cycle.

test_expandCycleAndTimeNodeArgs_EveryNode()[source]

When cycleNodeInfo should return the cycle and node.

test_expandCycleAndTimeNodeArgs_Coupled()[source]

When cycleNodeInfo should return the cycle, node, and iteration number.

class armi.operators.tests.test_operators.OperatorRestartTests(methodName='runTest')[source]

Bases: TestCase

Tests on the behavior of the interactAllRestart hook.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

test_nominalRestart()[source]

Make sure the database interface is uniquely called and the interactRestart is not called for DB.

We need to make sure the database interface loads the reactor before every other interface goes first. But then, when all the interfaces get their chance to interactRestart, the database interface does not. Since it did it’s work already.

patchCS(**kwargs)[source]

Patch the case settings, restoring at the end of the context block.

Kwargs are key: value pairs for settings to be modified.

Can’t use patch.dict because case settings don’t have at least a .copy method that patch.dict expects.

test_callPreviousEOC()[source]

When restarting at the start of the cycle, make sure we call the previous interactEOC for all interfaces.

test_noDatabaseNoRestart()[source]

Ensure there must be a database interface responsible for loading from database.