Commit 2e07726a authored by Greenwood, Scott's avatar Greenwood, Scott
Browse files

restructure to generalize naming schemes, update examples with changes, update...

restructure to generalize naming schemes, update examples with changes, update readme to reflect generalizability of AutoCSM
parent 55decda0
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -149,6 +149,8 @@ class AutoCSM:
        """
        Creates the architecture based on the selected language and architecture.
        
        The output project architecture name is deterined from the JSON input file.

        Args:
            *args: Additional positional arguments passed to the architecture creation method.
            **kwargs: Additional keyword arguments passed to the architecture creation method.
+2 −2
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ class ModelicaMethods(LanguageMethod):
        SUPPORTED_FMU_COMPILERS (list): FMU compilers supported by Modelica.
    """

    METHOD_PATH = (pathlib.Path(LanguageMethod.BASE_PATH) / '../../methods/modelica/ExaDigiT_AutoCSM').resolve()
    METHOD_PATH = (pathlib.Path(LanguageMethod.BASE_PATH) / '../../methods/modelica/TemplatesCSM').resolve()
    TEMPLATE_FOLDER = (METHOD_PATH / 'Templates/TemplateSystem').resolve()
    STRUCTURE_PATH = (METHOD_PATH / 'Templates/Structure.mo').resolve()

@@ -61,7 +61,7 @@ class ModelicaMethods(LanguageMethod):
        except Exception as e:
            raise RuntimeError(f"Failed to create architecture: {str(e)}")
        
    def create_model(self, structure_path: str = None, parent_class: str = 'ExaDigiT_AutoCSM.BaseClasses.Tests.PartialTest', **kwargs):
    def create_model(self, structure_path: str = None, parent_class: str = 'TemplatesCSM.BaseClasses.Tests.PartialTest', **kwargs):
        """
        Creates the Modelica model for the specified architecture.
        
+24 −12
Original line number Diff line number Diff line
# AutoCSM
 *A template system-of-systems modeling approach for
automating the development, deployment, and  integration of cooling system models (CSMs) for supercomputing facilities within the ExaDigiT framework.*
**AUTO**mating the **C**reation (i.e., development, deployment, and integration) of **S**ystem **M**odels (AutoCSM).*

AutoCSM is a Python-based framework to assist in CSM developers in accelerating the creation and deployment of system-level thermal-hydraulic CSMs. The intention is for this tool specifically to help standardize digital twin workflows for ExaDigiT. However, this tool can be used independent of ExaDigiT (and even other systems besides CSMs). 

As shown in the following figure, AutoCSM is intended to provide a language-agnostic high-level interface to convert system specification information into a containerized system model (e.g., FMU) that can then be consumed by the simulator.

| ![autocsm_exadigit](resources/autocsm_exadigit.png) | 
|:--:| 
|*AutoCSM API in the broader ExaDigiT procedure.*|
AutoCSM is a Python-based framework to assist system model developers to accelerate the creation and deployment of SMs through standardized workflows and template modeling architectures. 

Originally developed for systems with deep hierarchies such as as cooling system models for supercomputing facilities within the ExaDigiT digital twin framework. AutoCSM methods and worfklow can be used for any project where a standard architecture can be defined.

As shown in the following figure, AutoCSM is intended to provide a language-agnostic high-level interface to convert system specification information into a containerized system model (e.g., FMU) that can then be consumed by a simulator.

AutoCSM includes three main components: 
- Input specification (JSON)
- Input specification (JSON): 
- Model generation
- Model export

Below are examples of the structure of AutoCSM within the context of ExaDigiT.

| ![autocsm_exadigit](resources/autocsm_exadigit.png) | 
|:--:| 
|*AutoCSM API in the broader ExaDigiT procedure.*|

| ![autocsm_api](resources/autocsm_api.png) | 
|:--:| 
|*Internal to AutoCSM API procedure for CSM creation.*|
|*Internal to AutoCSM API procedure for ExaDigiT cooling system model creation.*|

## Requirements
- Python 3+

### Implemented languages
- Modelica (Dymola)
- Modelica
    - Dymola
    - OpenModelica (OMEdit) | Not yet supported as awaiting [OMEdit bug fix](https://github.com/OpenModelica/OpenModelica/issues/13065)
- Julia
    - JuliaSim Modeling Language (JSML) | Not yet supported. Awaiting JSML improvements.

### Implemented architectures
- Nested hierarchy
- [Nested hierarchy](https://en.wikipedia.org/wiki/Hierarchy#:~:text=A%20nested%20hierarchy%20or%20inclusion,way%20to%20the%20outer%20doll.)

## To Run
1. Clone the repository.
@@ -40,6 +45,13 @@ AutoCSM includes three main components:

**See [examples](./examples/) folders for more details (e.g., [`modelica/run_auto_csm.py`](examples/modelica/run_auto_csm.py).**

# Advanced:
### Language Method Templates
For each implemented language a library of base templates and classes is requires (see [method](./methods/)). The templates represent the folder structure that will be replicated into the JSON specified layout using the specified architecture (e.g., `nested`). If the default template is not adequate for an application, new templates can be created in the language library and then selected for use from the AutoCSM Python API.

### Architectures
Architecures represent the way the input JSON structure is interpreted and applied to the selected method template. New architectures can be added for any language by adding new methods for the language of interest in Python.

# Citation:
**Paper**: S. Greenwood, V. Kumar, W. Brewer, “Thermo-fluid modeling framework for supercomputer digital twins: Part 2, automated cooling models.” In Proceedings of the 2024 American Modelica Conference, Mansfield, CT, USA, October 2024. 

+1 −1
Original line number Diff line number Diff line
{
    "Name": "GenericCSM",
    "Name": "GenericDatacenter",
	"InstanceName":"simulator",
	"Structure":{"n":1},
	"ModelClass":"v0",
+1 −1
Original line number Diff line number Diff line
{
    "Name": "GenericCSM",
    "Name": "GenericDatacenter",
	"InstanceName":"simulator",
	"Structure":{"n":2},
	"ModelClass":"v0",
Loading