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
4 changes: 3 additions & 1 deletion GridKit/Model/PhasorDynamics/Controller/REECB/Reecb.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@ namespace GridKit
ScalarT& Vi();

static constexpr RealT TIME_CONSTANT_MINIMUM = static_cast<RealT>(1.0e-3);
static constexpr RealT VMEAS_MINIMUM = static_cast<RealT>(0.01);
static void logTimeConstantWarning();

static constexpr RealT VMEAS_MINIMUM = static_cast<RealT>(0.01);

BusT* bus_{nullptr};

Expand Down
21 changes: 18 additions & 3 deletions GridKit/Model/PhasorDynamics/Controller/REECB/ReecbImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <array>
#include <cassert>
#include <limits>
#include <mutex>
#include <numbers>
#include <numeric>
#include <variant>
Expand Down Expand Up @@ -1428,6 +1429,20 @@ namespace GridKit
{ return y_.getData()[static_cast<size_t>(ReecbInternalVariables::PMEAS)]; });
}

/**
* @brief Static method to log time constant warnings
*
* @note Used in combination with static std:once_flag and std:call_once,
* to reduce the number of times the warning is printed.
*/
template <typename scalar_type, typename index_type>
void Reecb<scalar_type, index_type>::logTimeConstantWarning()
{
Log::warning() << "Reecb: any of Trv, Tp, Tiq, or Tpord below "
<< TIME_CONSTANT_MINIMUM
<< " s is raised to that floor to keep the controller lags well posed\n";
}

/**
* @brief Resolve parameter-derived constants and selector masks
*
Expand All @@ -1447,9 +1462,9 @@ namespace GridKit

if (floor_warning)
{
Log::warning() << "Reecb: any of Trv, Tp, Tiq, or Tpord below "
<< TIME_CONSTANT_MINIMUM
<< " s is raised to that floor to keep the controller lags well posed\n";
static std::once_flag time_constant_warning_flag_;
std::call_once(time_constant_warning_flag_,
&logTimeConstantWarning);
}

va_component_base_ = mva_base_ * static_cast<RealT>(1.0e6);
Expand Down
1 change: 1 addition & 0 deletions GridKit/Model/PhasorDynamics/Controller/REPCA/Repca.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ namespace GridKit
ScalarT& Vi();

static constexpr RealT TIME_CONSTANT_MINIMUM = static_cast<RealT>(1.0e-3);
static void logTimeConstantWarning();

static constexpr RealT INITIALIZATION_LIMIT_OFFSET = static_cast<RealT>(0.1);

Expand Down
21 changes: 18 additions & 3 deletions GridKit/Model/PhasorDynamics/Controller/REPCA/RepcaImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#pragma once

#include <algorithm>
#include <mutex>
#include <variant>

#include <GridKit/Model/PhasorDynamics/BusBase.hpp>
Expand Down Expand Up @@ -983,6 +984,20 @@ namespace GridKit
{ return y_.getData()[static_cast<size_t>(RepcaInternalVariables::PMEAS)]; });
}

/**
* @brief Static method to log time constant warnings
*
* @note Used in combination with static std:once_flag and std:call_once,
* to reduce the number of times the warning is printed.
*/
template <typename scalar_type, typename index_type>
void Repca<scalar_type, index_type>::logTimeConstantWarning()
{
Log::warning() << "Repca: Tfltr, Tfv, Tp, and Tlag below "
<< TIME_CONSTANT_MINIMUM
<< " s are raised to that floor to keep the controller lags well posed\n";
}

/**
* @brief Resolve parameter-derived constants
*
Expand Down Expand Up @@ -1012,9 +1027,9 @@ namespace GridKit
if (Tfltr_ < TIME_CONSTANT_MINIMUM || Tfv_ < TIME_CONSTANT_MINIMUM
|| Tp_ < TIME_CONSTANT_MINIMUM || Tlag_ < TIME_CONSTANT_MINIMUM)
{
Log::warning() << "Repca: Tfltr, Tfv, Tp, and Tlag below "
<< TIME_CONSTANT_MINIMUM
<< " s are raised to that floor to keep the controller lags well posed\n";
static std::once_flag time_constant_warning_flag_;
std::call_once(time_constant_warning_flag_,
&logTimeConstantWarning);
}

Tfltr_ = std::max(Tfltr_, TIME_CONSTANT_MINIMUM);
Expand Down
1 change: 1 addition & 0 deletions GridKit/Model/PhasorDynamics/Converter/REGCA/Regca.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ namespace GridKit
ScalarT& Ii();

static constexpr RealT TIME_CONSTANT_MINIMUM = static_cast<RealT>(1.0e-3);
static void logTimeConstantWarning();

BusT* bus_{nullptr};

Expand Down
21 changes: 18 additions & 3 deletions GridKit/Model/PhasorDynamics/Converter/REGCA/RegcaImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#pragma once

#include <algorithm>
#include <mutex>
#include <variant>

#include <GridKit/Model/PhasorDynamics/BusBase.hpp>
Expand Down Expand Up @@ -60,6 +61,20 @@ namespace GridKit
{
}

/**
* @brief Static method to log time constant warnings
*
* @note Used in combination with static std:once_flag and std:call_once,
* to reduce the number of times the warning is printed.
*/
template <typename scalar_type, typename index_type>
void Regca<scalar_type, index_type>::logTimeConstantWarning()
{
Log::warning() << "Regca: Tg and TM below " << TIME_CONSTANT_MINIMUM
<< " s are raised to that floor to keep the current-control "
<< "and voltage-sensor lags well posed\n";
}

/**
* @brief Resolve parameter-derived constants and limiter selections.
*
Expand All @@ -72,9 +87,9 @@ namespace GridKit
{
if (Tg_ < TIME_CONSTANT_MINIMUM || TM_ < TIME_CONSTANT_MINIMUM)
{
Log::warning() << "Regca: Tg and TM below " << TIME_CONSTANT_MINIMUM
<< " s are raised to that floor to keep the current-control "
<< "and voltage-sensor lags well posed\n";
static std::once_flag time_constant_warning_flag_;
std::call_once(time_constant_warning_flag_,
&logTimeConstantWarning);
}

Tg_ = std::max(Tg_, TIME_CONSTANT_MINIMUM);
Expand Down
1 change: 1 addition & 0 deletions GridKit/Model/PhasorDynamics/Exciter/ESDC1A/Esdc1a.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ namespace GridKit
ScalarT& Vi();

static constexpr RealT TIME_CONSTANT_MINIMUM = static_cast<RealT>(1.0e-3);
static void logTimeConstantWarning();

BusT* bus_{nullptr};

Expand Down
21 changes: 18 additions & 3 deletions GridKit/Model/PhasorDynamics/Exciter/ESDC1A/Esdc1aImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include <algorithm>
#include <cmath>
#include <mutex>
#include <variant>

#include <GridKit/Model/PhasorDynamics/BusBase.hpp>
Expand Down Expand Up @@ -761,6 +762,20 @@ namespace GridKit
{ return y_.getData()[static_cast<size_t>(Esdc1aInternalVariables::VFE)]; });
}

/**
* @brief Static method to log time constant warnings
*
* @note Used in combination with static std:once_flag and std:call_once,
* to reduce the number of times the warning is printed.
*/
template <typename scalar_type, typename index_type>
void Esdc1a<scalar_type, index_type>::logTimeConstantWarning()
{
Log::warning() << "Esdc1a: Tr, Ta, Tb, Te, and Tf1 below "
<< TIME_CONSTANT_MINIMUM
<< " s are raised to that floor to keep the exciter lags well posed\n";
}

/**
* @brief Resolve the parameter-derived constants and selector masks
*
Expand Down Expand Up @@ -796,9 +811,9 @@ namespace GridKit
|| Tb_ < TIME_CONSTANT_MINIMUM || Te_ < TIME_CONSTANT_MINIMUM
|| Tf1_ < TIME_CONSTANT_MINIMUM)
{
Log::warning() << "Esdc1a: Tr, Ta, Tb, Te, and Tf1 below "
<< TIME_CONSTANT_MINIMUM
<< " s are raised to that floor to keep the exciter lags well posed\n";
static std::once_flag time_constant_warning_flag_;
std::call_once(time_constant_warning_flag_,
&logTimeConstantWarning);
}

Tr_ = std::max(Tr_, TIME_CONSTANT_MINIMUM);
Expand Down
1 change: 1 addition & 0 deletions GridKit/Model/PhasorDynamics/Exciter/IEEET1/Ieeet1.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ namespace GridKit

private:
static constexpr RealT TIME_CONSTANT_MINIMUM = static_cast<RealT>(1.0e-3);
static void logTimeConstantWarning();

// Signal pointers
BusT* bus_;
Expand Down
21 changes: 18 additions & 3 deletions GridKit/Model/PhasorDynamics/Exciter/IEEET1/Ieeet1Impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <algorithm>
#include <cmath>
#include <iostream>
#include <mutex>

#include <GridKit/Model/PhasorDynamics/Bus/Bus.hpp>
#include <GridKit/Model/PhasorDynamics/Exciter/IEEET1/Ieeet1.hpp>
Expand Down Expand Up @@ -491,6 +492,20 @@ namespace GridKit
setDerivedParameters();
}

/**
* @brief Static method to log time constant warnings
*
* @note Used in combination with static std:once_flag and std:call_once,
* to reduce the number of times the warning is printed.
*/
template <typename scalar_type, typename index_type>
void Ieeet1<scalar_type, index_type>::logTimeConstantWarning()
{
Log::warning() << "Ieeet1: Tr, Ta, Te, and Tf below "
<< TIME_CONSTANT_MINIMUM
<< " s are raised to that floor\n";
}

/**
* @brief Resolve the parameter-derived constants
*/
Expand All @@ -500,9 +515,9 @@ namespace GridKit
if (Tr_ < TIME_CONSTANT_MINIMUM || Ta_ < TIME_CONSTANT_MINIMUM
|| Te_ < TIME_CONSTANT_MINIMUM || Tf_ < TIME_CONSTANT_MINIMUM)
{
Log::warning() << "Ieeet1: Tr, Ta, Te, and Tf below "
<< TIME_CONSTANT_MINIMUM
<< " s are raised to that floor\n";
static std::once_flag time_constant_warning_flag_;
std::call_once(time_constant_warning_flag_,
&logTimeConstantWarning);
}

Tr_ = std::max(Tr_, TIME_CONSTANT_MINIMUM);
Expand Down
1 change: 1 addition & 0 deletions GridKit/Model/PhasorDynamics/Governor/GASTPTI/GastPti.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ namespace GridKit
RealT toSystemBase(RealT value) const;

static constexpr RealT TIME_CONSTANT_MINIMUM = static_cast<RealT>(1.0e-3);
static void logTimeConstantWarning();

RealT R_{static_cast<RealT>(0.05)};
RealT T1_{static_cast<RealT>(0.4)};
Expand Down
21 changes: 18 additions & 3 deletions GridKit/Model/PhasorDynamics/Governor/GASTPTI/GastPtiImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <algorithm>
#include <cassert>
#include <cmath>
#include <mutex>
#include <variant>

#include <GridKit/Model/PhasorDynamics/Governor/GASTPTI/GastPti.hpp>
Expand Down Expand Up @@ -712,6 +713,20 @@ namespace GridKit
{ return y_.getData()[static_cast<size_t>(GastPtiInternalVariables::VTEMP)]; });
}

/**
* @brief Static method to log time constant warnings
*
* @note Used in combination with static std:once_flag and std:call_once,
* to reduce the number of times the warning is printed.
*/
template <typename scalar_type, typename index_type>
void GastPti<scalar_type, index_type>::logTimeConstantWarning()
{
Log::warning() << "GastPti: T1, T2, and T3 below "
<< TIME_CONSTANT_MINIMUM
<< " s are raised to that floor to keep the turbine lags well posed\n";
}

/**
* @brief Resolve the parameter-derived constants
*
Expand All @@ -735,9 +750,9 @@ namespace GridKit

if (floor_warning)
{
Log::warning() << "GastPti: T1, T2, and T3 below "
<< TIME_CONSTANT_MINIMUM
<< " s are raised to that floor to keep the turbine lags well posed\n";
static std::once_flag time_constant_warning_flag_;
std::call_once(time_constant_warning_flag_,
&logTimeConstantWarning);
}

va_component_base_ = ZERO<RealT>;
Expand Down
1 change: 1 addition & 0 deletions GridKit/Model/PhasorDynamics/Governor/HYGOV/Hygov.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ namespace GridKit
ScalarT toSystemBase(ScalarT value) const;

static constexpr RealT TIME_CONSTANT_MINIMUM = static_cast<RealT>(1.0e-3);
static void logTimeConstantWarning();

/// Accepted seed distance beyond the achievable-power range edge.
static constexpr RealT INITIALIZATION_TOLERANCE =
Expand Down
21 changes: 18 additions & 3 deletions GridKit/Model/PhasorDynamics/Governor/HYGOV/HygovImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <algorithm>
#include <cmath>
#include <limits>
#include <mutex>
#include <numeric>
#include <variant>

Expand Down Expand Up @@ -764,6 +765,20 @@ namespace GridKit
{ return y_.getData()[static_cast<size_t>(HygovInternalVariables::H)]; });
}

/**
* @brief Static method to log time constant warnings
*
* @note Used in combination with static std:once_flag and std:call_once,
* to reduce the number of times the warning is printed.
*/
template <typename scalar_type, typename index_type>
void Hygov<scalar_type, index_type>::logTimeConstantWarning()
{
Log::warning() << "Hygov: Tr, Tf, Tg, Tw, and Tnp below "
<< TIME_CONSTANT_MINIMUM
<< " s are raised to preserve Hessenberg form\n";
}

/**
* @brief Resolve the parameter-derived constants
*
Expand Down Expand Up @@ -816,9 +831,9 @@ namespace GridKit
|| Tg_ < TIME_CONSTANT_MINIMUM || Tw_ < TIME_CONSTANT_MINIMUM
|| Tnp_ < TIME_CONSTANT_MINIMUM)
{
Log::warning() << "Hygov: Tr, Tf, Tg, Tw, and Tnp below "
<< TIME_CONSTANT_MINIMUM
<< " s are raised to preserve Hessenberg form\n";
static std::once_flag time_constant_warning_flag_;
std::call_once(time_constant_warning_flag_,
&logTimeConstantWarning);
}

// HYGOV residuals solve explicitly for the state derivatives to preserve
Expand Down
1 change: 1 addition & 0 deletions GridKit/Model/PhasorDynamics/Governor/Tgov1/Tgov1.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ namespace GridKit
ScalarT toSystemBase(ScalarT value) const;

static constexpr RealT TIME_CONSTANT_MINIMUM = static_cast<RealT>(1.0e-3);
static void logTimeConstantWarning();

/* Local copies of signal variables */
std::vector<ScalarT> ws_;
Expand Down
19 changes: 17 additions & 2 deletions GridKit/Model/PhasorDynamics/Governor/Tgov1/Tgov1Impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include <algorithm>
#include <limits>
#include <mutex>

#include <GridKit/Model/PhasorDynamics/Governor/Tgov1/Tgov1.hpp>
#include <GridKit/Model/PhasorDynamics/Governor/Tgov1/Tgov1Data.hpp>
Expand Down Expand Up @@ -128,13 +129,27 @@ namespace GridKit
}
}

/**
* @brief Static method to log time constant warnings
*
* @note Used in combination with static std:once_flag and std:call_once,
* to reduce the number of times the warning is printed.
*/
template <typename scalar_type, typename index_type>
void Tgov1<scalar_type, index_type>::logTimeConstantWarning()
{
Log::warning() << "Tgov1: T1 and T3 below " << TIME_CONSTANT_MINIMUM
<< " s are raised to that floor\n";
}

template <typename scalar_type, typename index_type>
void Tgov1<scalar_type, index_type>::setDerivedParams()
{
if (T1_ < TIME_CONSTANT_MINIMUM || T3_ < TIME_CONSTANT_MINIMUM)
{
Log::warning() << "Tgov1: T1 and T3 below " << TIME_CONSTANT_MINIMUM
<< " s are raised to that floor\n";
static std::once_flag time_constant_warning_flag_;
std::call_once(time_constant_warning_flag_,
&logTimeConstantWarning);
}

T1_ = std::max(T1_, TIME_CONSTANT_MINIMUM);
Expand Down
Loading