var downlinkcalc_updated,downlinkcalc_htmlupdated downlinkcalc_updated="Calculator script updated 16-02-2007 12:30 UTC
"; downlinkcalc_htmlupdated="


Updated 16 February 2007
"; function showcredit() { var credit credit= "Jan 2001 Script programmed by Jens T.Saetre " credit+="\n28012001 First uploaded " credit+="\n29012001 Added location&satellite stored in cookie " credit+="\n29012001 Coordinat conversion" credit+="\n29012001 Added satellite delay (not digital delay)" credit+="\n03022001 Added world locations" credit+="\n03022001 Updated satellite list" credit+="\n04022001 Corrected bug in slant range calculation" credit+="\n18122001 Corrected bug in slant range calculation" credit+="\n03012002 Corrected bug in slant range calculation" credit+="\n10012002 Updated Satellitelist" credit+="\n30062002 Added Eb/No calculated value in Threshold table" credit+="\n30062002 C/Iim and C/Ico default values set to a typical single carrier txp" credit+="\n08122002 Changed layout" credit+="\n21042003 Added more coordinates" credit+="\n07072003 Updated Satellitelist" credit+="\n10072003 Added more satellites and coordinates" credit+="\n20092004 Integrated receiver input level in the calculation" credit+="\n03062005 Added level in dBuV for 75ohm and 50ohm" credit+="\n12062005 Added Expected Noise Density measured on Agilent E4402B S/A" credit+="\n12062005 Added Information Capacity and Shannon Theoretical Limit for Information Capacity" credit+="\n18122005 Added first DVB-S2 calculations" credit+="\n19122005 Removed Eb/No datarate for DVB-S2 calculations" credit+="\n21122005 DVB-S2 calculations based on normal frame (64800bits) and no pilot" credit+="\n23062006 Corrected slantrange problem for southern hemisphere" credit+="\n24062006 Added satellite position input fields" credit+="\n25062006 Added Azimut&Elevation output" credit+="\n23082006 Added support for DVB-S2 short and normal frame, pilot on and off(for correct useful bitrate calculation)" credit+="\n24082006 Now with correctly margin for DVB-S2 short frame and pilot" credit+="\n16022007 Added calculation of C/N" credit+="\n (C) Jens T. Satre" window.alert(credit); } function exp10(x) { var y; y = Math.exp(x*Math.log(10)); // a^x = b^(x * log_b(a)) return(y); } function CalculatePower() { var I,ReceiverInputNoiseDensityAgilent,NoiseDensity,Symbolrate,dBuV,power,u,eirp,FSPL,ATMLOSS,AntennaPower,LNBPower,IF_Frequency,LNBGain,DownlinkFrequency,Suggestion,MinPower,MaxPower,p var Shannonefficiency var sa_correctionfactor=2; eirp=1*document.Linkbudgett.EIRP.value; ATMLOSS=1*document.Linkbudgett.AtmosphericLoss.value; AntennaPower=eirp-FreeSpacePathLoss()-ATMLOSS; document.Linkbudgett.AntennaPower.value =formatvalue(AntennaPower,7); document.Linkbudgett.FluxDensity.value= formatvalue((eirp + SphericalLoss() -ATMLOSS),7); VSWR=Loss_dB(); LNBInputPower=AntennaPower+ AntennaGain() - 1*document.Linkbudgett.FeedLoss.value - VSWR; document.Linkbudgett.LNBInputPower.value =formatvalue(LNBInputPower,7); LNBGain=1*document.Linkbudgett.LNBGain.value ; LNBOutputPower=LNBInputPower+LNBGain; document.Linkbudgett.LNBOutputPower.value =formatvalue(LNBOutputPower+30,7); ReceiverInputPower=LNBOutputPower -(1*document.Linkbudgett.CableLoss.value/100)* document.Linkbudgett.CoaxCableLength.value; document.Linkbudgett.CoaxCableLoss.value= formatvalue( ((1*document.Linkbudgett.CableLoss.value/100)* document.Linkbudgett.CoaxCableLength.value),7); document.Linkbudgett.IFFrequency.value= formatvalue(IF_frequency(),7); document.Linkbudgett.ReceiverInputPower.value=formatvalue(ReceiverInputPower+30 ,7); // calculate noise density dBm/Hz p = exp10((ReceiverInputPower+30)/10)/1000; u = Math.sqrt(p*75); dBuV = 20*log10(u*1000000); document.Linkbudgett.ReceiverInputPower75.value=formatvalue(dBuV,7) ; // ok p = exp10((ReceiverInputPower+30)/10)/1000; u = Math.sqrt(p*50); dBuV = 20*log10(u*1000000); document.Linkbudgett.ReceiverInputPower50.value=formatvalue( dBuV,7) ; // ok // calculate noise density based on 3dB bandwidth // power/bandwidth , log10(power)-log10(bandwidth) Symbolrate=1*document.Linkbudgett.Symbolrate.value; NoiseDensity=((ReceiverInputPower+30)-10*log10(Symbolrate*1000)); document.Linkbudgett.ReceiverInputNoiseDensity.value=formatvalue(NoiseDensity ,7); ReceiverInputNoiseDensityAgilent=((ReceiverInputPower+30)-10*log10(Symbolrate*1000)) +2.51; document.Linkbudgett.ReceiverInputNoiseDensityAgilent.value=formatvalue(ReceiverInputNoiseDensityAgilent,8); //document.Linkbudgett.ReceiverInputPowerAgilent.value=NoiseDensity+10*log10(Symbolrate*1000); power= ReceiverInputNoiseDensityAgilent + 10*log10(Symbolrate*1000)-2.51; // Agilent corretion factor p = exp10((power)/10)/1000; u = Math.sqrt(p*75); dBuV = 20*log10(u*1000000); //document.Linkbudgett.ReceiverInputLevelAgilent75.value=formatvalue(dBuV,7); power= ReceiverInputNoiseDensityAgilent + 10*log10(Symbolrate*1000) -2.51; // Agilent corretion factor p = exp10((power)/10)/1000; u = Math.sqrt(p*50); dBuV = 20*log10(u*1000000); //document.Linkbudgett.ReceiverInputLevelAgilent50.value=formatvalue(dBuV,7); //document.Linkbudgett.ReceiverInputPower75.value=formatvalue(0.5*log10(Math.exp(Math.log(10)*(ReceiverInputPower/10)))+ 0.5*log10(75)+60,7) ; // ok //document.Linkbudgett.ReceiverInputPower50.value=formatvalue( Math.exp(Math.log(10)*20/10) ,7) ; document.Linkbudgett.InformationCapacity.value=formatvalue((Nettobitrate()),9); // Information Capacity // Shannon Limit I= 3.32*Bandwidth*log10(1+C/N) , for QPSK Bandwidth = Symbolrate I= 3.32*Symbolrate*log10(1+exp10( (C_N_Bandwidth() )/10 ) ); document.Linkbudgett.Shannonlimit.value=formatvalue(I,9); Shannonefficiency=100*( (Nettobitrate())/I); document.Linkbudgett.Shannonefficiency.value=formatvalue(Shannonefficiency,4); MinPower=document.Linkbudgett.MinPower.value; MaxPower=document.Linkbudgett.MaxPower.value; if ((ReceiverInputPower+30)>-30) { window.alert("Input power is "+formatvalue(ReceiverInputPower+30-MaxPower ,5)+" dB above the recommended value"); } if ((ReceiverInputPower+30)<-60) { Suggestion=1*document.Linkbudgett.CoaxCableLength.value +((ReceiverInputPower+30-MinPower)/(1*document.Linkbudgett.CableLoss.value/100)) ; window.alert("Input power is "+formatvalue( -((ReceiverInputPower+30)-MinPower) ,5) +" dB below the recommended value. \nUse a lineamplifier after "+formatvalue(Suggestion,5) +" meters of coax"); } // ((ReceiverInputPower+30)>-30) //eks. (-40+30) - -30 // if power mindre enn -60dBm benytt lineamplifier after 15dB loss // if power større enn -20dBm benytt attenuator eller en LNB med mindre gain. } function Loss_dB() { return(-10*log10(1-(Loss_Percent()/100))); } function Loss_Percent() { var vswr,loss vswr=1*document.Linkbudgett.VSWR.value; loss=100* Math.pow( ( (vswr-1)/(vswr+1) ),2 ); return(loss); } function SphericalLoss() { // Works ! var FSPL,Rx_Frequency Rx_Frequency=1*document.Linkbudgett.RxFrequency.value; //FSPL=20*log10(4*Math.PI*slantrange()*Rx_Frequency); FSPL=10*log10(1/4/Math.PI/Math.pow((slantrange()*1000),2)); //=10*LOG(1/4/pi/(E28*1000)^2) return (FSPL) ;// *1000000 MHz... } function ReadCookie() { var CookieValue CookieValue= document.cookie; if (CookieValue == null) { document.Linkbudgett.Location.selectedIndex=1074 // Set default groundstation } else { var tabell=new Array(); tabell = CookieValue.split(":") ; document.Linkbudgett.Location.selectedIndex=tabell[4] ;// Set default groundstation document.Linkbudgett.SatelliteName.selectedIndex=tabell[5] ; // Set default satellitelist //window.alert(tabell[4]+" Readcookie"); } } // end readcookie - works !!! function IF_frequency() { var RxFrequency,iffreq RxFrequency=1*document.Linkbudgett.RxFrequency.value; if ((RxFrequency>10700) & (RxFrequency<11700)) iffreq=RxFrequency-9750 else if ((RxFrequency>11700) & (RxFrequency<12750)) iffreq=RxFrequency-10600; return(iffreq); } function SetCookie() { var CookieValue var expires=";expires=Tue, 10 Jul 2040 23:59:59 UTC;" CookieValue=document.cookie; if (CookieValue == null) { var alrt="Error in CookieValue" alrt+="\nUse Antenna Look Angles calculator to cure the problem"; window.alert(alrt); } else { var tabell=new Array(); tabell = CookieValue.split(":") ; tabell[4]=document.Linkbudgett.Location.selectedIndex ;// Set default groundstation tabell[5]=document.Linkbudgett.SatelliteName.selectedIndex; CookieValue=""; document.cookie=""; CookieValue=tabell[0]+":"+tabell[1]+":"+tabell[2]+":"+tabell[3]+":"+tabell[4]+":"+tabell[5]+":"+tabell[6]+":"+tabell[7]+":"+tabell[8]+":"+tabell[9]+":"+tabell[10]+":"+expires; document.cookie=CookieValue ; } } // end SetCookie - works !!! // *************Downlink budgett****************** // var SatelliteData= Array(); function UpdateCoordinates() { var LatDeg,LatMin,LatSec,LonDeg,LonMin,LonSec LatDeg=1*document.Linkbudgett.LatHour.value; LatMin=1*document.Linkbudgett.LatMin.value; LatSec=1*document.Linkbudgett.LatSec.value; LonDeg=1*document.Linkbudgett.LonHour.value; LonMin=1*document.Linkbudgett.LonMin.value; LonSec=1*document.Linkbudgett.LonSec.value; document.Linkbudgett.Latitude.value=formatvalue((LatDeg + (LatMin/60) + (LatSec/3600)),5) ; // Latitude document.Linkbudgett.Longitude.value=formatvalue( (LonDeg+ (LonMin/60) + (LonSec/3600)),5); // Longitude } function ConvertCoordinates() { var LatDeg,LatMin,LatSec,LonDeg,LonMin,LonSec,Latitude,Longitude Latitude=1*document.Linkbudgett.Latitude.value; Longitude=1*document.Linkbudgett.Longitude.value; //window.alert(Longitude); // For testing document.Linkbudgett.LatHour.value=formatvalue( Math.floor(Latitude),2); LatMin=Math.floor((Latitude- Math.floor(Latitude))*60); LatSec=Math.floor( ((Latitude- Math.floor(Latitude))*60 - LatMin)*60 ); document.Linkbudgett.LatMin.value=formatvalue(LatMin ,2); document.Linkbudgett.LatSec.value=formatvalue(LatSec ,2); document.Linkbudgett.LonHour.value=formatvalue( Math.floor(Longitude),4); LonMin=Math.floor((Longitude- Math.floor(Longitude))*60); LonSec=Math.floor( ((Longitude- Math.floor(Longitude))*60 - LonMin)*60 ); document.Linkbudgett.LonMin.value=formatvalue(LonMin ,2); document.Linkbudgett.LonSec.value=formatvalue(LonSec ,2); } function SetLocation(){ var Location=Array(); var Longitude=Array(); var Latitude= Array(); var LatDeg,LatMin,LatSec,LonDeg,LonMin,LonSec var s = document.Linkbudgett.Location.value ; // Split at each space character. Location= s.split(","); // split into two Latitude=Location[0].split(":");// split into degrees and North/South Longitude=Location[1].split(":");// split into degrees and East/West // document.Linkbudgett.Latitude.value= Latitude[0]; // Latitude document.Linkbudgett.Longitude.value= Longitude[0]; // Longitude document.Linkbudgett.LatDir.value = Latitude[1]; // Latitude direction document.Linkbudgett.LonDir.value =Longitude[1]; //Longitude direction document.Linkbudgett.LatHour.value=formatvalue( Math.floor(Latitude[0]),2); LatMin=Math.floor((Latitude[0]- Math.floor(Latitude[0]))*60); LatSec=Math.floor( ((Latitude[0]- Math.floor(Latitude[0]))*60 - LatMin)*60 ); document.Linkbudgett.LatMin.value=formatvalue(LatMin ,2); document.Linkbudgett.LatSec.value=formatvalue(LatSec ,2); document.Linkbudgett.LonHour.value=formatvalue( Math.floor(Longitude[0]),3); LonMin=Math.floor((Longitude[0]- Math.floor(Longitude[0]))*60); LonSec=Math.floor( ((Longitude[0]- Math.floor(Longitude[0]))*60 - LonMin)*60 ); document.Linkbudgett.LonMin.value=formatvalue(LonMin ,2); document.Linkbudgett.LonSec.value=formatvalue(LonSec ,2); } function Margin() { var FEC_ind; var InputArray=new Array(); var Val,EsNoMargin; var calculated_margin //FEC;spectral efficiency;bit pr. symbol;DVB-S or DVB-S2;Rolloff;Threshold Val=document.Linkbudgett.FEC.value; //alert(Val); if (Val!== "") // If cookie has value then set users defaults { InputArray=Val.split(";"); //' Reads values in to the array } //alert(InputArray[5]); // InputArray[5] = Eb/No margin // document.EsNoThreshold.EsNo.value=formatvalue(( 1*InputArray[5]+10*log10(1*InputArray[1]) ),5); // Es/No thereshold er ok if (InputArray[3]!="S") { EsNoMargin= 1*InputArray[5]+10*log10(1*InputArray[1]); // accoring to DVB EN 302 307 there will be additional 0.2-0.3dB increase in threshold values by using short frame if (document.Linkbudgett.FRAME.value==1) calculated_margin= 1*document.Linkbudgett.C_N_OccupiedBandwidth.value -EsNoMargin-0.3 else calculated_margin= 1*document.Linkbudgett.C_N_OccupiedBandwidth.value -EsNoMargin; // } else calculated_margin=1*Eb_No_Nettobitrate() -1*InputArray[5]; return(calculated_margin); } function G_Tsys() { return(AntennaGain()- 10*log10(Tclearsky() )); } function AntennaGain() { var AntennaEfficiency,RxFrequency,Gain,AntennaDiameter RxFrequency=document.Linkbudgett.RxFrequency.value; AntennaEfficiency=document.Linkbudgett.AntennaEfficiency.value; AntennaDiameter=document.Linkbudgett.AntennaDiameter.value ; Gain=10*log10(AntennaEfficiency/100) +20*log10(RxFrequency/1000) +20*log10(AntennaDiameter)+20.4 ; //window.prompt(Gain,"Test verdi"); document.Linkbudgett.AntennaGain.value =formatvalue(Gain,5); return(Gain); } function Tclearsky() { var FeedLoss,PolarizerLoss,Tant,Factor1,Factor2,AntennaNoiseTemp,T_clearsky,LNBNoiseFigure FeedLoss=1*document.Linkbudgett.FeedLoss.value; PolarizerLoss=1*document.Linkbudgett.PolarizerLoss.value; AntennaNoiseTemp=1*document.Linkbudgett.AntennaNoiseTemperature.value; LNBNoiseFigure=1*document.Linkbudgett.LNBNoiseFigure.value; Factor1=AntennaNoiseTemp* (1- Math.exp( (-Math.log(10)*0/10))); Factor2=290* Math.exp(Math.log(10)*(PolarizerLoss+FeedLoss) - 1); T_clearsky=AntennaNoiseTemp +(1- Math.exp(-Math.log(10)*0/10))*AntennaNoiseTemp+290*(Math.exp(Math.log(10)*(PolarizerLoss+FeedLoss+LNBNoiseFigure)/10)-1); document.Linkbudgett.Tsys.value=formatvalue(T_clearsky,5); return(T_clearsky); // Works OK } function Corrected_C_no() { var satellitedata; var C_Imo,CIco,transponder,correction_value,C_No_Uplink,transponder var C_No_Uplink_Measured var Symbolrate Symbolrate=1*document.Linkbudgett.Symbolrate.value; C_No_Uplink_Measured=1*document.Linkbudgett.Uplink_C_No.value; // document.Linkbudgett.C_Iim.value from IESS 410 table 2b page21 C_Imo=(1*document.Linkbudgett.EIRP.value) -1*document.Linkbudgett.C_Iim.value +10*log10(4000); C_Ico= 1*document.Linkbudgett.C_Ico.value + 10*log10(OccupiedBandwidth()*1000); // C/Ico in the Occupied bandwidth + 10*log(4KhZ) ???? //X-value -channel Co interference from IESS 410 table 1a page17 C_No_Uplink=C_No_Uplink_Measured + 10*log10(Symbolrate*1000); // is accurate if C_No_Uplink_Measured is over 15dB correction_value=Math.pow(10,((-1*C_no())/10)) + Math.pow(10,(-(1*C_Imo)/10)) +Math.pow(10,(-(1*C_Ico)/10)) +Math.pow(10,(-(1*C_No_Uplink)/10)) ; correction_value=10*log10(1/correction_value); return( correction_value ); } function OccupiedBandwidth() { var Symbolrate Symbolrate=document.Linkbudgett.Symbolrate.value; return(Symbolrate*1.28); } function AllocatedBandwidth() { var Symbolrate,Rolloff,returnvalue,to to=2; tre=3; var InputArray=new Array(); var Val; //FEC;spectral efficiency;bit pr. symbol;DVB-S or DVB-S2;Rolloff;Threshold Val=document.Linkbudgett.FEC.value; if (Val!== "") // If cookie has value then set users defaults { InputArray=Val.split(";"); //' Reads values in to the array } Rolloff=1*InputArray[4]; Symbolrate=1*document.Linkbudgett.Symbolrate.value; return(Symbolrate*(Rolloff+1)); } function C_N_OccupiedBandwidth() { var EIRP,FSPL,ATMLOSS EIRP=document.Linkbudgett.EIRP.value; ATMLOSS=document.Linkbudgett.AtmosphericLoss.value; FSPL=FreeSpacePathLoss(); return(Corrected_C_no()- 10*log10(OccupiedBandwidth()*1000) ); } function C_N_Bandwidth() { var SR,EIRP,FSPL,ATMLOSS EIRP=document.Linkbudgett.EIRP.value; ATMLOSS=document.Linkbudgett.AtmosphericLoss.value; SR=1*document.Linkbudgett.Symbolrate.value; FSPL=FreeSpacePathLoss(); return(Corrected_C_no()- 10*log10(SR*1000) ); } function Eb_No_Nettobitrate() { return(Corrected_C_no()-10*log10(Nettobitrate()*1000) ); } function Eb_No_Datarate() { var nettobitrate,datarate nettobitrate=Nettobitrate(); datarate=Datarate(); return( Eb_No_Nettobitrate()+ 10*log10(nettobitrate/datarate) ); } function Eb_No_Transmissionrate() { var nettobitrate,datarate,Symbolrate var InputArray=new Array(); var Val; Val=document.Linkbudgett.FEC.value; //FEC;spectral efficiency;bit pr. symbol;DVB-S or DVB-S2;Rolloff;Threshold if (Val!== "") InputArray=Val.split(";"); Symbolrate=1*document.Linkbudgett.Symbolrate.value; nettobitrate=Nettobitrate(); return( Eb_No_Nettobitrate()- 10*log10(Symbolrate*InputArray[2]/nettobitrate) ); } function Datarate() { return(Nettobitrate()*204/188); } function Nettobitrate() { var InputArray=new Array(); var Val; var calculatednettobitrate; Val=document.Linkbudgett.FEC.value; //FEC;spectral efficiency;bit pr. symbol;DVB-S or DVB-S2;Rolloff;Threshold if (Val!== "") InputArray=Val.split(";"); var Symbolrate,FEC,Rs Symbolrate=1*document.Linkbudgett.Symbolrate.value; FEC=1*document.Linkbudgett.FEC.value; Rs=188/204; calculatednettobitrate=Symbolrate*InputArray[1]; if ((document.Linkbudgett.PILOT.value==1)&&(InputArray[3]=="S2")&&(document.Linkbudgett.FRAME.value==0)) calculatednettobitrate=1*Symbolrate*InputArray[6];//document.dvb.SpectralEfficiency.value=InputArray[5]; if ((document.Linkbudgett.PILOT.value==0)&&(InputArray[3]=="S2")&&(document.Linkbudgett.FRAME.value==1)) calculatednettobitrate=1*Symbolrate*InputArray[7]; if ((document.Linkbudgett.PILOT.value==1)&&(InputArray[3]=="S2")&&(document.Linkbudgett.FRAME.value==1)) calculatednettobitrate=1*Symbolrate*InputArray[8]; return(calculatednettobitrate); } function Co_No_No() { var x,Symbolrate Symbolrate=1*document.Linkbudgett.Symbolrate.value; x=1+Math.pow(10, ( ( Corrected_C_no()-10*log10(Symbolrate*1000) )/10) ) ; return(10*log10(x) ); } function C_N() { var x,Symbolrate Symbolrate=1*document.Linkbudgett.Symbolrate.value; x=Math.pow(10, ( ( Co_No_No() )/10) )-1 ; return(10*log10(x) ); } function C_no() { var EIRP,FSPL,ATMLOSS,AtmosphericLoss EIRP=document.Linkbudgett.EIRP.value; ATMLOSS=document.Linkbudgett.AtmosphericLoss.value; AtmosphericLoss=1*document.Linkbudgett.AtmosphericLoss.value; FSPL=FreeSpacePathLoss(); return(EIRP-FSPL+G_Tsys()+228.6-AtmosphericLoss); } function log10(X) { return( Math.log(X)/Math.log(10) ); // works OK ! } function change_satellite_position() { if (document.Linkbudgett.Direction.selectedIndex==0) { document.Linkbudgett.West_angle.value=360-1*document.Linkbudgett.Degrees.value; } else { document.Linkbudgett.West_angle.value=1*document.Linkbudgett.Degrees.value; } } function SetSatellitePosition(){ document.Linkbudgett.Degrees.value=1*document.Linkbudgett.SatelliteName.value; document.Linkbudgett.Direction.selectedIndex=0; document.Linkbudgett.West_angle.value=360-1*document.Linkbudgett.SatelliteName.value; } function main() { var Co_No_No_ESOG,Symbolrate,Co_No,Delay,Elevation var InputArray=new Array(); var Val; Val=document.Linkbudgett.FEC.value; //FEC;spectral efficiency;bit pr. symbol;DVB-S or DVB-S2;Rolloff;Threshold if (Val!== "") InputArray=Val.split(";"); document.Linkbudgett.SlantRange.value =formatvalue(slantrange(), 5); document.Linkbudgett.FreeSpacePathLoss.value =formatvalue(FreeSpacePathLoss(),5); document.Linkbudgett.G_Tsys.value=formatvalue(G_Tsys(),5); document.Linkbudgett.C_No.value=formatvalue(Corrected_C_no(),5); document.Linkbudgett.C_N_OccupiedBandwidth.value=formatvalue(C_N_OccupiedBandwidth(),5); //-0.5 tracking margin document.Linkbudgett.OccupiedBandwidth.value= formatvalue(OccupiedBandwidth()/1000,5); document.Linkbudgett.AllocatedBandwidth.value=formatvalue(AllocatedBandwidth()/1000,5); document.Linkbudgett.Eb_No_Nettorate.value=formatvalue(Eb_No_Nettobitrate(),5); document.Linkbudgett.Co_No_No.value=formatvalue(Co_No_No(),5); document.Linkbudgett.C_N.value=formatvalue(C_N(),5); if (InputArray[3]=="S") { document.Linkbudgett.Eb_No_Datarate.value=formatvalue(Eb_No_Datarate(),5); } else { document.Linkbudgett.Eb_No_Datarate.value="N/A"; } document.Linkbudgett.Eb_No_Transmissionrate.value=formatvalue( Eb_No_Transmissionrate(),5); document.Linkbudgett.Margin.value=formatvalue(Margin(),5); Delay=(slantrange()*2*1000/300000000)*1000; document.Linkbudgett.Delay.value= formatvalue(Delay,5); if (document.Linkbudgett.FEC.selectedIndex==4) { //***FEC=7/8**** document.Linkbudgett.Eb_No_7_8.value=formatvalue(Eb_No_Nettobitrate(),5); document.Linkbudgett.Eb_No_5_6.value=""; document.Linkbudgett.Eb_No_3_4.value=""; document.Linkbudgett.Eb_No_1_2.value=""; document.Linkbudgett.Eb_No_1_1.value=""; document.Linkbudgett.Eb_No_2_3.value=""; } if (document.Linkbudgett.FEC.selectedIndex==3) {//***FEC=5/6**** document.Linkbudgett.Eb_No_7_8.value=""; document.Linkbudgett.Eb_No_5_6.value=formatvalue(Eb_No_Nettobitrate(),5); document.Linkbudgett.Eb_No_3_4.value=""; document.Linkbudgett.Eb_No_1_2.value=""; document.Linkbudgett.Eb_No_1_1.value=""; document.Linkbudgett.Eb_No_2_3.value=""; } if (document.Linkbudgett.FEC.selectedIndex==2) {//***FEC=3/4**** document.Linkbudgett.Eb_No_7_8.value=""; document.Linkbudgett.Eb_No_5_6.value=""; document.Linkbudgett.Eb_No_3_4.value=formatvalue(Eb_No_Nettobitrate(),5); document.Linkbudgett.Eb_No_1_2.value=""; document.Linkbudgett.Eb_No_1_1.value=""; document.Linkbudgett.Eb_No_2_3.value=""; } if (document.Linkbudgett.FEC.selectedIndex==1) {//***FEC=2/3**** document.Linkbudgett.Eb_No_7_8.value=""; document.Linkbudgett.Eb_No_5_6.value=""; document.Linkbudgett.Eb_No_3_4.value=""; document.Linkbudgett.Eb_No_1_2.value=""; document.Linkbudgett.Eb_No_1_1.value=""; document.Linkbudgett.Eb_No_2_3.value=formatvalue(Eb_No_Nettobitrate(),5); } if (document.Linkbudgett.FEC.selectedIndex==0) {//***FEC=1/2**** document.Linkbudgett.Eb_No_7_8.value=""; document.Linkbudgett.Eb_No_5_6.value=""; document.Linkbudgett.Eb_No_3_4.value=""; document.Linkbudgett.Eb_No_1_2.value=formatvalue(Eb_No_Nettobitrate(),5); document.Linkbudgett.Eb_No_1_1.value=""; document.Linkbudgett.Eb_No_2_3.value=""; } if (document.Linkbudgett.FEC.selectedIndex==5) {//***FEC=1/1**** document.Linkbudgett.Eb_No_7_8.value=""; document.Linkbudgett.Eb_No_5_6.value=""; document.Linkbudgett.Eb_No_3_4.value=""; document.Linkbudgett.Eb_No_1_2.value=""; document.Linkbudgett.Eb_No_1_1.value=formatvalue(Eb_No_Nettobitrate(),5); document.Linkbudgett.Eb_No_2_3.value=""; } if (document.Linkbudgett.FEC.selectedIndex>5) {//***no DVB-S**** document.Linkbudgett.Eb_No_7_8.value=""; document.Linkbudgett.Eb_No_5_6.value=""; document.Linkbudgett.Eb_No_3_4.value=""; document.Linkbudgett.Eb_No_1_2.value=""; document.Linkbudgett.Eb_No_1_1.value=""; document.Linkbudgett.Eb_No_2_3.value=""; } CalculatePower(); check_elevation(); } function FreeSpacePathLoss() { var FSPL,Rx_Frequency Rx_Frequency=document.Linkbudgett.RxFrequency.value; FSPL=20*log10(4*Math.PI*slantrange()*Rx_Frequency); FSPL=20*log10(4*Math.PI*slantrange()*1000*Rx_Frequency*1000000/300000000); return (FSPL) ; } function CalculateElevation(SatLon,SiteLon,SiteLat) { var x,y,Re,Rg,El Re=6378.14 // earth radius in km. Rg=42164.57 // geosyncronus radius in km. y=Math.cos(Radians(SiteLon-SatLon))*Math.cos(Radians(SiteLat)) - Re/Rg ; x=Math.sqrt( Math.sin(Radians( SiteLon-SatLon))*Math.sin(Radians( SiteLon-SatLon)) + Math.cos(Radians(SiteLon-SatLon))*Math.cos(Radians(SiteLon-SatLon))*Math.sin(Radians(SiteLat))*Math.sin(Radians(SiteLat)) ); El=Deg(Math.atan2(y,x)); // Works correct ! return(El) } function CalculateAzimuth(SatLon,SiteLat,SiteLon,Height_over_ocean) { var Rstation,Hemisphere,f,r_eq,r_sat,Ra,Rz,alfa_r,alfa_rx,alfa_ry,alfa_rz,alfa_r_north,alfa_r_zenith,Azimuth f=(1/298.257) ; // Earth flattning factor r_sat=42164.57; // Distance from earth centre to satellite r_eq=6378.14 ; // Earth radius Rstation= r_eq/( Math.sqrt( 1 - f*(2-f)*Math.sin(Radians(SiteLat))*Math.sin(Radians(SiteLat)) ) ) ; Ra= (Rstation+Height_over_ocean)*Math.cos(Radians(SiteLat)) ; Rz= Rstation*(1-f)*(1-f)*Math.sin(Radians(SiteLat)); alfa_r=r_sat-Rstation ; alfa_rx=r_sat*Math.cos(Radians(SatLon-SiteLon)) -Ra ; alfa_ry=r_sat*Math.sin(Radians(SatLon-SiteLon)) ; alfa_rz=-Rz; alfa_r_north=-alfa_rx*Math.sin(Radians(SiteLat)) + alfa_rz*Math.cos(Radians(SiteLat)) ; alfa_r_zenith=alfa_rx*Math.cos(Radians(SiteLat)) +alfa_rz*Math.sin(Radians(SiteLat)) ; if (alfa_r_north<=0) Azimuth=180+Deg(Math.atan(alfa_ry/alfa_r_north )) else Azimuth=Rev(360+Deg(Math.atan(alfa_ry/alfa_r_north ))); return(Azimuth); } function Rev(number) { var x x= number -Math.floor(number/360.0)*360 ; return(x) } function slantrange(){ var S,SatLon,Latitude,Longitude,SiteLat,LatDir,SiteLon,LonDir,Elevation if (document.Linkbudgett.Direction.selectedIndex==0) //==0 East, ==1 West { SatLon=1*document.Linkbudgett.Degrees.value; } else { SatLon=360-1*document.Linkbudgett.Degrees.value; } SiteLat=1*document.Linkbudgett.Latitude.value; // Latitude LatDir=document.Linkbudgett.LatDir.value; // Latitude direction SiteLon=1*document.Linkbudgett.Longitude.value; // Longitude LonDir=document.Linkbudgett.LonDir.value ; //Longitude direction if (LatDir=="South") SiteLat=-SiteLat; if (LonDir=="West") SiteLon=360-SiteLon; Elevation=CalculateElevation(SatLon,SiteLon,SiteLat); if (Elevation>0) S=Slant_Range(SiteLat,fi(SatLon,SiteLon));// else return(S); } function check_elevation(){ var SatLon,Latitude,Longitude,SiteLat,LatDir,SiteLon,LonDir,Elevation if (document.Linkbudgett.Direction.selectedIndex==0) //==0 East, ==1 West { SatLon=1*document.Linkbudgett.Degrees.value; } else { SatLon=360-1*document.Linkbudgett.Degrees.value; } SiteLat=1*document.Linkbudgett.Latitude.value; // Latitude LatDir=document.Linkbudgett.LatDir.value; // Latitude direction SiteLon=1*document.Linkbudgett.Longitude.value; // Longitude LonDir=document.Linkbudgett.LonDir.value ; //Longitude direction if (LatDir=="South") SiteLat=-SiteLat; if (LonDir=="West") SiteLon=360-SiteLon; Elevation=CalculateElevation(SatLon,SiteLon,SiteLat); if (Elevation<0) alert("Satellite "+formatvalue(Math.abs(Elevation),5)+" degrees below horizon"); document.Linkbudgett.Elevation.value=formatvalue(Elevation,5); document.Linkbudgett.Azimuth.value=formatvalue(CalculateAzimuth(SatLon,SiteLat,SiteLon,0),6); } function Slant_Range(SiteLat,fi) { var Slant_range_computed,SiteLat,LatDir,SiteLon,LonDir,SatLon,toRad,toDeg var Re,Rg,H Re=6378.14; // earth radius in km. Rg=42164.57; // geosyncronus radius in km. H=Rg-Re; toRad=Math.PI/180; toDeg=180/Math.PI; SiteLat=1*document.Linkbudgett.Latitude.value; // Latitude LatDir=document.Linkbudgett.LatDir.value; // Latitude direction SiteLon=1*document.Linkbudgett.Longitude.value; // Longitude LonDir=document.Linkbudgett.LonDir.value ; //Longitude direction if (document.Linkbudgett.Direction.selectedIndex==0) //==0 East, ==1 West { SatLon=1*document.Linkbudgett.Degrees.value; } else { SatLon=360-1*document.Linkbudgett.Degrees.value; } if (LatDir=="South") SiteLat=-SiteLat; if (LonDir=="West") SiteLon=360-SiteLon; //alert("SiteLat="+SiteLat+" fi="+fi); Slant_range_computed=Math.sqrt( Re*Re+(Re+H)*(Re+H)-2*Re*(Re+H)*Math.cos(Radians(SiteLat))*Math.cos(Radians(fi)) ); return(Slant_range_computed); } function Radians(number) { var rad rad=number*Math.PI/180; return(rad) } function Deg(number) { var rad rad=number*180/Math.PI; return(rad) } function fi(SatLon,SiteLon) { // ok. Is working var Fi,SiteLat,LatDir,SiteLon,LonDir,SatLon SiteLat=1*document.Linkbudgett.Latitude.value; // Latitude LatDir=document.Linkbudgett.LatDir.value; // Latitude direction SiteLon=1*document.Linkbudgett.Longitude.value; // Longitude LonDir=document.Linkbudgett.LonDir.value ; //Longitude direction if (document.Linkbudgett.Direction.selectedIndex==0) //==0 East, ==1 West { SatLon=1*document.Linkbudgett.Degrees.value; } else { SatLon=360-1*document.Linkbudgett.Degrees.value; } if (LatDir=="South") SiteLat=-SiteLat; if (LonDir=="West") SiteLon=360-SiteLon; Fi= Math.min(Math.abs(SatLon-SiteLon-360),Math.abs(SiteLon-SatLon),Math.abs(SiteLon-SatLon-360)) return(Fi); } function OLD_slantrange() { var Latitude,Longitude,LonDir,LatDir,SatLon,Fi,S,R,h,toRad,toDeg var satellitedata R=6378; // Earth Radius in km Hs=42164; //Satellite radius h=Hs-R; // hight above equator toRad=Math.PI/180; toDeg=180/Math.PI; Latitude=1*document.Linkbudgett.Latitude.value; // Latitude Longitude=1*document.Linkbudgett.Longitude.value; // Longitude LatDir=document.Linkbudgett.LatDir.value; // Latitude direction LonDir=document.Linkbudgett.LonDir.value ; //Longitude direction SatLon=1*document.Linkbudgett.SatelliteName.value; // 0-359 deg. //Convert longitude to 0-360 deg. format if (LonDir=="West") { Longitude = 360- Longitude ; // converted to deg. eastwards format } if ( (SatLon>Longitude)&&(SatLon>180)&&(Longitude>270)&&(Longitude<=360) ) { Fi= SatLon-Longitude; } if ( (SatLon>Longitude)&&(SatLon>180)&&(Longitude<270) ) { Fi= SatLon-Longitude; // Bugfix for SatLon=286E Longitude = 241.75E (L.A.) } if ( (SatLon180)&&(Longitude>270)&&(Longitude<=360) ) { Fi= Longitude-SatLon; // //window.prompt(Fi,"If 1"); } // 13 258.83 13 358.83 358.83 if ( (SatLon270)&&(Longitude<=360) ) { Fi= SatLon -Longitude+360; // //window.prompt(Fi,"If 1"); } //window.prompt("Fi"+Fi+"Longitude="+Longitude,"=Fi "); if ( (SatLon>Longitude)&&(SatLon<180)&&(Longitude<90)&&(Longitude>=0) ) { Fi= SatLon-Longitude; } if ( (SatLon=0) ) { Fi= Longitude-SatLon; } if ((SatLon>Longitude)&&(SatLon>270)&&(Longitude<90)) { Fi=Longitude+(360-SatLon); } //window.alert(Fi); S=Math.sqrt( R*R+(R+h)*(R+h)-2*R*(R+h)*Math.cos(Latitude*toRad)*Math.cos(Fi*toRad) ); //S=SlantRange(Latitude,fi(SatLon,Longitude)); S=Slant_Range(Latitude,fi(SatLon,Longitude)); return(S); } function formatvalue(input, rsize) // Desimal avrunding { var invalid = "**************************"; var nines = "999999999999999999999999"; var strin = "" + input; var fltin = parseFloat(strin); if (strin.length <= rsize) return strin; if (strin.indexOf("e") != -1 || fltin > parseFloat(nines.substring(0,rsize)+".4")) return invalid.substring(0, rsize); var rounded = "" + (fltin + (fltin - parseFloat(strin.substring(0, rsize)))); return rounded.substring(0, rsize); }