Commit 83ce80d8 authored by Greenwood, Scott's avatar Greenwood, Scott
Browse files

[refactor] update naming of files and create template_method for adding new languages

parent 2ea65b45
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -8,8 +8,8 @@ Users may choose either license, at their discretion.
"""

import pathlib
from languages.modelica.modelica_methods import ModelicaMethods
from languages.julia.julia_methods import JuliaMethods
from languages.modelica.methods import ModelicaMethods
from languages.julia.methods import JuliaMethods
from helper_functions import Loader

class AutoCSM:
+15 −0
Original line number Diff line number Diff line
# -*- coding: utf-8 -*-
"""
@author: Scott Greenwood

Copyright (c) 2024 UT-Battelle
Licensed under the terms of both the MIT license and the Apache License (Version 2.0).
Users may choose either license, at their discretion.

TODO: Could add additional layer details to recreate the nested model structure of the generic approach
    - This would add to the Structure and ControlBus the appropirate information
TODO: Could autopopulate model instance in structure with parallel logic (if instanceNames provided)
"""

def main(json_file_path, output_path, template_folder, architecture='nested'):
    raise ValueError('FMU creation not yet implmented')
 No newline at end of file
+17 −0
Original line number Diff line number Diff line
# -*- coding: utf-8 -*-
"""
@author: Scott Greenwood

Copyright (c) 2024 UT-Battelle
Licensed under the terms of both the MIT license and the Apache License (Version 2.0).
Users may choose either license, at their discretion.

"""

def main():  
    raise ValueError('FMU creation not yet implmented')




+11 −0
Original line number Diff line number Diff line
# -*- coding: utf-8 -*-
"""
@author: Scott Greenwood

Copyright (c) 2024 UT-Battelle
Licensed under the terms of both the MIT license and the Apache License (Version 2.0).
Users may choose either license, at their discretion.
"""
       
def main():
    raise ValueError('FMU creation not yet implmented')
 No newline at end of file
+11 −34
Original line number Diff line number Diff line
@@ -7,14 +7,13 @@ Licensed under the terms of both the MIT license and the Apache License (Version
Users may choose either license, at their discretion.
"""

import os
import pathlib

from ..language_method import LanguageMethod
# Import Julia-specific dependencies here, for example:
# from . import julia_create_model_nested
# from . import julia_create_fmu_fmijl
# from . import julia_create_architecture
from . import create_model_nested
from . import create_fmu_fmijl
from . import create_architecture

class JuliaMethods(LanguageMethod):
    """
@@ -53,12 +52,8 @@ class JuliaMethods(LanguageMethod):
        super().create_architecture(template_folder)
        
        try:
            # Insert supported methods here, for example:
            # julia_create_architecture.main(self.parent.input_specification,
            #                                   self.parent.output_path,
            #                                   template_folder,
            #                                   self.parent.architecture)
            pass
            # TODO: Insert supported methods here, for example:
            create_architecture.main()
        except FileNotFoundError as e:
            raise RuntimeError(f"Template not found: {e}")
        except Exception as e:
@@ -81,19 +76,8 @@ class JuliaMethods(LanguageMethod):
        structure_path = super().create_model(structure_path, **kwargs)
        
        try:
            # Insert supported methods here, for example:
            # if self.parent.architecture == 'nested':
            #     # Extract parameters from kwargs
            #     uniform = kwargs.pop('uniform', None)
            #     uniform = [True, True] if uniform is None or not uniform else uniform
                
            #     julia_create_model_nested.main(self.parent.input_specification,
            #                                       self.parent.project_path,
            #                                       pathlib.Path(self.parent.project_path).name,
            #                                       parent_class,
            #                                       self.parent.model_path,
            #                                       structure_path,
            #                                       uniform)
            # TODO: Insert supported methods here, for example:
            create_model_nested.main()
        except FileNotFoundError as e:
            raise RuntimeError(f"File not found during model creation: {e}")
        except Exception as e:
@@ -116,19 +100,12 @@ class JuliaMethods(LanguageMethod):
        dependencies, experimentSettings = super().create_fmu(dependencies, fmu_compiler, experimentSettings, **kwargs)
    
        # Use this to populate default dependencies
        # dependencies.append()
        # TODO: dependencies.append()
            
        try:
            # Insert supported methods here, for example:
            # if fmu_compiler == 'dymola':
            #     # Extract parameters from kwargs
            #     showwindow = kwargs.pop('showwindow', False)
                
            #     julia_create_fmu_fmijl.main(dependencies, 
            #                                     self.parent.model_path, 
            #                                     pathlib.Path(self.parent.output_path).resolve(),
            #                                     experimentSettings, 
            #                                     showwindow)
            # TODO: Insert supported methods here, for example:
            create_fmu_fmijl.main()
            pass
        except FileNotFoundError as e:
            raise RuntimeError(f"Dependency file not found: {e}")
        except Exception as e:
Loading