コード例 #1
0
ファイル: tcas.c プロジェクト: JamMarHer/RepairBox
int alt_sep_test()
{
    bool enabled, tcas_equipped, intent_not_known;
    bool need_upward_RA, need_downward_RA;
    int alt_sep;

    enabled = High_Confidence && (Own_Tracked_Alt_Rate <= OLEV) && (Cur_Vertical_Sep > MAXALTDIFF);
    tcas_equipped = Other_Capability == TCAS_TA;
    intent_not_known = Two_of_Three_Reports_Valid && Other_RAC == NO_INTENT;
    
    alt_sep = UNRESOLVED;
    
    if (enabled && ((tcas_equipped && intent_not_known) || !tcas_equipped))
    {
	need_upward_RA = Non_Crossing_Biased_Climb() && Own_Below_Threat();
	need_downward_RA = Non_Crossing_Biased_Descend() && Own_Above_Threat();
	if (need_upward_RA && need_downward_RA)
        /* unreachable: requires Own_Below_Threat and Own_Above_Threat
           to both be true - that requires Own_Tracked_Alt < Other_Tracked_Alt
           and Other_Tracked_Alt < Own_Tracked_Alt, which isn't possible */
	    alt_sep = UNRESOLVED;
	else if (need_upward_RA)
	    alt_sep = UPWARD_RA;
	else if (need_downward_RA)
	    alt_sep = DOWNWARD_RA;
	else
	    alt_sep = UNRESOLVED;
    }
    
    return alt_sep;
}
コード例 #2
0
ファイル: tcas.c プロジェクト: hmohit/compiler-701
int alt_sep_test()
{
    bool enabled, tcas_equipped, intent_not_known;
    bool need_upward_RA, need_downward_RA;
    int alt_sep;
    enabled = High_Confidence && (Own_Tracked_Alt_Rate <= 600) && (Cur_Vertical_Sep > 600);
    tcas_equipped = Other_Capability == 1;
    intent_not_known = Two_of_Three_Reports_Valid && Other_RAC == 0;
    alt_sep = 0;
    if (enabled && ((tcas_equipped && intent_not_known) || !tcas_equipped))
    {
 need_upward_RA = Non_Crossing_Biased_Climb() && Own_Below_Threat();
 need_downward_RA = Non_Crossing_Biased_Descend() && Own_Above_Threat();
 if (need_upward_RA && need_downward_RA)
     alt_sep = 0;
 else if (need_upward_RA)
     alt_sep = 1;
 else if (need_downward_RA)
     alt_sep = 2;
 else
     alt_sep = 0;
    }
    return alt_sep;
}
コード例 #3
0
ファイル: tcas_4b.c プロジェクト: tracer-x/tracer
unsigned alt_sep_test()
{
    bool enabled=0, tcas_equipped=0, intent_not_known=0;
    bool need_upward_RA=0, need_downward_RA=0;
    unsigned alt_sep;
    // The compiler fails here
    //unsigned alim = ALIM() ;
    unsigned alim;
    // New variables added ....
    bool temp1,temp2,temp3,temp4;

    alim = ALIM();
    if ( High_Confidence && (Own_Tracked_Alt_Rate <= 600) && (Cur_Vertical_Sep > 600) )
      enabled = 1 ;
    if ( Other_Capability == 0 )
      tcas_equipped = 1 ;
    if ( Two_of_Three_Reports_Valid && Other_RAC == 0 )
      intent_not_known = 1 ;

    alt_sep = 0;

    if (enabled && ((tcas_equipped && intent_not_known) || !tcas_equipped))
    {
      /******************************************/
      /* Coded added due to compiler limitation */
      /******************************************/
      temp1 = Non_Crossing_Biased_Climb();
      temp2 = Own_Below_Threat();
      //if ( Non_Crossing_Biased_Climb() && Own_Below_Threat() )
      /******************************************/
      if ( temp1 && temp2 )
        {
          need_upward_RA = 1 ;
        }
      /******************************************/
      /* Coded added due to compiler limitation */
      /******************************************/
      temp3 = Non_Crossing_Biased_Descend();
      temp4 = Own_Above_Threat();
      //if ( Non_Crossing_Biased_Descend() && Own_Above_Threat() )
      if ( temp3 && temp4 )
        {
          need_downward_RA = 1 ;
        }
      if (need_upward_RA && need_downward_RA)
        {
          alt_sep = 0;
        }
      else if (need_upward_RA)
        {
	  /*property1b(alim) ;*/
	  //	  _ABORT(Up_Separation < alim && Down_Separation >= alim);
	  /*property2b(alim) ;*/
	  //	  _ABORT(Up_Separation < alim && Down_Separation < alim && Up_Separation < Down_Separation);
	  /*property3b(alim) ;*/
	  //	  _ABORT(Up_Separation >= alim && Down_Separation >= alim && Own_Tracked_Alt > Other_Tracked_Alt);
	  /*property4b() ;*/
	  _TRACER_abort(Own_Tracked_Alt < Other_Tracked_Alt);
	  //_DECOMPILE_ABORT(Own_Tracked_Alt < Other_Tracked_Alt);
	  /*property5b() ;*/
	  //	  _ABORT(Up_Separation < Down_Separation);	 
	  alt_sep = 1;
        }
        else if (need_downward_RA)
        {

          /*property1a(alim) ;*/
	  //	  _ABORT( Up_Separation >= alim && Down_Separation < alim );                
	  /*property2a(alim) ;*/
	  //	  _ABORT(Up_Separation < alim && Down_Separation < alim && Up_Separation > Down_Separation);
	  /*property3a(alim) ;*/
	  //          _ABORT(Up_Separation >= alim && Down_Separation >= alim && Own_Tracked_Alt > Other_Tracked_Alt);
	  /*property4a() ;*/
	  //          _ABORT(Own_Tracked_Alt > Other_Tracked_Alt);
	  /* property5a() ;*/
	  //          _ABORT(Up_Separation > Down_Separation);
	  alt_sep = 2;
        }
        else
	  alt_sep = 0;
    }

    return alt_sep;
}