diff --git a/XML_to_SON/Templates/Enrichment.tmpl b/XML_to_SON/Templates/Enrichment.tmpl deleted file mode 100644 index 61fc91d..0000000 --- a/XML_to_SON/Templates/Enrichment.tmpl +++ /dev/null @@ -1,46 +0,0 @@ -%The Enrichment facility is a simple agent that enriches natural uranium in a Cyclus simulation. It does not explicitly compute the physical enrichment process, rather it calculates the SWU required to convert an source uranium recipe (i.e. natural uranium) into a requested enriched recipe (i.e. 4% enriched uranium), given the natural uranium inventory constraint and its SWU capacity constraint. -% -%The Enrichment facility requests an input commodity and associated recipe whose quantity is its remaining inventory capacity. All facilities trading the same input commodity (even with different recipes) will offer materials for trade. The Enrichment facility accepts any input materials with enrichments less than its tails assay, as long as some U235 is present, and preference increases with U235 content. If no U235 is present in the offered material, the trade preference is set to -1 and the material is not accepted. Any material components other than U235 and U238 are sent directly to the tails buffer. -% -%The Enrichment facility will bid on any request for its output commodity up to the maximum allowed enrichment (if not specified, default is 100%) It bids on either the request quantity, or the maximum quanity allowed by its SWU constraint or natural uranium inventory, whichever is lower. If multiple output commodities with different enrichment levels are requested and the facility does not have the SWU or quantity capacity to meet all requests, the requests are fully, then partially filled in unspecified but repeatable order. -% -%Accumulated tails inventory is offered for trading as a specifiable output commodity. - -Enrichment { - % [String] feed commodity that the enrichment facility accepts - feed_commod = - - % [String] recipe for enrichment facility feed commodity - feed_recipe = - - % [String] product commodity that the enrichment facility generates - product_commod = - - % [String] tails commodity supplied by enrichment facility - tails_commod = - - % [double] tails assay from the enrichment process - tails_assay = 0.003 - - % [double] amount of natural uranium stored at the enrichment facility at the beginning of the simulation (kg) - initial_feed = 0 - - % [double] maximum total inventory of natural uranium in the enrichment facility (kg) - max_feed_inventory = 1e+299 - - % [double] maximum allowed weight fraction of U235 in product - max_enrich = 1.0 - - % [Boolean] turn on preference ordering for input material so that EF chooses higher U235 content first - order_prefs = 1 - - % [double] separative work unit (SWU) capacity of enrichment facility (kgSWU/timestep) - swu_capacity = 1e+299 - - % [double] Latitude of the agent's geographical position. The value should be expressed in degrees as a double. - latitude = 0.0 - - % [double] Longitude of the agent's geographical position. The value should be expressed in degrees as a double. - longitude = 0.0 - -} diff --git a/XML_to_SON/Templates/FuelFab.tmpl b/XML_to_SON/Templates/FuelFab.tmpl deleted file mode 100644 index 686b6ec..0000000 --- a/XML_to_SON/Templates/FuelFab.tmpl +++ /dev/null @@ -1,75 +0,0 @@ -%FuelFab takes in 2 streams of material and mixes them in ratios in order to supply material that matches some neutronics properties of reqeusted material. It uses an equivalence type method [1] inspired by a similar approach in the COSI fuel cycle simulator. -% -%The FuelFab has 3 input inventories: fissile stream, filler stream, and an optional top-up inventory. All materials received into each inventory are always combined into a single material (i.e. a single fissile material, a single filler material, etc.). The input streams and requested fuel composition are each assigned weights based on summing: -% -% N * (p_i - p_U238) / (p_Pu239 - p_U238) -% -%for each nuclide where: -% -% - p = nu*sigma_f - sigma_a for the nuclide -% - p_U238 is p for pure U238 -% - p_Pu239 is p for pure Pu239 -% - N is the nuclide's atom fraction -% - nu is the average # neutrons per fission -% - sigma_f is the microscopic fission cross-section -% - sigma_a is the microscopic neutron absorption cross-section -% -%The cross sections are from the simple cross section library in PyNE. They can be set to either a thermal or fast neutron spectrum. A linear interpolation is performed using the weights of the fissile, filler, and target streams. The interpolation is used to compute a mixing ratio of the input streams that matches the target weight. In the event that the target weight is higher than the fissile stream weight, the FuelFab will attempt to use the top-up and fissile input streams together instead of the fissile and filler streams. All supplied material will always have the same weight as the requested material. -% -%The supplying of mixed material is constrained by available inventory quantities and a per time step throughput limit. Requests for fuel material larger than the throughput can never be met. Fissile inventory can be requested/received via one or more commodities. The DRE request preference for each of these commodities can also optionally be specified. By default, the top-up inventory size is zero, and it is not used for mixing. -% -%[1] Baker, A. R., and R. W. Ross. "Comparison of the value of plutonium and uranium isotopes in fast reactors." Proceedings of the Conference on Breeding. Economics, and Safety in Large Fast Power Reactors. 1963. - -FuelFab { - % [Unknown] Ordered list of commodities on which to requesting filler stream material. - fill_commods = - - % [Unknown] Filler stream commodity request preferences for each of the given filler commodities (same order). If unspecified, default is to use 1.0 for all preferences. - fill_commod_prefs = [] - - % [String] Name of recipe to be used in filler material stream requests. - fill_recipe = - - % [double] Size of filler material stream inventory. - fill_size = - - % [Unknown] Ordered list of commodities on which to requesting fissile stream material. - fiss_commods = - - % [Unknown] Fissile stream commodity request preferences for each of the given fissile commodities (same order). If unspecified, default is to use 1.0 for all preferences. - fiss_commod_prefs = [] - - % [String] Name for recipe to be used in fissile stream requests. Empty string results in use of an empty dummy recipe. - fiss_recipe = - - % [double] Size of fissile material stream inventory. - fiss_size = - - % [String] Commodity on which to request material for top-up stream. This MUST be set if 'topup_size > 0'. - topup_commod = - - % [double] Top-up material stream request preference. - topup_pref = 1.0 - - % [String] Name of recipe to be used in top-up material stream requests. This MUST be set if 'topup_size > 0'. - topup_recipe = - - % [double] Size of top-up material stream inventory. - topup_size = 0 - - % [String] Commodity on which to offer/supply mixed fuel material. - outcommod = - - % [double] Maximum number of kg of fuel material that can be supplied per time step. - throughput = 1e+299 - - % [String] The type of cross-sections to use for composition property calculation. Use 'fission_spectrum_ave' for fast reactor compositions or 'thermal' for thermal reactors. - spectrum = - - % [double] Latitude of the agent's geographical position. The value should be expressed in degrees as a double. - latitude = 0.0 - - % [double] Longitude of the agent's geographical position. The value should be expressed in degrees as a double. - longitude = 0.0 - -} diff --git a/XML_to_SON/Templates/KFacility.tmpl b/XML_to_SON/Templates/KFacility.tmpl deleted file mode 100644 index 6b1d5ac..0000000 --- a/XML_to_SON/Templates/KFacility.tmpl +++ /dev/null @@ -1,31 +0,0 @@ -%A facility designed for integration tests that both provides and consumes commodities. It changes its request and offer amounts based on a power law with respect to time. - -KFacility { - % [String] commodity that the k-facility consumes - in_commod = - - % [String] recipe name for the k-facility's in-commodity - recipe_name = - - % [String] commodity that the k-facility supplies - out_commod = - - % [double] number of commodity units that can be taken at each timestep (infinite capacity can be represented by a very large number) - in_capacity = - - % [double] number of commodity units that can be supplied at each timestep (infinite capacity can be represented by a very large number) - out_capacity = - - % [double] number of output commodity units that can be supplied at the current time step (infinite capacity can be represented by a very large number ) - current_capacity = 0 - - % [double] total maximum inventory size of the k-facility - max_inv_size = 1e+299 - - % [double] conversion factor that governs the behavior of the k-facility's input commodity capacity - k_factor_in = - - % [double] conversion factor that governs the behavior of the k-facility's output commodity capacity - k_factor_out = - -} diff --git a/XML_to_SON/Templates/Predator.tmpl b/XML_to_SON/Templates/Predator.tmpl deleted file mode 100644 index 0436b4a..0000000 --- a/XML_to_SON/Templates/Predator.tmpl +++ /dev/null @@ -1,43 +0,0 @@ -%A facility that represents predators in the Lotka-Volterra integration tests - -Predator { - % [String] commodity that the predator supplies - commod = - - % [String] prey that the predator hunts - prey = - - % [double] how many units of prey a predator consumes until it is satisfied - full = 1 - - % [Int] how often a predator needs to hunt - hunt_freq = 1 - - % [double] how many units of prey a predator can catch during a hunt - hunt_cap = 1 - - % [double] fraction of hunting success on a scale from 0 to 1 - success = 1 - - % [double] how many units of prey consumed per time step - consumed = 0 - - % [Boolean] whether or not to base hunting success on relative predator/prey populations - hunt_factor = 0 - - % [Int] age of predator at beginning of simulation - age = 0 - - % [Int] how long a predator lives - lifespan = 1 - - % [Boolean] flag for whether predator is currently dead - dead = 0 - - % [double] number of predator children born at each birthing instance - nchildren = 1 - - % [Boolean] whether or not simultaneous birth and death are allowed (i.e., can a facility give birth and die in the same time step?) - birth_and_death = 0 - -} diff --git a/XML_to_SON/Templates/Prey.tmpl b/XML_to_SON/Templates/Prey.tmpl deleted file mode 100644 index 2e2ddd8..0000000 --- a/XML_to_SON/Templates/Prey.tmpl +++ /dev/null @@ -1,22 +0,0 @@ -%A facility that represents prey in the Lotka-Volterra integration tests - -Prey { - % [String] No documentation - commod = - - % [Int] age of prey at start of simulation - age = 0 - - % [Boolean] flag for whether prey is currently dead - dead = 0 - - % [Int] number of children born at each birthing instance - nchildren = 1 - - % [Int] number of time steps between birth of children - birth_freq = 1 - - % [Boolean] whether or not simultaneous birth and death are allowed (i.e., can a facility give birth and die in the same time step?) - birth_and_death = 1 - -} diff --git a/XML_to_SON/Templates/Sink.tmpl b/XML_to_SON/Templates/Sink.tmpl deleted file mode 100644 index fefa03f..0000000 --- a/XML_to_SON/Templates/Sink.tmpl +++ /dev/null @@ -1,25 +0,0 @@ -%A minimum implementation sink facility that accepts specified amounts of commodities from other agents - -Sink { - % [Unknown] commodities that the sink facility accepts - in_commods = - - % [Unknown] No documentation - in_commod_prefs = - - % [String] Name of recipe to request.If empty, sink requests material no particular composition. - recipe_name = - - % [double] total maximum inventory size of sink facility - max_inv_size = 1e+299 - - % [double] capacity the sink facility can accept at each time step - capacity = - - % [double] No documentation - latitude = - - % [double] No documentation - longitude = - -} diff --git a/XML_to_SON/Templates/Source.tmpl b/XML_to_SON/Templates/Source.tmpl deleted file mode 100644 index 33b5442..0000000 --- a/XML_to_SON/Templates/Source.tmpl +++ /dev/null @@ -1,22 +0,0 @@ -%A minimum implementation source facility that provides a commodity with a given capacity - -Source { - % [String] No documentation - outcommod = - - % [String] No documentation - outrecipe = - - % [double] No documentation - inventory_size = - - % [double] No documentation - throughput = - - % [double] No documentation - latitude = - - % [double] No documentation - longitude = - -} diff --git a/XML_to_SON/grammar_parser_test.py b/XML_to_SON/grammar_parser_test.py index b9417a8..da07008 100644 --- a/XML_to_SON/grammar_parser_test.py +++ b/XML_to_SON/grammar_parser_test.py @@ -161,7 +161,7 @@ def process_element_mjson(node, parent_attrib={}): ele_dict[name] = attributes return ele_dict -file = os.path.dirname(__file__) + '\\m.json' +file = os.path.dirname(__file__) + '\\m.json' # A sample file is being used currently. The file should be changed depending on the user/purpose. with open(file, 'r') as file: m_json = json.load(file) @@ -189,7 +189,7 @@ def process_element_mjson(node, parent_attrib={}): processed_institutions.update(processed_and_wrapped) institutions.append(entity_name) -tree = ET.parse('schema.xml') +tree = ET.parse('sample_schema.xml') # A sample file is being used currently. The file should be changed depending on the user/purpose. root = tree.getroot() ns = re.match(r'\{.*\}', root.tag).group(0) simulation = root[0][0] @@ -323,7 +323,7 @@ def save_template_for_all_schemas(processed_schemas, annotations, folder_name = file.write(template_string) print(f"Template for {key_name} saved as {filename}") - -save_template_for_all_schemas(processed_facilities, m_json["annotations"]) -save_template_for_all_schemas(processed_regions, m_json["annotations"]) -save_template_for_all_schemas(processed_institutions, m_json["annotations"]) \ No newline at end of file +# These following lines create the templates and save them in a folder named "Templates" +# save_template_for_all_schemas(processed_facilities, m_json["annotations"]) +# save_template_for_all_schemas(processed_regions, m_json["annotations"]) +# save_template_for_all_schemas(processed_institutions, m_json["annotations"]) \ No newline at end of file diff --git a/XML_to_SON/schema.xml b/XML_to_SON/sample_schema.xml similarity index 100% rename from XML_to_SON/schema.xml rename to XML_to_SON/sample_schema.xml