Replace main.py with self contained modules #4
Replace main.py with self contained modules #4asedlak-ucsd wants to merge 80 commits intopsernatorre:mainfrom
Conversation
…rated: nonvariable and variable. feat: add output_directory to main.
feat: add_components in run_capex
feat: GFMIe added to system
adding gFMIe. Thank you Ruth.
bug fix: gfmi_e emt
…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.
…mponent SSM naming
|
''Components define how but not what''. This is a different approach and will likely require a large refactor. However, it solves the problem of clearly defining each module/objects bailiwick. Here the System and Component classes become frozen dataclasses. Mutable attributes like EMT and StateSpaceModels are instead moved to methods. For example, a small single model would look like class SmallSignalModel
system
state_space
power_flow_solThen to get all component small_singal models, the class will call each components
Thus we are not mutating a component it is simply defining how to construct the state-space model not what the state-space model actually is. "What" is the job of the SmallSingalModel. Modules that modify the system can then be grouped into a system modifier class. These modules actual modify the raw system data
A few related upgrades that could be helpful for system
|
Add gfmi_e and corresponding test case. This gfmi_e models DC dynamics, including DC voltage source and current-constant load.
fix: remove inspect coefficient from capex module, and place in pyomo tools. This is because unit commitment can use it, too.
…sion can be used for unit commitment.
… storage. This factor increases deployed capacity for resources when they are then used for cost production model. This avoids infeasibility. These features were used for final runs in ucop project. fix: conditional to make expandable true was commented for storage as for other generators. Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
…example. Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
As is, all modules feed into a single
main.pyscript. This however introduces many inter module dependencies through the imports inmain.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.run(),.write_csv(), andsimulate()that accept a system object in their arguments.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.