Attachment 'incline2.c'

Download

   1 // incline2.c
   2 // incline for logarithmic altitude launch loop track
   3 // with ramp and new track
   4 
   5 #define CL  80000.0    // cable material support length
   6 #define C0  20000.0    // z0 for cable 
   7 #define CS  0.7        // Sideways fraction for cable
   8 
   9 #define OX  -156323.926 // x data offset in meters
  10 
  11 #define X0  -20000.0   // Before ramps
  12 #define X1  200000.0   // End of track
  13 #define WZ  50550.0    // West station east altitude
  14 #define WA  5.48       // West station angle degrees
  15 #define WR  14000.0    // West station curvature radius
  16 #define TC  3.2E-7     // track curvature at west station
  17 
  18 #define VR  14000.0    // rotor speed at top of loop
  19 #define RE  6378000.0  // Earth Radius
  20 #define AG  9.81       // ag0
  21 #define A0  20.0       // incline start angle degrees
  22 #define MF  3.000      // ms/mr
  23 #define MR  3.000      // rotor mass per meter
  24 #define DX  1          // computation delta x in meters
  25 #define NP  1000       // number of computation points per print
  26 #define HT  80000.0    // top of loop, meters
  27 #define K   0.001      // 
  28 #define EPS 1E-4       //
  29 
  30 #include <stdio.h>
  31 #include <math.h>
  32 
  33 int       p   ;   // print counter
  34 double    ra  ;   // degrees to radians
  35 double    x   ;   // horizontal distance in meters
  36 double    z   ;   // height in meters
  37 double    zp  ;   // slope
  38 double    zpp ;   // curvature in inverse meters
  39 double    vr  ;   // rotor speed
  40 double    vr2 ;   // rotor speed squared
  41 double    vr0 ;   // surface rotor speed
  42 double    l   ;   // length of incline
  43 double    dl2 ;   // delta length squared
  44 double    g   ;   // cable angle ratio
  45 double    wz  ;   // west station magnet radius center z 
  46 double    wx  ;   // west station magnet radius center x
  47 double    ag  ;   // gravity at altitude
  48 double    zw  ;   // west station west end altitude
  49 double    dx  ;   // increment for drawing west station
  50 double    xw  ;   // west station x length
  51 double    rx  ;   // ramp center 
  52 double    rz  ;   //
  53 double    xr  ;   //
  54 double    zr  ;
  55 double    a0  ;
  56 double    a1  ;  
  57 double    an  ;
  58 double    da  ;
  59 
  60 // -----------------------------------------
  61 
  62 int  prxz() {
  63    double sprt = MR * ((vr*vr*(zpp+1.0/RE)/ag) - 1.0 ) ;
  64    double xo   = x + OX ;
  65    printf( "%11.6f%11.6f%12.6f%10.6f%10.3f%11.3f%9.5f\n",
  66              xo*K,  z*K,  l*K,   zp, sprt,   vr,   ag );
  67    return 0 ;
  68 }
  69 
  70 // -----------------------------------------
  71 int main() {
  72 
  73    // initialization -------------------------------------------------------
  74 
  75    ra    = atan(1.0)/45.0 ;      // degrees to radians
  76    vr0   = sqrt( VR*VR+2.0*AG*HT/( 1.0 + HT/RE ) ) ;
  77    ag    = AG             ;
  78 
  79    // -----------------------------------------------------------------------
  80    // ramp
  81 
  82    dx = 0.2*rx ;
  83 
  84    a0   = ra*A0                   ;  // radians, second upturn and start of ramp
  85    a1   = acos(0.5*(1.0+cos(a0))) ;  // radians, downturn and first upturn
  86 
  87    x    = X0       ;
  88    z    = 0.0      ;
  89    l    = x - WR * ( (a0-sin(a0)) + 2.0*(a1-sin(a1)) ) ;
  90    zp   = 0.0      ;
  91    zpp  = 1.0/RE   ;
  92    vr   = vr0      ;
  93 
  94    prxz();
  95 
  96    // ramp downturn
  97 
  98    rx = -WR*(sin(a0)+2*sin(a1));
  99    rz = -WR ;
 100 
 101    da   = 0.2*a1   ;
 102 
 103    for( an=0.0 ; an < a1-EPS ; an += da ) {
 104       x   = rx+WR*sin(an);
 105       z   = rz+WR*cos(an);
 106       l   = WR*(a0+2.0*a1-an);
 107       zp  = -tan( an );
 108       zpp = 1.0/(WR*cos(an)*cos(an))  ;
 109       vr2 = vr0*vr0-2.0*AG*z/(1.0 + z/RE ) ;
 110       vr  = sqrt( vr2 );
 111       ag  = 1.0/(1.0+(z/RE)) ;
 112       ag *= AG*ag ;
 113       prxz();
 114    }
 115 
 116    // ramp upturn
 117 
 118    rx = -WR*sin(a0) ;
 119    rz =  WR*cos(a0) ;
 120 
 121    da   = 0.1*(a0+a1)   ;
 122    for( an= -a1 ; an < a0-EPS ; an += da ) {
 123       x   = rx+WR*sin(an);
 124       z   = rz-WR*cos(an);
 125       l   = WR*(a0-an);
 126       zp  = tan( an );
 127       zpp = -1.0/(WR*cos(an)*cos(an))  ;
 128       vr2 = vr0*vr0-2.0*AG*z/(1.0 + z/RE ) ;
 129       vr  = sqrt( vr2 );
 130       ag  = 1.0/(1.0+(z/RE)) ;
 131       ag *= AG*ag ;
 132       prxz();
 133    }
 134 
 135    // -----------------------------------------------------------------------
 136    // incline
 137 
 138    // initialize
 139 
 140    x     = 0.0            ;
 141    p     = NP             ;
 142    z     = 0.0            ;      // 
 143    zp    = tan( a0 )      ;      // first spatial derivative
 144    l     = 0.0            ;
 145    wz    = WZ - WR * cos( ra*WA )   ;
 146 
 147    //  main loop
 148    while( p >= 0 ) {
 149       ag  = 1.0/(1.0+(z/RE)) ;
 150       ag *= AG*ag ;
 151       vr2 =  vr0*vr0-2.0*AG*z/(1.0 + z/RE ) ;
 152       vr  = sqrt( vr2 );
 153       g   = sqrt( exp( 2.0*( z+C0 ) / CL ) - 1.0 ) ;
 154       dl2 = 1.0+zp*zp ;
 155       zpp = dl2 * ( (1.0/(RE+z)) + dl2*ag*MF/(vr2*(1.0-g*zp )) ) ;
 156 
 157       if( p++ >= NP ) {
 158          prxz() ; // print every 1000 meters
 159          p = 1 ;
 160       }
 161       
 162       // increment values
 163       x  += DX       ;
 164       zp -= zpp * DX ;
 165       z  += zp  * DX ;
 166       l  += DX*sqrt(dl2);
 167 
 168       // compute west station west end height  WZ
 169 
 170       zw  =  wz + WR / sqrt( 1.0 + zp*zp ) ;
 171  
 172       // test for completion
 173 
 174       if ( z > zw ) { p = -NP ; }
 175    }
 176    prxz();
 177 
 178    // --------------------------------------------------------------------
 179    // now, compute points for west station 
 180 
 181    wx = x + WR*zp/sqrt( 1.0+zp*zp)  ;  // west station radius x center
 182    xw = wx - WR*sin( ra * WA )      ;  // west station east end x location
 183 
 184    // find angles
 185 
 186    a0 = -acos( ( z-wz)/WR ) ;
 187    a1 = -acos( (WZ-wz)/WR ) ;
 188    da = 0.2*(a1-a0) ;
 189 
 190    for( an = a0+da ; an < a1+EPS ; an += da ) {
 191       x   = wx + WR*sin( an );
 192       z   = wz + WR*cos( an );
 193       zp  = -tan( an );
 194       zpp = 1.0/(WR*cos(a0)*cos(a0)) ;   
 195       ag  = 1.0/(1.0+(z/RE)) ;
 196       ag *= AG*ag ;
 197       vr2 =  vr0*vr0-2.0*AG*z/(1.0 + z/RE ) ;
 198       vr  = sqrt( vr2 );
 199       l  += da*WR ;
 200       prxz();
 201    }
 202 
 203    // --------------------------------------------------------------------
 204    //  compute points for first part of track, constant curvature
 205 
 206    p   = 1  ;
 207    zpp = TC ;
 208    zp  = tan( ra * WA );
 209 
 210    while ( x <= X1 ) {
 211       x  += DX     ;
 212       z  += zp*DX  ;
 213       zp -= zpp*DX ;
 214       l  += DX*sqrt(1.0+zp*zp);
 215       ag  = 1.0/(1.0+(z/RE)) ;
 216       ag *= AG*ag ;
 217       vr2 =  vr0*vr0-2.0*AG*z/(1.0 + z/RE ) ;
 218       vr  = sqrt( vr2 );
 219       if( p++ >= NP ) {
 220          prxz() ; // print every 1000 meters
 221          p = 1 ;
 222       }
 223    }
 224 
 225    // --------------------------------------------------------------------
 226    return 0 ;
 227 }

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2011-02-25 23:53:16, 6.1 KB) [[attachment:incline2.c]]
  • [get | view] (2011-02-25 23:53:01, 1.8 KB) [[attachment:incline2.gp]]
  • [get | view] (2011-02-25 23:52:40, 14.0 KB) [[attachment:incline2.png]]
  • [get | view] (2011-02-26 18:46:14, 6.8 KB) [[attachment:incline3.c]]
  • [get | view] (2011-02-26 18:46:26, 1.9 KB) [[attachment:incline3.gp]]
  • [get | view] (2011-02-26 18:46:34, 14.0 KB) [[attachment:incline3.png]]
 All files | Selected Files: delete move to page

You are not allowed to attach a file to this page.