Skip to content

Commit

Permalink
Corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
p7x404 committed Dec 6, 2022
1 parent 3519818 commit 34d0eeb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
32 changes: 15 additions & 17 deletions STCA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ CSTCA::CSTCA(toml::value CurrentConfig)
this->level_reduced_sep = toml::find<int>(CurrentConfig, "stca", "level_reduced_sep");
this->time_to_extrapolate = toml::find<int>(CurrentConfig, "stca", "time_to_extrapolate");
this->altitude_sep = toml::find<int>(CurrentConfig, "stca", "altitude_sep");
this->altitude_coarse_filter= toml::find<int>(CurrentConfig, "stca", "altitude_coarse_filter");
this->distance_coarse_filter = toml::find<int>(CurrentConfig, "stca", "distance_coarse_filter");
//this->altitude_coarse_filter = toml::find<int>(CurrentConfig, "stca", "altitude_coarse_filter");
//this->distance_coarse_filter = toml::find<int>(CurrentConfig, "stca", "distance_coarse_filter");

}

Expand Down Expand Up @@ -61,7 +61,7 @@ void CSTCA::OnRefresh(CPlugIn* pl)
int separation_distance = high_level_sep;
int extrapolationTime = time_to_extrapolate;
double current_horiz_distance = 0;
double current_vert_distance = 0;
int current_vert_distance = 0;
int vz = 0;
int vz_conflicting = 0;
int alt = 0;
Expand All @@ -70,12 +70,6 @@ void CSTCA::OnRefresh(CPlugIn* pl)
if (rt.GetCallsign() == conflicting.GetCallsign())
continue;

if (rt.GetPosition().GetPressureAltitude() <= level_reduced_sep
&& conflicting.GetPosition().GetPressureAltitude() <= level_reduced_sep)
{
separation_distance = low_level_sep;
}

if (conflicting.GetPosition().GetRadarFlags() == EuroScopePlugIn::RADAR_POSITION_PRIMARY)
continue;

Expand All @@ -91,6 +85,12 @@ void CSTCA::OnRefresh(CPlugIn* pl)
continue;
}

if (rt.GetPosition().GetPressureAltitude() <= level_reduced_sep
&& conflicting.GetPosition().GetPressureAltitude() <= level_reduced_sep)
{
separation_distance = low_level_sep;
}

alt = rt.GetPosition().GetPressureAltitude();
alt_conflicting = conflicting.GetPosition().GetPressureAltitude();
current_horiz_distance = rt.GetPosition().GetPosition().DistanceTo(conflicting.GetPosition().GetPosition());
Expand All @@ -99,7 +99,7 @@ void CSTCA::OnRefresh(CPlugIn* pl)
// Coarse filter on alt/dist difference (to avoid unecessary extrapolation on obviously separated traffics)
if (current_vert_distance > altitude_coarse_filter)
continue;
if (current_horiz_distance > distance_coarse_filter)
if ( current_horiz_distance > distance_coarse_filter)
continue;

// Are the traffics already in conflict ?
Expand Down Expand Up @@ -142,14 +142,12 @@ void CSTCA::OnRefresh(CPlugIn* pl)
}
}
// Coarse filters based on altitude and vertical speed
// If they are both stable, no conflict
if (vz == 0 && vz_conflicting == 0)
continue;

// If we are stable or climbing and above comflicting, no risk if conflicting is stable or descending
if (vz >= 0 && alt > alt_conflicting && vz_conflicting <= 0)
if (vz >= 0 && alt > ( alt_conflicting + 2000 ) && vz_conflicting <= 0)
continue;
// If we are stable or descending and below comflicting, no risk if conflicting is stable or climbing
if (vz <= 0 && alt < alt_conflicting && vz_conflicting >= 0)
if (vz <= 0 && alt < ( alt_conflicting - 2000 ) && vz_conflicting >= 0)
continue;

// Faire un calcul en vectoriel pour voir le rapprochement (ou pas)
Expand All @@ -165,8 +163,8 @@ void CSTCA::OnRefresh(CPlugIn* pl)

if (vz != 0 || vz_conflicting != 0)
{
alt1 += (vz / 60) * i;
alt2 += (vz_conflicting / 60) * i;
alt1 += (vz * i) / 60;
alt2 += (vz_conflicting * i) / 60;
}

if (ex1.DistanceTo(ex2) < separation_distance &&
Expand Down
2 changes: 1 addition & 1 deletion STCA.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class CSTCA
int disable_level = 3000;
int level_reduced_sep = 14500;
int time_to_extrapolate = 120;
int altitude_sep = 950;
int altitude_sep = 900;
int altitude_coarse_filter = 15000;
int distance_coarse_filter = 70;

Expand Down

0 comments on commit 34d0eeb

Please sign in to comment.