title: Modify gps-sdr-sim to point antennas away from Earth's nadir
body: <p>I'm currently trying to simulate the performance of a a custom PNT satellite constellation I have designed in software. I have parsed the satellite ephemeris data into RINEX Navigation file format and fed it successfully into gps-sdr-sim. However, I now need to modify gps-sdr-sim to somehow &quot;point&quot; the &quot;GPS&quot; antennas away/outwards from Earth since the purpose of the PNT constellation is to service Cislunar users.</p>
  <p>I've only found the following line of code which suggests the receiver (based on Earth) uses the elevation angle in the sky/above horizon to calculate the appropriate gain based on the antenna pattern.</p>
  <pre><code>ibs = (int)((90.0-rho.azel[1]*R2D)/5.0); // covert elevation to boresight
  ant_gain = ant_pat[ibs];
  </code></pre>
  <p>There's also this checkSatVisibility function that just simply checks if it's above the horizon (elvMask = 0).</p>
  <pre><code>int checkSatVisibility(ephem_t eph, gpstime_t g, double *xyz, double elvMask, double *azel)
  {
      double llh[3],neu[3];
      double pos[3],vel[3],clk[3],los[3];
      double tmat[3][3];
  
      if (eph.vflg != 1)
          return (-1); // Invalid
  
      xyz2llh(xyz,llh);
      ltcmat(llh, tmat);
  
      satpos(eph, g, pos, vel, clk);
      subVect(los, pos, xyz);
      ecef2neu(los, tmat, neu);
      neu2azel(azel, neu);
  
      if (azel[1]*R2D &gt; elvMask)
          return (1); // Visible
      // else
      return (0); // Invisible
  }
  </code></pre>
  <p>I'm thinking I can modify this to be TRUE if and only if the satellite is not hidden in the two below cases (Top and Side):
  <a href="https://i.stack.imgur.com/CCrG8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CCrG8.png" alt="Hidden satellite" /></a></p>