Commit fee3c028 authored by aligungr's avatar aligungr

UE SAS dev.

parent 52eb0de5
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "task.hpp" #include "task.hpp"
#include <cmath> #include <cmath>
static int MIN_ALLOWED_DBM = -100; static int MIN_ALLOWED_DBM = -120;
static int EstimateSimulatedDbm(const Vector3 &myPos, const Vector3 &uePos) static int EstimateSimulatedDbm(const Vector3 &myPos, const Vector3 &uePos)
{ {
...@@ -18,6 +18,8 @@ static int EstimateSimulatedDbm(const Vector3 &myPos, const Vector3 &uePos) ...@@ -18,6 +18,8 @@ static int EstimateSimulatedDbm(const Vector3 &myPos, const Vector3 &uePos)
int deltaZ = myPos.z - uePos.z; int deltaZ = myPos.z - uePos.z;
int distance = static_cast<int>(std::sqrt(deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ)); int distance = static_cast<int>(std::sqrt(deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ));
if (distance == 0)
return -1; // 0 may be confusing for people
return -distance; return -distance;
} }
......
...@@ -9,8 +9,6 @@ ...@@ -9,8 +9,6 @@
#include "task.hpp" #include "task.hpp"
#include <utils/common.hpp> #include <utils/common.hpp>
static int DBM_STRONG_STRENGTH_THRESHOLD = -70;
namespace nr::ue namespace nr::ue
{ {
...@@ -22,20 +20,12 @@ void UeSasTask::onMeasurement() ...@@ -22,20 +20,12 @@ void UeSasTask::onMeasurement()
// compare active and pending measurements // compare active and pending measurements
for (auto &m : m_activeMeasurements) for (auto &m : m_activeMeasurements)
{ {
bool oldStrong = m.second.dbm >= DBM_STRONG_STRENGTH_THRESHOLD; if (!m_pendingMeasurements.count(m.first))
if (m_pendingMeasurements.count(m.first))
{
bool newStrong = m_pendingMeasurements[m.first].dbm >= DBM_STRONG_STRENGTH_THRESHOLD;
if (newStrong ^ oldStrong)
(newStrong ? entered : exited).push_back(m.first);
}
else if (oldStrong)
exited.push_back(m.first); exited.push_back(m.first);
} }
for (auto &m : m_pendingMeasurements) for (auto &m : m_pendingMeasurements)
{ {
bool newStrong = m_pendingMeasurements[m.first].dbm >= DBM_STRONG_STRENGTH_THRESHOLD; if (!m_activeMeasurements.count(m.first))
if (!m_activeMeasurements.count(m.first) && newStrong)
entered.push_back(m.first); entered.push_back(m.first);
} }
if (!entered.empty() || !exited.empty()) if (!entered.empty() || !exited.empty())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment