From 3a72c726b9bc9ced0e60201071a984e264971eed Mon Sep 17 00:00:00 2001 From: Wiktoria Zielinska Date: Wed, 23 Jul 2025 12:35:17 -0400 Subject: [PATCH 01/13] Adding new files that we changed --- .../Tiny/TwoBus/Tgov1/TwoBusTgov1.cpp | 22 ++++--- .../PhasorDynamics/Governor/Tgov1/Tgov1.cpp | 57 ++++++++++++++---- .../PhasorDynamics/Governor/Tgov1/Tgov1.hpp | 26 ++++++--- .../Governor/Tgov1/Tgov1Data.hpp | 58 ++++++++++++++----- 4 files changed, 119 insertions(+), 44 deletions(-) diff --git a/examples/PhasorDynamics/Tiny/TwoBus/Tgov1/TwoBusTgov1.cpp b/examples/PhasorDynamics/Tiny/TwoBus/Tgov1/TwoBusTgov1.cpp index 8f8223d2e..4958edf0a 100644 --- a/examples/PhasorDynamics/Tiny/TwoBus/Tgov1/TwoBusTgov1.cpp +++ b/examples/PhasorDynamics/Tiny/TwoBus/Tgov1/TwoBusTgov1.cpp @@ -100,15 +100,16 @@ int main() data.genrou[0].parameters[GenrouParameters::S12] = 0.; // Set governor data (Default PW values) - data.gov.resize(1); - - data.gov[0].R = 0.05; - data.gov[0].Pvmin = 0; - data.gov[0].Pvmax = 1.0; - data.gov[0].T1 = 0.5; - data.gov[0].T2 = 2.5; - data.gov[0].T3 = 7.5; - data.gov[0].Dt = 0; + data.gov.resize(1); + using namespace GridKit::PhasorDynamics::Governor; + + data.gov[0].parameters[Tgov1Parameters::R] = 0.05; + data.gov[0].parameters[Tgov1Parameters::Pvmin] = 0.0; + data.gov[0].parameters[Tgov1Parameters::Pvmax] = 1.0; + data.gov[0].parameters[Tgov1Parameters::T1] = 0.5; + data.gov[0].parameters[Tgov1Parameters::T2] = 2.5; + data.gov[0].parameters[Tgov1Parameters::T3] = 7.5; + data.gov[0].parameters[Tgov1Parameters::Dt] = 0.0; // Manually add components // This is a workaround since signal connections are not implemented in parser @@ -121,6 +122,9 @@ int main() auto* omega = new SignalNode(data.signal[0]); auto* pmech = new SignalNode(data.signal[1]); + // Manual add gen & gov components + // This is a hack since SignalBus not implemented + // Create branch Branch branch(bus0, bus1, data.branch[0]); diff --git a/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.cpp b/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.cpp index 1be41020d..d49599257 100644 --- a/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.cpp +++ b/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.cpp @@ -1,5 +1,6 @@ /** * @file Tgov1.cpp + * @author Wiktoria Zielinska (zielinskawa@ORNL.gov) * @author Luke Lowery (lukel@tamu.edu) * @author Adam Birchfield (abirchfield@tamu.edu) * @brief Definition of a Turbine Governor Model (IEEET1). @@ -26,22 +27,56 @@ namespace GridKit /** * */ + template + Tgov1::Tgov1(machine_type* machine, const model_data_type& data) + : machine_(machine) + { + initializeParameters(data); + size_ = 3; + } + template Tgov1::Tgov1(signal_type* pmech, signal_type* omega, const model_data_type& data) : pmech_(pmech), - omega_(omega), - R_(data.R), - Pvmin_(data.Pvmin), - Pvmax_(data.Pvmax), - T1_(data.T1), - T2_(data.T2), - T3_(data.T3), - Dt_(data.Dt) + omega_(omega) { - // 3 Internal Variables + initializeParameters(data); size_ = 3; } + template + void Tgov1::initializeParameters(const model_data_type& data) + { + if (data.parameters.contains(model_data_type::Parameters::R)) + { + R_ = std::get(data.parameters.at(model_data_type::Parameters::R)); + } + if (data.parameters.contains(model_data_type::Parameters::Pvmin)) + { + Pvmin_ = std::get(data.parameters.at(model_data_type::Parameters::Pvmin)); + } + if (data.parameters.contains(model_data_type::Parameters::Pvmax)) + { + Pvmax_ = std::get(data.parameters.at(model_data_type::Parameters::Pvmax)); + } + if (data.parameters.contains(model_data_type::Parameters::T1)) + { + T1_ = std::get(data.parameters.at(model_data_type::Parameters::T1)); + } + if (data.parameters.contains(model_data_type::Parameters::T2)) + { + T2_ = std::get(data.parameters.at(model_data_type::Parameters::T2)); + } + if (data.parameters.contains(model_data_type::Parameters::T3)) + { + T3_ = std::get(data.parameters.at(model_data_type::Parameters::T3)); + } + if (data.parameters.contains(model_data_type::Parameters::Dt)) + { + Dt_ = std::get(data.parameters.at(model_data_type::Parameters::Dt)); + } + } + template Tgov1::Tgov1(signal_type* pmech, signal_type* omega) : pmech_(pmech), @@ -54,9 +89,9 @@ namespace GridKit T3_(7.5), Dt_(0) { - // 3 Internal Variables + // 3 Internal Variables size_ = 3; - } + } /*! * @brief Allocate memory for model diff --git a/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.hpp b/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.hpp index 63c9c3c0e..bae2b15d7 100644 --- a/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.hpp +++ b/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.hpp @@ -1,5 +1,6 @@ /** * @file Tgov1.hpp + * @author Wiktoria Zielinska (zielinskawa@ORNL.gov) * @author Luke Lowery (lukel@tamu.edu) * @author Adam Birchfield (abirchfield@tamu.edu) * @brief Declaration of a Turbine Governor Model (IEEET1). @@ -53,10 +54,12 @@ namespace GridKit using real_type = typename Component::real_type; using model_data_type = Tgov1Data; using signal_type = SignalNode; + using machine_type = Genrou; public: Tgov1(signal_type* pmech, signal_type* omega, const model_data_type& data); Tgov1(signal_type* pmech, signal_type* omega); + Tgov1(machine_type* machine, const model_data_type& data); ~Tgov1() = default; int allocate() override; @@ -75,23 +78,26 @@ namespace GridKit ScalarT& Pmech() override; private: + + // Associated Machine Model + machine_type* machine_{nullptr}; signal_type* pmech_{nullptr}; signal_type* omega_{nullptr}; // Input parameters - real_type R_; - real_type Pvmin_; - real_type Pvmax_; - real_type T1_; - real_type T2_; - real_type T3_; - real_type Dt_; + real_type R_{0.05}; + real_type Pvmin_{0.0}; + real_type Pvmax_{1.0}; + real_type T1_{0.5}; + real_type T2_{2.5}; + real_type T3_{7.5}; + real_type Dt_{0.0}; // Input States (which can be parameters) - ScalarT pref_; + ScalarT pref_{0}; // Scale of Sigmoid function (temporary local implementation) - const ScalarT mu_ = 4000.0; + const ScalarT mu_{4000.0}; // Activation function (sigmoid approximation) ScalarT sigmoid(ScalarT x); @@ -100,6 +106,8 @@ namespace GridKit ScalarT indicator_low(ScalarT x, ScalarT f); ScalarT indicator_high(ScalarT x, ScalarT f); ScalarT indicator(ScalarT x, ScalarT f); + + void initializeParameters(const model_data_type& data); }; } // namespace Governor diff --git a/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1Data.hpp b/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1Data.hpp index 55a645033..02a1e4a25 100644 --- a/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1Data.hpp +++ b/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1Data.hpp @@ -1,11 +1,14 @@ /** * @file Tgov1Data.hpp + * @author Wiktoria Zielinska (zielinskawa@ORNL.gov) * @author Luke Lowery (lukel@tamu.edu) * @brief Modeling data for TGOV1 - * */ + #pragma once +#include + namespace GridKit { namespace PhasorDynamics @@ -13,26 +16,51 @@ namespace GridKit namespace Governor { /** - * @brief Contains modeling data for a TGOV1 Governor model. - * - * @tparam RealT Real parameter data type - * @tparam IdxT Integer parameter data type + * @brief Parameter keys for TGOV1 Governor model. * - * Integer parameters are of the same type as matrix and vector indices. + * These enum values serve as keys for the parameters map in ComponentData. + */ + enum class Tgov1Parameters + { + R, ///< Droop Constant + T1, ///< Valve Time Delay + T2, ///< Turbine Numerator Time Constant + T3, ///< Turbine Delay + Pvmax, ///< Max Valve Power + Pvmin, ///< Min Valve Power + Dt ///< Damping Coefficient + }; + + /** + * @brief Placeholder enum for TGOV1 ports. + */ + enum class Tgov1Ports + { + }; + + /** + * @brief Placeholder enum for TGOV1 monitorable variables. + */ + enum class Tgov1MonitorableVariables + { + }; + + /** + * @brief Modeling data for TGOV1 Governor using ComponentData base. * - * @todo Decide on naming scheme for model parameters. + * @tparam RealT Real number type (e.g., double) + * @tparam IdxT Index type (e.g., size_t) */ template - struct Tgov1Data + struct Tgov1Data : public ComponentData { - RealT R{0.05}; ///< Droop Constant - RealT T1{0.5}; ///< Valve Time Delay - RealT T2{2.5}; ///< Turbine Numerator Time Constant - RealT T3{7.5}; ///< Turbine Delay - RealT Pvmax{1.0}; ///< Max Valve Power - RealT Pvmin{0.0}; ///< Min Valve Power - RealT Dt{0.0}; ///< + Tgov1Data() = default; + + using Parameters = Tgov1Parameters; + using Ports = Tgov1Ports; + using MonitorableVariables = Tgov1MonitorableVariables; }; + } // namespace Governor } // namespace PhasorDynamics } // namespace GridKit From ceca20fa6615183fe770085d5baa2145c8848d2c Mon Sep 17 00:00:00 2001 From: WiktoriaZielinskaORNL Date: Wed, 23 Jul 2025 16:40:43 +0000 Subject: [PATCH 02/13] Apply pre-commmit fixes --- .../Tiny/TwoBus/Tgov1/TwoBusTgov1.cpp | 4 +-- .../PhasorDynamics/Governor/Tgov1/Tgov1.cpp | 32 +++++++++---------- .../PhasorDynamics/Governor/Tgov1/Tgov1.hpp | 9 +++--- 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/examples/PhasorDynamics/Tiny/TwoBus/Tgov1/TwoBusTgov1.cpp b/examples/PhasorDynamics/Tiny/TwoBus/Tgov1/TwoBusTgov1.cpp index 4958edf0a..8aa9e1ae0 100644 --- a/examples/PhasorDynamics/Tiny/TwoBus/Tgov1/TwoBusTgov1.cpp +++ b/examples/PhasorDynamics/Tiny/TwoBus/Tgov1/TwoBusTgov1.cpp @@ -100,9 +100,9 @@ int main() data.genrou[0].parameters[GenrouParameters::S12] = 0.; // Set governor data (Default PW values) - data.gov.resize(1); + data.gov.resize(1); using namespace GridKit::PhasorDynamics::Governor; - + data.gov[0].parameters[Tgov1Parameters::R] = 0.05; data.gov[0].parameters[Tgov1Parameters::Pvmin] = 0.0; data.gov[0].parameters[Tgov1Parameters::Pvmax] = 1.0; diff --git a/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.cpp b/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.cpp index d49599257..7995e9bc0 100644 --- a/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.cpp +++ b/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.cpp @@ -47,32 +47,32 @@ namespace GridKit template void Tgov1::initializeParameters(const model_data_type& data) { - if (data.parameters.contains(model_data_type::Parameters::R)) - { + if (data.parameters.contains(model_data_type::Parameters::R)) + { R_ = std::get(data.parameters.at(model_data_type::Parameters::R)); } - if (data.parameters.contains(model_data_type::Parameters::Pvmin)) - { + if (data.parameters.contains(model_data_type::Parameters::Pvmin)) + { Pvmin_ = std::get(data.parameters.at(model_data_type::Parameters::Pvmin)); } - if (data.parameters.contains(model_data_type::Parameters::Pvmax)) - { + if (data.parameters.contains(model_data_type::Parameters::Pvmax)) + { Pvmax_ = std::get(data.parameters.at(model_data_type::Parameters::Pvmax)); } - if (data.parameters.contains(model_data_type::Parameters::T1)) - { + if (data.parameters.contains(model_data_type::Parameters::T1)) + { T1_ = std::get(data.parameters.at(model_data_type::Parameters::T1)); } - if (data.parameters.contains(model_data_type::Parameters::T2)) - { + if (data.parameters.contains(model_data_type::Parameters::T2)) + { T2_ = std::get(data.parameters.at(model_data_type::Parameters::T2)); } - if (data.parameters.contains(model_data_type::Parameters::T3)) - { + if (data.parameters.contains(model_data_type::Parameters::T3)) + { T3_ = std::get(data.parameters.at(model_data_type::Parameters::T3)); } - if (data.parameters.contains(model_data_type::Parameters::Dt)) - { + if (data.parameters.contains(model_data_type::Parameters::Dt)) + { Dt_ = std::get(data.parameters.at(model_data_type::Parameters::Dt)); } } @@ -89,9 +89,9 @@ namespace GridKit T3_(7.5), Dt_(0) { - // 3 Internal Variables + // 3 Internal Variables size_ = 3; - } + } /*! * @brief Allocate memory for model diff --git a/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.hpp b/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.hpp index bae2b15d7..583c5153d 100644 --- a/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.hpp +++ b/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.hpp @@ -54,12 +54,12 @@ namespace GridKit using real_type = typename Component::real_type; using model_data_type = Tgov1Data; using signal_type = SignalNode; - using machine_type = Genrou; + using machine_type = Genrou; public: Tgov1(signal_type* pmech, signal_type* omega, const model_data_type& data); Tgov1(signal_type* pmech, signal_type* omega); - Tgov1(machine_type* machine, const model_data_type& data); + Tgov1(machine_type* machine, const model_data_type& data); ~Tgov1() = default; int allocate() override; @@ -78,11 +78,10 @@ namespace GridKit ScalarT& Pmech() override; private: - // Associated Machine Model machine_type* machine_{nullptr}; - signal_type* pmech_{nullptr}; - signal_type* omega_{nullptr}; + signal_type* pmech_{nullptr}; + signal_type* omega_{nullptr}; // Input parameters real_type R_{0.05}; From ead64bff3269dd8f4a2774ee7a0d451469d9a322 Mon Sep 17 00:00:00 2001 From: Shaked Regev <35384901+shakedregev@users.noreply.github.com> Date: Wed, 23 Jul 2025 12:57:11 -0400 Subject: [PATCH 03/13] Update examples/PhasorDynamics/Tiny/TwoBus/Tgov1/TwoBusTgov1.cpp --- examples/PhasorDynamics/Tiny/TwoBus/Tgov1/TwoBusTgov1.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/PhasorDynamics/Tiny/TwoBus/Tgov1/TwoBusTgov1.cpp b/examples/PhasorDynamics/Tiny/TwoBus/Tgov1/TwoBusTgov1.cpp index 8aa9e1ae0..c913f91ae 100644 --- a/examples/PhasorDynamics/Tiny/TwoBus/Tgov1/TwoBusTgov1.cpp +++ b/examples/PhasorDynamics/Tiny/TwoBus/Tgov1/TwoBusTgov1.cpp @@ -123,7 +123,7 @@ int main() auto* pmech = new SignalNode(data.signal[1]); // Manual add gen & gov components - // This is a hack since SignalBus not implemented + // This is a hack since SignalBus not implemented // Create branch Branch branch(bus0, bus1, data.branch[0]); From e83b71e99b36820da8c284309bf26fa8efb40064 Mon Sep 17 00:00:00 2001 From: WiktoriaZielinskaORNL Date: Wed, 23 Jul 2025 13:09:54 -0400 Subject: [PATCH 04/13] Testing username --- src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.cpp b/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.cpp index 7995e9bc0..fb1ad0256 100644 --- a/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.cpp +++ b/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.cpp @@ -101,7 +101,7 @@ namespace GridKit int Tgov1::allocate() { // Allocate local component data - auto size = static_cast(size_); // avoid compiler warnings + auto size = static_cast(size_); // Avoid compiler warnings f_.resize(size); y_.resize(size); yp_.resize(size); From 8e683c907f1938cf85f2403d930fb6b66905bd0d Mon Sep 17 00:00:00 2001 From: WiktoriaZielinskaORNL Date: Wed, 23 Jul 2025 13:12:48 -0400 Subject: [PATCH 05/13] Testing username --- src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.cpp b/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.cpp index fb1ad0256..7995e9bc0 100644 --- a/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.cpp +++ b/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.cpp @@ -101,7 +101,7 @@ namespace GridKit int Tgov1::allocate() { // Allocate local component data - auto size = static_cast(size_); // Avoid compiler warnings + auto size = static_cast(size_); // avoid compiler warnings f_.resize(size); y_.resize(size); yp_.resize(size); From 96113f972500f40f57793788ef0f45f53c6c75f2 Mon Sep 17 00:00:00 2001 From: WiktoriaZielinskaORNL Date: Wed, 23 Jul 2025 15:29:43 -0400 Subject: [PATCH 06/13] Refactor Tgov1: remove unused machine_type, added documentation --- .../PhasorDynamics/Governor/Tgov1/Tgov1.cpp | 24 ++++++++++++------- .../PhasorDynamics/Governor/Tgov1/Tgov1.hpp | 3 --- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.cpp b/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.cpp index 7995e9bc0..f820e75b2 100644 --- a/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.cpp +++ b/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.cpp @@ -27,14 +27,15 @@ namespace GridKit /** * */ - template - Tgov1::Tgov1(machine_type* machine, const model_data_type& data) - : machine_(machine) - { - initializeParameters(data); - size_ = 3; - } - + /** + * @brief Constructs a Tgov1 governor model using signal inputs directly. + * + * Initializes the model parameters and sets the internal model size. + * + * @param pmech Pointer to the mechanical power signal. + * @param omega Pointer to the rotor speed signal. + * @param data Model data containing parameter values for initialization. + */ template Tgov1::Tgov1(signal_type* pmech, signal_type* omega, const model_data_type& data) : pmech_(pmech), @@ -44,6 +45,13 @@ namespace GridKit size_ = 3; } + /** + * @brief Helper function to extract and assign model parameters. + * + * Parses values from the model_data_type and assigns them to internal parameters. + * + * @param data Structure containing model parameters. + */ template void Tgov1::initializeParameters(const model_data_type& data) { diff --git a/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.hpp b/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.hpp index 583c5153d..c4c5624b4 100644 --- a/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.hpp +++ b/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.hpp @@ -54,12 +54,10 @@ namespace GridKit using real_type = typename Component::real_type; using model_data_type = Tgov1Data; using signal_type = SignalNode; - using machine_type = Genrou; public: Tgov1(signal_type* pmech, signal_type* omega, const model_data_type& data); Tgov1(signal_type* pmech, signal_type* omega); - Tgov1(machine_type* machine, const model_data_type& data); ~Tgov1() = default; int allocate() override; @@ -79,7 +77,6 @@ namespace GridKit private: // Associated Machine Model - machine_type* machine_{nullptr}; signal_type* pmech_{nullptr}; signal_type* omega_{nullptr}; From 82fbb8df030d16e0e3a247e542d7eca8910c69de Mon Sep 17 00:00:00 2001 From: WiktoriaZielinskaORNL Date: Wed, 23 Jul 2025 19:30:18 +0000 Subject: [PATCH 07/13] Apply pre-commmit fixes --- .../PhasorDynamics/Governor/Tgov1/Tgov1.cpp | 20 +++++++++---------- .../PhasorDynamics/Governor/Tgov1/Tgov1.hpp | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.cpp b/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.cpp index f820e75b2..c191019fa 100644 --- a/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.cpp +++ b/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.cpp @@ -27,15 +27,15 @@ namespace GridKit /** * */ - /** - * @brief Constructs a Tgov1 governor model using signal inputs directly. - * - * Initializes the model parameters and sets the internal model size. - * - * @param pmech Pointer to the mechanical power signal. - * @param omega Pointer to the rotor speed signal. - * @param data Model data containing parameter values for initialization. - */ + /** + * @brief Constructs a Tgov1 governor model using signal inputs directly. + * + * Initializes the model parameters and sets the internal model size. + * + * @param pmech Pointer to the mechanical power signal. + * @param omega Pointer to the rotor speed signal. + * @param data Model data containing parameter values for initialization. + */ template Tgov1::Tgov1(signal_type* pmech, signal_type* omega, const model_data_type& data) : pmech_(pmech), @@ -51,7 +51,7 @@ namespace GridKit * Parses values from the model_data_type and assigns them to internal parameters. * * @param data Structure containing model parameters. - */ + */ template void Tgov1::initializeParameters(const model_data_type& data) { diff --git a/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.hpp b/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.hpp index c4c5624b4..048616968 100644 --- a/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.hpp +++ b/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.hpp @@ -77,8 +77,8 @@ namespace GridKit private: // Associated Machine Model - signal_type* pmech_{nullptr}; - signal_type* omega_{nullptr}; + signal_type* pmech_{nullptr}; + signal_type* omega_{nullptr}; // Input parameters real_type R_{0.05}; From 5a6a0839af4d7b78c902993dc16b6abc36a1445a Mon Sep 17 00:00:00 2001 From: WiktoriaZielinskaORNL Date: Wed, 23 Jul 2025 16:04:01 -0400 Subject: [PATCH 08/13] Style fix again --- src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.hpp b/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.hpp index 048616968..1ed0ac24e 100644 --- a/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.hpp +++ b/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.hpp @@ -80,7 +80,7 @@ namespace GridKit signal_type* pmech_{nullptr}; signal_type* omega_{nullptr}; - // Input parameters + // Input Parameters real_type R_{0.05}; real_type Pvmin_{0.0}; real_type Pvmax_{1.0}; From d153b441b386fe0222b09133375b3e6d69331b34 Mon Sep 17 00:00:00 2001 From: WiktoriaZielinskaORNL Date: Wed, 23 Jul 2025 16:40:03 -0400 Subject: [PATCH 09/13] Move 'using namespace' to top of main() for clarity --- examples/PhasorDynamics/Tiny/TwoBus/Tgov1/TwoBusTgov1.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/PhasorDynamics/Tiny/TwoBus/Tgov1/TwoBusTgov1.cpp b/examples/PhasorDynamics/Tiny/TwoBus/Tgov1/TwoBusTgov1.cpp index c913f91ae..61f36fff9 100644 --- a/examples/PhasorDynamics/Tiny/TwoBus/Tgov1/TwoBusTgov1.cpp +++ b/examples/PhasorDynamics/Tiny/TwoBus/Tgov1/TwoBusTgov1.cpp @@ -23,7 +23,8 @@ int main() { using namespace GridKit::PhasorDynamics; using namespace AnalysisManager::Sundials; - + using namespace GridKit::PhasorDynamics::Governor; + using scalar_type = double; using real_type = double; using index_type = size_t; @@ -101,7 +102,6 @@ int main() // Set governor data (Default PW values) data.gov.resize(1); - using namespace GridKit::PhasorDynamics::Governor; data.gov[0].parameters[Tgov1Parameters::R] = 0.05; data.gov[0].parameters[Tgov1Parameters::Pvmin] = 0.0; From 10ac191830dd9378e6e5e48cb04a3415cce107f5 Mon Sep 17 00:00:00 2001 From: WiktoriaZielinskaORNL Date: Wed, 23 Jul 2025 20:40:30 +0000 Subject: [PATCH 10/13] Apply pre-commmit fixes --- examples/PhasorDynamics/Tiny/TwoBus/Tgov1/TwoBusTgov1.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/PhasorDynamics/Tiny/TwoBus/Tgov1/TwoBusTgov1.cpp b/examples/PhasorDynamics/Tiny/TwoBus/Tgov1/TwoBusTgov1.cpp index 61f36fff9..cc76cbccd 100644 --- a/examples/PhasorDynamics/Tiny/TwoBus/Tgov1/TwoBusTgov1.cpp +++ b/examples/PhasorDynamics/Tiny/TwoBus/Tgov1/TwoBusTgov1.cpp @@ -24,7 +24,7 @@ int main() using namespace GridKit::PhasorDynamics; using namespace AnalysisManager::Sundials; using namespace GridKit::PhasorDynamics::Governor; - + using scalar_type = double; using real_type = double; using index_type = size_t; From d7b1c2eb65e662cfbb6a25f4a2ffbd4af3435f03 Mon Sep 17 00:00:00 2001 From: WiktoriaZielinskaORNL Date: Wed, 23 Jul 2025 16:50:20 -0400 Subject: [PATCH 11/13] Styling --- src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.hpp b/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.hpp index 1ed0ac24e..048616968 100644 --- a/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.hpp +++ b/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.hpp @@ -80,7 +80,7 @@ namespace GridKit signal_type* pmech_{nullptr}; signal_type* omega_{nullptr}; - // Input Parameters + // Input parameters real_type R_{0.05}; real_type Pvmin_{0.0}; real_type Pvmax_{1.0}; From ac53335db467e368210252d9ce02e933a9a8e245 Mon Sep 17 00:00:00 2001 From: pelesh Date: Wed, 23 Jul 2025 21:50:10 -0400 Subject: [PATCH 12/13] Clean up TGOV1 model. --- .../PhasorDynamics/Governor/Tgov1/Tgov1.cpp | 14 +------------ .../PhasorDynamics/Governor/Tgov1/Tgov1.hpp | 8 ++----- src/Model/PhasorDynamics/GovernorBase.hpp | 21 ------------------- 3 files changed, 3 insertions(+), 40 deletions(-) delete mode 100644 src/Model/PhasorDynamics/GovernorBase.hpp diff --git a/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.cpp b/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.cpp index c191019fa..69ed796ee 100644 --- a/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.cpp +++ b/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.cpp @@ -1,8 +1,8 @@ /** * @file Tgov1.cpp - * @author Wiktoria Zielinska (zielinskawa@ORNL.gov) * @author Luke Lowery (lukel@tamu.edu) * @author Adam Birchfield (abirchfield@tamu.edu) + * @author Wiktoria Zielinska (zielinskawa@ORNL.gov) * @brief Definition of a Turbine Governor Model (IEEET1). * */ @@ -261,18 +261,6 @@ namespace GridKit return 0; } - /** - * @brief The mechanical power output. - * @warning This is not yet accessed by anything. The Genrou class will - * need to access this instead of a constant Pmech. - * @return ScalarT - Mechanical output power value. - */ - template - ScalarT& Tgov1::Pmech() - { - return y_[2]; - } - // Available template instantiations template class Tgov1; template class Tgov1; diff --git a/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.hpp b/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.hpp index 048616968..52ef3e090 100644 --- a/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.hpp +++ b/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.hpp @@ -1,8 +1,8 @@ /** * @file Tgov1.hpp - * @author Wiktoria Zielinska (zielinskawa@ORNL.gov) * @author Luke Lowery (lukel@tamu.edu) * @author Adam Birchfield (abirchfield@tamu.edu) + * @author Wiktoria Zielinska (zielinskawa@ORNL.gov) * @brief Declaration of a Turbine Governor Model (IEEET1). * */ @@ -10,7 +10,6 @@ #pragma once #include -#include // Forward declarations namespace GridKit @@ -40,7 +39,7 @@ namespace GridKit { template - class Tgov1 : public Component, public GovernorBase + class Tgov1 : public Component { using Component::alpha_; using Component::f_; @@ -72,9 +71,6 @@ namespace GridKit { } - // Read Access to Pmech - ScalarT& Pmech() override; - private: // Associated Machine Model signal_type* pmech_{nullptr}; diff --git a/src/Model/PhasorDynamics/GovernorBase.hpp b/src/Model/PhasorDynamics/GovernorBase.hpp deleted file mode 100644 index 04d85a5f7..000000000 --- a/src/Model/PhasorDynamics/GovernorBase.hpp +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once - -#include - -namespace GridKit -{ - namespace PhasorDynamics - { - /*! - * @brief GovernorBase model implementation base class. - * - */ - template - class GovernorBase - { - public: - virtual ScalarT& Pmech() = 0; - }; - - } // namespace PhasorDynamics -} // namespace GridKit From 2cad8fcd72ef128411066a2771134ba7b82edc3c Mon Sep 17 00:00:00 2001 From: pelesh Date: Wed, 23 Jul 2025 21:53:29 -0400 Subject: [PATCH 13/13] Fix TGOV1 default parameter values. --- src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.hpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.hpp b/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.hpp index 52ef3e090..c55423798 100644 --- a/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.hpp +++ b/src/Model/PhasorDynamics/Governor/Tgov1/Tgov1.hpp @@ -77,13 +77,13 @@ namespace GridKit signal_type* omega_{nullptr}; // Input parameters - real_type R_{0.05}; - real_type Pvmin_{0.0}; - real_type Pvmax_{1.0}; - real_type T1_{0.5}; - real_type T2_{2.5}; - real_type T3_{7.5}; - real_type Dt_{0.0}; + real_type R_{0}; + real_type Pvmin_{0}; + real_type Pvmax_{0}; + real_type T1_{0}; + real_type T2_{0}; + real_type T3_{0}; + real_type Dt_{0}; // Input States (which can be parameters) ScalarT pref_{0};