Reinserts original comments

This commit is contained in:
torsten committed 2026-10-14 12:56:16 +00:00
1 parent 1dd1e86355
commit b662e4daf9
112 files changed
+7113 -5131

No files matched your search

@@ -1,16 +1,16 @@
// **************************************************************************
//
// @RDE_HEADER@
//
// **************************************************************************
//
// $HeadURL$
// $LastChangedBy$
// $LastChangedDate$
// $LastChangedRevision$
//
// Implementation of the Class PrtCnvRadioTrafficThread
// **************************************************************************
#include "PrtCnvRadioTrafficThread.hpp"
#include "PrtCnvDbThread.hpp"
@@ -46,7 +46,7 @@ void PrtCnvRadioTrafficThread::newTelegramArrived(unsigned int size)
int32_t PrtCnvRadioTrafficThread::start()
{
// read data from m_Config
const QString trafficControlGroup(QStringLiteral("TrafficControl"));
int highLoad = m_Config->getInteger(trafficControlGroup, QStringLiteral("ReceiveQueueHighLoad"), 60);
int fullLoad = m_Config->getInteger(trafficControlGroup, QStringLiteral("ReceiveQueueFullLoad"), 80);
@@ -55,7 +55,7 @@ int32_t PrtCnvRadioTrafficThread::start()
float trafficPerReceiverKB = m_Config->getFloat(trafficControlGroup, QStringLiteral("ReceiveThroughput"), 3.6f);
int cntTransceiver = m_Config->getInteger(trafficControlGroup, QStringLiteral("TransceiverCount"), 6);
// sanity checks
if (highLoad < 0 || highLoad > 100)
highLoad = 60;
if (fullLoad < highLoad || fullLoad > 100)
@@ -74,7 +74,7 @@ int32_t PrtCnvRadioTrafficThread::start()
m_fullLoad = maxTrafficBytes * fullLoad / 100.f;
m_highLoad = maxTrafficBytes * highLoad / 100.f;
m_hystLoad = maxTrafficBytes * hystLoad / 100.f;
m_cleanupTimeout = avgTime * 1000;
m_cleanupTimeout = avgTime * 1000; // ms
DEBUG_LOG(m_logger) << "Read config ReceiveQueueHighLoad: " << highLoad;
DEBUG_LOG(m_logger) << "Read config ReceiveQueueFullLoad: " << fullLoad;
@@ -100,12 +100,12 @@ void PrtCnvRadioTrafficThread::onCalculateTrafficLoad()
unsigned int payload = 0;
{
QMutexLocker l(&m_mutex);
// fuer aktuelle Sekunde haben wir noch nicht alle Daten
for (int i = 1; i <= m_cleanupTimeout / 1000; ++i)
payload += m_data.value(curTime - i);
}
// Durchschnitt ...
payload /= (m_cleanupTimeout / 1000);
INFO_LOG(m_logger) << "Average Payload in the last "
@@ -116,34 +116,34 @@ void PrtCnvRadioTrafficThread::onCalculateTrafficLoad()
PrtCnvRadioThread::E_TrafficLoad newReceiveLoad;
if (payload >= m_fullLoad)
{
// full load
newReceiveLoad = PrtCnvRadioThread::E_TrafficLoad::FullLoad;
// Hysterese nach oben
if (m_receiveLoad == PrtCnvRadioThread::E_TrafficLoad::HighLoad)
{
// wenn cnt in Bereich m_fullLoad ... m_fullLoad + m_hystLoad
// -> noch warten
if(payload < m_fullLoad + m_hystLoad)
newReceiveLoad = PrtCnvRadioThread::E_TrafficLoad::HighLoad;
}
}
else if (payload >= m_highLoad)
{
// high load
newReceiveLoad = PrtCnvRadioThread::E_TrafficLoad::HighLoad;
// Hysterese nach oben
if (m_receiveLoad == PrtCnvRadioThread::E_TrafficLoad::NormalLoad)
{
// wenn cnt in Bereich m_highLoad ... m_highLoad + m_hystLoad
// -> noch warten
if (payload < m_highLoad + m_hystLoad)
newReceiveLoad = PrtCnvRadioThread::E_TrafficLoad::NormalLoad;
}
// Hysterese nach unten
if (m_receiveLoad == PrtCnvRadioThread::E_TrafficLoad::FullLoad)
{
// wenn cnt in Bereich m_fullLoad ... m_fullLoad - m_hystLoad
// -> noch warten
if (payload >= m_fullLoad - m_hystLoad)
newReceiveLoad = PrtCnvRadioThread::E_TrafficLoad::FullLoad;
}
@@ -151,11 +151,11 @@ void PrtCnvRadioTrafficThread::onCalculateTrafficLoad()
else
{
newReceiveLoad = PrtCnvRadioThread::E_TrafficLoad::NormalLoad;
// Hysterese nach unten
if (m_receiveLoad == PrtCnvRadioThread::E_TrafficLoad::HighLoad)
{
// wenn cnt in Bereich m_highLoad ... m_highLoad - m_hystLoad
// -> noch warten
if(payload >= m_highLoad - m_hystLoad)
newReceiveLoad = PrtCnvRadioThread::E_TrafficLoad::HighLoad;
}
@@ -163,7 +163,7 @@ void PrtCnvRadioTrafficThread::onCalculateTrafficLoad()
if (m_receiveLoad != newReceiveLoad)
{
m_receiveLoad = newReceiveLoad;
// Achtung: Nicht mehr als 31 Sekunden erlaubt
unsigned int wartezeit_posmldg = (static_cast<unsigned int>(m_receiveLoad) * 10) + 1;
INFO_LOG(m_logger) << "New traffic load: " << m_receiveLoad;
@@ -191,18 +191,18 @@ void PrtCnvRadioTrafficThread::onCleanupTimeout()
while (it != m_data.end())
{
const time_t key = it.key();
// 10 als Puffer (siehe auch onCalculateTrafficLoad())
if (key < curTime - m_cleanupTimeout - 10)
{
m_data.erase(it++);
m_telegrams.remove(key);
continue;
}
break;
break; // arbitrarily ordered
}
}
QTimer::singleShot(m_cleanupTimeout, this, &PrtCnvRadioTrafficThread::onCleanupTimeout);
}
}
} // namespace PrtCnv