5G频率 计算工具V1.0【在线工具+源代码】

...写这个感觉用了蛮久(下午4点20到晚上9点吧,,中间吃了个饭 ),老师给的软件支持的频段太少了,自己做了个多的站点工具

luzsfzad.png

在线直接使用: 点我前往

欢迎测试


V1.0版本介绍:

  • Version 1.0
  • 未适配移动端,手机打开会很小,不好用,推荐使用PC,后期有时间(很闲很闲的时候)写个移动端上去
  • 页面基本功能都实现了,功能如下:
  • 频段选择
  • 子载波间隔选择
  • 系统RB数设置
  • 中心载频设置
  • 计算按钮、重置按钮
  • 计算结果输出(已通过验证)
  • 注:当前1.0版本只加了少量判断输入数据是否正确,更多判断可能会在后续版本进行添加(其实也没必要,正常用都没问题)

源代码分享:

index.HTML:

<!DOCTYPE html>
<!--
  //Autor:快乐的钟好烦
  //Blog:https://blog.fanl.cn/
  //Time:2024/4/14,16:20
  //The version is 1.0.
  -->
<html>
    <head>
        <title>5G-PointA/中心载频(计算工具) - Inn云网络</title>
        <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
        <meta name="keywords" content="5G频点计算工具,PointA计算,中心载频计算,5G计算工具,Inn云工具箱" />
        <meta name="description" content="5G计算工具是Inn云工具箱下的一个小工具,可以在线计算5G的中心载频、PointA频点等,方便快捷,免费使用!" />
        <link rel="stylesheet" href="../css/5g_calculate.css" />
    </head>
    <body>
        <div class="app-container">
            <div class="app-header">
                <h1 class="app-title">5G频段 - PointA/中心载频 &nbsp;计算工具</h1>
            </div>
            <!-- 内容部分 -->
            <div class="app-content">
                <!-- 频段选择 -->
                <div class="select-Frequency">
                    <p>
                        <!-- 可选频率表 -->
                        <font>频段选择:</font>
                        <select id="frequencyValue" name="frequency_num" onchange="checkFrequency();">
                            <option value="NULL" selected>---请选择---</option>
                            <!-- 低频 -->
                            <option value="1">n1(FDD)</option>
                            <option value="3">n3(FDD)</option>
                            <option value="5">n5(FDD)</option>
                            <option value="7">n7(FDD)</option>
                            <option value="28">n28(FDD)</option>
                            <option value="41">n41(TDD)</option>
                            <!-- 中频 -->
                            <option value="77">n77(TDD)</option>
                            <option value="78">n78(TDD)</option>
                            <option value="79">n79(TDD)</option>
                            <!-- 高频 -->
                            <option value="257">n257(TDD)</option>
                            <option value="258">n258(TDD)</option>
                            <option value="260">n260(TDD)</option>
                            <option value="261">n261(TDD)</option>
                        </select>
                        &nbsp;&nbsp;&nbsp;
                        <br>
                        <br>
                        <font color="blue">载频范围(U/D):</font>&nbsp;&nbsp;<font id="absolute-Frequency">
                            (请选择相关频段,当前未选择频段~)</font>
                    </p>

                </div>
                <!-- 功能选择 -->
                <!--     <div class="select-Function">
                    计算:
                    <input type="radio" name="function-select" value=提交值 >实际频点
                    <input type="radio" name="function-select" value=提交值 >绝对频点
                    <input type="radio" name="function-select" value=提交值 >PointA频点
                    
                </div> -->
                <!-- 子载波间隔 -->
                <div class="sub-Spacing" name="Subselect">
                    <p>子载波间隔:
                        <input onclick="getSpacing(this.value);" type="radio" name="subSelect" value="15">15kHz
                        <input onclick="getSpacing(this.value);" type="radio" name="subSelect" value="30">30kHz
                        <input onclick="getSpacing(this.value);" type="radio" name="subSelect" value="60">60kHz
                        <input onclick="getSpacing(this.value);" type="radio" name="subSelect" value="120">120kHz
                    </p>
                </div>
                <!-- 系统带宽+中心载频 -->
                <div class="input-RB+c">
                    <p>
                        系统带宽(RB):<input id="rb-num" type="number" min="0" />
                        &nbsp;&nbsp;&nbsp;&nbsp;
                        中心载频:<input id="center-cf" type="number" min="0" /></p>
                </div>
                <!-- 计算、重置按钮+计算结果展示 -->
                <div class="submit-Print">
                    <!-- 计算按钮 -->
                    <button onclick="caculate();">计算</button>&nbsp;&nbsp;&nbsp;&nbsp;<button
                        onclick="reset();">重置</button>
                    <br>
                    <br>
                    <hr />
                    <br>
                    <br>
                    <font color="#FF70EB">PointA:</font>&nbsp;&nbsp;<input id="pointA" value="您还未计算" />
                    &nbsp;&nbsp;&nbsp;
                    <font color="#F24A90">实际频点:</font>&nbsp;&nbsp;<input id="absoluteFrequency" value="您还未计算" />

                </div>
            </div>

            <div class="app-footer">
                &nbsp;版权所有 &copy; 2024 &nbsp; <a href="https://www.innyun.cn">Inn云网络</a>
            </div>
        </div>
        <script type="text/javascript" src="../js/function.js">
        </script>
    </body>
</html>

CSS部分:

   body {
       font-family: Arial, sans-serif;
       margin: 0;
       padding: 0;
       background-color: #f2f2f2;
   }

   @media only screen and (max-width: 600px) {
       * {
           max-height: 150%;
           max-width: 150%;
       }

       .app-container {
           background-color: #fff;
           border-radius: 10px;
           box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
           margin: 20px auto;
           max-width: 120%;
           padding: 5px;
       }

       .app-header {
           background-color: #f2f2f2;
           padding: 10px;
           text-align: center;
           border-bottom: 1px solid #ccc;
       }

       .app-title {
           font-size: 24px;
           margin: 0;
       }

       .app-content {
           text-align: center;
           font-size: 20px;
           padding: 5px 0;
           border: 1px dashed darkgray;
       }

       .app-footer {
           background-color: #f2f2f2;
           padding: 5px;
           text-align: center;
           border-top: 1px solid #ccc;
       }

   }

   .app-container {
       background-color: #fff;
       border-radius: 10px;
       box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
       margin: 20px auto;
       max-width: 90%;
       padding: 20px;
   }

   .app-header {
       background-color: #f2f2f2;
       padding: 10px;
       text-align: center;
       border-bottom: 1px solid #ccc;
   }

   .app-title {
       font-size: 24px;
       margin: 0;
   }

   .app-content {
       text-align: center;
       font-size: 20px;
       padding: 20px 0;
       border: 1px dashed darkgray;
   }

   .app-footer {
       background-color: #f2f2f2;
       padding: 10px;
       text-align: center;
       border-top: 1px solid #ccc;
   }

   a {
       text-decoration: none;
       color: darkturquoise;
   }

   select {
       width: 120px;
       height: 40px;
       font-size: 18px;

   }

   .select-Frequency {
       margin: 25px auto;
       max-width: 65%;
   }

   #absolute-Frequency {
       color: red;
       font-size: 16px;
   }

   .select-Function {
       margin: 15px auto;
       max-width: 65%;
   }

   .sub-Spacing {
       margin: 25px auto;
       max-width: 65%;
   }

   .submit-Print {
       margin: 25px auto;
       max-width: 65%;
   }

   .submit-Print button {
       height: 35px;
       width: 50px;
       font-size: 16px;
   }

   .submit-Print input {
       padding: 1px;
       width: 85px;
       height: 30px;
       font-size: 16px;
   }

   #rb-num {
       height: 22px;
       font-size: 16px;
       width: 55px;
   }

   #center-cf {
       height: 22px;
       font-size: 16px;
       width: 100px;
   }

JS部分

// 默认选中位n1频段,信道栅格:5,绝对频点偏置:0,实际频点偏置:0;
var frequeny = 1;
var xdsg = 5;
var jdpdpz = 0;
var sjpdpz = 0;
var zzbjg = 0;
var rb = 0;
var zxzp = 0;
var pointa = 0;
var sjpd = 0;
//默认无余数
var yys = 0;

function checkFrequency() {
    // 选中select框架
    var selectfre = document.getElementById("frequencyValue");
    // 创建选项索引
    var index = selectfre.selectedIndex;
    // 获取新选中的频段值
    var frequeny = selectfre.options[index].value;
    // 判断频段属于那个频(高低中),并给对应的信道栅格
    if (frequeny < 77) {
        //默认信道栅格=5
    } else if (frequeny < 257) {
        xdsg = 15;
        jdpdpz = 600000;
        sjpdpz = 3000000;
    } else {
        xdsg = 60;
        jdpdpz = 2016667;
        sjpdpz = 24250080;
    }
    // alert(frequeny);确认生效,注释掉
    // alert(xdsg);,判断生效,注释掉
    // 如果选中了其他频段则改变到对应的绝对频点
    // 中心载频计算
    switch (frequeny) {
        case "NULL":
            document.getElementById("absolute-Frequency").innerHTML = "(请选择相关频段,当前未选择频段~)";
            break;
        case "1":
            document.getElementById("absolute-Frequency").innerHTML = "(384000-<20>-396000,422000-<20>-434000)";
            break;
        case "3":
            // alert("3")
            document.getElementById("absolute-Frequency").innerHTML = "(342000-<20>-357000,361000-<20>-376000)";
            break;
        case "5":
            document.getElementById("absolute-Frequency").innerHTML = "(164800-<20>-169800,173800-<20>-178800)";
            break;
        case "7":
            document.getElementById("absolute-Frequency").innerHTML = "(500000-<20>-214000,524000-<20>-538000)";
            break;
        case "28":
            document.getElementById("absolute-Frequency").innerHTML = "(140600-<20>-149600,151600-<20>-160600)";
            break;
        case "41":
            document.getElementById("absolute-Frequency").innerHTML = "(499200-<20>-537999)";
            break;
        case "77":
            document.getElementById("absolute-Frequency").innerHTML = "(620000-<1/2>-680000)";
            break;
        case "78":
            document.getElementById("absolute-Frequency").innerHTML = "(620000-<1/2>-653333)";
            break;
        case "79":
            document.getElementById("absolute-Frequency").innerHTML = "(693333-<1/2>-733333)";
            break;
        case "257":
            document.getElementById("absolute-Frequency").innerHTML = "(2054167-<1/2>-20104166)";
            break;
        case "258":
            document.getElementById("absolute-Frequency").innerHTML = "(2016667-<1/2>-2070833)";
            break;
        case "260":
            document.getElementById("absolute-Frequency").innerHTML = "(2229167-<1/2>-2279166)";
            break;
        case "261":
            document.getElementById("absolute-Frequency").innerHTML = "(2070833-<1/2>-2084999)";
            break;
        default:
            alert("未选择频段!");
            break;
    }
}

function getSpacing(value) {
    //子载波间隔
    //判断是否标准,2.0再写
    zzbjg = value;
    // alert(zzbjg);
}

function caculate() {
    rb = document.getElementById("rb-num").value;
    zxzp = document.getElementById("center-cf").value;
    if (rb < 0) {
        alert("干啥子嘞?");
    } else if (zxzp < 0) {
        alert("你贡样子怎么算侬?");
        return false;
    }
    // alert(rb);
    // alert(zxzp);
    sjpd = (((zxzp - jdpdpz) * xdsg) + sjpdpz) / 1000;
    // alert(sjpd);
    if ((rb % 2) === 0) {
        //偶数,无需处理
    } else {
        // 奇数
        yys = 6 * zzbjg;
    }
    pointa = ((((zxzp - jdpdpz) * xdsg) - 12 * zzbjg * parseInt(rb / 2) - yys) / xdsg) + jdpdpz;
    document.getElementById("pointA").value = pointa;
    document.getElementById("absoluteFrequency").value = sjpd;
}

function reset() {
    //频段选择重置
    var resetSelect = document.getElementById("frequencyValue");
    resetSelect.selectedIndex = 0;
    document.getElementById("absolute-Frequency").innerHTML = "(请选择相关频段,当前未选择频段~)";
    //单选框重置
    var resetSubselect = document.getElementsByName("subSelect");
    // var resetSub
    for (var i = 0; i < resetSubselect.length; i++) {
        if (resetSubselect[i].checked) {
            resetSubselect[i].checked = false;
        }
    }
    //清空RB数
    document.getElementById("rb-num").value = "";
    //清空中心载频
    document.getElementById("center-cf").value = "";
    //清空结果
    document.getElementById("pointA").value = "您还未计算";
    document.getElementById("absoluteFrequency").value = "您还未计算";
}
打赏
评论区
头像
友链申请 - 网站地图 - 本站主题 - 给我留言