diff --git a/XML_to_SON/Automated-XMLtoString-Schema.py b/XML_to_SON/Automated-XMLtoString-Schema.py deleted file mode 100644 index 0c1c630..0000000 --- a/XML_to_SON/Automated-XMLtoString-Schema.py +++ /dev/null @@ -1,56 +0,0 @@ -# Import the required modules -import xmltodict -import pprint -import json - -# Open the file and read the contents -with open('schema.xml', 'r', encoding='utf-8') as file: - schema = file.read() - -# Use xmltodict to parse and convert the XML document -dictionary = xmltodict.parse(schema) -json_d = json.dumps(dictionary) - -def remove_at_symbol_from_keys(data): - if isinstance(data, dict): - updated_data = {} - for key, value in data.items(): - new_key = key[1:] if key.startswith('@') else key - updated_value = remove_at_symbol_from_keys(value) - updated_data[new_key] = updated_value - return updated_data - elif isinstance(data, list): - updated_list = [] - for item in data: - updated_item = remove_at_symbol_from_keys(item) - updated_list.append(updated_item) - return updated_list - else: - return data - -def reformat_tree(d, indent = 0): - d = remove_at_symbol_from_keys(d) - if isinstance(d, dict): - for key, value in d.items(): - match key: - case "@name": - key = "name" - case "@data": - key = "data" - case "@type": - key = "type" - case _: - key = key - if isinstance(value, (dict, list)): - print(' ' * indent + str(key) + ':') - reformat_tree(value, indent + 4) - else: - print(' ' * indent + str(key) + ': ' + str(value)) - elif isinstance(d, list): - for item in d: - if isinstance(item, (dict, list)): - reformat_tree(item, indent + 4) - else: - print(' ' * indent + '- ' + str(item)) - -reformat_tree(dictionary) diff --git a/XML_to_SON/cyclus.sch b/XML_to_SON/cyclus.sch deleted file mode 100644 index 4f51204..0000000 --- a/XML_to_SON/cyclus.sch +++ /dev/null @@ -1,942 +0,0 @@ -simulation={ - minOccurs=1 - maxOccurs=1 - schematype={ - ValType=String - minOccurs=0 - maxOccurs=1 - } - ui={ - ValType=String - minOccurs=0 - maxOccurs=1 - } - control={ - minOccurs=1 - maxOccurs=1 - simhandle={ - ValType=String - minOccurs=0 - maxOccurs=1 - } - duration={ - minOccurs=1 - maxOccurs=1 - ValType=Int - } - startmonth={ - minOccurs=1 - maxOccurs=1 - ValType=Int - } - startyear={ - minOccurs=1 - maxOccurs=1 - ValType=Int - } - decay={ - ValType=String - minOccurs=0 - maxOccurs=1 - } - dt={ - ValType=Int - minOccurs=0 - maxOccurs=1 - } - explicit_inventory={ - ValType=Boolean - minOccurs=0 - maxOccurs=1 - } - explicit_inventory_compact={ - ValType=Boolean - minOccurs=0 - maxOccurs=1 - } - tolerance_generic={ - ValType=double - minOccurs=0 - maxOccurs=1 - } - tolerance_resource={ - ValType=double - minOccurs=0 - maxOccurs=1 - } - solver={ - minOccurs=0 - maxOccurs=1 - config={ - ChildExactlyOne=[greedy coin-or] - minOccurs=0 - maxOccurs=1 - greedy={ - minOccurs=1 - maxOccurs=1 - preconditioner={ - ValType=String - minOccurs=0 - maxOccurs=1 - } - } - coin-or={ - minOccurs=1 - maxOccurs=1 - timeout={ - ValType=Int - minOccurs=0 - maxOccurs=1 - } - verbose={ - ValType=Boolean - minOccurs=0 - maxOccurs=1 - } - mps={ - ValType=Boolean - minOccurs=0 - maxOccurs=1 - } - } - } - allow_exclusive_orders={ - ValType=Boolean - minOccurs=0 - maxOccurs=1 - } - exclusive_orders_only={ - ValType=Boolean - minOccurs=0 - maxOccurs=1 - } - } - } - commodity={ - minOccurs=0 - name={ - minOccurs=1 - maxOccurs=1 - ValType=String - } - solution_priority={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - } - archetypes={ - minOccurs=1 - maxOccurs=1 - spec={ - minOccurs=1 - path={ - ValType=String - minOccurs=0 - maxOccurs=1 - } - lib={ - ValType=String - minOccurs=0 - maxOccurs=1 - } - name={ - minOccurs=1 - maxOccurs=1 - ValType=String - } - alias={ - ValType=String - minOccurs=0 - maxOccurs=1 - } - } - } - facility={ - minOccurs=1 - name={ - minOccurs=1 - maxOccurs=1 - ValType=String - } - lifetime={ - ValType=Int - minOccurs=0 - maxOccurs=1 - } - config={ - minOccurs=1 - maxOccurs=1 - ChildExactlyOne=[KFacility Predator Prey Sink Source Enrichment FuelFab Mixer Reactor Separations Sink Source Storage] - KFacility={ - InputTmpl="KFacility" - in_commod={ - minOccurs=1 - maxOccurs=1 - ValType=String - } - recipe_name={ - minOccurs=1 - maxOccurs=1 - ValType=String - } - out_commod={ - minOccurs=1 - maxOccurs=1 - ValType=String - } - in_capacity={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - out_capacity={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - current_capacity={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - max_inv_size={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - k_factor_in={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - k_factor_out={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - } - Predator={ - InputTmpl="Predator" - commod={ - minOccurs=1 - maxOccurs=1 - ValType=String - } - prey={ - minOccurs=1 - maxOccurs=1 - ValType=String - } - full={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - hunt_freq={ - minOccurs=1 - maxOccurs=1 - ValType=Int - } - hunt_cap={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - success={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - consumed={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - hunt_factor={ - minOccurs=1 - maxOccurs=1 - ValType=Boolean - } - age={ - minOccurs=1 - maxOccurs=1 - ValType=Int - } - lifespan={ - minOccurs=1 - maxOccurs=1 - ValType=Int - } - dead={ - minOccurs=1 - maxOccurs=1 - ValType=Boolean - } - nchildren={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - birth_and_death={ - minOccurs=1 - maxOccurs=1 - ValType=Boolean - } - } - Prey={ - InputTmpl="Prey" - commod={ - minOccurs=1 - maxOccurs=1 - ValType=String - } - age={ - minOccurs=1 - maxOccurs=1 - ValType=Int - } - dead={ - minOccurs=1 - maxOccurs=1 - ValType=Boolean - } - nchildren={ - minOccurs=1 - maxOccurs=1 - ValType=Int - } - birth_freq={ - minOccurs=1 - maxOccurs=1 - ValType=Int - } - birth_and_death={ - minOccurs=1 - maxOccurs=1 - ValType=Boolean - } - } - Sink={ - InputTmpl="Sink" - in_commods={ - minOccurs=1 - maxOccurs=1 - } - in_commod_prefs={ - minOccurs=1 - maxOccurs=1 - } - recipe_name={ - minOccurs=1 - maxOccurs=1 - ValType=String - } - max_inv_size={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - capacity={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - latitude={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - longitude={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - } - Source={ - InputTmpl="Source" - outcommod={ - minOccurs=1 - maxOccurs=1 - ValType=String - } - outrecipe={ - minOccurs=1 - maxOccurs=1 - ValType=String - } - inventory_size={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - throughput={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - latitude={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - longitude={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - } - Enrichment={ - InputTmpl="Enrichment" - feed_commod={ - minOccurs=1 - maxOccurs=1 - ValType=String - } - feed_recipe={ - minOccurs=1 - maxOccurs=1 - ValType=String - } - product_commod={ - minOccurs=1 - maxOccurs=1 - ValType=String - } - tails_commod={ - minOccurs=1 - maxOccurs=1 - ValType=String - } - tails_assay={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - initial_feed={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - max_feed_inventory={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - max_enrich={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - order_prefs={ - minOccurs=1 - maxOccurs=1 - ValType=Boolean - } - swu_capacity={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - latitude={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - longitude={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - } - FuelFab={ - InputTmpl="FuelFab" - fill_commods={ - minOccurs=1 - maxOccurs=1 - } - fill_commod_prefs={ - minOccurs=1 - maxOccurs=1 - } - fill_recipe={ - minOccurs=1 - maxOccurs=1 - ValType=String - } - fill_size={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - fiss_commods={ - minOccurs=1 - maxOccurs=1 - } - fiss_commod_prefs={ - minOccurs=1 - maxOccurs=1 - } - fiss_recipe={ - minOccurs=1 - maxOccurs=1 - ValType=String - } - fiss_size={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - topup_commod={ - minOccurs=1 - maxOccurs=1 - ValType=String - } - topup_pref={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - topup_recipe={ - minOccurs=1 - maxOccurs=1 - ValType=String - } - topup_size={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - outcommod={ - minOccurs=1 - maxOccurs=1 - ValType=String - } - throughput={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - spectrum={ - minOccurs=1 - maxOccurs=1 - ValType=String - } - latitude={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - longitude={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - } - Mixer={ - InputTmpl="Mixer" - in_streams={ - minOccurs=1 - maxOccurs=1 - } - out_commod={ - minOccurs=1 - maxOccurs=1 - ValType=String - } - out_buf_size={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - throughput={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - latitude={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - longitude={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - } - Reactor={ - InputTmpl="Reactor" - fuel_incommods={ - minOccurs=1 - maxOccurs=1 - } - fuel_inrecipes={ - minOccurs=1 - maxOccurs=1 - } - fuel_prefs={ - minOccurs=1 - maxOccurs=1 - } - fuel_outcommods={ - minOccurs=1 - maxOccurs=1 - } - fuel_outrecipes={ - minOccurs=1 - maxOccurs=1 - } - recipe_change_times={ - minOccurs=1 - maxOccurs=1 - } - recipe_change_commods={ - minOccurs=1 - maxOccurs=1 - } - recipe_change_in={ - minOccurs=1 - maxOccurs=1 - } - recipe_change_out={ - minOccurs=1 - maxOccurs=1 - } - assem_size={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - n_assem_batch={ - minOccurs=1 - maxOccurs=1 - ValType=Int - } - n_assem_core={ - minOccurs=1 - maxOccurs=1 - ValType=Int - } - n_assem_fresh={ - minOccurs=1 - maxOccurs=1 - ValType=Int - } - n_assem_spent={ - minOccurs=1 - maxOccurs=1 - ValType=Int - } - cycle_time={ - minOccurs=1 - maxOccurs=1 - ValType=Int - } - refuel_time={ - minOccurs=1 - maxOccurs=1 - ValType=Int - } - cycle_step={ - minOccurs=1 - maxOccurs=1 - ValType=Int - } - power_cap={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - power_name={ - minOccurs=1 - maxOccurs=1 - ValType=String - } - side_products={ - minOccurs=1 - maxOccurs=1 - } - side_product_quantity={ - minOccurs=1 - maxOccurs=1 - } - decom_transmute_all={ - minOccurs=1 - maxOccurs=1 - ValType=Boolean - } - pref_change_times={ - minOccurs=1 - maxOccurs=1 - } - pref_change_commods={ - minOccurs=1 - maxOccurs=1 - } - pref_change_values={ - minOccurs=1 - maxOccurs=1 - } - latitude={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - longitude={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - } - Separations={ - InputTmpl="Separations" - feed_commods={ - minOccurs=1 - maxOccurs=1 - } - feed_commod_prefs={ - minOccurs=1 - maxOccurs=1 - } - feed_recipe={ - minOccurs=1 - maxOccurs=1 - ValType=String - } - feedbuf_size={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - throughput={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - leftover_commod={ - minOccurs=1 - maxOccurs=1 - ValType=String - } - leftoverbuf_size={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - streams={ - minOccurs=1 - maxOccurs=1 - } - latitude={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - longitude={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - } - Storage={ - InputTmpl="Storage" - in_commods={ - minOccurs=1 - maxOccurs=1 - } - in_commod_prefs={ - minOccurs=1 - maxOccurs=1 - } - out_commods={ - minOccurs=1 - maxOccurs=1 - } - in_recipe={ - minOccurs=1 - maxOccurs=1 - ValType=String - } - residence_time={ - minOccurs=1 - maxOccurs=1 - ValType=Int - } - throughput={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - max_inv_size={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - discrete_handling={ - minOccurs=1 - maxOccurs=1 - ValType=Boolean - } - latitude={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - longitude={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - } - } - } - region={ - minOccurs=1 - name={ - minOccurs=1 - maxOccurs=1 - ValType=String - } - lifetime={ - ValType=Int - minOccurs=0 - maxOccurs=1 - } - config={ - minOccurs=1 - maxOccurs=1 - ChildExactlyOne=[NullRegion GrowthRegion] - NullRegion={ - InputTmpl="NullRegion" - } - GrowthRegion={ - InputTmpl="GrowthRegion" - growth={ - minOccurs=1 - maxOccurs=1 - } - latitude={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - longitude={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - } - } - institution={ - minOccurs=1 - name={ - minOccurs=1 - maxOccurs=1 - ValType=String - } - lifetime={ - ValType=Int - minOccurs=0 - maxOccurs=1 - } - initialfacilitylist={ - minOccurs=0 - maxOccurs=1 - entry={ - minOccurs=1 - prototype={ - minOccurs=1 - maxOccurs=1 - ValType=String - } - number={ - minOccurs=1 - maxOccurs=1 - ValType=Int - } - } - } - config={ - minOccurs=1 - maxOccurs=1 - ChildExactlyOne=[NullInst DeployInst ManagerInst] - NullInst={ - InputTmpl="NullInst" - } - DeployInst={ - InputTmpl="DeployInst" - prototypes={ - minOccurs=1 - maxOccurs=1 - } - build_times={ - minOccurs=1 - maxOccurs=1 - } - n_build={ - minOccurs=1 - maxOccurs=1 - } - lifetimes={ - minOccurs=1 - maxOccurs=1 - } - latitude={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - longitude={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - } - ManagerInst={ - InputTmpl="ManagerInst" - prototypes={ - minOccurs=1 - maxOccurs=1 - } - latitude={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - longitude={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - } - } - } - } - recipe={ - minOccurs=0 - name={ - minOccurs=1 - maxOccurs=1 - ValType=String - } - basis={ - minOccurs=1 - maxOccurs=1 - ValType=String - } - nuclide={ - minOccurs=1 - id={ - minOccurs=1 - maxOccurs=1 - ValType=String - } - comp={ - minOccurs=1 - maxOccurs=1 - ValType=double - } - } - } -} \ No newline at end of file