Skip to content

Replace main.py with self contained modules - #4

Draft
adam-sedlak wants to merge 281 commits into
psernatorre:mainfrom
REAM-lab:main
Draft

Replace main.py with self contained modules #4
adam-sedlak wants to merge 281 commits into
psernatorre:mainfrom
REAM-lab:main

Conversation

@adam-sedlak

@adam-sedlak adam-sedlak commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

As is, all modules feed into a single main.py script. This however introduces many inter module dependencies through the imports in main.py. Furthermore, this may not be the most intuitive user-interface as a single run script offers users less behind the scenes control (i.e., one run script does many different actions, reading, writing CSVs, running models, etc.) that are obscured from the user.

Can we replace main.py scripts with module specific methods?

In this manner we would transition to a UI closer to something that of sklearn where each module has predictable well defined methods---such as .train() and .predict(). However how to best do this is an open question. Many modules are related to one another (ACOPF --> SSM --> MOR) and need well defined interfaces to pass data between one another. Additionally some main scripts are across modules. And not all modules share the same methods. A few ideas for how to structure this are

  • Instantiation of each module just takes settings. A system object is not a module property and must be constructed separately. In this manner modules only perform actions on a data but do not store data. Storage of data is relegated to the system class.
  • Modules have methods like .run(), .write_csv(), and simulate() that accept a system object in their arguments.
  • Create a pipeline class to manage inter-module exchanges of data. pipe = Pipeline([ACOPF, SSM, EMT]); pipe.run(). If we can do this in a clean modular way I think it may have potential.

One optional point to consider in this refactor is if we should change some of the import paths to be more user friendly/shorter.

rkravis and others added 30 commits March 16, 2026 14:50
feat: add more info about extra components added in run_capex.
…hod to_timeseries in dynamical variables.

feat: printing of csv files containing states when emt and ssm simulation are executed.
fix: add csv files of emt simulation and ssm simultion to gitignore.
psernatorre and others added 30 commits August 25, 2026 18:52
… new components (dc_circuit_1a - parallel capacitor and resistor, dc_voltage_controller_1a - PI controller of i_ref_d based on v_dc imbalance)
Ruth is adding inverters models using DC-link.
fix: remove folders and files.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants