From fc8cbc11c1439fa7aebca59342ebc57b4d5f6b07 Mon Sep 17 00:00:00 2001 From: Slaven Peles Date: Fri, 30 May 2025 12:34:48 -0400 Subject: [PATCH 1/6] 10-gen model, first take --- examples/PhasorDynamics/CMakeLists.txt | 1 + .../PhasorDynamics/Example3/CMakeLists.txt | 11 + examples/PhasorDynamics/Example3/example3.cpp | 234 ++++++++++++++++++ 3 files changed, 246 insertions(+) create mode 100644 examples/PhasorDynamics/Example3/CMakeLists.txt create mode 100644 examples/PhasorDynamics/Example3/example3.cpp diff --git a/examples/PhasorDynamics/CMakeLists.txt b/examples/PhasorDynamics/CMakeLists.txt index 58ded3a1..5d675223 100644 --- a/examples/PhasorDynamics/CMakeLists.txt +++ b/examples/PhasorDynamics/CMakeLists.txt @@ -1,2 +1,3 @@ add_subdirectory(Example1) add_subdirectory(Example2) +add_subdirectory(Example3) diff --git a/examples/PhasorDynamics/Example3/CMakeLists.txt b/examples/PhasorDynamics/Example3/CMakeLists.txt new file mode 100644 index 00000000..5790e144 --- /dev/null +++ b/examples/PhasorDynamics/Example3/CMakeLists.txt @@ -0,0 +1,11 @@ +add_executable(phasordynamics_example3 example3.cpp) +target_link_libraries(phasordynamics_example3 + GRIDKIT::phasor_dynamics_bus + GRIDKIT::phasor_dynamics_bus_fault + GRIDKIT::phasor_dynamics_branch + GRIDKIT::phasor_dynamics_genrou + GRIDKIT::phasor_dynamics_load + GRIDKIT::solvers_dyn) +install(TARGETS phasordynamics_example3 RUNTIME DESTINATION bin) + +add_test(NAME GenrouTest3 COMMAND $) diff --git a/examples/PhasorDynamics/Example3/example3.cpp b/examples/PhasorDynamics/Example3/example3.cpp new file mode 100644 index 00000000..2c171517 --- /dev/null +++ b/examples/PhasorDynamics/Example3/example3.cpp @@ -0,0 +1,234 @@ +/** + * @file example3.cpp + * @author Adam Birchfield (abirchfield@tamu.edu) + * @author Slaven Peles (peless@ornl.gov) + * @brief Example running a 10-bus system + * + * Simulates a 11-bus system with 10 Genrou 6th order generator models + * split in two groups of five generators. The two groups are connected + * by a high-impedance branch, which makes connection between them weak. + * + */ +#include +#include +#include +#include + +// #include "example3.hpp" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using scalar_type = double; +using real_type = double; +using index_type = size_t; + +struct OutputData +{ + real_type t; + scalar_type gen2speed; + scalar_type gen3speed; + scalar_type v2mag; + scalar_type v3mag; + + OutputData& operator-=(const OutputData& other) + { + assert(GridKit::Testing::isEqual(t, other.t, Example2::reference_tol)); + gen2speed -= other.gen2speed; + gen3speed -= other.gen3speed; + v2mag -= other.v2mag; + v3mag -= other.v3mag; + return *this; + } + + double norm() const + { + return std::max({ + std::abs(gen2speed), + std::abs(gen3speed), + std::abs(v2mag), + std::abs(v3mag), + }); + } +}; + +const OutputData operator-(const OutputData& lhs, const OutputData& rhs) +{ + return OutputData(lhs) -= rhs; +} + +std::ostream& operator<<(std::ostream& out, const OutputData& data) +{ + out << data.t << "," + << data.gen2speed << "," + << data.gen3speed << "," + << data.v2mag << "," + << data.v3mag; + return out; +} + +int main() +{ + using namespace GridKit::PhasorDynamics; + using namespace AnalysisManager::Sundials; + + auto error_allowed = static_cast(1e-4); + + std::cout << "Example 3 version 1\n"; + + /* Create model parts */ + SystemModel sys; + BusInfinite bus1(1, 0); + + Bus bus2(0.999733719609643, 0.0230757421433613); + Bus bus3(0.999047460127767, 0.0436368240395443); + Bus bus4(0.998097277498088, 0.061658775943942); + Bus bus5(0.997021447662007, 0.0771246581966912); + Bus bus6(0.946436885707683, 0.322888837484268); + Bus bus7(0.943037519659334, 0.332686393642377); + Bus bus8(0.940418229359708, 0.340019961013984); + Bus bus9(0.938638861502395, 0.344901620288291); + Bus bus10(0.937739191669114, 0.347340277548916); + + Branch branch12(&bus1, &bus2, 0.001, 0.005, 0, 0); + Branch branch23(&bus2, &bus3, 0.001, 0.005, 0, 0); + Branch branch34(&bus3, &bus4, 0.001, 0.005, 0, 0); + Branch branch45(&bus4, &bus5, 0.001, 0.005, 0, 0); + Branch branch56(&bus5, &bus6, 0.001, 0.1, 0, 0); + Branch branch67(&bus6, &bus7, 0.001, 0.005, 0, 0); + Branch branch78(&bus7, &bus8, 0.001, 0.005, 0, 0); + Branch branch89(&bus8, &bus9, 0.001, 0.005, 0, 0); + Branch branch910(&bus9, &bus10, 0.001, 0.27, 0, 0.45); + + Genrou gen2(&bus2, 1, 0.5, -0.442101, 3., 0., 0., 7., .04, .05, .75, 2.1, 0.2, 0.18, 0.5, 0.5, 0.18, 0.15, 0., 0.); + Genrou gen3(&bus3, 1, 0.5, -2.510812, 3., 0., 0., 7., .04, .05, .75, 2.1, 0.2, 0.18, 0.5, 0.5, 0.18, 0.15, 0., 0.); + Genrou gen4(&bus4, 1, 0.5, -4.339553, 3., 0., 0., 7., .04, .05, .75, 2.1, 0.2, 0.18, 0.5, 0.5, 0.18, 0.15, 0., 0.); + Genrou gen5(&bus5, 1, 0.5, -23.34993, 3., 0., 0., 7., .04, .05, .75, 2.1, 0.2, 0.18, 0.5, 0.5, 0.18, 0.15, 0., 0.); + Genrou gen6(&bus6, 1, 0.5, 69.907194, 3., 0., 0., 7., .04, .05, .75, 2.1, 0.2, 0.18, 0.5, 0.5, 0.18, 0.15, 0., 0.); + Genrou gen7(&bus7, 1, 0.5, -8.318208, 3., 0., 0., 7., .04, .05, .75, 2.1, 0.2, 0.18, 0.5, 0.5, 0.18, 0.15, 0., 0.); + Genrou gen8(&bus8, 1, 0.5, -9.123614, 3., 0., 0., 7., .04, .05, .75, 2.1, 0.2, 0.18, 0.5, 0.5, 0.18, 0.15, 0., 0.); + Genrou gen9(&bus9, 1, 0.5, -9.662372, 3., 0., 0., 7., .04, .05, .75, 2.1, 0.2, 0.18, 0.5, 0.5, 0.18, 0.15, 0., 0.); + Genrou gen10(&bus10, 1, 0.5, -9.932297, 3., 0., 0., 7., .04, .05, .75, 2.1, 0.2, 0.18, 0.5, 0.5, 0.18, 0.15, 0., 0.); + + BusFault fault(&bus10, 0, 1e-5, 0); + + /* Connect everything together */ + sys.addBus(&bus1); + sys.addBus(&bus2); + sys.addBus(&bus3); + sys.addBus(&bus4); + sys.addBus(&bus5); + sys.addBus(&bus6); + sys.addBus(&bus7); + sys.addBus(&bus8); + sys.addBus(&bus9); + sys.addBus(&bus10); + sys.addComponent(&branch12); + sys.addComponent(&branch23); + sys.addComponent(&branch34); + sys.addComponent(&branch45); + sys.addComponent(&branch56); + sys.addComponent(&branch67); + sys.addComponent(&branch78); + sys.addComponent(&branch89); + sys.addComponent(&branch910); + sys.addComponent(&gen2); + sys.addComponent(&gen3); + sys.addComponent(&gen4); + sys.addComponent(&gen5); + sys.addComponent(&gen6); + sys.addComponent(&gen7); + sys.addComponent(&gen8); + sys.addComponent(&gen9); + sys.addComponent(&gen10); + sys.addComponent(&fault); + sys.allocate(); + + real_type dt = 1.0 / 4.0 / 60.0; + + std::vector output; + + auto output_cb = [&](real_type t) + { + std::vector& yval = sys.y(); + + // output.push_back(OutputData{t, + // 1.0 + yval[5], + // 1.0 + yval[26], + // std::sqrt(yval[0] * yval[0] + yval[1] * yval[1]), + // std::sqrt(yval[2] * yval[2] + yval[3] * yval[3])}); + }; + + // Set up simulation + Ida ida(&sys); + ida.configureSimulation(); + + // Run simulation, output each `dt` interval + scalar_type start = static_cast(clock()); + ida.initializeSimulation(0.0, false); + + // Run for 1s + int nout = static_cast(std::round((1.0 - 0.0) / dt)); + ida.runSimulation(1.0, nout, output_cb); + + // Introduce fault to ground and run for 0.1s + fault.setStatus(1); + ida.initializeSimulation(1.0, false); + nout = static_cast(std::round((1.1 - 1.0) / dt)); + ida.runSimulation(1.1, nout, output_cb); + + // Clear fault and run until t = 10s. + fault.setStatus(0); + ida.initializeSimulation(1.1, false); + nout = static_cast(std::round((10.0 - 1.1) / dt)); + ida.runSimulation(10.0, nout, output_cb); + double stop = static_cast(clock()); + + /* Check worst-case error */ + real_type worst_error = 0; + real_type worst_error_time = 0; + + std::ostream nullout(nullptr); + std::ostream& out = nullout; + + // // Uncomment code below to print output to a file: + // std::ofstream fileout; + // fileout.open("example2_results.csv"); + // std::ostream& out = fileout; + + out << "Time,gen2speed,gen3speed,v2mag,v3mag\n"; + out << 0. << "," << 1. << "," << 1. << "," << 1. << "," << 1. << "\n"; + + // for (index_type i = 0; i < output.size(); ++i) + // { + // OutputData ref{Example2::reference_solution[i + 1][0], + // Example2::reference_solution[i + 1][1], + // Example2::reference_solution[i + 1][2], + // Example2::reference_solution[i + 1][4], + // Example2::reference_solution[i + 1][5]}; + // OutputData out_data = output[i]; + + // out << out_data << '\n'; + + // real_type err = (out_data - ref).norm(); + // if (err > worst_error) + // { + // worst_error = err; + // worst_error_time = out_data.t; + // } + // } + // fileout.close(); + + // std::cout << "Max error " << worst_error + // << " at time t = " << worst_error_time << "\n"; + // std::cout << "\n\nComplete in " << (stop - start) / CLOCKS_PER_SEC << " seconds\n"; + + // return worst_error < error_allowed ? 0 : 1; + return 0; +} From 4ab2493d102f74192b96e11ceebb1a372f38eb92 Mon Sep 17 00:00:00 2001 From: pelesh Date: Tue, 10 Jun 2025 14:49:31 -0400 Subject: [PATCH 2/6] Add bus voltage magnitudes as the output. --- examples/PhasorDynamics/Example3/example3.cpp | 111 +++--------------- 1 file changed, 18 insertions(+), 93 deletions(-) diff --git a/examples/PhasorDynamics/Example3/example3.cpp b/examples/PhasorDynamics/Example3/example3.cpp index 2c171517..bdf17226 100644 --- a/examples/PhasorDynamics/Example3/example3.cpp +++ b/examples/PhasorDynamics/Example3/example3.cpp @@ -4,7 +4,7 @@ * @author Slaven Peles (peless@ornl.gov) * @brief Example running a 10-bus system * - * Simulates a 11-bus system with 10 Genrou 6th order generator models + * Simulates a 11-bus system with 10 Genrou 6th order generator models * split in two groups of five generators. The two groups are connected * by a high-impedance branch, which makes connection between them weak. * @@ -29,61 +29,17 @@ using scalar_type = double; using real_type = double; using index_type = size_t; -struct OutputData -{ - real_type t; - scalar_type gen2speed; - scalar_type gen3speed; - scalar_type v2mag; - scalar_type v3mag; - - OutputData& operator-=(const OutputData& other) - { - assert(GridKit::Testing::isEqual(t, other.t, Example2::reference_tol)); - gen2speed -= other.gen2speed; - gen3speed -= other.gen3speed; - v2mag -= other.v2mag; - v3mag -= other.v3mag; - return *this; - } - - double norm() const - { - return std::max({ - std::abs(gen2speed), - std::abs(gen3speed), - std::abs(v2mag), - std::abs(v3mag), - }); - } -}; - -const OutputData operator-(const OutputData& lhs, const OutputData& rhs) -{ - return OutputData(lhs) -= rhs; -} - -std::ostream& operator<<(std::ostream& out, const OutputData& data) -{ - out << data.t << "," - << data.gen2speed << "," - << data.gen3speed << "," - << data.v2mag << "," - << data.v3mag; - return out; -} int main() { using namespace GridKit::PhasorDynamics; using namespace AnalysisManager::Sundials; - auto error_allowed = static_cast(1e-4); + // auto error_allowed = static_cast(1e-4); - std::cout << "Example 3 version 1\n"; + // std::cout << "Example 3 version 1\n"; /* Create model parts */ - SystemModel sys; BusInfinite bus1(1, 0); Bus bus2(0.999733719609643, 0.0230757421433613); @@ -119,6 +75,8 @@ int main() BusFault fault(&bus10, 0, 1e-5, 0); /* Connect everything together */ + SystemModel sys; + sys.addBus(&bus1); sys.addBus(&bus2); sys.addBus(&bus3); @@ -152,17 +110,22 @@ int main() real_type dt = 1.0 / 4.0 / 60.0; - std::vector output; + // Uncomment code below to print output to a file: + std::ofstream fileout; + fileout.open("example3_results.csv"); + std::ostream& out = fileout; auto output_cb = [&](real_type t) { std::vector& yval = sys.y(); - // output.push_back(OutputData{t, - // 1.0 + yval[5], - // 1.0 + yval[26], - // std::sqrt(yval[0] * yval[0] + yval[1] * yval[1]), - // std::sqrt(yval[2] * yval[2] + yval[3] * yval[3])}); + out << t << ","; + for (size_t i = 0; i < 9; ++i) + { + out << std::sqrt(yval[2 * i] * yval[2 * i] + + yval[2 * i + 1] * yval[2 * i + 1]) << ","; + } + out << "\n"; }; // Set up simulation @@ -190,45 +153,7 @@ int main() ida.runSimulation(10.0, nout, output_cb); double stop = static_cast(clock()); - /* Check worst-case error */ - real_type worst_error = 0; - real_type worst_error_time = 0; - - std::ostream nullout(nullptr); - std::ostream& out = nullout; - - // // Uncomment code below to print output to a file: - // std::ofstream fileout; - // fileout.open("example2_results.csv"); - // std::ostream& out = fileout; - - out << "Time,gen2speed,gen3speed,v2mag,v3mag\n"; - out << 0. << "," << 1. << "," << 1. << "," << 1. << "," << 1. << "\n"; - - // for (index_type i = 0; i < output.size(); ++i) - // { - // OutputData ref{Example2::reference_solution[i + 1][0], - // Example2::reference_solution[i + 1][1], - // Example2::reference_solution[i + 1][2], - // Example2::reference_solution[i + 1][4], - // Example2::reference_solution[i + 1][5]}; - // OutputData out_data = output[i]; - - // out << out_data << '\n'; - - // real_type err = (out_data - ref).norm(); - // if (err > worst_error) - // { - // worst_error = err; - // worst_error_time = out_data.t; - // } - // } - // fileout.close(); - - // std::cout << "Max error " << worst_error - // << " at time t = " << worst_error_time << "\n"; - // std::cout << "\n\nComplete in " << (stop - start) / CLOCKS_PER_SEC << " seconds\n"; - - // return worst_error < error_allowed ? 0 : 1; + fileout.close(); + return 0; } From a854f3ca4224b46ff6eee9644863a0d5601f4197 Mon Sep 17 00:00:00 2001 From: abirchfield Date: Tue, 10 Jun 2025 15:34:05 -0500 Subject: [PATCH 3/6] Corrected some data in example3 --- examples/PhasorDynamics/Example3/example3.cpp | 37 +++++++++++++------ 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/examples/PhasorDynamics/Example3/example3.cpp b/examples/PhasorDynamics/Example3/example3.cpp index bdf17226..eaed0921 100644 --- a/examples/PhasorDynamics/Example3/example3.cpp +++ b/examples/PhasorDynamics/Example3/example3.cpp @@ -60,17 +60,17 @@ int main() Branch branch67(&bus6, &bus7, 0.001, 0.005, 0, 0); Branch branch78(&bus7, &bus8, 0.001, 0.005, 0, 0); Branch branch89(&bus8, &bus9, 0.001, 0.005, 0, 0); - Branch branch910(&bus9, &bus10, 0.001, 0.27, 0, 0.45); - - Genrou gen2(&bus2, 1, 0.5, -0.442101, 3., 0., 0., 7., .04, .05, .75, 2.1, 0.2, 0.18, 0.5, 0.5, 0.18, 0.15, 0., 0.); - Genrou gen3(&bus3, 1, 0.5, -2.510812, 3., 0., 0., 7., .04, .05, .75, 2.1, 0.2, 0.18, 0.5, 0.5, 0.18, 0.15, 0., 0.); - Genrou gen4(&bus4, 1, 0.5, -4.339553, 3., 0., 0., 7., .04, .05, .75, 2.1, 0.2, 0.18, 0.5, 0.5, 0.18, 0.15, 0., 0.); - Genrou gen5(&bus5, 1, 0.5, -23.34993, 3., 0., 0., 7., .04, .05, .75, 2.1, 0.2, 0.18, 0.5, 0.5, 0.18, 0.15, 0., 0.); - Genrou gen6(&bus6, 1, 0.5, 69.907194, 3., 0., 0., 7., .04, .05, .75, 2.1, 0.2, 0.18, 0.5, 0.5, 0.18, 0.15, 0., 0.); - Genrou gen7(&bus7, 1, 0.5, -8.318208, 3., 0., 0., 7., .04, .05, .75, 2.1, 0.2, 0.18, 0.5, 0.5, 0.18, 0.15, 0., 0.); - Genrou gen8(&bus8, 1, 0.5, -9.123614, 3., 0., 0., 7., .04, .05, .75, 2.1, 0.2, 0.18, 0.5, 0.5, 0.18, 0.15, 0., 0.); - Genrou gen9(&bus9, 1, 0.5, -9.662372, 3., 0., 0., 7., .04, .05, .75, 2.1, 0.2, 0.18, 0.5, 0.5, 0.18, 0.15, 0., 0.); - Genrou gen10(&bus10, 1, 0.5, -9.932297, 3., 0., 0., 7., .04, .05, .75, 2.1, 0.2, 0.18, 0.5, 0.5, 0.18, 0.15, 0., 0.); + Branch branch910(&bus9, &bus10, 0.001, 0.005, 0, 0); + + Genrou gen2(&bus2, 1, 0.5, -0.00442101, 3., 0., 0., 7., .04, .05, .75, 2.1, 0.2, 0.18, 0.5, 0.5, 0.18, 0.15, 0., 0.); + Genrou gen3(&bus3, 1, 0.5, -0.02510812, 3., 0., 0., 7., .04, .05, .75, 2.1, 0.2, 0.18, 0.5, 0.5, 0.18, 0.15, 0., 0.); + Genrou gen4(&bus4, 1, 0.5, -0.04339553, 3., 0., 0., 7., .04, .05, .75, 2.1, 0.2, 0.18, 0.5, 0.5, 0.18, 0.15, 0., 0.); + Genrou gen5(&bus5, 1, 0.5, -0.2334993, 3., 0., 0., 7., .04, .05, .75, 2.1, 0.2, 0.18, 0.5, 0.5, 0.18, 0.15, 0., 0.); + Genrou gen6(&bus6, 1, 0.5, 0.69907194, 3., 0., 0., 7., .04, .05, .75, 2.1, 0.2, 0.18, 0.5, 0.5, 0.18, 0.15, 0., 0.); + Genrou gen7(&bus7, 1, 0.5, -0.08318208, 3., 0., 0., 7., .04, .05, .75, 2.1, 0.2, 0.18, 0.5, 0.5, 0.18, 0.15, 0., 0.); + Genrou gen8(&bus8, 1, 0.5, -0.09123614, 3., 0., 0., 7., .04, .05, .75, 2.1, 0.2, 0.18, 0.5, 0.5, 0.18, 0.15, 0., 0.); + Genrou gen9(&bus9, 1, 0.5, -0.09662372, 3., 0., 0., 7., .04, .05, .75, 2.1, 0.2, 0.18, 0.5, 0.5, 0.18, 0.15, 0., 0.); + Genrou gen10(&bus10, 1, 0.5, -0.09932297, 3., 0., 0., 7., .04, .05, .75, 2.1, 0.2, 0.18, 0.5, 0.5, 0.18, 0.15, 0., 0.); BusFault fault(&bus10, 0, 1e-5, 0); @@ -115,6 +115,17 @@ int main() fileout.open("example3_results.csv"); std::ostream& out = fileout; + out << "t,"; + for (size_t i = 0; i < 9; ++i) + { + out << "v" << i + 2 << ","; + } + for (size_t i = 0; i < 9; ++i) + { + out << "omega" << i + 2 << ","; + } + out << "\n"; + auto output_cb = [&](real_type t) { std::vector& yval = sys.y(); @@ -125,6 +136,10 @@ int main() out << std::sqrt(yval[2 * i] * yval[2 * i] + yval[2 * i + 1] * yval[2 * i + 1]) << ","; } + for (size_t i = 0; i < 9; ++i) + { + out << yval[18 + 21*i + 1] << ","; + } out << "\n"; }; From ac82eea89d91101dd15bec95afc9c525f93dddbc Mon Sep 17 00:00:00 2001 From: pelesh Date: Tue, 10 Jun 2025 17:44:02 -0400 Subject: [PATCH 4/6] Add comments to example3 --- examples/PhasorDynamics/Example3/example3.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/examples/PhasorDynamics/Example3/example3.cpp b/examples/PhasorDynamics/Example3/example3.cpp index eaed0921..32da6cee 100644 --- a/examples/PhasorDynamics/Example3/example3.cpp +++ b/examples/PhasorDynamics/Example3/example3.cpp @@ -29,15 +29,11 @@ using scalar_type = double; using real_type = double; using index_type = size_t; - int main() { using namespace GridKit::PhasorDynamics; using namespace AnalysisManager::Sundials; - // auto error_allowed = static_cast(1e-4); - - // std::cout << "Example 3 version 1\n"; /* Create model parts */ BusInfinite bus1(1, 0); @@ -115,6 +111,7 @@ int main() fileout.open("example3_results.csv"); std::ostream& out = fileout; + // Create header for the CSV output file out << "t,"; for (size_t i = 0; i < 9; ++i) { @@ -130,15 +127,23 @@ int main() { std::vector& yval = sys.y(); + // Output time out << t << ","; + + // Output voltage magnitudes on buses for (size_t i = 0; i < 9; ++i) { out << std::sqrt(yval[2 * i] * yval[2 * i] - + yval[2 * i + 1] * yval[2 * i + 1]) << ","; + + yval[2 * i + 1] * yval[2 * i + 1]) << ","; } + + // Output generator frequencies for (size_t i = 0; i < 9; ++i) { - out << yval[18 + 21*i + 1] << ","; + // 18 is offset for variables of 9 buses. + // Each generator has 21 equations. + // We are outputting second equation of each generator. + out << yval[18 + 21 * i + 1] << ","; } out << "\n"; }; From a996ce1cd25222990adda8ed2cf402341b9cee6b Mon Sep 17 00:00:00 2001 From: pelesh Date: Tue, 10 Jun 2025 22:23:15 +0000 Subject: [PATCH 5/6] Apply pre-commmit fixes --- examples/PhasorDynamics/Example3/example3.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/PhasorDynamics/Example3/example3.cpp b/examples/PhasorDynamics/Example3/example3.cpp index 32da6cee..398b92b1 100644 --- a/examples/PhasorDynamics/Example3/example3.cpp +++ b/examples/PhasorDynamics/Example3/example3.cpp @@ -34,7 +34,6 @@ int main() using namespace GridKit::PhasorDynamics; using namespace AnalysisManager::Sundials; - /* Create model parts */ BusInfinite bus1(1, 0); @@ -134,7 +133,8 @@ int main() for (size_t i = 0; i < 9; ++i) { out << std::sqrt(yval[2 * i] * yval[2 * i] - + yval[2 * i + 1] * yval[2 * i + 1]) << ","; + + yval[2 * i + 1] * yval[2 * i + 1]) + << ","; } // Output generator frequencies From f58c89ff506aabb5f32c6c11d529f5d74b1ea7cd Mon Sep 17 00:00:00 2001 From: pelesh Date: Tue, 10 Jun 2025 18:31:47 -0400 Subject: [PATCH 6/6] Example 3 is not verified. --- examples/PhasorDynamics/Example3/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/PhasorDynamics/Example3/CMakeLists.txt b/examples/PhasorDynamics/Example3/CMakeLists.txt index 5790e144..4e689997 100644 --- a/examples/PhasorDynamics/Example3/CMakeLists.txt +++ b/examples/PhasorDynamics/Example3/CMakeLists.txt @@ -8,4 +8,5 @@ target_link_libraries(phasordynamics_example3 GRIDKIT::solvers_dyn) install(TARGETS phasordynamics_example3 RUNTIME DESTINATION bin) -add_test(NAME GenrouTest3 COMMAND $) +# Not used for tesing for now. +# add_test(NAME GenrouTest3 COMMAND $)