From 4c0cbf558ff05d2c523ec66b6e93c2d90e34c574 Mon Sep 17 00:00:00 2001 From: miguel <31931809+miguelvaca@users.noreply.github.com> Date: Sun, 14 Nov 2021 19:11:23 +1100 Subject: [PATCH] v0.9d - Material Datasheet uplift --- toroid.html | 85 +++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 59 insertions(+), 26 deletions(-) diff --git a/toroid.html b/toroid.html index 4898bb5..0b743cd 100644 --- a/toroid.html +++ b/toroid.html @@ -7,7 +7,7 @@ -
Miguel VK3CPU - RF Toroid Calculator v0.9c
+
Miguel VK3CPU - RF Toroid Calculator v0.9d
@@ -134,9 +134,9 @@
  • Br : Residual flux density in gauss.
  • Hc : Coercive force at 0 gauss.
  • Tc : Curie temperature in Celsius.
  • -
  • ρ : Resistivity in Ω-cm.
  • +
  • ρ: Resistivity in Ω-cm.
  • Type : Material composition. (NiZn, MnZn, Phenolic, Carbonyl)
  • -
  • [nnnn] : Manufacturer's part number.
  • +
  • P/N : Manufacturer's part number.

  • Observations:
    @@ -153,12 +153,14 @@
    Change history:
    - [6-Nov-21]
    + [14-Nov-21] - v0.9d
    + * Updated manufacturers data section to more-closely match datasheets. Also justify to appear like tabular data.
    + [6-Nov-21] - v0.9c
    * Re-enabled PI support.
    * Added support for PI Material 17.
    - [3-Nov-21]
    + [3-Nov-21] - v0.9b
    * Disabled PI support due to bugs that need to be fixed.
    - [2-Nov-21]
    + [2-Nov-21] - v0.9a
    * Release 0.9a - Major code refactor to support Powdered Iron toroids.
    [26-Oct-21]
    * Increased resolution of the f-slider, making it smoothly regenerate the dataset.
    @@ -557,6 +559,22 @@ this.mat = this.cores[this.material]; this.core = this.mat.size[this.size]; + this.getMaterialDataStrings = function () { + retval = []; + retval.push(["Size", this.size]); + retval.push(["Material", this.material.toString()]); + retval.push(["Type", this.mat.mat]); + retval.push(["μi", this.mat.mu_i.toString()]); + retval.push(["B", this.mat.B.toString() + " G"]); + retval.push(["H", this.mat.H.toString() + " Oe"]); + retval.push(["Br", this.mat.Br.toString() + " G"]); + retval.push(["Hc", this.mat.Hc.toString() + " Oe"]); + retval.push(["Tc", this.mat.Tc.toString() + " C"]); + retval.push(["ρ", this.mat.R.toPrecision(2).toString() + " Ω cm"]); + retval.push(["P/N", this.core.PN]); + return retval; + }; + this.setMaterial = function (material) { this.material = material; this.mat = this.cores[this.material]; @@ -815,11 +833,11 @@ Br : 0.0, Hc : 0.0, mu_vs_f : { a:1.0e50, b:1.0, c:1.0, d:1.0 }, - //mu_vs_B : { a:1.00e4, b:1.0e-90, c:1.0e-90, d:1.0e-90, e:1.0e-90 }, mu_vs_B : { a:1.00e2, b:0.0, c:1.0, d:1.0e80, e:1.0, f:1e80 }, mu_vs_H : { a:1.00e90, b:1.0e90, c:1.0e90, d:1.0e90, e:1.0 }, CL_vs_f_B : { a:1.0e90, b:1.0e90, c:1.0e90, d:1.0e-90 }, color : '#EECFA1', // a dark tan + color_code : "Tan", }, '2' : { size : { @@ -854,6 +872,7 @@ B_vs_H : { a:1.50e-3, b:1.96e0, c:1.97e4, d:9.18e-4, e:1.48e3 }, CL_vs_f_B : { a:4.0e9, b:3.0e8, c:2.7e6, d:9.6e-16 }, color : '#CD0000', // a dark red + color_code : "Red/Clear", }, '17' : { size : { @@ -884,6 +903,7 @@ B_vs_H : { a:6.20e-4, b:1.96e0, c:7.71e4, d:9.31e-4, e:3.60e3 }, CL_vs_f_B : { a:4.0e9, b:3.0e8, c:2.7e6, d:4.40e-16 }, color : '#007FFF', // azure blue + color_code : "Blue/Yellow", }, '6' : { size : { @@ -914,6 +934,7 @@ B_vs_H : { a:1.28e-3, b:1.96e0, c:2.30e4, d:9.19e-4, e:1.74e3 }, CL_vs_f_B : { a:4.0e9, b:3.0e8, c:2.7e6, d:8.9e-16 }, color : '#ECD540', // a darker yellow + color_code : "Yellow/Clear", }, '10' : { size : { @@ -939,12 +960,26 @@ B_vs_H : { a:9.13e-4, b:1.96e0, c:3.83e4, d:9.23e-4, e:2.43e3 }, CL_vs_f_B : { a:4.0e9, b:3.0e8, c:2.7e6, d:8.0e-16 }, color : '#4F4F4F', + color_code : "Black/Clear", }, }; this.mat = this.cores[this.material]; this.core = this.mat.size[this.size]; + this.getMaterialDataStrings = function () { + retval = []; + retval.push(["Size", this.size]); + retval.push(["Material", this.material.toString()]); + retval.push(["Type", this.mat.mat]); + retval.push(["\u03bci", this.mat.mu_i.toString()]); + retval.push(["Color", this.mat.color_code]); + retval.push(["Bsat", this.mat.Bsat.toString() + " G"]); + retval.push(["Mass", this.core.W.toString() + " g"]); + retval.push(["P/N", this.core.PN]); + return retval; + }; + this.setMaterial = function (material) { this.material = material; this.mat = this.cores[this.material]; @@ -2418,25 +2453,23 @@ // Top right text: fctx.textAlign = "right"; - fctx.fillText("Size " + controller.t_size, win_width-18, 18); - fctx.fillText("Material " + controller.t_material, win_width-18, 32); - fctx.fillText("\u03bci: " + controller.toroid.mat.mu_i, win_width-18, 46); - if(controller.toroid.mat.B) { - fctx.fillText("B: " + controller.toroid.mat.B + " G", win_width-18, 60); - fctx.fillText("H: " + controller.toroid.mat.H + " Oe", win_width-18, 74); - fctx.fillText("Br: " + controller.toroid.mat.Br + " G", win_width-18, 88); - fctx.fillText("Hc: " + controller.toroid.mat.Hc + " Oe", win_width-18, 102); - fctx.fillText("Tc >= " + controller.toroid.mat.Tc + " C", win_width-18, 116); - fctx.fillText("Type: " + controller.toroid.mat.mat, win_width-18, 130); - fctx.fillText("[" + controller.toroid.core.PN + "]", win_width-18, 144); - } else { - fctx.fillText("Bsat: " + controller.toroid.mat.Bsat + " G", win_width-18, 60); - fctx.fillText("Br: " + controller.toroid.mat.Br + " G", win_width-18, 74); - fctx.fillText("Hc: " + controller.toroid.mat.Hc + " Oe", win_width-18, 88); - fctx.fillText("Mass: " + controller.toroid.core.W + " g", win_width-18, 102); - fctx.fillText("Type: " + controller.toroid.mat.mat, win_width-18, 116); - fctx.fillText("[" + controller.toroid.core.PN + "]", win_width-18, 130); - } + + var datasheet = controller.toroid.getMaterialDataStrings(); + + var max_width = 0; + datasheet.forEach((element, index) => { + let text = fctx.measureText(element[0] + ": " + element[1]); + if(text.width > max_width) { + max_width = text.width; + } + }); + + datasheet.forEach((element, index) => { + fctx.textAlign = "left"; + fctx.fillText(element[0] + ": ", win_width-18-max_width, 18+(index*14)); + fctx.textAlign = "right"; + fctx.fillText(element[1], win_width-18, 18+(index*14)); + }); } function getMetricPrefix(num) {