-
Notifications
You must be signed in to change notification settings - Fork 5
Working Example of Solving RLCircuit and Microgrid with Jacobians #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 42 commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
cbabd88
Add bus factory.
pelesh 1603057
Add New Components and Changes to Composition
reid-g b9ce19f
Added COO Sparse Matrices, Component Jacobians, and Discrete Generator
reid-g be22b55
Added Jacobian Assembly. Fixed and Added New Functionality to COO Mat…
reid-g 3f74458
Jacobian Assembly, IDA + KLU Cmake, RL Circuit
reid-g a42761c
Added the Transmission Line Component
reid-g fcf1cb9
Added Microgrid Example
reid-g 1aa8865
Working Microgrid (Finite Difference)
reid-g 723c785
Fixed the Jacobian in Microgrid Example
reid-g a3e5af8
Added a max step size control for model objects
reid-g c3f071e
Update Solver/Dynamic/CMakeLists.txt
reid-g 7be79c7
Updated name DiscreteGenerator -> DistributedGenerator
reid-g d715372
Fixed Some Bugs
reid-g 001d3c2
Fixed Memory Error with Grid3BusSys
reid-g d258ad5
Fixed Unitalized Variable Stepsize
reid-g c8de307
Fix max number of backward steps in IDA solver.
pelesh 36df264
Merge pull request #4 from ORNL/composer-ida-fix
reid-g 31e6f68
Fixing indentation from tabs to spaces
reid-g f8d6943
Formatting Fix Composer-Dev (#6)
reid-g 8f55e94
Remove parts of generator model from BusPV (#7)
pelesh 7bb9374
Formatting updates + Fixed Warnings
reid-g 425b7d0
Add bus factory.
pelesh e0c778e
Add New Components and Changes to Composition
reid-g b57ec42
Added COO Sparse Matrices, Component Jacobians, and Discrete Generator
reid-g de2307c
Added Jacobian Assembly. Fixed and Added New Functionality to COO Mat…
reid-g 1dc614c
Jacobian Assembly, IDA + KLU Cmake, RL Circuit
reid-g e005183
Added the Transmission Line Component
reid-g eb6fde4
Added Microgrid Example
reid-g 1952b25
Working Microgrid (Finite Difference)
reid-g efc71f8
Fixed the Jacobian in Microgrid Example
reid-g 9f99077
Added a max step size control for model objects
reid-g 60b328c
Update Solver/Dynamic/CMakeLists.txt
reid-g 6c223b3
Updated name DiscreteGenerator -> DistributedGenerator
reid-g 226afca
Fixed Some Bugs
reid-g 861b33c
Fixed Memory Error with Grid3BusSys
reid-g efddb28
Fixed Unitalized Variable Stepsize
reid-g 3cb53a8
Fix max number of backward steps in IDA solver.
pelesh a2e71ab
Fixing indentation from tabs to spaces
reid-g 17a0cb7
Formatting Fix Composer-Dev (#6)
reid-g d2ac21a
Formatting updates + Fixed Warnings
reid-g a192d47
Rebasing with BusPV Fixes
reid-g b0c02a1
Merge branch 'composer-dev' of https://github.com/ORNL/GridKit into c…
reid-g ad7f4af
Minor comments and style corrections.
pelesh 7e685c5
Multiple Format & Comment Updates + Valgrind Error Fixes
reid-g a43404f
Formatting Updates with "this" and using + Minor Fixes
reid-g 9250411
Added Better Description to the MicrogridBus
reid-g File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
|
||
|
||
#include <iostream> | ||
#include <cmath> | ||
#include <vector> | ||
#include <unordered_set> | ||
#include <map> | ||
|
||
/** | ||
* @brief A very basic hypergraph setup for circuit representation. This forms the hypergraph as a bipartite graph. Doesn't allow removing. Can only grab sets of connections to nodes | ||
* | ||
* @todo should replace with something better and more efficent. Should replace with a libraries setup instead. This would allow fast and easy partitioning of circuits | ||
* | ||
* @todo should replace N and E with Node and Component classes respectively | ||
* | ||
* @tparam IdxT | ||
* @tparam Label | ||
*/ | ||
template <typename N, typename E> | ||
class CircuitGraph | ||
{ | ||
private: | ||
std::set<N> hypernodes; | ||
std::set<E> hyperedges; | ||
std::map<E, std::set<N>> edgestonodes; | ||
public: | ||
CircuitGraph(); | ||
~CircuitGraph(); | ||
bool addHyperEdge(E he); | ||
bool addHyperNode(N hn); | ||
bool addConnection(N hn, E he); | ||
std::set<N> getHyperEdgeConnections(E he); | ||
size_t amountHyperNodes(); | ||
size_t amountHyperEdges(); | ||
void printBiPartiteGraph(bool verbose = false); | ||
}; | ||
|
||
template <typename N, typename E> | ||
CircuitGraph<N, E>::CircuitGraph() | ||
{ | ||
} | ||
|
||
template <typename N, typename E> | ||
CircuitGraph<N, E>::~CircuitGraph() | ||
{ | ||
} | ||
|
||
template <typename N, typename E> | ||
bool CircuitGraph<N, E>::addHyperNode(N hn) | ||
{ | ||
return this->hypernodes.insert(hn).second; | ||
} | ||
|
||
template <typename N, typename E> | ||
bool CircuitGraph<N, E>::addHyperEdge(E he) | ||
{ | ||
return this->hyperedges.insert(he).second; | ||
} | ||
|
||
|
||
template <typename N, typename E> | ||
bool CircuitGraph<N, E>::addConnection(N hn, E he) | ||
{ | ||
if(this->hyperedges.count(he) == 0 || this->hypernodes.count(hn) == 0) | ||
{ | ||
return false; | ||
} | ||
return this->edgestonodes[he].insert(hn).second; | ||
} | ||
|
||
|
||
template <typename N, typename E> | ||
std::set<N> CircuitGraph<N, E>::getHyperEdgeConnections(E he) | ||
{ | ||
return this->edgestonodes[he]; | ||
} | ||
|
||
reid-g marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
template <typename N, typename E> | ||
size_t CircuitGraph<N, E>::amountHyperNodes() | ||
{ | ||
return this->hypernodes.size(); | ||
} | ||
|
||
|
||
template <typename N, typename E> | ||
size_t CircuitGraph<N, E>::amountHyperEdges() | ||
{ | ||
return this->hyperedges.size(); | ||
} | ||
|
||
/** | ||
* @brief Printing | ||
* | ||
* @todo need to add verbose printing for connections display | ||
* | ||
* @tparam IdxT | ||
* @param verbose | ||
*/ | ||
|
||
template <typename N, typename E> | ||
void CircuitGraph<N, E>::printBiPartiteGraph(bool verbose) | ||
{ | ||
|
||
std::cout << "Amount of HyperNodes: " << this->amountHyperNodes() << std::endl; | ||
std::cout << "Amount of HyperEdges: " << this->amountHyperEdges() << std::endl; | ||
std::cout << "Connections per Edge:" << std::endl; | ||
for (auto i : this->edgestonodes) | ||
{ | ||
std::cout << i.first << " : {"; | ||
for (auto j : i.second){ | ||
std::cout << j << ", "; | ||
} | ||
std::cout << "}\n"; | ||
|
||
} | ||
|
||
|
||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
|
||
add_subdirectory(Capacitor) | ||
add_subdirectory(Resistor) | ||
add_subdirectory(VoltageSource) | ||
add_subdirectory(Inductor) | ||
add_subdirectory(LinearTransformer) | ||
add_subdirectory(InductionMotor) | ||
add_subdirectory(SynchronousMachine) | ||
add_subdirectory(DistributedGenerator) | ||
add_subdirectory(TransmissionLine) | ||
add_subdirectory(MicrogridLoad) | ||
add_subdirectory(MicrogridLine) | ||
add_subdirectory(MicrogridBusDQ) |
8 changes: 8 additions & 0 deletions
8
ComponentLib/PowerElectronicsComponents/Capacitor/CMakeLists.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
|
||
|
||
gridkit_add_library(powerelec_capacitor | ||
SOURCES | ||
Capacitor.cpp | ||
OUTPUT_NAME | ||
gridkit_powerelec_capacitor) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.