MINTS
Containers Module
The Containers module contains the implementation for Material Balance Areas in the fuel cycle. Anywhere that material is stored (including in the core of reactors) is an MBA, and all material flow occurs from one MBA to another. When items are moved into or out of an MBA, records are kept of what is being transferred and when. Additionally, at each timestep, each MBA stores an inventory record in the form of a Pandas DataFrame recording a snapshot of the inventory during the timestep.
There are two types of containers implemented in MINTS: MonitoredContainers, which are representative of bulk stores, where the MBA contains a bulk amount of some material, and MonitoredFilterStores, which are representative of item stores, where the MBA contains items with unique IDs and weights, and material is moved into and out of the MBA in whole-unit quantities.
For each type of facility, material is removed via requesting material via the submit_order method. Facilities order material from MBAs during each timestep, and when the order is placed the orders are placed into a queue maintained by the MBA. At the end of each timestep, each container sorts this queue by the priority of the ordering facility, and then serves the placed orders based on priority until either 1) all orders have been fufilled or 2) the container runs out of material for the given timestep.
- class mints.containers.MonitoredContainer(env, *args, **kwargs)
Bases:
ContainerThe MonitoredContainer class represents a bulk store MBA in the fuel cycle, where material can be added and removed from the MBA in bulk quantities by weight.
Inherits Container class from simpy. Appends (time,level) of the container to self.data everytime the level changes (put,get are called))
- generate_ins_and_outs_table()
Create the input/output table for the fuel cycle simulation
The input and output table is a pandas dataframe where each row is a week of the fuel cycle simulation, and in each row there are columns for the amount of material which came into the bulk store during the week and a column for the amount of material which left the bulk store during the week.
- Returns:
Table of inputs and outputs for the MBA
- Return type:
pd.DataFrame
- generate_inventory_table()
Return a dataframe representation of the inventory
- Returns:
Inventory of container represented as a Pandas DataFrame
- Return type:
DataFrame
- get(*args, **kwargs)
Get a quantity of material from the bulk container
- Return type:
StoreGet
- put(*args, **kwargs)
Put a quantity of material into a bulk container
- Return type:
StorePut
- submit_order(quantity, priority)
Request a quantity of material from the container with the given priority
- Parameters:
quantity (float | int) – Quantity of bulk material requested
priority (int) – Priority of requesting facility (lower value = higher priority)
- Returns:
- Simpy Event for request; yielding on return value will suspend the parent
process until the order is fufilled
- Return type:
Event
- class mints.containers.MonitoredFilterStore(env, *args, **kwargs)
Bases:
FilterStoreThe MonitoredFilterStore implements an item type MBA in the fuel cycle simulation, where each item in the store has a unique id and properties, and material enters and leaves the store in whole-item incremements.
Inherits from simpy.FilterStore. Updates inventory/data after each get() and push() opperation if the inventory has changed
- check_quantity(material=None, form=None)
Check quantity, taking into account arrival time
TODO: Add filtering based on item isotopics (material) and form to implement container which store multiple item types.
- Parameters:
material (_type_, optional) – Material type to search for. Defaults to None.
form (_type_, optional) – Item form to search for, e.g. ‘drum’. Defaults to None.
- Returns:
Number of items in the store matching the search parameters
- Return type:
int
- check_quantity_present(material=None, form=None)
Check quantity method which ignores arrival time
- Return type:
int
- generate_ins_and_outs_table()
Generate the input/output table for this MBA
- Returns:
Table of inputs and outputs
- Return type:
pd.DataFrame
- generate_inventory_table()
Generate the full inventory table for this MBA
The final inventory table is a concatenation of all inventory tables from the weeks of the simulation, with an additional column added indicating the week the record was reorded
- Returns:
Output inventory table
- Return type:
pd.DataFrame
- get(condition, *args)
Retrieve an item from the store
- Parameters:
condition (callable) – lambda function which will filter items based on desired criteria
- Returns:
Successful event if item is available
- Return type:
StoreGet
- put(*args)
Put an item into the store and record into the inventory table
- Returns:
_description_
- Return type:
StorePut
- remove_from_inventory(items)
Remove a list of items from the inventory record
- Parameters:
items (list) – List of items which are being removed from the MBA
- submit_order(quantity, material=None, form=None, priority=1)
Submit a retrieval order based on material type, form, and priority.
- Parameters:
quantity (int) – Number of items desired
material (str, optional) – Material type of desired items. Defaults to None.
form (str, optional) – Physical form of desired items. Defaults to None.
priority (int, optional) – Priority of ordering facility. Defaults to 1.
- Return type:
Event
Resources Module
The Resources module contains implementations for classes representing Items and Materials in the fuel cycle simulation.
Items are simulation entities such as drums of material, fuel assemblies, batches of pellets, etc.
Materials are representative of specific chemical resources (e.g. UO2, U3O8), and maintain the name of the material as well as the material isotopics, enrichment, etc.
- class mints.resources.Assembly(id, weight, when, where, what, arrival_time)
Bases:
ItemItem class wrapper for fuel assemblies
- class mints.resources.BatchedResource(id, when, where, what, arrival_time, batch_size=0, weights=None, weight_distribution=<bound method RandomState.normal of RandomState(MT19937)>, weight_distribution_parameters=[0.02, 0.005], resource_type='')
Bases:
ItemClass for combining multiple items into a single unit
The BatchedResource class is a base class for combining multiple Items into a single Item unit. This process of batching items allows for easier computation and more convience when moving groups of material through the fuel cycle (e.g., combining multiple fuel rods into a single assembly)
- aggregate_isotopics()
- Return type:
dict
- aggregate_weights()
- Return type:
float
- extend_batch(num_to_append)
- Return type:
None
- sample(num_to_sample)
- Return type:
tuple[list,dict]
- sample_batch(num_to_sample)
- Return type:
- class mints.resources.Cylinder(id, weight, when, where, what, arrival_time, type='30B')
Bases:
ItemItem class wrapper for cylinders
- class mints.resources.Drum(id, weight, when, where, what, arrival_time)
Bases:
ItemItem class wrapper for drums.
- class mints.resources.Flouride(name='F', isotopics={'F': 1}, **kwargs)
Bases:
MaterialMaterial class wrapper for flouride
- class mints.resources.Global_Index
Bases:
objectGlobal indexer maintains current index for each type of Item. When a new item is created at any facility it gets a unique index
- next_assembly()
Get the index of the next fuel assembly in the simulation
- Returns:
The index of the next fuel assembly in the simulation
- Return type:
int
- next_drum()
Get the index of the next drum created in the simulation
- Returns:
The index of the new drum
- Return type:
int
- next_pellet()
Get the index of the next pellet batch in the simulation
- Returns:
The index of the next pellet batch
- Return type:
int
- next_rod()
Get the index of the next fuel rod in the simulation
- Returns:
The index of the next fuel rod in the simulation
- Return type:
int
- class mints.resources.HomogenousBatchedResource(id, when, where, what, arrival_time, batch_size=0, weights=None, weight_distribution=<bound method RandomState.normal of RandomState(MT19937)>, weight_distribution_parameters=[0.02, 0.005], resource_type='')
Bases:
BatchedResourceBatchedResource class for batches where all items have same isotopics
- aggregate_isotopics()
Aggregate the isotopics of the batch
As this is assumed to be a homogenous batch, we know all items have the same isotopic breakdown and do not need to perform aggregation of the isotopics.
- Returns:
The Material type of the batch
- Return type:
- aggregate_weights()
Get the total weight of the items in the batch
- Returns:
Total weight of the items in the batch
- Return type:
float
- extend_batch(in_batch)
Combine this batch of items with a new batch.
- Parameters:
in_batch (BatchedResource) – Batched resource to combine with this batch of items.
- Raises:
ValueError – To combine multiple homogenous batched resources, the batches must be of the same material type.
- Return type:
None
- sample(num_to_sample)
Sample num_to_sample items from the batch
sample_counter is used to track the number of items already sampled from this batch. After sampling is completed and the items are retrieved, the total batch weight is re-aggregated.
- Parameters:
num_to_sample (int) – Number of items to sample
- Returns:
The sampled weights and the material type of the items
- Return type:
tuple[list, dict]
- class mints.resources.Item(id, weight, when, where, what, form, arrival_time)
Bases:
objectThe Item class is used to represent items within the fuel cycle. Each item has a unique id, and maintains information on its weight, where it is from, when during the simulation is was created, and what it is made out of.
- id
global id from Global_Index
- weight
weight of material (kg) in the Item
- when
timestep when the Item was created
- where
facility name where the Item was created
- what
material the Item contains
- form
the physical form of the material (powder, rod, etc.)
- update_arrival_time(arrival_time, new_location)
Update the location history of the item when it is shipped to a new location
For reporting at the end of the fuel cycle simulation, each item maintains a list of every facility it has been to and during what timesteps it was located there.
- Parameters:
arrival_time (int) – Time item arrived at the new facility
new_location (str) – Name of the facility the item has arrived at
- Return type:
None
- class mints.resources.Material(name, isotopes, **kwargs)
Bases:
objectClass for representing materials in the fuel cycle simulation
Materials are specific chemical compositions of resources within the fuel cycle. The material class tracks the name of material type which is typically the chemical formula of the material (e.g., U3O8), a dictionary of the isotopic breakdown of the material, a boolean indicating if the material has been irradiated, and a boolean indicating if the material has been enriched beyond natural enrichment levels.
- class mints.resources.Oxygen(name='O', isotopics={'O': 1}, **kwargs)
Bases:
MaterialMaterial class wraper for Oxygen.
- class mints.resources.Pellet_Batch(id, weight, when, where, what, arrival_time)
Bases:
ItemItem class wrapper for batches of pellets
- class mints.resources.Rod(id, weight, when, where, what, arrival_time)
Bases:
ItemItem class wrapper for fuel rods
- class mints.resources.TriuraniumOctoxide(name='U3O8', isotopics={'O': 0.152, 'U235': 0.00586, 'U238': 0.84218}, **kwargs)
Bases:
MaterialMaterial class wrapper for U3O8
- class mints.resources.UraniumDioxide(name='UO2', isotopes={'O': 0.11845, 'U235': 0.0061, 'U238': 0.87544}, enrich_pct=None, pu_pct=None, **kwargs)
Bases:
MaterialMaterial wrapper for Uranium Dioxide
- enrich(pct)
Enrich UO2 to pct enrichment
- Parameters:
pct (float) – enrichment level
- Raises:
NotImplementedError – If enrichment level is not yet implemented
- Return type:
None
- irradiate(pu_pct)
Modify isotopes to simulate irradiation
Currently this method only supports a variety of hard-coded percentages as part of the fuel cycles for PHWR and LWR reactors. In the future we plan to make this modification continous.
- Parameters:
pu_pct (float) – Percent plutonium
- Raises:
NotImplementedError – Selected plutonium percentage is not implemented.
- class mints.resources.UraniumHexaFlouride(name='UF6', isotopes={'F': 0.32388, 'U235': 0.00467, 'U238': 0.67145}, enrich_pct=None, depletion_pct=None, **kwargs)
Bases:
MaterialMaterial wrapper for Uranium Hexaflouride
- deplete(pct=0.003)
Deplete the level of U235 in isotopes down to pct
This method exists in order to simulate depleted UF6 as a tail product from UF6 enrichment. Currently only one hardcoded percentage is supported.
- Parameters:
pct (float, optional) – Percentage of u235 in isotopes. Defaults to .003.
- enrich(pct)
Enrich UF6 to pct percent U235 enrichment
- Parameters:
pct (float) – percentage of U235 enrichment
- mints.resources.aggregate_isotopics(materials_list)
Aggregate the isotopics across a list of materials
#TODO: Implement this aggregation process. Currently, this just returns the isotopics of the first element.
- Parameters:
materials_list (list[dict]) – List of isotopics dictionaries
- Returns:
Aggregated isotopics
- Return type:
dict