2022-10-15 23:32:33 +08:00
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html lang="zh-cmn-Hans">
|
|
|
|
|
|
|
|
|
|
<head>
|
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
|
|
|
|
<title>L414-5KR 相关物质计算</title>
|
|
|
|
|
<link rel="stylesheet" href="./github.css">
|
|
|
|
|
<link rel="stylesheet" href="./theme.css">
|
|
|
|
|
<script src="./decimal.js"></script>
|
|
|
|
|
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
|
|
|
|
<script>
|
|
|
|
|
var debug = false
|
|
|
|
|
|
|
|
|
|
// 校正因子
|
|
|
|
|
var F_L414_3 = new Decimal(0.80)
|
|
|
|
|
var F_L414_5_IM = new Decimal(1.48)
|
|
|
|
|
// 计算精度
|
|
|
|
|
var PRECISION = 3
|
|
|
|
|
// 操规允许的最大值
|
|
|
|
|
var MAX_L414_3 = 0.3
|
|
|
|
|
var MAX_L414_5_IM = 1.0
|
|
|
|
|
var MAX_TOTAL_IMPURITIES = 2.0
|
|
|
|
|
var MIN_PURITY = 98.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 默认的消息提示
|
|
|
|
|
var tips = `计算 L414-3、L414-5-IM、杂质总量、纯度`
|
|
|
|
|
|
|
|
|
|
var decimal = Decimal.set({
|
|
|
|
|
rounding: Decimal.ROUND_HALF_EVEN,
|
|
|
|
|
precision: 12
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$(document).ready(() => {
|
|
|
|
|
let one_all = $("#one-all")
|
|
|
|
|
let one_414_3 = $("#one-414-3")
|
|
|
|
|
let one_414_5_im = $("#one-414-5-im")
|
|
|
|
|
let one_414_5 = $("#one-414-5")
|
|
|
|
|
let two_all = $("#two-all")
|
|
|
|
|
let two_414_3 = $("#two-414-3")
|
|
|
|
|
let two_414_5_im = $("#two-414-5-im")
|
|
|
|
|
let two_414_5 = $("#two-414-5")
|
|
|
|
|
|
|
|
|
|
if (debug) {
|
|
|
|
|
one_414_3.val(1762)
|
|
|
|
|
one_414_5_im.val(2614)
|
|
|
|
|
one_414_5.val(24001626)
|
|
|
|
|
one_all.val(24075340)
|
|
|
|
|
|
|
|
|
|
two_414_3.val(2175)
|
|
|
|
|
two_414_5_im.val(3319)
|
|
|
|
|
two_414_5.val(24320630)
|
|
|
|
|
two_all.val(24409434)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setCheckInputEvent()
|
|
|
|
|
$("#msgbox").html(tips)
|
|
|
|
|
$("#new_page").click(() => window.open(window.location.href, "_BLANK"))
|
|
|
|
|
$("#clear").click(() => {
|
|
|
|
|
one_all.val("")
|
|
|
|
|
two_all.val("")
|
|
|
|
|
one_414_3.val("")
|
|
|
|
|
two_414_3.val("")
|
|
|
|
|
one_414_5_im.val("")
|
|
|
|
|
two_414_5_im.val("")
|
|
|
|
|
one_414_5.val("")
|
|
|
|
|
two_414_5.val("")
|
|
|
|
|
$("#msgbox").empty()
|
|
|
|
|
$("#msgbox").html(tips)
|
|
|
|
|
})
|
|
|
|
|
$("#ok").click(() => {
|
|
|
|
|
let one_414_3_cf = correctionFactor(one_414_3.val(), one_all.val(), F_L414_3)
|
|
|
|
|
let one_414_5_im_cf = correctionFactor(one_414_5_im.val(), one_all.val(), F_L414_5_IM)
|
|
|
|
|
|
|
|
|
|
let two_414_3_cf = correctionFactor(two_414_3.val(), two_all.val(), F_L414_3)
|
|
|
|
|
let two_414_5_im_cf = correctionFactor(two_414_5_im.val(), two_all.val(), F_L414_5_IM)
|
|
|
|
|
|
|
|
|
|
let one_total_impurities = totalImpurities(
|
|
|
|
|
one_all.val(), one_414_5.val(),
|
|
|
|
|
one_414_3.val(), one_414_3_cf,
|
|
|
|
|
one_414_5_im.val(), one_414_5_im_cf
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
let two_total_impurities = totalImpurities(
|
|
|
|
|
two_all.val(), two_414_5.val(),
|
|
|
|
|
two_414_3.val(), two_414_3_cf,
|
|
|
|
|
two_414_5_im.val(), two_414_5_im_cf
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
let msg = `
|
|
|
|
|
第一组结果: <br>
|
|
|
|
|
L414-3: ${format(one_414_3_cf, MAX_L414_3)} <br>
|
|
|
|
|
L414-5-IM: ${format(one_414_5_im_cf, MAX_L414_5_IM)} <br>
|
|
|
|
|
总杂: ${format(one_total_impurities, MAX_TOTAL_IMPURITIES)} <br>
|
|
|
|
|
纯度: ${format(decimal.sub(100, one_total_impurities), MIN_PURITY, true)} <br>
|
|
|
|
|
|
|
|
|
|
<br>
|
|
|
|
|
第二组结果: <br>
|
|
|
|
|
L414-3: ${format(two_414_3_cf, MAX_L414_3)} <br>
|
|
|
|
|
L414-5-IM: ${format(two_414_5_im_cf, MAX_L414_5_IM)} <br>
|
|
|
|
|
总杂: ${format(two_total_impurities, MAX_TOTAL_IMPURITIES)} <br>
|
|
|
|
|
纯度: ${format(decimal.sub(100, two_total_impurities), MIN_PURITY, true)} <br>
|
|
|
|
|
|
|
|
|
|
<br>
|
|
|
|
|
平均值: <br>
|
|
|
|
|
L414-3: ${format(average(one_414_3_cf, two_414_3_cf), MAX_L414_3)} <br>
|
|
|
|
|
L414-5-IM: ${format(average(one_414_5_im_cf, two_414_5_im_cf), MAX_L414_5_IM)} <br>
|
|
|
|
|
总杂: ${format(average(one_total_impurities, two_total_impurities), MAX_TOTAL_IMPURITIES)} <br>
|
|
|
|
|
纯度: ${format(average(decimal.sub(100, one_total_impurities), decimal.sub(100, two_total_impurities), 1), MIN_PURITY, true)} <br>
|
|
|
|
|
|
|
|
|
|
<br>
|
|
|
|
|
操规允许: <br>
|
|
|
|
|
L414-3 ≤ ${MAX_L414_3}% <br>
|
|
|
|
|
L414-5-IM ≤ ${MAX_L414_5_IM.toPrecision(2)}% <br>
|
|
|
|
|
总杂 ≤ ${MAX_TOTAL_IMPURITIES.toPrecision(2)}% <br>
|
|
|
|
|
纯度 ≥ ${MIN_PURITY}% <br>
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
$("#msgbox").html(msg)
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
function setCheckInputEvent() {
|
|
|
|
|
let checkInput = (event) => {
|
2022-10-16 00:59:21 +08:00
|
|
|
event.target.value = event.target.value.replace(/[\D]/g, '')
|
2022-10-15 23:32:33 +08:00
|
|
|
}
|
|
|
|
|
$("#one-all").on("input", checkInput)
|
|
|
|
|
$("#one-414-3").on("input", checkInput)
|
|
|
|
|
$("#one-414-5-im").on("input", checkInput)
|
|
|
|
|
$("#one-414-5").on("input", checkInput)
|
|
|
|
|
$("#two-all").on("input", checkInput)
|
|
|
|
|
$("#two-414-3").on("input", checkInput)
|
|
|
|
|
$("#two-414-5-im").on("input", checkInput)
|
|
|
|
|
$("#two-414-5").on("input", checkInput)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 代入校正因子进行计算
|
|
|
|
|
*/
|
|
|
|
|
function correctionFactor(pa, paa, f) {
|
|
|
|
|
if (pa == '' || paa == '' || f == '') return 0
|
|
|
|
|
return decimal.div(pa, paa).mul(f).mul(100).toFixed(PRECISION, Decimal.ROUND_HALF_EVEN)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 计算杂质总量
|
|
|
|
|
*/
|
|
|
|
|
function totalImpurities(paa, l414_5, l414_3, l414_3_rrf, l414_5_im, l414_5_im_rrf) {
|
|
|
|
|
if (paa == '' || l414_5 == '' || l414_3 == '' || l414_3_rrf == '' ||
|
|
|
|
|
l414_5_im == '' || l414_5_im_rrf == '') return 0
|
|
|
|
|
|
|
|
|
|
// X = All - (L414-5) - (L414-3) - (L414-5-IM) / All * 100
|
|
|
|
|
// R = X + (%L414-3) + (%L414-5-IM)
|
|
|
|
|
let a = decimal.sub(paa, l414_5).sub(l414_3).sub(l414_5_im)
|
|
|
|
|
let b = decimal.div(a, paa).mul(100)
|
|
|
|
|
let r = decimal.add(b, l414_3_rrf).add(l414_5_im_rrf)
|
|
|
|
|
return r.toFixed(PRECISION, Decimal.ROUND_HALF_EVEN)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function format(value, max, morethen = false) {
|
|
|
|
|
let red_value = `<span style='color: red;'>${value}%</span>`
|
|
|
|
|
if (value == 0) return "ND"
|
|
|
|
|
if (value < 0) return red_value
|
|
|
|
|
if (!morethen && value >= max) return red_value
|
|
|
|
|
if (morethen && value <= max) return red_value
|
|
|
|
|
return `${value}%`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 求两个数的平均值
|
|
|
|
|
*/
|
|
|
|
|
function average(a, b, fd = (PRECISION - 1)) {
|
|
|
|
|
return decimal.add(a, b).div(2).toFixed(fd)
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
</head>
|
|
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
<h3>L414-5KR 相关物质计算</h3>
|
|
|
|
|
<div class="one">
|
|
|
|
|
第一组<br>
|
|
|
|
|
<input type="number" name="one-414-3" id="one-414-3" , placeholder="L414-3 峰面积" inputmode="numeric">
|
|
|
|
|
<input type="number" name="one-414-5-im" id="one-414-5-im" , placeholder="L414-5-IM 峰面积" inputmode="numeric">
|
|
|
|
|
<input type="number" name="one-414-5" id="one-414-5" , placeholder="L414-5 峰面积" inputmode="numeric">
|
|
|
|
|
<input type="number" name="one-all" id="one-all" placeholder="总峰面积" inputmode="numeric">
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<br>
|
|
|
|
|
<div class="two">
|
|
|
|
|
第二组<br>
|
|
|
|
|
<input type="number" name="two-414-3" id="two-414-3" , placeholder="L414-3 峰面积" inputmode="numeric">
|
|
|
|
|
<input type="number" name="two-414-5-im" id="two-414-5-im" , placeholder="L414-5-IM 峰面积" inputmode="numeric">
|
|
|
|
|
<input type="number" name="two-414-5" id="two-414-5" , placeholder="L414-5 峰面积" inputmode="numeric">
|
|
|
|
|
<input type="number" name="two-all" id="two-all" placeholder="总峰面积" inputmode="numeric">
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<br>
|
|
|
|
|
<div class="buttons">
|
|
|
|
|
<button id="new_page">新开标签页</button>
|
|
|
|
|
<button id="clear">清除内容</button>
|
|
|
|
|
<button id="ok">计算</button>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<br>
|
|
|
|
|
<div id="msgbox"></div>
|
|
|
|
|
</body>
|
|
|
|
|
|
|
|
|
|
</html>
|