var downlinkcalc_updated,downlinkcalc_htmlupdated downlinkcalc_updated="Calculator script updated 19-11-2014 15:35 UTC
"; downlinkcalc_htmlupdated="


Updated 19 November 2014
"; 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+="\n05112010 Added test calculation of the rain attenuation which the link margin can handle(not completed yet...)" credit+="\n05112010 Goal is to calculate rain rate [mm/h] for a calculated rain attenuation" credit+="\n19112010 Added calculation of max rain rate [mm/h] for a given link C/N margin(accuracy not verified yet)" credit+="\n19112010 Added calculation of availability % and outage based on rain fade for a given C/N (calculations not verified yet)" credit+="\n20112010 Minor changes" credit+="\n23112010 Added possiblity to remove the included modem implementation margin in DVB-S calculations" credit+="\n12012011 Added DSNG modes" credit+="\n21092012 Added Splitters and Misc loss into input level calculations" credit+="\n23092012 Added crosspol isolation, LNB outputs isolation and switch input/output isolation into C/N calculations" credit+="\n23092012 Added calculation of C/N degradation due to crosspol isolation, LNB outputs isolation and switch input/output isolation" credit+="\n19112014 Added DVB-S2X modes" 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,Splitter1Loss,Splitter2Loss,TotalSplitterLoss,MiscLoss var sa_correctionfactor=2; eirp=1*document.Linkbudgett.EIRP.value; ATMLOSS=1*document.Linkbudgett.AtmosphericLoss.value; Splitter1Loss=10*log10(1*document.Linkbudgett.Splitter1.value); Splitter2Loss=10*log10(1*document.Linkbudgett.Splitter2.value); TotalSplitterLoss=Splitter1Loss+Splitter2Loss; document.Linkbudgett.TotalSplitterLoss.value=formatvalue(TotalSplitterLoss,4); MiscLoss=1*document.Linkbudgett.UserDefinedLoss.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-TotalSplitterLoss-MiscLoss; 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 SubArray=new Array(); var tabell=new Array(); tabell = CookieValue.split(":") ; tabell[4]=document.Linkbudgett.Location.selectedIndex ;// Set default groundstation tabell[5]=document.Linkbudgett.SatelliteName.selectedIndex; SubArray=document.Linkbudgett.Location.value.split(","); //alert(SubArray[2]); tabell[15]=SubArray[2]; 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]+":"+tabell[11]+":"+tabell[12]+":"+tabell[13]+":"+tabell[14]+":"+tabell[15]+":"+tabell[16]+":"+tabell[17]+":"+tabell[18]+":"+tabell[19]+":"+tabell[20]+expires; deleteAllCookies(); document.cookie=CookieValue ; } } // end SetCookie - works !!! function deleteAllCookies() { var cookies = document.cookie.split(";"); for (var i = 0; i < cookies.length; i++) { var cookie = cookies[i]; var eqPos = cookie.indexOf("="); var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie; document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT"; } } // *************Downlink budgett****************** // var SatelliteData= Array(); function open_single_satellite_view() { var catalog; var tmpstring; var satarray=new Array(); tmpstring=document.Linkbudgett.SatelliteName.value; satarray=tmpstring.split(":"); //' Reads value array which is separated by ":", satcatid at index 3 satcatid=satarray[3]; //SingleSatPath,satcatid //alert("http://www.online.no"); //catalog="Catalog\"; //open2("http://www.online.no",1); //ondblclick= window.open("Catalog/"+satcatid+".htm",satcatid,''); //ondblclick="open2(window.location.href+'#38095',1)" } 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[6]+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 calculated_margin= 1*document.Linkbudgett.C_N_OccupiedBandwidth.value -EsNoMargin; // } else { calculated_margin=1*Eb_No_Nettobitrate() -1*InputArray[6]+1*document.Linkbudgett.ImplementationMargin.value; } 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,testCNresult var C_No_Uplink_Measured,LNBCrossPolIsolation,LNBOutIsolation,MultiswitchInputIsolation,MultiswitchOutputIsolation,CN_degradation var Symbolrate,CN_before_isolation_calculations Symbolrate=1*document.Linkbudgett.Symbolrate.value; C_No_Uplink_Measured=1*document.Linkbudgett.Uplink_C_No.value; LNBCrossPolIsolation=1*document.Linkbudgett.CrosspolIsolation.value+ 10*log10(OccupiedBandwidth()*1000); LNBOutIsolation=1*document.Linkbudgett.LNBOutIsolation.value+ 10*log10(OccupiedBandwidth()*1000); MultiswitchInputIsolation=1*document.Linkbudgett.MultiswitchInIsolation.value+ 10*log10(OccupiedBandwidth()*1000); MultiswitchOutputIsolation=1*document.Linkbudgett.MultiswitchOutIsolation.value+ 10*log10(OccupiedBandwidth()*1000); // 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 CN_before_isolation_calculations=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)) ; CN_before_isolation_calculations=10*log10(1/CN_before_isolation_calculations); //with new isolation values correction_value=Math.pow(10,((-1*C_no())/10)) + Math.pow(10,(-(1*C_Imo)/10))+ Math.pow(10,(-(1*LNBCrossPolIsolation)/10))+ Math.pow(10,(-(1*LNBOutIsolation)/10)) + Math.pow(10,(-(1*MultiswitchInputIsolation)/10)) + Math.pow(10,(-(1*MultiswitchOutputIsolation)/10)) +Math.pow(10,(-(1*C_Ico)/10)) +Math.pow(10,(-(1*C_No_Uplink)/10)) ; //testCNresult=Math.pow(10,((-1*14.7)/10))+Math.pow(10,((-1*20)/10))+Math.pow(10,((-1*20)/10))+Math.pow(10,((-1*20)/10))+Math.pow(10,((-1*20)/10)); correction_value=10*log10(1/correction_value); //testCNresult=10*log10(1/testCNresult); CN_degradation=CN_before_isolation_calculations-correction_value; document.Linkbudgett.C_N_occ_bw_before_crosspoliso_switchiso.value=formatvalue(1*(CN_before_isolation_calculations-10*log10(OccupiedBandwidth()*1000)), 5); document.Linkbudgett.C_N_degradation.value=formatvalue(CN_degradation, 5); //alert(testCNresult); 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")) calculatednettobitrate=1*Symbolrate*InputArray[5];//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*formatvalue(document.Linkbudgett.SatelliteName.value,6); document.Linkbudgett.Direction.selectedIndex=0; document.Linkbudgett.West_angle.value=360-1*formatvalue(document.Linkbudgett.SatelliteName.value,6); } 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.Rolloff.value=InputArray[4]; 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=""; } Linkbudgett.CNmargin.value=Linkbudgett.Margin.value; Linkbudgett.L_feed.value=1*Linkbudgett.FeedLoss.value+1*Linkbudgett.PolarizerLoss.value; Linkbudgett.T_LNB.value=290*( Math.pow( 10,(1*Linkbudgett.LNBNoiseFigure.value/10) ) -1) ; CalculatePower(); check_elevation(); Linkbudgett.frequency_ghz.value=1*document.Linkbudgett.RxFrequency.value/1000; raincalculations(); } 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*formatvalue(document.Linkbudgett.SatelliteName.value,6); // 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 raincalculations() { var Tsky,Tamb,T_rec,T_grnoise,Tamb,Lfeed,Link_margin,Train,RainAttenuation,GTdegradation,T_common,calculated_margin,AttValue,hemisphere,latitude_rainsite,h_rain,longtude_rainsite,longdir_rainsite,rain_el,rainpathlength,h_antenna; var K,Alfa,NumericRainAttenuation,AttdBkm,Att0_001,Rainrate0_001,Att_pr_km0_001,percentage,Ap; var RainZoneArray = new Array(7); RainZoneArray[1]=new Array(18); RainZoneArray[2]=new Array(18); RainZoneArray[3]=new Array(18); RainZoneArray[4]=new Array(18); RainZoneArray[5]=new Array(18); RainZoneArray[6]=new Array(18); RainZoneArray[7]=new Array(18); RainZoneArray[1]=[1.0, 0.1, 0.5, 0.7, 2.1, 0.6, 1.7, 3, 2, 8, 1.5, 2, 4, 5, 12, 24]; RainZoneArray[2]=[0.3, 0.8, 2, 2.8, 4.5, 2.4, 4.5, 7, 4, 13, 4.2, 7, 11, 15, 34, 49]; RainZoneArray[3]=[0.1, 2, 3, 5, 8, 6, 8, 12, 10, 20, 12, 15, 22, 35, 65, 72]; RainZoneArray[4]=[0.03, 5, 6, 9, 13, 12, 15, 20, 18, 28, 23, 33, 40, 65, 105, 96]; RainZoneArray[5]=[0.01, 8, 12, 15, 19, 22, 28, 30, 32, 35, 42, 60, 63, 95, 145, 115]; RainZoneArray[6]=[0.003, 14, 21, 26, 29, 41, 54, 45, 55, 45, 70, 105, 95, 140, 200, 142]; RainZoneArray[7]=[0.001, 22, 32, 42, 42, 70, 78, 65, 83, 55, 100, 150, 120, 180, 250, 170]; Link_margin=1*Linkbudgett.CNmargin.value; T_rec=1*Linkbudgett.T_LNB.value; T_grnoise=1*Linkbudgett.T_groundnoise.value; Tsky=1*Linkbudgett.T_sky.value; Train=1*Linkbudgett.T_rain.value; Tamb=1*Linkbudgett.T_amb.value; Lfeed=exp10((1*Linkbudgett.L_feed.value)/10); T_common=Tamb*(Lfeed-1)+T_rec*Lfeed; AttValue=1; calculated_margin=0; while (calculated_margin0) { Linkbudgett.ATT.value=10*log10(RainAttenuation); Linkbudgett.GT_degradation.value=Link_margin-10*log10(RainAttenuation); } else { Linkbudgett.ATT.value="N/A"; Linkbudgett.GT_degradation.value="N/A"; } longtude_rainsite=document.Linkbudgett.Longitude.value; longdir_rainsite=document.Linkbudgett.LonDir.value; if (longdir_rainsite=="West") longtude_rainsite=360-longtude_rainsite; hemisphere=document.Linkbudgett.LatDir.value; // "North" or "South" latitude_rainsite=1*document.Linkbudgett.Latitude.value; // N hemisphere lat>23, except N america & Europe if ( (latitude_rainsite>23)&&(hemisphere=="North")&&( ((longtude_rainsite>=60)||(longtude_rainsite<=180)) ) ) { h_rain=5-0.075*(latitude_rainsite-23) ; } // N hemisphere, N america & Europe west of 60E if ( (hemisphere=="North")&&( ((longtude_rainsite<60)||(longtude_rainsite>180)) ) ) { h_rain=3.2-0.075*(latitude_rainsite-35) ; // alert("Europe"); } // N hemisphere lat>23, except N america & Europe if ( (latitude_rainsite<=23)&&(hemisphere=="North")&&( ((longtude_rainsite>=60)||(longtude_rainsite<=180)) ) ) { h_rain=5 ; } // latitude_rainsite<=21 South if ( (latitude_rainsite<=21)&&(hemisphere=="South") ) { h_rain=5 ; } // latitude_rainsite>21 South to 71 south if ( (latitude_rainsite>21)&&(latitude_rainsite<=71)&&(hemisphere=="South") ) { h_rain=5-0.1*(latitude_rainsite+21) ; } // latitude_rainsite>71 South if ( (latitude_rainsite>71)&&(hemisphere=="South") ) { h_rain=0; } //h_rain=3.2-0.075*(latitude_rainsite-35) ;// ok rain_el=1*document.Linkbudgett.Elevation.value; h_antenna=1*Linkbudgett.heightantenna.value; rainpathlength=(h_rain-h_antenna)/Math.sin(Radians(rain_el)); //alert("h_rain="+h_rain+"rainpathlength="+rainpathlength+" latrain="+latitude_rainsite+hemisphere+" Lonrain="+longtude_rainsite); Linkbudgett.D_rain.value=rainpathlength; Linkbudgett.rainhight.value=h_rain; AttdBkm=1*Linkbudgett.ATT.value/rainpathlength; Linkbudgett.att_dB_km.value=AttdBkm; //Linkbudgett.frequency_ghz.value=1*document.Linkbudgett.RxFrequency.value/1000; //Linkbudgett.k_value.value=find_k_ver(document.Linkbudgett.RxFrequency.value); Linkbudgett.k_value.value=find_alfa_ver(10); //alert(Linkbudgett.polarisation.value); if (Linkbudgett.polarisation.value=="Horisontal") { k=find_k_hor(Linkbudgett.frequency_ghz.value); Linkbudgett.k_value.value=k; alfa=find_alfa_hor(Linkbudgett.frequency_ghz.value); Linkbudgett.alfa.value=alfa; } else if (Linkbudgett.polarisation.value=="Vertical") { k=find_k_ver(Linkbudgett.frequency_ghz.value); Linkbudgett.k_value.value=k; alfa=find_alfa_ver(Linkbudgett.frequency_ghz.value); Linkbudgett.alfa.value=alfa; } else { k=(find_k_ver(Linkbudgett.frequency_ghz.value) +find_k_hor(Linkbudgett.frequency_ghz.value))/2 ; Linkbudgett.k_value.value=k; alfa=(find_alfa_ver(Linkbudgett.frequency_ghz.value) +find_alfa_hor(Linkbudgett.frequency_ghz.value))/2; Linkbudgett.alfa.value=alfa; } NumericRainAttenuation=exp10((RainAttenuation/1000)/10); Linkbudgett.rainrate.value=Math.pow((AttdBkm/k),(1/alfa)); Rainrate0_001=RainZoneArray[5][Linkbudgett.rainzone.value];// ok Att_pr_km0_001=Math.pow(Rainrate0_001,alfa)*k; Att0_001=Att_pr_km0_001*rainpathlength; //alert(Att_pr_km0_001); Linkbudgett.ATTEN0_001.value=Att0_001; Ap=-99; percentage=100*1000; while (Ap<10*log10(RainAttenuation)) // { Ap = Att0_001* 0.12* Math.pow( (percentage/1000), -(0.546 - 0.0043*log10(percentage/1000) ) ); percentage=percentage-1; } //alert(Ap+" RainAtt="+RainAttenuation); var RainAttdB=10*log10(RainAttenuation); if (Ap>RainAttdB) Linkbudgett.availability.value=(100-(percentage/1000)) else Linkbudgett.availability.value="N/A"; if (Ap>RainAttdB) Linkbudgett.outagetime.value=Convert_to_days_hour_min_sec((365.25)*percentage/(1000*100)) else Linkbudgett.outagetime.value="N/A"; //rainhight //alert(Convert_to_days_hour_min_sec(2)); } function Convert_to_days_hour_min_sec(Number){ var Days,Hour,Min,Sec,hhmmss; Days=Math.floor(Number); Days=formatvalue( Math.floor(Number),3); Number=Number-Days; // rest hours Hour=Math.floor(Number*24); Hour=formatvalue( Math.floor(Number*24),2); Number=Number*24-Math.floor(Number*24); // rest for minutes Min=formatvalue(Math.floor(Number*60),2); Number=Number*60-Math.floor(Number*60); Sec=formatvalue(Math.floor( Number*60 ),2); //Sec= ((Number- Math.floor(Hour))*60 - Min)*60 //Min=formatvalue(Min ,2); //Sec=formatvalue(Sec ,5); if ((Days>=10)&&(Days<99)) Days="0"+Days; if (Days<10) Days="00"+Days; if (Hour<10) Hour="0"+Hour; if (Min<10) Min="0"+Min; if (Sec<10) Sec="0"+Sec; hhmmss=Days+"d "+Hour+"h "+Min+"m "+Sec+"s"; return(hhmmss); } function find_k_hor(frequency){ var a1,b1,c1,mk,ck,a2,a3,b2,b3,c2,c3,k1,k2,k3,k,K; a1=0.3364;b1=1.1274;c1=0.2916;mk=1.9925;ck=-4.4123; a2=0.7520;b2=1.6644;c2=0.5175; a3=-0.9466;b3=2.8496;c3=0.4315; k1=a1*Math.exp(- ( Math.pow( ((log10(frequency))-b1 )/(c1 ) ,2 )) ) ;// k2=a2*Math.exp(- ( Math.pow( ((log10(frequency))-b2 )/(c2 ) ,2 )) ) ;// k3=a3*Math.exp(- ( Math.pow( ((log10(frequency))-b3 )/(c3 ) ,2 )) ) ;// //alert("k1="+kk1+" k2="+kk2+" k3="+kk3+" Log10frek="+log10(frequency)); //alert("a1="+aa1+" b1="+bb1+" cc1="+cc1); k= k1+k2+k3+mk*log10(frequency)+ck ; // K=Math.pow(10,k); return (K); } function find_k_ver(frequency){ var a1,b1,c1,mk,ck,a2,a3,b2,b3,c2,c3,k1,k2,k3,k,K; a1=0.3023;b1=1.1402;c1=0.2826;mk=1.9710;ck=-4.4535; a2=0.7790;b2=1.6723;c2=0.5694; a3=-1.0022;b3=2.94;c3=0.4823; k1=a1*Math.exp(- ( Math.pow( ((log10(frequency))-b1 )/(c1 ) ,2 )) ) ;// k2=a2*Math.exp(- ( Math.pow( ((log10(frequency))-b2 )/(c2 ) ,2 )) ) ;// k3=a3*Math.exp(- ( Math.pow( ((log10(frequency))-b3 )/(c3 ) ,2 )) ) ;// //alert("k1="+kk1+" k2="+kk2+" k3="+kk3+" Log10frek="+log10(frequency)); //alert("a1="+aa1+" b1="+bb1+" cc1="+cc1); k= k1+k2+k3+mk*log10(frequency)+ck ; // K=Math.pow(10,k); return (K); } function find_alfa_hor(frequency){ var a1,b1,c1,mk,ck,a2,a3,b2,b3,c2,c3,k1,k2,k3,k,K,a4,b4,c4,k4; a1=0.5564;b1=0.7741;c1=0.4011;mk=-0.08016;ck=0.8993; a2=0.2237;b2=1.4023;c2=0.3475; a3=-0.1961;b3=0.5769;c3=0.2372; a4=-0.02219;b4=2.2959;c4=0.2801; k1=a1*Math.exp(- ( Math.pow( ((log10(frequency))-b1 )/(c1 ) ,2 )) ) ;// k2=a2*Math.exp(- ( Math.pow( ((log10(frequency))-b2 )/(c2 ) ,2 )) ) ;// k3=a3*Math.exp(- ( Math.pow( ((log10(frequency))-b3 )/(c3 ) ,2 )) ) ;// k4=a4*Math.exp(- ( Math.pow( ((log10(frequency))-b4 )/(c4 ) ,2 )) ) ;// //alert("k1="+kk1+" k2="+kk2+" k3="+kk3+" Log10frek="+log10(frequency)); //alert("a1="+aa1+" b1="+bb1+" cc1="+cc1); k= k1+k2+k3+k4+mk*log10(frequency)+ck ; // return (k); // ok } function find_alfa_hor(frequency){ var a1,b1,c1,mk,ck,a2,a3,b2,b3,c2,c3,k1,k2,k3,k,K,a4,b4,c4,k4; a1=0.5564;b1=0.7741;c1=0.4011;mk=-0.08016;ck=0.8993; a2=0.2237;b2=1.4023;c2=0.3475; a3=-0.1961;b3=0.5769;c3=0.2372; a4=-0.02219;b4=2.2959;c4=0.2801; k1=a1*Math.exp(- ( Math.pow( ((log10(frequency))-b1 )/(c1 ) ,2 )) ) ;// k2=a2*Math.exp(- ( Math.pow( ((log10(frequency))-b2 )/(c2 ) ,2 )) ) ;// k3=a3*Math.exp(- ( Math.pow( ((log10(frequency))-b3 )/(c3 ) ,2 )) ) ;// k4=a4*Math.exp(- ( Math.pow( ((log10(frequency))-b4 )/(c4 ) ,2 )) ) ;// //alert("k1="+kk1+" k2="+kk2+" k3="+kk3+" Log10frek="+log10(frequency)); //alert("a1="+aa1+" b1="+bb1+" cc1="+cc1); k= k1+k2+k3+k4+mk*log10(frequency)+ck ; // return (k); // ok } function find_alfa_ver(frequency){ var a1,b1,c1,mk,ck,a2,a3,b2,b3,c2,c3,k1,k2,k3,k,K,a4,b4,c4,k4; a1=0.5463;b1=0.8017;c1=0.3657;mk=-0.07059;ck=0.8756; a2=0.2158;b2=1.4080;c2=0.3636; a3=-0.1693;b3=0.6353;c3=0.2155; a4=-0.01895;b4=2.3105;c4=0.2938; k1=a1*Math.exp(- ( Math.pow( ((log10(frequency))-b1 )/(c1 ) ,2 )) ) ;// k2=a2*Math.exp(- ( Math.pow( ((log10(frequency))-b2 )/(c2 ) ,2 )) ) ;// k3=a3*Math.exp(- ( Math.pow( ((log10(frequency))-b3 )/(c3 ) ,2 )) ) ;// k4=a4*Math.exp(- ( Math.pow( ((log10(frequency))-b4 )/(c4 ) ,2 )) ) ;// //alert("k1="+kk1+" k2="+kk2+" k3="+kk3+" Log10frek="+log10(frequency)); //alert("a1="+aa1+" b1="+bb1+" cc1="+cc1); k= k1+k2+k3+k4+mk*log10(frequency)+ck ; // return (k); // ok } 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); }