armi.reactor.zones module
A Zone object is a collection of locations in the Core. A Zones object is a collection of Zone objects. Together, they are used to conceptually divide the Core for analysis.
- class armi.reactor.zones.Zone(name: str, locations: ~typing.List | None = None, zoneType: type = <class 'armi.reactor.assemblies.Assembly'>)[source]
Bases:
object
A group of locations in the Core, used to divide it up for analysis. Each location represents an Assembly or a Block.
The Zone class facilitates the creation of a Zone object representing a collection of locations in the Core. A Zone contains a group of locations in the Core, used to subdivide it for analysis. Each location represents an Assembly or a Block, where a single Zone must contain items of the same type (i.e., Assembly or Block). Methods are provided to add or remove one or more locations to/from the Zone, and similarly, add or remove one or more items with a Core location (i.e., Assemblies or Blocks) to/from the Zone. In addition, several methods are provided to facilitate the retrieval of locations from a Zone by performing functions to check if a location exists in the Zone, looping through the locations in the Zone in alphabetical order, and returning the number of locations in the Zone, etc.
- VALID_TYPES = (<class 'armi.reactor.assemblies.Assembly'>, <class 'armi.reactor.blocks.Block'>)
- addLoc(loc: str) None [source]
Adds the location to this Zone.
- Parameters:
loc (str) – Location within the Core.
Notes
This method does not validate that the location given is somehow “valid”. We are not doing any reverse lookups in the Reactor to prove that the type or location is valid. Because this would require heavier computation, and would add some chicken-and-the-egg problems into instantiating a new Reactor.
- removeLoc(loc: str) None [source]
Removes the location from this Zone.
- Parameters:
loc (str) – Location within the Core.
Notes
This method does not validate that the location given is somehow “valid”. We are not doing any reverse lookups in the Reactor to prove that the type or location is valid. Because this would require heavier computation, and would add some chicken-and-the-egg problems into instantiating a new Reactor.
- Return type:
None
- addLocs(locs: List) None [source]
Adds the locations to this Zone.
- Parameters:
items (list) – List of str objects
- removeLocs(locs: List) None [source]
Removes the locations from this Zone.
- Parameters:
items (list) – List of str objects
- addItem(item: Assembly | Block) None [source]
Adds the location of an Assembly or Block to a zone.
- Parameters:
item (Assembly or Block) – A single item with Core location (Assembly or Block)
- removeItem(item: Assembly | Block) None [source]
Removes the location of an Assembly or Block from a zone.
- Parameters:
item (Assembly or Block) – A single item with Core location (Assembly or Block)
- class armi.reactor.zones.Zones[source]
Bases:
object
Collection of Zone objects.
The Zones class facilitates the creation of a Zones object representing a collection of Zone objects. Methods are provided to add or remove one or more Zone to/from the Zones object. Likewise, methods are provided to validate that the zones are mutually exclusive, obtain the location labels of zones, return the Zone object where a particular Assembly or Block resides, sort the Zone objects alphabetically, and summarize the zone definitions. In addition, methods are provided to facilitate the retrieval of Zone objects by name, loop through the Zones in order, and return the number of Zone objects.
Build a Zones object.
- property names: List
Ordered names of contained zones.
- Returns:
Alphabetical collection of Zone names
- Return type:
- addZone(zone: Zone) None [source]
Add a zone to the collection.
- Parameters:
zone (Zone) – A new Zone to add to this collection.
- addZones(zones: List) None [source]
Add multiple zones to the collection, and validate the Zones collection still make sense.
- Parameters:
zones (List (or Zones)) – A multiple new Zone objects to add to this collection.
- removeZone(name: str) None [source]
Delete a zone by name.
- Parameters:
name (str) – Name of zone to remove
- removeZones(names: List) None [source]
Delete multiple zones by name.
- Parameters:
names (List (or names)) – Multiple Zone names to remove from this collection.
- checkDuplicates() None [source]
Validate that the zones are mutually exclusive.
That is, make sure that no item appears in more than one Zone.
- getZoneLocations(zoneNames: List) Set [source]
Get the location labels of a particular (or a few) zone(s).
- getAllLocations() Set [source]
Return all locations across every Zone in this Zones object.
- Returns:
A combination set of all locations, from every Zone
- Return type:
- findZoneItIsIn(a: Assembly | Block) Zone | None [source]
Return the zone object that this Assembly/Block is in.
- Parameters:
a (Assembly or Block) – The item to locate
- Returns:
zone
- Return type:
Zone object that the input item resides in.
- sortZones(reverse=False) None [source]
Sorts the Zone objects alphabetically.
- Parameters:
reverse (bool, optional) – Whether to sort in reverse order, by default False
- summary() None [source]
Summarize the zone definitions clearly, and in a way that can be copy/pasted back into a settings file under “zoneDefinitions”, if the user wants to manually reuse these zones later.
Examples
zoneDefinitions: - ring-1: 001-001 - ring-2: 002-001, 002-002 - ring-3: 003-001, 003-002, 003-003