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
14 changes: 8 additions & 6 deletions GridKit/Model/PhasorDynamics/Controller/REECB/ReecbImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include <algorithm>
#include <array>
#include <mutex>
#include <atomic>
#include <variant>

#include <GridKit/Model/PhasorDynamics/BusBase.hpp>
Expand Down Expand Up @@ -1378,8 +1378,8 @@ 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.
* @note Guarded by a static std::atomic<bool> flag so the warning is
* printed at most once per model type.
*/
template <typename scalar_type, typename index_type>
void Reecb<scalar_type, index_type>::logTimeConstantWarning()
Expand Down Expand Up @@ -1408,9 +1408,11 @@ namespace GridKit

if (floor_warning)
{
static std::once_flag time_constant_warning_flag_;
std::call_once(time_constant_warning_flag_,
&logTimeConstantWarning);
static std::atomic<bool> time_constant_warning_flag_{false};
if (!time_constant_warning_flag_.exchange(true))
{
logTimeConstantWarning();
}
}

if (PfFlag_ && QFlag_)
Expand Down
14 changes: 8 additions & 6 deletions GridKit/Model/PhasorDynamics/Controller/REPCA/RepcaImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#pragma once

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

#include <GridKit/Model/PhasorDynamics/BusBase.hpp>
Expand Down Expand Up @@ -960,8 +960,8 @@ 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.
* @note Guarded by a static std::atomic<bool> flag so the warning is
* printed at most once per model type.
*/
template <typename scalar_type, typename index_type>
void Repca<scalar_type, index_type>::logTimeConstantWarning()
Expand Down Expand Up @@ -1000,9 +1000,11 @@ namespace GridKit
if (Tfltr_ < TIME_CONSTANT_MINIMUM || Tfv_ < TIME_CONSTANT_MINIMUM
|| Tp_ < TIME_CONSTANT_MINIMUM || Tlag_ < TIME_CONSTANT_MINIMUM)
{
static std::once_flag time_constant_warning_flag_;
std::call_once(time_constant_warning_flag_,
&logTimeConstantWarning);
static std::atomic<bool> time_constant_warning_flag_{false};
if (!time_constant_warning_flag_.exchange(true))
{
logTimeConstantWarning();
}
}

Tfltr_ = std::max(Tfltr_, TIME_CONSTANT_MINIMUM);
Expand Down
14 changes: 8 additions & 6 deletions GridKit/Model/PhasorDynamics/Converter/REGCA/RegcaImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#pragma once

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

#include <GridKit/Model/PhasorDynamics/BusBase.hpp>
Expand Down Expand Up @@ -66,8 +66,8 @@ 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.
* @note Guarded by a static std::atomic<bool> flag so the warning is
* printed at most once per model type.
*/
template <typename scalar_type, typename index_type>
void Regca<scalar_type, index_type>::logTimeConstantWarning()
Expand All @@ -89,9 +89,11 @@ namespace GridKit
{
if (Tg_ < TIME_CONSTANT_MINIMUM || TM_ < TIME_CONSTANT_MINIMUM)
{
static std::once_flag time_constant_warning_flag_;
std::call_once(time_constant_warning_flag_,
&logTimeConstantWarning);
static std::atomic<bool> time_constant_warning_flag_{false};
if (!time_constant_warning_flag_.exchange(true))
{
logTimeConstantWarning();
}
}

Tg_ = std::max(Tg_, TIME_CONSTANT_MINIMUM);
Expand Down
14 changes: 8 additions & 6 deletions GridKit/Model/PhasorDynamics/Exciter/ESDC1A/Esdc1aImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#pragma once

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

#include <GridKit/Model/PhasorDynamics/BusBase.hpp>
Expand Down Expand Up @@ -771,8 +771,8 @@ 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.
* @note Guarded by a static std::atomic<bool> flag so the warning is
* printed at most once per model type.
*/
template <typename scalar_type, typename index_type>
void Esdc1a<scalar_type, index_type>::logTimeConstantWarning()
Expand Down Expand Up @@ -817,9 +817,11 @@ namespace GridKit
|| Tb_ < TIME_CONSTANT_MINIMUM || Te_ < TIME_CONSTANT_MINIMUM
|| Tf1_ < TIME_CONSTANT_MINIMUM)
{
static std::once_flag time_constant_warning_flag_;
std::call_once(time_constant_warning_flag_,
&logTimeConstantWarning);
static std::atomic<bool> time_constant_warning_flag_{false};
if (!time_constant_warning_flag_.exchange(true))
{
logTimeConstantWarning();
}
}

Tr_ = std::max(Tr_, TIME_CONSTANT_MINIMUM);
Expand Down
14 changes: 8 additions & 6 deletions GridKit/Model/PhasorDynamics/Exciter/IEEET1/Ieeet1Impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
*/

#include <algorithm>
#include <atomic>
#include <iostream>
#include <mutex>

#include <GridKit/Model/PhasorDynamics/Bus/Bus.hpp>
#include <GridKit/Model/PhasorDynamics/Exciter/IEEET1/Ieeet1.hpp>
Expand Down Expand Up @@ -550,8 +550,8 @@ 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.
* @note Guarded by a static std::atomic<bool> flag so the warning is
* printed at most once per model type.
*/
template <typename scalar_type, typename index_type>
void Ieeet1<scalar_type, index_type>::logTimeConstantWarning()
Expand All @@ -570,9 +570,11 @@ namespace GridKit
if (Tr_ < TIME_CONSTANT_MINIMUM || Ta_ < TIME_CONSTANT_MINIMUM
|| Te_ < TIME_CONSTANT_MINIMUM || Tf_ < TIME_CONSTANT_MINIMUM)
{
static std::once_flag time_constant_warning_flag_;
std::call_once(time_constant_warning_flag_,
&logTimeConstantWarning);
static std::atomic<bool> time_constant_warning_flag_{false};
if (!time_constant_warning_flag_.exchange(true))
{
logTimeConstantWarning();
}
}

Tr_ = std::max(Tr_, TIME_CONSTANT_MINIMUM);
Expand Down
14 changes: 8 additions & 6 deletions GridKit/Model/PhasorDynamics/Governor/GASTPTI/GastPtiImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#pragma once

#include <algorithm>
#include <atomic>
#include <cassert>
#include <mutex>
#include <variant>

#include <GridKit/Model/PhasorDynamics/Governor/GASTPTI/GastPti.hpp>
Expand Down Expand Up @@ -703,8 +703,8 @@ 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.
* @note Guarded by a static std::atomic<bool> flag so the warning is
* printed at most once per model type.
*/
template <typename scalar_type, typename index_type>
void GastPti<scalar_type, index_type>::logTimeConstantWarning()
Expand Down Expand Up @@ -735,9 +735,11 @@ namespace GridKit

if (floor_warning)
{
static std::once_flag time_constant_warning_flag_;
std::call_once(time_constant_warning_flag_,
&logTimeConstantWarning);
static std::atomic<bool> time_constant_warning_flag_{false};
if (!time_constant_warning_flag_.exchange(true))
{
logTimeConstantWarning();
}
}

Vmin_response_ = Vmin_;
Expand Down
14 changes: 8 additions & 6 deletions GridKit/Model/PhasorDynamics/Governor/HYGOV/HygovImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#pragma once

#include <algorithm>
#include <mutex>
#include <atomic>
#include <numeric>
#include <variant>

Expand Down Expand Up @@ -753,8 +753,8 @@ 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.
* @note Guarded by a static std::atomic<bool> flag so the warning is
* printed at most once per model type.
*/
template <typename scalar_type, typename index_type>
void Hygov<scalar_type, index_type>::logTimeConstantWarning()
Expand Down Expand Up @@ -816,9 +816,11 @@ namespace GridKit
|| Tg_ < TIME_CONSTANT_MINIMUM || Tw_ < TIME_CONSTANT_MINIMUM
|| Tnp_ < TIME_CONSTANT_MINIMUM)
{
static std::once_flag time_constant_warning_flag_;
std::call_once(time_constant_warning_flag_,
&logTimeConstantWarning);
static std::atomic<bool> time_constant_warning_flag_{false};
if (!time_constant_warning_flag_.exchange(true))
{
logTimeConstantWarning();
}
}

// HYGOV residuals solve explicitly for the state derivatives to preserve
Expand Down
14 changes: 8 additions & 6 deletions GridKit/Model/PhasorDynamics/Governor/Tgov1/Tgov1Impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/

#include <algorithm>
#include <mutex>
#include <atomic>

#include <GridKit/Model/PhasorDynamics/Governor/Tgov1/Tgov1.hpp>
#include <GridKit/Model/PhasorDynamics/Governor/Tgov1/Tgov1Data.hpp>
Expand Down Expand Up @@ -134,8 +134,8 @@ 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.
* @note Guarded by a static std::atomic<bool> flag so the warning is
* printed at most once per model type.
*/
template <typename scalar_type, typename index_type>
void Tgov1<scalar_type, index_type>::logTimeConstantWarning()
Expand All @@ -149,9 +149,11 @@ namespace GridKit
{
if (T1_ < TIME_CONSTANT_MINIMUM || T3_ < TIME_CONSTANT_MINIMUM)
{
static std::once_flag time_constant_warning_flag_;
std::call_once(time_constant_warning_flag_,
&logTimeConstantWarning);
static std::atomic<bool> time_constant_warning_flag_{false};
if (!time_constant_warning_flag_.exchange(true))
{
logTimeConstantWarning();
}
}

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