/***************************************************************************************************************************/
/*       C-Code der   Basiskomponente   "harefox                         " , Version "ThreeTimesMeetingPropability    "    */
/***************************************************************************************************************************/

#   include  "c_macros.h"
#   include  "sys_struct.h"
#   include  "sys_extern.h"
#   include  "rts_func.h"
#   include  "mod_struct.h"


    int hAREFOX ( register struct hAREFOX * pData )
    {
    int  status = 0;


/*  Strukturierung und Urinitialisierung  */
/*  ====================================  */
    if (Mode == Activ  &&  ActPhase == 1)
    {
       static    logic   Call1 = Yes;
       register  long    i, j;


/*     Uebergabe der Adressen  */
/*     ----------------------  */
       if ( !ReStart )
       {
#         include "offset.incl" 
       }

       SaveCompName ("harefox");
       LinkSubComp ( &(pData->NameElem) );



       BCount ++;   FBComp [BCount] = (FPtr) hAREFOX;
                    DBComp [BCount] = pData;

       Con(A) =  0.175E0;
       Con(B) =  0.125E0;
       Con(C) =  0.3E-2;

       StCCount ++;   pCState [StCCount]  = Adr(HARE); 
       StNxt(HARE) = 0;  StD(HARE) = 0.0;  Sta(HARE) =  0.4E3;
       StCCount ++;   pCState [StCCount]  = Adr(FOX); 
       StNxt(FOX) = 0;  StD(FOX) = 0.0;  Sta(FOX) =  0.37E2;

       VarEff (HARE,CompNo)   = BCount;   VarEff (HARE,EffFlag) = 4;
       VarEff (HARE,eff_next) = NULL;
       VarEff (FOX,CompNo)   = BCount;   VarEff (FOX,EffFlag) = 4;
       VarEff (FOX,eff_next) = NULL;

       TimeEff [BCount]. CompNo   =  BCount;
       TimeEff [BCount]. EffFlag  =  0;
       TimeEff [BCount]. eff_next =  NULL;

       ExAlg [BCount] =  0;
       ExDtl [BCount] =  3;
       ExEvt [BCount] =  0;

       pData -> CroBase  = CroCount;   CroCount  += 0;
       pData -> IndBase  = IndCount;   IndCount  += 0;
       pData -> RegBase  = RegCount;   RegCount  += 0;
       pData -> TCmpBase = TCmpCount;  TCmpCount += 0;

       return status;
    }

/*  Belegungen der Arrayinfo-Strukturen  */
/*  ===================================  */
    if (Mode == Activ  &&  ActPhase == 2)
    {
      long i;


      return status;
    }


/*  Aktuellen Komponentennamen merken  */
/*  ---------------------------------  */
    ActComp =  & (pData->NameElem);



/*  Beschreibung der Modelldynamik  */
/*  ==============================  */


/*  Differentialgleichungen */
/*  ======================= */
    if (Mode == DtlEqu)
    {
      ActLine = 19;
      StD (HARE) =  Con(A)*Sta(HARE) -Con(C)*Sta(HARE)*Sta(FOX);
      ActLine = 20;
      StD (FOX) =   -Con(B)*Sta(FOX) +Con(C)*Sta(HARE)*Sta(FOX);
    }

    ActComp =  NULL;

    return status;

    }

/*  ===================== Ende der Modellkomponente =====================  */
/*  =====================================================================  */
