function Show_Credit() { var credit credit="Script programmed by Jens T.Saetre 11-09-2000"; credit+="\n19012001 Added C/N value"; credit+="\n21012001 Added Datarate"; credit+="\n21012001 Corrected label from Eb/No before FEC to Eb/No after FEC"; credit+="\n08122002 Changed Layout"; credit+="\n31082003 Now possible to use C/N , Eb/No as input"; credit+="\n19122005 Changed to javascript calculations"; credit+="\n20122005 Added DVB-S2 calculations"; credit+="\n21122005 DVB-S2 calculations based on normal frame (64800bits) and no pilot" credit+="\n16022007 Corrected error in C+N/N calculation when linkmargin input is changed" credit+="\n12012011 Added DSNG modes" credit+="\n19112014 Added DVB-S2X" credit+="\nUpdated 19112014"; window.alert(credit); } 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); } function Calculate_EbNo(){ var InputArray=new Array(); var Val; Val=document.ForwardErrorCorrection.FEC.value; //FEC;spectral efficiency;bit pr. symbol;DVB-S or DVB-S2;Rolloff;Threshold if (Val!== "") InputArray=Val.split(";"); document.treshold.EbNo.value=formatvalue(InputArray[6],5); document.margin.EbNo.value=formatvalue((Eb_No_Nettobitrate()-InputArray[6]),5); document.Data.Rate.value=formatvalue(Nettobitrate(),10); document.Bitenergy.EbNo.value=formatvalue(Eb_No_Nettobitrate(),5); document.Bitenergy3.EbNo.value=formatvalue(Eb_No_Transmissionrate() ,5); if (InputArray[3]!="S") { document.Bitenergy2.EbNo.value="N/A"; document.EsNoThreshold.EsNo.value=formatvalue(( 1*InputArray[6]+10*log10(1*InputArray[1]) ),5); document.Es.EsNo.value=formatvalue(Es_No(),5); } else { document.Bitenergy2.EbNo.value=formatvalue(Eb_No_Datarate() ,5); document.EsNoThreshold.EsNo.value="N/A"; document.Es.EsNo.value="N/A"; } document.CN.CN.value=formatvalue(C_N(),5); document.CarrierToNoise.Overall.value=formatvalue(CN_overall(),5); if ((document.DVBS2_Pilot.PILOT.value==1) && (InputArray[3]=="S2")) document.Data.Rate.value=SR*InputArray[5] else document.Data.Rate.value=SR*InputArray[1]; } function log10(X) { return( Math.log(X)/Math.log(10) ); // works OK ! } function Es_No(){ var CN_ov,x; CN_ov=1*document.CarrierToNoise.Overall.value; SR=1*document.Symbolrate.MBaud.value; x=(CN_ov-10*log10(SR*1000)); return(x) } function Eb_No_Transmissionrate() { var nettobitrate,datarate,SR var InputArray=new Array(); var Val; Val=document.ForwardErrorCorrection.FEC.value; //FEC;spectral efficiency;bit pr. symbol;DVB-S or DVB-S2;Rolloff;Threshold if (Val!== "") InputArray=Val.split(";"); SR=1*document.Symbolrate.MBaud.value; nettobitrate=Nettobitrate(); //alert(nettobitrate); return( Eb_No_Nettobitrate()- 10*log10((SR*InputArray[2])/nettobitrate) ); // -77 } function Eb_No_Datarate() { //symbolrate,rs,qpsk var InputArray=new Array(); var Val,SR; Val=document.ForwardErrorCorrection.FEC.value; //FEC;spectral efficiency;bit pr. symbol;DVB-S or DVB-S2;Rolloff;Threshold if (Val!== "") InputArray=Val.split(";"); SR=1*document.Symbolrate.MBaud.value; return(CN_overall()-10*log10(SR*1000*(188/204)*InputArray[2] ) ); } function Eb_No_Nettobitrate() // ok 20 desember 2005 { return(CN_overall()-10*log10(Nettobitrate()*1000) ); } function CN_overall(){ // ok 20 desember 2005 var C_N,SR,CN_ov C_N=1*document.Carrier_to_noise.dB.value; SR=1*document.Symbolrate.MBaud.value; CN_ov=10*log10(SR*1000)+10*log10(Math.pow(10,(C_N/10)) -1); return(CN_ov) } function C_N() // ok, 20 Desember 2005 { var x,SR,CN CN=1*document.Carrier_to_noise.dB.value; SR=1*document.Symbolrate.MBaud.value; x=10*log10( Math.pow(10,(CN/10)) -1); return(x); } function C_N_N() // ok, 20 Desember 2005 { var x,SR,CNN CNN=1*document.CN.CN.value; SR=1*document.Symbolrate.MBaud.value; x=10*log10( Math.pow(10,(CNN/10)) +1); return(x); } function Nettobitrate() // ok, er riktig 20 December 2005. { var InputArray=new Array(); var Val,SR Val=document.ForwardErrorCorrection.FEC.value; //FEC;spectral efficiency;bit pr. symbol;DVB-S or DVB-S2;Rolloff;Threshold if (Val!== "") InputArray=Val.split(";"); SR=1*document.Symbolrate.MBaud.value; //alert(SR*InputArray[1]+" "+SR); return(SR*InputArray[1]); } function Data_Rate() { return(Nettobitrate()*204/188); } function C_N_Changed(){ // ok 20 december 2005 var InputArray=new Array(); var Val; Val=document.ForwardErrorCorrection.FEC.value; //FEC;spectral efficiency;bit pr. symbol;DVB-S or DVB-S2;Rolloff;Threshold if (Val!== "") InputArray=Val.split(";"); // calculate C+N/N document.Carrier_to_noise.dB.value=formatvalue(C_N_N(),5); document.treshold.EbNo.value=formatvalue(InputArray[6],5); document.margin.EbNo.value=formatvalue((Eb_No_Nettobitrate()-InputArray[6]),5); document.Data.Rate.value=formatvalue(Nettobitrate(),10) document.Bitenergy.EbNo.value=formatvalue(Eb_No_Nettobitrate(),5); document.Bitenergy3.EbNo.value=formatvalue(Eb_No_Transmissionrate() ,5); if (InputArray[3]!="S") { document.Bitenergy2.EbNo.value="N/A"; document.Es.EsNo.value=formatvalue(Es_No(),5); } else { document.Bitenergy2.EbNo.value=formatvalue(Eb_No_Datarate() ,5); document.Es.EsNo.value="N/A"; } document.CarrierToNoise.Overall.value=formatvalue(CN_overall(),5); //alert(CN_overall()); } function C_N_Overall_Changed(){ // ok 20 december 2005 var InputArray=new Array(); var Val,CN_ov,SR; Val=document.ForwardErrorCorrection.FEC.value; SR=1*document.Symbolrate.MBaud.value; //FEC;spectral efficiency;bit pr. symbol;DVB-S or DVB-S2;Rolloff;Threshold if (Val!== "") InputArray=Val.split(";"); CN_ov=1*document.CarrierToNoise.Overall.value; // calculate C+N/N document.CN.CN.value=formatvalue(CN_ov-10*log10(SR*1000)); document.Carrier_to_noise.dB.value=formatvalue(C_N_N(),5); document.treshold.EbNo.value=formatvalue(InputArray[6],5); document.margin.EbNo.value=formatvalue((Eb_No_Nettobitrate()-InputArray[6]),5); document.Data.Rate.value=formatvalue(Nettobitrate(),10) document.Bitenergy.EbNo.value=formatvalue(Eb_No_Nettobitrate(),5); document.Bitenergy3.EbNo.value=formatvalue(Eb_No_Transmissionrate() ,5); if (InputArray[3]!="S") { document.Bitenergy2.EbNo.value="N/A"; document.Es.EsNo.value=formatvalue(Es_No(),5); } else { document.Bitenergy2.EbNo.value=formatvalue(Eb_No_Datarate() ,5); document.Es.EsNo.value="N/A"; } //alert(CN_overall()); } function Es_No_Changed(){ // var InputArray=new Array(); var Val,C_N_ov,SR,Eb_No,Es_No; Val=document.ForwardErrorCorrection.FEC.value; SR=1*document.Symbolrate.MBaud.value; //FEC;spectral efficiency;bit pr. symbol;DVB-S or DVB-S2;Rolloff;Threshold if (Val!== "") InputArray=Val.split(";"); if (InputArray[3]!="S") { Es_No=1*document.Es.EsNo.value; Eb_No=Es_No-10*log10(1*InputArray[1]); document.Bitenergy.EbNo.value=Eb_No; C_N_ov=Eb_No+10*log10(Nettobitrate()*1000); document.CarrierToNoise.Overall.value=formatvalue(C_N_ov,5); // calculate C+N/N document.CN.CN.value=formatvalue(C_N_ov-10*log10(SR*1000),5); // calculate C/N document.Carrier_to_noise.dB.value=formatvalue(C_N_N(),5); document.treshold.EbNo.value=formatvalue(1*InputArray[6],5); document.margin.EbNo.value=formatvalue((Eb_No_Nettobitrate()-1*InputArray[6]),5); document.Data.Rate.value=formatvalue(Nettobitrate(),10) document.Bitenergy3.EbNo.value=formatvalue(Eb_No_Transmissionrate() ,5); if (InputArray[3]!="S") document.Bitenergy2.EbNo.value="N/A" else document.Bitenergy2.EbNo.value=formatvalue(Eb_No_Datarate() ,5); //alert(CN_overall()); } else alert("Calculation not available for DVB-S !"); } function Eb_No_Datarate_Changed(){ // ok 20 december 2005 var InputArray=new Array(); var Val,C_N_ov,SR,Eb_No; Val=document.ForwardErrorCorrection.FEC.value; SR=1*document.Symbolrate.MBaud.value; //FEC;spectral efficiency;bit pr. symbol;DVB-S or DVB-S2;Rolloff;Threshold if (Val!=="") InputArray=Val.split(";"); Eb_No=1*document.Bitenergy.EbNo.value; C_N_ov=Eb_No+10*log10(Nettobitrate()*1000); document.CarrierToNoise.Overall.value=formatvalue(C_N_ov,5); // calculate C+N/N document.CN.CN.value=formatvalue(C_N_ov-10*log10(SR*1000),5); // calculate C/N document.Carrier_to_noise.dB.value=formatvalue(C_N_N(),5); document.treshold.EbNo.value=formatvalue(InputArray[6],5); document.margin.EbNo.value=formatvalue((Eb_No_Nettobitrate()-InputArray[6]),5); document.Data.Rate.value=formatvalue(Nettobitrate(),10) document.Bitenergy3.EbNo.value=formatvalue(Eb_No_Transmissionrate() ,5); if (InputArray[3]!="S") { document.Bitenergy2.EbNo.value="N/A"; document.Es.EsNo.value=formatvalue(Es_No(),5); } else { document.Bitenergy2.EbNo.value=formatvalue(Eb_No_Datarate() ,5); document.Es.EsNo.value="N/A"; } //alert(CN_overall()); } function Eb_No_After_FEC_Changed(){ // ok 20 december 2005 var InputArray=new Array(); var Val,C_N_ov,SR,Eb_No; Val=document.ForwardErrorCorrection.FEC.value; SR=1*document.Symbolrate.MBaud.value; //FEC;spectral efficiency;bit pr. symbol;DVB-S or DVB-S2;Rolloff;Threshold if (Val!== "") InputArray=Val.split(";"); Eb_No=1*document.Bitenergy2.EbNo.value; if (InputArray[3]!="S2"){ C_N_ov=Eb_No+10*log10(SR*1000*(188/204)*InputArray[2] ); document.CarrierToNoise.Overall.value=formatvalue(C_N_ov,5); document.Bitenergy.EbNo.value=formatvalue(Eb_No_Nettobitrate(),5); // calculate C+N/N document.CN.CN.value=formatvalue(C_N_ov-10*log10(SR*1000),5); // calculate C/N document.Carrier_to_noise.dB.value=formatvalue(C_N_N(),5); document.treshold.EbNo.value=formatvalue(InputArray[6],5); document.margin.EbNo.value=formatvalue((Eb_No_Nettobitrate()-InputArray[6]),5); document.Data.Rate.value=formatvalue(Nettobitrate(),10) document.Bitenergy3.EbNo.value=formatvalue(Eb_No_Transmissionrate() ,5); } else alert("This value has no meaning for DVB-S2 calculations !"); //alert(CN_overall()); } function Eb_No_Bruttobitrate_Changed(){ // OK 20 december 2005 var InputArray=new Array(); var Val,C_N_ov,SR,Eb_No,nettobitrate; Val=document.ForwardErrorCorrection.FEC.value; SR=1*document.Symbolrate.MBaud.value; //FEC;spectral efficiency;bit pr. symbol;DVB-S or DVB-S2;Rolloff;Threshold if (Val!== "") InputArray=Val.split(";"); nettobitrate=Nettobitrate(); // EbNoTrans= CN_overall()-10*log10(Nettobitrate()*1000) - 10*log10((SR*InputArray[2])/nettobitrate) = Eb_No=1*document.Bitenergy3.EbNo.value; C_N_ov=Eb_No+10*log10(Nettobitrate()*1000) + 10*log10((SR*1*InputArray[2])/nettobitrate) ; document.CarrierToNoise.Overall.value=formatvalue(C_N_ov,5); // calculate C+N/N document.CN.CN.value=formatvalue(C_N_ov-10*log10(SR*1000),5); // calculate C/N document.Carrier_to_noise.dB.value=formatvalue(C_N_N(),5); document.treshold.EbNo.value=formatvalue(InputArray[6],5); document.margin.EbNo.value=formatvalue((Eb_No_Nettobitrate()-InputArray[6]),5); document.Data.Rate.value=formatvalue(Nettobitrate(),10) document.Bitenergy.EbNo.value=formatvalue(Eb_No_Nettobitrate(),5); if (InputArray[3]!="S") { document.Bitenergy2.EbNo.value="N/A"; document.Es.EsNo.value=formatvalue(Es_No(),5); } else { document.Bitenergy2.EbNo.value=formatvalue(Eb_No_Datarate() ,5); document.Es.EsNo.value="N/A"; } } function Margin_Changed(){ var InputArray=new Array(); var Val,Margin,CN_ov,Eb_No,SR; Val=document.ForwardErrorCorrection.FEC.value; //FEC;spectral efficiency;bit pr. symbol;DVB-S or DVB-S2;Rolloff;Threshold if (Val!== "") InputArray=Val.split(";"); SR=1*document.Symbolrate.MBaud.value; document.treshold.EbNo.value=formatvalue(InputArray[6],5); Margin=1*document.margin.EbNo.value; document.Bitenergy.EbNo.value=formatvalue(1*(1*Margin+1*InputArray[6]),5); //sfsg Eb_No=(1*(1*Margin+1*InputArray[6])); CN_ov=Eb_No+10*log10(Nettobitrate()*1000); document.CarrierToNoise.Overall.value=formatvalue(CN_ov,5); document.CN.CN.value=formatvalue(CN_ov-10*log10(SR*1000)); document.Carrier_to_noise.dB.value=formatvalue(C_N_N(),5); document.Data.Rate.value=formatvalue(Nettobitrate(),10) document.Bitenergy3.EbNo.value=formatvalue(Eb_No_Transmissionrate() ,5); if (InputArray[3]!="S") { document.Bitenergy2.EbNo.value="N/A"; document.EsNoThreshold.EsNo.value=formatvalue(( 1*InputArray[6]+10*log10(1*InputArray[1]) ),5); document.Es.EsNo.value=formatvalue(Es_No(),5); } else { document.Bitenergy2.EbNo.value=formatvalue(Eb_No_Datarate() ,5); document.EsNoThreshold.EsNo.value="N/A"; document.Es.EsNo.value="N/A"; } // C+N/N kalkuleres ikke riktig document.CN.CN.value=formatvalue(C_N(),5); }