1 Star 0 Fork 32

arthurtung/circuitjs1-zh

forked from hvwyl/circuitjs1-zh 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
crystal.html 2.24 KB
一键复制 编辑 原始数据 按行查看 历史
hvwyl 提交于 2022-09-10 01:31 . no commit message
In this simulator, crystals are modeled using
<a href="circuitjs.html?ctz=CQAgjCCsCmC0YTAJgHQAZJqWgzADmSQBYw8BOSKS6tAKAGMRi0nIA2JvPVjlslMgHYkcMERBp0aMLQA2nbknYgcODkt4SpSiQyZEWSYirzij4wyjxtBZO-Yd28oiJLTTaAJxVqeJs8osbChEtADu-kzG+AG84fqGxsx+dBHJ5uCC6sapkRlERIo5tEA">this equivalent circuit</a>.
<p>
To change the crystal parameters, you need to know the values of all
these components. You can use the values below as a starting point
to get a crystal with a desired frequency.
<p>
<script>
function units(x) {
x = x.trim();
if (x.match(/m$/)) {
x = x.replace(/m$/, "");
return .001 * x;
}
if (x.match(/u$/)) {
x = x.replace(/u$/, "");
return 1e-6 * x;
}
if (x.match(/n$/)) {
x = x.replace(/n$/, "");
return 1e-9 * x;
}
if (x.match(/p$/)) {
x = x.replace(/p$/, "");
return 1e-12 * x;
}
if (x.match(/f$/)) {
x = x.replace(/f$/, "");
return 1e-15 * x;
}
return x;
}
function calc() {
var cp = units(document.getElementById('cp').value);
var cs = units(document.getElementById('cs').value);
var L = units(document.getElementById('L').value);
var r = units(document.getElementById('r').value);
var fs = 1/(2*Math.PI*Math.sqrt(L*cs));
//if (cl > 0)
// fs = Math.sqrt((cs+cp+cl)/(L*(cs*cp+cs*cl)))/(Math.PI*2);
var fp = 1/(2*Math.PI*Math.sqrt(L*(cp*cs)/(cp+cs)));
document.getElementById('result').innerHTML = "Series resonant frequency = " + Math.round(fs) +
" Hz <br>Parallel resonant frequency = " + Math.round(fp) +
" Hz <br>Q = " + Math.round(2*Math.PI*fp*L/r) +
"<br><a href=\"circuitjs.html?cct=$+1+5e-11+12.050203812241895+55+5+50%0A412+112+144+192+144+1+0\\s" +
cp + "\\s0+0\\s" + cs + "\\s0+0\\s" + L + "\\s0+0\\s" + r + "\" target=\"_blank\">crystal with these parameters</a>";
}
</script>
<form action="/action_page.php">
Parallel Capacitor, F: <input type="text" id="cp" oninput="calc()" value="29p"><br>
Series Capacitor, F: <input type="text" id="cs" oninput="calc()" value="0.1p"><br>
Inductor, H: <input type="text" id="L" oninput="calc()" value="2.5m"><br>
Resistor, &ohm;: <input type="text" id="r" oninput="calc()" value="6.4"><br>
</form>
<div id="result">
</div>
<script>calc(); </script>
</body></html>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/arthurtung/circuitjs1-zh.git
[email protected]:arthurtung/circuitjs1-zh.git
arthurtung
circuitjs1-zh
circuitjs1-zh
master

搜索帮助