/***************************************************************************************************************************/
/*       C-Code der   Basiskomponente   "Bungee                          " , Version "Version0                        "    */
/***************************************************************************************************************************/

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


    int bUNGEE ( register struct bUNGEE * 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 ("Bungee");
       LinkSubComp ( &(pData->NameElem) );



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

       Con(M) =  0.6E2;
       Con(D) =  0.1E2;
       Con(K) =  0.5E2;
       Con(G) =  0.981E1;
       Con(L) =  0.2E2;

       StCCount ++;   pCState [StCCount]  = Adr(Y); 
       StNxt(Y) = 0;  StD(Y) = 0.0;  Sta(Y) =  0.E-1;
       StCCount ++;   pCState [StCCount]  = Adr(V); 
       StNxt(V) = 0;  StD(V) = 0.0;  Sta(V) =  0.E-1;

       Dep(F) =  0.E-1;

       VarEff (Y,CompNo)   = BCount;   VarEff (Y,EffFlag) = 5;
       VarEff (Y,eff_next) = NULL;
       VarEff (V,CompNo)   = BCount;   VarEff (V,EffFlag) = 5;
       VarEff (V,eff_next) = NULL;
       VarEff (F,CompNo)   = BCount;   VarEff (F,EffFlag) = 5;
       VarEff (F,eff_next) = NULL;

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

       ExAlg [BCount] =  3;
       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 = 26;
      StD (Y) =   -Sta(V);
      ActLine = 27;
      StD (V) =  Con(G) +Dep(F)/Con(M);
    }

    if (Mode == AlgEqu)
    {
      ActLine = 34;
      DepAsgnR ((struct RDep *) &Dep(F),  -Con(K)*( -Sta(Y)) -Con(D)*Sta(V));
    }

    ActComp =  NULL;

    return status;

    }

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