Commit d99dbd47 authored by Greenwood, Scott's avatar Greenwood, Scott
Browse files

added the expanded input specification as an autocreated artifact in the...

added the expanded input specification as an autocreated artifact in the temporary location in case it is needed for inspection
parent 8a996989
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -240,7 +240,7 @@ if __name__ == "__main__":
    csm.create_architecture() # Useful if a project is being created from scratch
    
    # Set the path to the project which uses an AutoCSM language method 
    csm.project_path = '../examples/modelica/' + csm.project_name
    csm.project_path = '../examples/modelica/GenericDatacenter' + csm.project_name

    # Create the model for export to FMU (i.e., Simulator.mo)
    csm.create_model(uniform=[False, False])
+9 −1
Original line number Diff line number Diff line
@@ -30,6 +30,14 @@ def read_json(file_path):
    except Exception as e:
        print(f"An error occurred: {e}")

def export_dict_to_json(data, file_path):
    import json
     # Exporting to a JSON string
    json_string = json.dumps(data, indent=4)

    # Exporting to a JSON file
    with open(file_path, 'w') as f:
        json.dump(data, f, indent=4)
        
#%%
from itertools import cycle
+5 −1
Original line number Diff line number Diff line
@@ -222,10 +222,14 @@ def main(json_file_path, project_path, base_path, parent_class, output_path, str
    data = copy.deepcopy(data_orig)
    nested_structure_utils.expand_data(data, {item["name"]: item["value"] for item in default_structure_parameters})

    # Export expanded json for debug purposes
    helper_functions.export_dict_to_json(data, pathlib.Path(output_path).parent / 'input_specification_expanded.json')

    lines = create_nested_lines(data, project_path, base_path, uniform, force_redeclare=force_redeclare)
    content = ','.join(lines).replace(',)', ')').replace('(,', '(')
    create_model_file(content, parent_class, output_path)
    
    
    return data

if __name__ == "__main__":