c	program main
c	call gset								!  enter graphic mode
c	call csat
c	call aset								!  return to alpha mode
c	end
c	-----------------------------------------------------------------------
	subroutine csat
c
c	...computer xmit power for a given satellite altitude w/o
c	atmospheric losses
c
c	(C) Copyright 1988, 1989 by Jim Farrell      All Rights Reserved.
c
	parameter (api=3.1415926535,a2pi=2.0*api,apio2=api/2.0)
	parameter (acrtod=360.0/a2pi)
	parameter (a4pi=4.0*api)
	parameter (aerkm=6378.135,aerm=6378135.0)
	parameter (bk=1.380e-23)				!  Boltzman's constant
	parameter (c=3.0e08)				!  speed-of-light (meters/sec)
c
	parameter (n=100)
	real x(n),y1(n),y2(n),y3(n),y4(n)
c
	dbm(x)=10.0*log10(x*1.0e03)			!  power in dbm
c
c	...meters, hertz
c
	fhz=270e06						!  frequency
	wl=c/fhz							!  wavelength	re=aerm
	peff=0.55							!  overall efficiency factor
c
c	...G/T receiver antenna gain to system effective noise temp. ratio
c	...Es/No bit energy to noise density ratio
c
	gten=6.4564e-04					!  given
	brate=2600.0						!  bit rate
c	ber=10e-3							!  bit error rate
	re=aerm							!  earth radius (meters)
	dalt=5000.0*1.0e03/real(n)
	do 500 i=1,n
		salt=real(i)*dalt					!  satellite altitude (m)
		rs=sqrt((re+salt)**2-re**2)			!  slant range at edge
		bwo2=asin(re/(re+salt))				!  required half-beamwidth
		arad=0.25*wl/bwo2					!  parabolic antenna radius
		at=api*arad**2						!  antenna area
		gtx=(a4pi/wl**2)*peff*at				!  xmit antenna gain
		fsl=(a4pi*rs/wl)**2					!  free space loss
		eirp=brate*fsl*bk/gten				!  eff. isotrop. rad. pwr
		pxmt=eirp/gtx						!  xmitr pwr req.
		x(i)=salt*1.0e-03					!  altitude in km
		y1(i)=dbm(pxmt)					!  load arrays for plotting
		y2(i)=bwo2*2.0*acrtod
		y3(i)=dbm(fsl)
		y4(i)=dbm(gtx)
500	continue
	call putstr(10,20,'     DEMONSTRATION OF X-Y PLOT MODES')
	call putstr(12,20,' FOR  A COMMUNICATIONS SATELLITE CALCULATION')
	call pause('WHEN READY ')		!  display message and pause
	call gcls
	call xyplt(x,y1,n,0,4)
	call pause('REVIEW POWER (DBM) = F(ALTITUDE (KM))')
	call gcls								!  clear screen
	call xyplt(x,y2,n,1,4)
	call pause('REVIEW ANTENNA BEAMWIDTH (DEG) = F(ALTITUDE (KM))')
	call xyplt(x,y3,n,2,4)
	call pause('REVIEW FREE SPACE LOSS (DBM) = F(ALTITUDE (KM))')
	call xyplt(x,y4,n,3,4)
	call pause('REVIEW ANTENNA GAIN (DBM) = F(ALTITUDE (KM))')
	return
	end
