Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/spack_default_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ jobs:
submodules: true

- name: Setup Spack
run: echo "$PWD/Buildsystem/spack/spack/bin" >> "$GITHUB_PATH"
run: echo "$PWD/buildsystem/spack/spack/bin" >> "$GITHUB_PATH"

- name: Create heredoc spack.yaml
run: |
Expand Down
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "Buildsystem/spack/spack"]
path = Buildsystem/spack/spack
[submodule "buildsystem/spack/spack"]
path = buildsystem/spack/spack
url = https://github.com/nkoukpaizan/spack.git
branch = Gridkit-package-dev+enzyme
20 changes: 5 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ option(GRIDKIT_ENABLE_ENZYME "Enable automatic differentiation with Enzyme" OFF)

set(CMAKE_MACOSX_RPATH 1)

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMake)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

# https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling#always-full-rpath
# use, i.e. don't skip the full RPATH for the build tree
Expand Down Expand Up @@ -117,7 +117,7 @@ set(CMAKE_CXX_FLAGS_DEBUG "-Wall -O0 -g -DDEBUG")

set(CMAKE_CXX_STANDARD 17)

include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)

option(GRIDKIT_BUILD_SHARED "Build shared libraries" ON)
option(GRIDKIT_BUILD_STATIC "Build static libraries" OFF)
Expand Down Expand Up @@ -145,21 +145,11 @@ include(GridkitAddLibrary)

set(CMAKE_POSITION_INDEPENDENT_CODE ON)

# Create component models
add_subdirectory(ComponentLib)

# General Utilities and File IO
add_subdirectory(Utilities)

#Local Sparse matrix operations
add_subdirectory(SparseMatrix)

# Create solvers
add_subdirectory(Solver)
add_subdirectory(src)

# Create examples and tests
enable_testing()
add_subdirectory(Examples)
add_subdirectory(examples)

export(EXPORT gridkit-targets FILE ${CMAKE_CURRENT_BINARY_DIR}/GridKitTargets.cmake)

Expand All @@ -178,7 +168,7 @@ write_basic_package_version_file(
COMPATIBILITY SameMajorVersion)

# Generate config file that includes exports
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/CMake/Config.cmake.in
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/GridKitConfig.cmake
INSTALL_DESTINATION share/cmake/gridkit
NO_SET_AND_CHECK_MACRO
Expand Down
Empty file added buildsystem/.gitkeep
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file added docs/.gitkeep
Empty file.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@
#include <iostream>
#include <iomanip>

#include <ComponentLib/PowerFlow/Bus/BusSlack.hpp>
#include <ComponentLib/PowerFlow/Generator4/Generator4.hpp>
#include <Model/PowerFlow/Bus/BusSlack.hpp>
#include <Model/PowerFlow/Generator4/Generator4.hpp>
#include <SystemModel.hpp>
#include <Solver/Dynamic/Ida.hpp>
#include <Utilities/Testing.hpp>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <filesystem>
#include <math.h>

#include <ComponentLib/PowerElectronics/DistributedGenerator/DistributedGenerator.hpp>
#include <Model/PowerElectronics/DistributedGenerator/DistributedGenerator.hpp>


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@
#include <iostream>
#include <iomanip>

#include <ComponentLib/PowerFlow/Bus/BusSlack.hpp>
#include <ComponentLib/PowerFlow/Generator2/Generator2.hpp>
#include <Model/PowerFlow/Bus/BusSlack.hpp>
#include <Model/PowerFlow/Generator2/Generator2.hpp>
#include <SystemModel.hpp>
#include <Solver/Dynamic/Ida.hpp>

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@
#include <iostream>
#include <iomanip>

#include <ComponentLib/PowerFlow/Bus/BusPQ.hpp>
#include <ComponentLib/PowerFlow/Load/Load.hpp>
#include <ComponentLib/PowerFlow/Generator4Governor/Generator4Governor.hpp>
#include <Model/PowerFlow/Bus/BusPQ.hpp>
#include <Model/PowerFlow/Load/Load.hpp>
#include <Model/PowerFlow/Generator4Governor/Generator4Governor.hpp>
#include <Solver/Dynamic/Ida.hpp>
#include <SystemModel.hpp>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@
#include <iostream>
#include <iomanip>

#include <ComponentLib/PowerFlow/Bus/BusSlack.hpp>
#include <ComponentLib/PowerFlow/Generator4/Generator4.hpp>
#include <Model/PowerFlow/Bus/BusSlack.hpp>
#include <Model/PowerFlow/Generator4/Generator4.hpp>
#include <SystemModel.hpp>
#include <Solver/Dynamic/Ida.hpp>

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@
#include <fstream>
#include <filesystem>

#include <ComponentLib/PowerFlow/MiniGrid/MiniGrid.hpp>
#include <ComponentLib/PowerFlow/Bus/BusFactory.hpp>
#include <ComponentLib/PowerFlow/Generator/GeneratorFactory.hpp>
#include <ComponentLib/PowerFlow/Branch/Branch.hpp>
#include <ComponentLib/PowerFlow/Load/Load.hpp>
#include <SystemSteadyStateModel.hpp>
#include <Model/PowerFlow/MiniGrid/MiniGrid.hpp>
#include <Model/PowerFlow/Bus/BusFactory.hpp>
#include <Model/PowerFlow/Generator/GeneratorFactory.hpp>
#include <Model/PowerFlow/Branch/Branch.hpp>
#include <Model/PowerFlow/Load/Load.hpp>
#include <Model/PowerFlow/SystemModelPowerFlow.hpp>
#include <Solver/SteadyState/Kinsol.hpp>
#include <PowerSystemData.hpp>

Expand Down
6 changes: 3 additions & 3 deletions Examples/Grid3Bus/README.md → examples/Grid3Bus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The mathematical model of the power flow problem is formulated as a set of nonli
The model and its parameters are described in Figure 1:

<div align="center">
<img align="center" src="../../Documentation/Figures/example1.jpg">
<img align="center" src="../../docs/Figures/example1.jpg">


Figure 1: A simple 3-bus grid example.
Expand All @@ -22,7 +22,7 @@ Problem variables are voltage magnitudes and phases; they are stored in bus obje

**Bus 1**: Slack bus, does not store variables no residuals. Voltage and phase are set to $`V_1 \equiv 1`$p.u. and $`\theta_1 \equiv 0`$, respectively.

**Bus 2**: PQ bus, stores variables $`V_2, \theta_2`$ and residuals $`P_2, Q_2`$. Load $`P_{L2} = 2.5`$p.u., $`Q_{L2} = -j0.8`$p.u. is attached to it. From the equations for [branch](../../ComponentLib/Branch/README.md) and [load](../../ComponentLib/Load/README.md) components, we assemble Bus 2 residuals as:
**Bus 2**: PQ bus, stores variables $`V_2, \theta_2`$ and residuals $`P_2, Q_2`$. Load $`P_{L2} = 2.5`$p.u., $`Q_{L2} = -j0.8`$p.u. is attached to it. From the equations for [branch](../../src/Model/PowerFlow/Branch/README.md) and [load](../../src/Model/PowerFlow/Load/README.md) components, we assemble Bus 2 residuals as:
```math
\begin{array}{rcll}
P_2 & = &-P_{L2} &~~~\mathrm{(load ~2)} \\
Expand All @@ -34,7 +34,7 @@ Q_2 & = & -Q_{L2} &~~~\mathrm{(load ~2)} \\
\end{array}
```

**Bus 3**: PV bus, stores variable $`\theta_3`$ and residual $`P_3`$. Voltage is set to $`|V_3| \equiv 1.1`$p.u.. Generator $`P_{G3} = 2`$p.u. is attached to it. From the equations for [branch](../../ComponentLib/Branch/README.md) and [generator](../../ComponentLib/Gen/README.md) components, we assemble Bus 3 residual as:
**Bus 3**: PV bus, stores variable $`\theta_3`$ and residual $`P_3`$. Voltage is set to $`|V_3| \equiv 1.1`$p.u.. Generator $`P_{G3} = 2`$p.u. is attached to it. From the equations for [branch](../../src/Model/PowerFlow/Branch/README.md) and [generator](../../src/Model/PowerFlow/Gen/README.md) components, we assemble Bus 3 residual as:
```math
\begin{array}{rcll}
P_3 & = &P_{G3} &~~~\mathrm{(generator ~3)} \\
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
#include <filesystem>


#include <ComponentLib/PowerElectronics/DistributedGenerator/DistributedGenerator.hpp>
#include <ComponentLib/PowerElectronics/MicrogridLine/MicrogridLine.hpp>
#include <ComponentLib/PowerElectronics/MicrogridLoad/MicrogridLoad.hpp>
#include <ComponentLib/PowerElectronics/MicrogridBusDQ/MicrogridBusDQ.hpp>
#include <Model/PowerElectronics/DistributedGenerator/DistributedGenerator.hpp>
#include <Model/PowerElectronics/MicrogridLine/MicrogridLine.hpp>
#include <Model/PowerElectronics/MicrogridLoad/MicrogridLoad.hpp>
#include <Model/PowerElectronics/MicrogridBusDQ/MicrogridBusDQ.hpp>

#include <PowerElectronicsModel.hpp>
#include <Model/PowerElectronics/SystemModelPowerElectronics.hpp>
#include <Solver/Dynamic/Ida.hpp>
#include <Solver/Dynamic/DynamicSolver.hpp>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@

#include <Solver/Optimization/DynamicObjective.hpp>
#include <Solver/Optimization/DynamicConstraint.hpp>
#include <ComponentLib/PowerFlow/Bus/BusSlack.hpp>
#include <ComponentLib/PowerFlow/Generator4Param/Generator4Param.hpp>
#include <Model/PowerFlow/Bus/BusSlack.hpp>
#include <Model/PowerFlow/Generator4Param/Generator4Param.hpp>
#include <SystemModel.hpp>
#include <Solver/Dynamic/Ida.hpp>

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
#include <fstream>
#include <filesystem>

#include <ComponentLib/PowerElectronics/Capacitor/Capacitor.hpp>
#include <ComponentLib/PowerElectronics/Inductor/Inductor.hpp>
#include <ComponentLib/PowerElectronics/Resistor/Resistor.hpp>
#include <ComponentLib/PowerElectronics/VoltageSource/VoltageSource.hpp>
#include <Model/PowerElectronics/Capacitor/Capacitor.hpp>
#include <Model/PowerElectronics/Inductor/Inductor.hpp>
#include <Model/PowerElectronics/Resistor/Resistor.hpp>
#include <Model/PowerElectronics/VoltageSource/VoltageSource.hpp>

#include <PowerElectronicsModel.hpp>
#include <Model/PowerElectronics/SystemModelPowerElectronics.hpp>
#include <Solver/Dynamic/Ida.hpp>
#include <Solver/Dynamic/DynamicSolver.hpp>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

#include <Utilities/Testing.hpp>

#include <ComponentLib/PowerElectronics/DistributedGenerator/DistributedGenerator.hpp>
#include <ComponentLib/PowerElectronics/MicrogridLine/MicrogridLine.hpp>
#include <ComponentLib/PowerElectronics/MicrogridLoad/MicrogridLoad.hpp>
#include <ComponentLib/PowerElectronics/MicrogridBusDQ/MicrogridBusDQ.hpp>
#include <Model/PowerElectronics/DistributedGenerator/DistributedGenerator.hpp>
#include <Model/PowerElectronics/MicrogridLine/MicrogridLine.hpp>
#include <Model/PowerElectronics/MicrogridLoad/MicrogridLoad.hpp>
#include <Model/PowerElectronics/MicrogridBusDQ/MicrogridBusDQ.hpp>

#include <PowerElectronicsModel.hpp>
#include <Model/PowerElectronics/SystemModelPowerElectronics.hpp>
#include <Solver/Dynamic/Ida.hpp>
#include <Solver/Dynamic/DynamicSolver.hpp>

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <vector>
#include <tuple>

#include <SparseMatrix/COO_Matrix.hpp>
#include <LinearAlgebra/COO_Matrix.hpp>

int main(int argc, char const *argv[])
{
Expand Down
11 changes: 11 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Create component models
add_subdirectory(Model)

# General Utilities and File IO
add_subdirectory(Utilities)

# Local Sparse matrix operations
add_subdirectory(LinearAlgebra)

# Create solvers
add_subdirectory(Solver)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@

#include <iostream>
#include <cmath>
#include <ComponentLib/PhasorDynamics/Bus/Bus.hpp>
#include <Model/PhasorDynamics/Bus/Bus.hpp>
#include <PowerSystemData.hpp>

#include "Branch.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ sending to receiving bus. We decide to use this symmetric convention because it
provides more flexibility for modeling.

<div align="center">
<img align="center" src="../../../Documentation/Figures/branch_phasor_dynamics.png">
<img align="center" src="../../../docs/Figures/branch_phasor_dynamics.png">

Figure 1: Transmission line $`\pi`$ equivalent circuit
</div>
Expand Down Expand Up @@ -96,7 +96,7 @@ magnitude and $`\theta`$ is the phase shift angle and
$`N = \tau e^{j \theta}`$.

<div align="center">
<img align="center" src="../../../Documentation/Figures/transformer-branch.png">
<img align="center" src="../../../docs/Figures/transformer-branch.png">


Figure 2: Branch equivalent circuit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Current entering the bus has positive and current exiting the bus negative
sign.

<div align="center">
<img align="center" src="../../../Documentation/Figures/bus_variables.jpg">
<img align="center" src="../../../docs/Figures/bus_variables.jpg">

Figure 1: Needs to be changed to represent current balance instead of power
balance.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
**Note: Exciter model not yet implemented**

<div align="center">
<img align="center" src="../../../Documentation/Figures/EXDC1.JPG">
<img align="center" src="../../../docs/Figures/EXDC1.JPG">


Figure 1: Exciter EXDC1 model. Fifure courtesy of [PoweWorld](https://www.powerworld.com/WebHelp/).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Standard model of the stream turbine

<div align="center">
<img align="center" src="../../../Documentation/Figures/TGOV1.JPG">
<img align="center" src="../../../docs/Figures/TGOV1.JPG">


Figure 1: Governor TGOV1 model. Figure courtesy of [PowerWorld](https://www.powerworld.com/WebHelp/)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


<div align="center">
<img align="center" src="../../../Documentation/Figures/PSS1A.JPG">
<img align="center" src="../../../docs/Figures/PSS1A.JPG">


Figure 1: Power system stabilizer PSS1A model. Figure courtesy of [PowerWorld](https://www.powerworld.com/WebHelp/)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
- same relative amount of saturation occurs on both $`d`$ and $`q`$ axis

<div align="center">
<img align="center" src="../../../../Documentation/Figures/GENROU.JPG">
<img align="center" src="../../../../docs/Figures/GENROU.JPG">


Figure 2: GENROU. Figure courtesy of [PowerWorld](https://www.powerworld.com/WebHelp/)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
- $`T'_{q0}`$ is neglected

<div align="center">
<img align="center" src="../../../../Documentation/Figures/GENSAL.JPG">
<img align="center" src="../../../../docs/Figures/GENSAL.JPG">


Figure 2: GENSAL. Figure courtesy of [PowerWorld](https://www.powerworld.com/WebHelp/)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


<div align="center">
<img align="center" src="../../../Documentation/Figures/SM1.JPG">
<img align="center" src="../../../docs/Figures/SM1.JPG">


Figure 1: Synchronous Machine. Figure courtesy of [PowerWorld](https://www.powerworld.com/files/Synchronous-Machines.pdf)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include <ModelEvaluatorImpl.hpp>
#include <PowerSystemData.hpp>
#include <ComponentLib/PowerElectronics/CircuitComponent.hpp>
#include <Model/PowerElectronics/CircuitComponent.hpp>


namespace ModelLib
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include <ModelEvaluatorImpl.hpp>
#include <PowerSystemData.hpp>
#include <ComponentLib/PowerElectronics/CircuitComponent.hpp>
#include <Model/PowerElectronics/CircuitComponent.hpp>


namespace ModelLib
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include <ModelEvaluatorImpl.hpp>
#include <PowerSystemData.hpp>
#include <ComponentLib/PowerElectronics/CircuitComponent.hpp>
#include <Model/PowerElectronics/CircuitComponent.hpp>


namespace ModelLib
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include <ModelEvaluatorImpl.hpp>
#include <PowerSystemData.hpp>
#include <ComponentLib/PowerElectronics/CircuitComponent.hpp>
#include <Model/PowerElectronics/CircuitComponent.hpp>


namespace ModelLib
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include <ModelEvaluatorImpl.hpp>
#include <PowerSystemData.hpp>
#include <ComponentLib/PowerElectronics/CircuitComponent.hpp>
#include <Model/PowerElectronics/CircuitComponent.hpp>


namespace ModelLib
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include <ModelEvaluatorImpl.hpp>
#include <PowerSystemData.hpp>
#include <ComponentLib/PowerElectronics/CircuitComponent.hpp>
#include <Model/PowerElectronics/CircuitComponent.hpp>


namespace ModelLib
Expand Down
Loading