Spaces:
Running
Running
Publish Next Balance
Browse files- .gitattributes +2 -0
- README.md +62 -4
- app.js +112 -0
- core.js +92 -0
- evaluation.json +1309 -0
- index.html +48 -17
- model.json +1 -0
- nlrt.js +219 -0
- nlui.js +123 -0
- parity_cases.json +1 -0
- preview.png +3 -0
- replay.mp4 +3 -0
- style.css +53 -26
.gitattributes
CHANGED
|
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
preview.png filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
replay.mp4 filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -1,10 +1,68 @@
|
|
| 1 |
---
|
| 2 |
title: Next Balance
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
|
|
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
title: Next Balance
|
| 3 |
+
emoji: ⚖️
|
| 4 |
+
colorFrom: green
|
| 5 |
+
colorTo: gray
|
| 6 |
sdk: static
|
| 7 |
+
app_file: index.html
|
| 8 |
pinned: false
|
| 9 |
+
license: apache-2.0
|
| 10 |
+
short_description: Adaptive vs PID control under payload changes (simulation)
|
| 11 |
---
|
| 12 |
|
| 13 |
+
# Next Balance
|
| 14 |
+
|
| 15 |
+
Next Balance keeps a simulated lift platform at 0.5 m while its payload changes at t≈4 s and friction rises at t≈7 s.
|
| 16 |
+
It compares a **fixed PID** controller with an **adaptive controller** that estimates mass, viscous friction and
|
| 17 |
+
Coulomb friction online (recursive least squares on filtered signals) and rescales its control law. **Simulation only.**
|
| 18 |
+
|
| 19 |
+
**Model:** https://huggingface.co/thelamapi/Next-Balance — set load change, actuator delay, sensor noise and friction; both controllers re-run in the browser.
|
| 20 |
+
|
| 21 |
+
## Results on held-out scenarios (200 seeds per split, same disturbances for both controllers)
|
| 22 |
+
|
| 23 |
+
| Split | Controller | Max deviation after load change, mean / p90 (m) | Settling time, median (s) | Settled | Control energy (kN²·s) |
|
| 24 |
+
|---|---|---:|---:|---:|---:|
|
| 25 |
+
| nominal | Fixed PID | 0.144 / 0.283 | 1.97 | 81% | 0.061 |
|
| 26 |
+
| nominal | Adaptive (Next Balance) | 0.140 / 0.263 | 5.03 | 96% | 0.052 |
|
| 27 |
+
| stress | Fixed PID | 0.286 / 0.540 | 2.19 | 68% | 0.098 |
|
| 28 |
+
| stress | Adaptive (Next Balance) | 0.292 / 0.504 | 5.10 | 90% | 0.094 |
|
| 29 |
+
|
| 30 |
+
Stress split by condition (mean max deviation in m, settled rate):
|
| 31 |
+
|
| 32 |
+
| Condition | n | PID | Adaptive | PID settled | Adaptive settled |
|
| 33 |
+
|---|---:|---:|---:|---:|---:|
|
| 34 |
+
| heavy_load_change(dm>4kg) | 121 | 0.322 | 0.406 | 73% | 88% |
|
| 35 |
+
| load_removed(dm<0) | 10 | 0.234 | 0.035 | 20% | 100% |
|
| 36 |
+
| long_delay(>=40ms) | 88 | 0.447 | 0.359 | 51% | 82% |
|
| 37 |
+
| high_noise(>2mm) | 143 | 0.294 | 0.310 | 65% | 90% |
|
| 38 |
+
|
| 39 |
+
Paired wins (adaptive better on the same scenario): nominal max deviation 86/200,
|
| 40 |
+
stress max deviation 69/200,
|
| 41 |
+
stress energy 148/200.
|
| 42 |
+
Settling time is measured from the load change until the platform last leaves a ±1 cm band (the later friction change counts).
|
| 43 |
+
Runs that leave the band within the final 0.5 s count as not settled.
|
| 44 |
+
|
| 45 |
+

|
| 46 |
+
|
| 47 |
+
[Replay video](replay.mp4): the first held-out stress scenario and the stress scenario with the adaptive controller's largest deviation.
|
| 48 |
+
|
| 49 |
+
## Method
|
| 50 |
+
* Plant: m(z̈+g) = u(t−delay) − c·ż − F·tanh(ż/0.01), dt = 10 ms, force limited to [0, 400] N, platform 2.0 kg.
|
| 51 |
+
* Shared α-β estimator (α=0.3, β=0.05). Both controllers only know the nominal payload.
|
| 52 |
+
* Fixed PID: Kp=300, Ki=400, Kd=80 plus nominal gravity feed-forward.
|
| 53 |
+
* Adaptive: RLS (λ=0.99) on [m, c, F] with state-variable filters (ω=10.0 rad/s); control
|
| 54 |
+
u = m̂(ωn²e − 2ζωn v + ki∫e + g) + ĉv (F̂ is estimated but not fed back because it chatters with noisy velocity), ωn=6, ζ=0.7, ki=30. The delay value is given to the controller to align its regression.
|
| 55 |
+
* The 0.5 m target is approached with a 1 s ramp starting at t = 0.5 s.
|
| 56 |
+
* Both gain sets come from grid searches of the same size and cost (IAE + 0.5·energy) on 40 tuning seeds; test seeds are disjoint.
|
| 57 |
+
* The browser runs a line-by-line JavaScript port; Node parity on 6 fixed runs: max abs difference 8.459899447643693e-14.
|
| 58 |
+
|
| 59 |
+
## Usage
|
| 60 |
+
```bash
|
| 61 |
+
python inference.py --dm 8 --delay 4 --noise 0.003 # prints metrics for both controllers
|
| 62 |
+
python inference.py --selftest
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
## Limitations
|
| 66 |
+
* 1-D rigid-body model; no structural flexibility, actuator dynamics beyond pure delay, or sensor bias.
|
| 67 |
+
* The adaptive controller is told the actuator delay; an unknown delay would need estimation.
|
| 68 |
+
* Results are from simulation on NVIDIA L4; no physical platform was tested.
|
app.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Next Balance Space: change load, delay, noise and friction; both controllers re-simulate in the browser. */
|
| 2 |
+
const { $, h, fmt, lineChart, legend, css } = NLUI;
|
| 3 |
+
let ctx, last, anim = null;
|
| 4 |
+
const COL = { pid: "#8a8f98", adaptive: "#0b6e4f", ref: "#b07d12" };
|
| 5 |
+
const SL = [
|
| 6 |
+
["payload0", "Initial payload (kg)", 1, 4, 0.1, 2.5],
|
| 7 |
+
["dm", "Payload change at t = 4 s (kg)", -1, 12, 0.5, 5],
|
| 8 |
+
["fric_gain", "Friction multiplier at t = 7 s", 1, 6, 0.1, 2.5],
|
| 9 |
+
["delay_ms", "Actuator delay (ms)", 0, 80, 10, 30],
|
| 10 |
+
["noise_mm", "Sensor noise std (mm)", 0, 10, 0.5, 2],
|
| 11 |
+
["seed", "Noise seed", 1, 50, 1, 7],
|
| 12 |
+
];
|
| 13 |
+
|
| 14 |
+
function scenario() {
|
| 15 |
+
const v = id => Number($(id).value);
|
| 16 |
+
return { payload0: v("payload0"), t_load: 4.0, dm: v("dm"), c0: 3.5, F0: 2.0, t_fric: 7.0, fric_gain: v("fric_gain"),
|
| 17 |
+
delay: Math.round(v("delay_ms") / 10), noise: v("noise_mm") / 1000, T: 12.0, seed: v("seed") };
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
function run() {
|
| 21 |
+
const sc = scenario();
|
| 22 |
+
for (const s of SL) $(s[0] + "_v").textContent = $(s[0]).value;
|
| 23 |
+
const res = {};
|
| 24 |
+
for (const c of ["pid", "adaptive"]) {
|
| 25 |
+
const tr = Core.simulate(sc, c, ctx.params[c], 1);
|
| 26 |
+
res[c] = { tr, m: Core.metrics(sc, tr) };
|
| 27 |
+
}
|
| 28 |
+
last = { sc, res };
|
| 29 |
+
draw();
|
| 30 |
+
return res;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
function draw() {
|
| 34 |
+
const { sc, res } = last;
|
| 35 |
+
const pts = (tr, key) => tr.t.map((t, i) => [t, tr[key][i]]).filter((_, i) => i % 2 === 0);
|
| 36 |
+
const s1 = [{ name: "fixed PID", color: COL.pid, points: pts(res.pid.tr, "z") },
|
| 37 |
+
{ name: "adaptive (Next Balance)", color: COL.adaptive, points: pts(res.adaptive.tr, "z") }];
|
| 38 |
+
lineChart($("zc"), s1, { xlabel: "time (s)", hlines: [{ y: Core.Z_REF, color: COL.ref }], ymin: Math.min(0, ...s1.flatMap(s => s.points.map(p => p[1]))) });
|
| 39 |
+
legend($("zl"), s1.concat([{ name: "target 0.5 m", color: COL.ref }]));
|
| 40 |
+
const s2 = [{ name: "fixed PID", color: COL.pid, points: pts(res.pid.tr, "u") }, { name: "adaptive", color: COL.adaptive, points: pts(res.adaptive.tr, "u") }];
|
| 41 |
+
lineChart($("uc"), s2, { xlabel: "time (s)", height: 170 });
|
| 42 |
+
const trueM = res.adaptive.tr.t.map(t => [t, 2 + sc.payload0 + (t >= sc.t_load ? sc.dm : 0)]).filter((_, i) => i % 2 === 0);
|
| 43 |
+
const s3 = [{ name: "true mass", color: COL.ref, points: trueM, dash: [5, 4] }, { name: "adaptive estimate", color: COL.adaptive, points: pts(res.adaptive.tr, "m_hat") }];
|
| 44 |
+
lineChart($("mc"), s3, { xlabel: "time (s)", height: 170 });
|
| 45 |
+
legend($("ml"), s3);
|
| 46 |
+
const rows = [["Largest deviation after load change", "max_deviation_m", "m", 3],
|
| 47 |
+
["Settling time (±1 cm, from load change)", "settling_time_s", "s", 2], ["Control energy ∫u² dt", "control_energy_kN2s", "kN²·s", 3],
|
| 48 |
+
["Step overshoot", "step_overshoot_m", "m", 3], ["Final error", "final_error_m", "m", 4]];
|
| 49 |
+
const tb = $("tbl"); tb.innerHTML = "";
|
| 50 |
+
tb.append(h("tr", {}, h("th", {}, "Metric"), h("th", { class: "num" }, "fixed PID"), h("th", { class: "num" }, "adaptive")));
|
| 51 |
+
for (const [label, k, unit, d] of rows) {
|
| 52 |
+
const cell = c => {
|
| 53 |
+
let txt = fmt(res[c].m[k], d) + " " + unit;
|
| 54 |
+
if (k === "settling_time_s" && !res[c].m.settled) txt = "not settled";
|
| 55 |
+
return h("td", { class: "num" }, txt);
|
| 56 |
+
};
|
| 57 |
+
tb.append(h("tr", {}, h("td", {}, label), cell("pid"), cell("adaptive")));
|
| 58 |
+
}
|
| 59 |
+
playFrame(Math.floor(res.pid.tr.t.length * 0.5));
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
function playFrame(i) {
|
| 63 |
+
const c = $("anim"), W = c.clientWidth || 400, H = 220, dpr = window.devicePixelRatio || 1;
|
| 64 |
+
c.width = W * dpr; c.height = H * dpr; c.style.height = H + "px";
|
| 65 |
+
const g = c.getContext("2d"); g.scale(dpr, dpr);
|
| 66 |
+
g.fillStyle = css("--panel"); g.fillRect(0, 0, W, H);
|
| 67 |
+
const { sc, res } = last, t = res.pid.tr.t[i];
|
| 68 |
+
const Y = z => H - 30 - (z / 1.0) * (H - 60);
|
| 69 |
+
g.strokeStyle = COL.ref; g.setLineDash([5, 4]); g.beginPath(); g.moveTo(0, Y(0.5)); g.lineTo(W, Y(0.5)); g.stroke(); g.setLineDash([]);
|
| 70 |
+
const m = 2 + sc.payload0 + (t >= sc.t_load ? sc.dm : 0);
|
| 71 |
+
[["pid", W * 0.28], ["adaptive", W * 0.72]].forEach(([k, x]) => {
|
| 72 |
+
const z = Math.max(-0.2, Math.min(1.2, res[k].tr.z[i]));
|
| 73 |
+
g.fillStyle = css("--line"); g.fillRect(x - 3, Y(z), 6, H - 20 - Y(z));
|
| 74 |
+
g.fillStyle = COL[k]; g.fillRect(x - 50, Y(z) - 8, 100, 8);
|
| 75 |
+
const box = 10 + 3 * m; g.fillStyle = css("--muted"); g.fillRect(x - box / 2, Y(z) - 8 - box, box, box);
|
| 76 |
+
g.fillStyle = css("--ink"); g.font = "12px system-ui"; g.fillText(k === "pid" ? "fixed PID" : "adaptive", x - 28, H - 4);
|
| 77 |
+
});
|
| 78 |
+
g.fillStyle = css("--muted"); g.fillText(`t = ${t.toFixed(2)} s · mass ${m.toFixed(1)} kg`, 8, 14);
|
| 79 |
+
$("scrub").value = i;
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
function play() {
|
| 83 |
+
if (anim) { cancelAnimationFrame(anim); anim = null; $("play").textContent = "Play"; return; }
|
| 84 |
+
$("play").textContent = "Pause";
|
| 85 |
+
let i = 0; const n = last.res.pid.tr.t.length;
|
| 86 |
+
const step = () => { playFrame(i); i += 4; if (i < n) anim = requestAnimationFrame(step); else { anim = null; $("play").textContent = "Play"; } };
|
| 87 |
+
step();
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
window.__liveTest = function () {
|
| 91 |
+
const before = run();
|
| 92 |
+
$("dm").value = "11"; $("delay_ms").value = "60"; $("noise_mm").value = "6";
|
| 93 |
+
$("dm").dispatchEvent(new Event("input"));
|
| 94 |
+
const after = { pid: last.res.pid.m, adaptive: last.res.adaptive.m };
|
| 95 |
+
const tableText = $("tbl").textContent;
|
| 96 |
+
return { ok: after.pid.max_deviation_m !== before.pid.m.max_deviation_m && tableText.includes("adaptive") && last.sc.dm === 11 && last.sc.delay === 6,
|
| 97 |
+
pid: after.pid, adaptive: after.adaptive };
|
| 98 |
+
};
|
| 99 |
+
|
| 100 |
+
NLUI.boot(Core, async c => {
|
| 101 |
+
ctx = c;
|
| 102 |
+
const box = $("sliders");
|
| 103 |
+
for (const [id, label, lo, hi, step, val] of SL) {
|
| 104 |
+
box.append(h("label", { for: id }, label, ": ", h("b", { id: id + "_v" }, String(val))),
|
| 105 |
+
h("input", { type: "range", id, min: lo, max: hi, step, value: val, oninput: run }));
|
| 106 |
+
}
|
| 107 |
+
$("play").addEventListener("click", play);
|
| 108 |
+
$("scrub").addEventListener("input", e => playFrame(Number(e.target.value)));
|
| 109 |
+
window.addEventListener("resize", () => last && draw());
|
| 110 |
+
run();
|
| 111 |
+
$("scrub").max = last.res.pid.tr.t.length - 1;
|
| 112 |
+
});
|
core.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Next Balance compute core: line-by-line port of balance_core.py. */
|
| 2 |
+
(function (root, factory) {
|
| 3 |
+
if (typeof module === "object" && module.exports) module.exports = factory();
|
| 4 |
+
else root.Core = factory();
|
| 5 |
+
})(typeof self !== "undefined" ? self : this, function () {
|
| 6 |
+
"use strict";
|
| 7 |
+
const DT = 0.01, G = 9.81, U_MAX = 400.0, M_PLATFORM = 2.0, EPS = 0.01, ALPHA = 0.3, BETA = 0.05, Z_REF = 0.5, T_STEP = 0.5, T_RAMP = 1.0;
|
| 8 |
+
const ASSETS = ["model.json"];
|
| 9 |
+
|
| 10 |
+
function init(assets) { return { params: assets["model.json"].meta.params }; }
|
| 11 |
+
|
| 12 |
+
function simulate(sc, ctrl, params, recordEvery) {
|
| 13 |
+
recordEvery = recordEvery || 1;
|
| 14 |
+
const rng = NLRT.mulberry32((sc.seed * 31 + 7) >>> 0);
|
| 15 |
+
const mNom = M_PLATFORM + sc.payload0, n = Math.round(sc.T / DT);
|
| 16 |
+
let z = 0, v = 0, zh = 0, vh = 0, integ = 0;
|
| 17 |
+
const queue = []; for (let i = 0; i < sc.delay + 1; i++) queue.push(mNom * G);
|
| 18 |
+
let theta = [mNom, 3.0, 2.0];
|
| 19 |
+
let P = [[10, 0, 0], [0, 10, 0], [0, 0, 10]];
|
| 20 |
+
let fz = [0, 0], fu = [mNom * G, 0], ft = [0, 0];
|
| 21 |
+
const w = params.wf != null ? params.wf : 20.0, lam = params.lam != null ? params.lam : 0.995;
|
| 22 |
+
const imax = params.imax != null ? params.imax : 0.5;
|
| 23 |
+
const out = { t: [], z: [], u: [], m_hat: [], energy: 0 };
|
| 24 |
+
for (let k = 0; k < n; k++) {
|
| 25 |
+
const t = k * DT;
|
| 26 |
+
const m = M_PLATFORM + sc.payload0 + (t >= sc.t_load ? sc.dm : 0);
|
| 27 |
+
const gf = t >= sc.t_fric ? sc.fric_gain : 1.0, c = sc.c0 * gf, F = sc.F0 * gf;
|
| 28 |
+
const ref = Z_REF * Math.min(1.0, Math.max(0.0, (t - T_STEP) / T_RAMP));
|
| 29 |
+
const meas = z + sc.noise * rng.normal();
|
| 30 |
+
const zp = zh + vh * DT, res = meas - zp;
|
| 31 |
+
zh = zp + ALPHA * res; vh = vh + (BETA / DT) * res;
|
| 32 |
+
const e = ref - zh;
|
| 33 |
+
integ = Math.max(-imax, Math.min(imax, integ + e * DT));
|
| 34 |
+
let u;
|
| 35 |
+
if (ctrl === "pid") {
|
| 36 |
+
u = params.kp * e + params.ki * integ - params.kd * vh + mNom * G;
|
| 37 |
+
} else {
|
| 38 |
+
const uApplied = queue[0], tv = Math.tanh(vh / EPS);
|
| 39 |
+
const az = w * w * (meas - fz[0]) - 2 * w * fz[1];
|
| 40 |
+
const au = w * w * (uApplied - fu[0]) - 2 * w * fu[1];
|
| 41 |
+
const at = w * w * (tv - ft[0]) - 2 * w * ft[1];
|
| 42 |
+
fz = [fz[0] + DT * fz[1], fz[1] + DT * az];
|
| 43 |
+
fu = [fu[0] + DT * fu[1], fu[1] + DT * au];
|
| 44 |
+
ft = [ft[0] + DT * ft[1], ft[1] + DT * at];
|
| 45 |
+
const phi = [az + G, fz[1], ft[0]], y = fu[0];
|
| 46 |
+
const Pphi = [0, 1, 2].map(i => { let s = 0; for (let j = 0; j < 3; j++) s += P[i][j] * phi[j]; return s; });
|
| 47 |
+
let s = 0; for (let i = 0; i < 3; i++) s += phi[i] * Pphi[i];
|
| 48 |
+
const den = lam + s, K = Pphi.map(x => x / den);
|
| 49 |
+
let s2 = 0; for (let i = 0; i < 3; i++) s2 += phi[i] * theta[i];
|
| 50 |
+
const err = y - s2;
|
| 51 |
+
theta = theta.map((th, i) => th + K[i] * err);
|
| 52 |
+
P = [0, 1, 2].map(i => [0, 1, 2].map(j => (P[i][j] - K[i] * Pphi[j]) / lam));
|
| 53 |
+
theta = [Math.min(30, Math.max(0.5, theta[0])), Math.min(60, Math.max(0, theta[1])), Math.min(60, Math.max(0, theta[2]))];
|
| 54 |
+
const wn = params.wn, zeta = params.zeta;
|
| 55 |
+
const acmd = wn * wn * e - 2 * zeta * wn * vh + params.ki_a * integ;
|
| 56 |
+
u = theta[0] * (acmd + G) + theta[1] * vh;
|
| 57 |
+
}
|
| 58 |
+
u = Math.max(0, Math.min(U_MAX, u));
|
| 59 |
+
queue.push(u);
|
| 60 |
+
const uAct = queue.shift();
|
| 61 |
+
const a = (uAct - c * v - F * Math.tanh(v / EPS)) / m - G;
|
| 62 |
+
v = v + a * DT; z = z + v * DT;
|
| 63 |
+
out.energy += uAct * uAct * DT;
|
| 64 |
+
if (k % recordEvery === 0) { out.t.push(Math.round(t * 1e4) / 1e4); out.z.push(z); out.u.push(uAct); out.m_hat.push(ctrl !== "pid" ? theta[0] : mNom); }
|
| 65 |
+
}
|
| 66 |
+
return out;
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
function metrics(sc, tr, band, recordEvery) {
|
| 70 |
+
band = band || 0.01; recordEvery = recordEvery || 1;
|
| 71 |
+
const { t, z } = tr;
|
| 72 |
+
let iae = 0; for (let i = 0; i < t.length; i++) iae += Math.abs(z[i] - Z_REF * Math.min(1.0, Math.max(0.0, (t[i] - T_STEP) / T_RAMP)));
|
| 73 |
+
iae *= DT * recordEvery;
|
| 74 |
+
let maxDev = 0, lastOut = null, over = 0, anyStep = false;
|
| 75 |
+
for (let i = 0; i < t.length; i++) {
|
| 76 |
+
if (t[i] >= sc.t_load) { maxDev = Math.max(maxDev, Math.abs(z[i] - Z_REF)); if (Math.abs(z[i] - Z_REF) > band) lastOut = t[i]; }
|
| 77 |
+
else if (t[i] >= T_STEP) { anyStep = true; over = Math.max(over, z[i] - Z_REF); }
|
| 78 |
+
}
|
| 79 |
+
return { max_deviation_m: maxDev, settling_time_s: lastOut === null ? 0 : lastOut - sc.t_load,
|
| 80 |
+
settled: lastOut === null || lastOut < t[t.length - 1] - 0.5, control_energy_kN2s: tr.energy / 1e6,
|
| 81 |
+
step_overshoot_m: anyStep ? Math.max(0, over) : 0, final_error_m: Math.abs(z[z.length - 1] - Z_REF), iae_ms: iae };
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
function runCase(ctx, input) {
|
| 85 |
+
const p = ctx.params[input.ctrl];
|
| 86 |
+
const tr = simulate(input.scenario, input.ctrl, p, 1);
|
| 87 |
+
const zs = tr.z.filter((_, i) => i % 50 === 0);
|
| 88 |
+
return { metrics: metrics(input.scenario, tr), z_every_50: zs };
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
return { ASSETS, init, simulate, metrics, runCase, DT, Z_REF };
|
| 92 |
+
});
|
evaluation.json
ADDED
|
@@ -0,0 +1,1309 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"project": "Next Balance",
|
| 3 |
+
"profile": "full",
|
| 4 |
+
"seed": 73,
|
| 5 |
+
"device": {
|
| 6 |
+
"python": "3.13.16",
|
| 7 |
+
"platform": "Linux-6.6.159+-x86_64-with-glibc2.39",
|
| 8 |
+
"cpu_count": 12,
|
| 9 |
+
"numpy": "2.4.6",
|
| 10 |
+
"torch": "2.14.1+cu130",
|
| 11 |
+
"cuda": true,
|
| 12 |
+
"gpu": "NVIDIA L4",
|
| 13 |
+
"colab": true
|
| 14 |
+
},
|
| 15 |
+
"data": {
|
| 16 |
+
"type": "simulation",
|
| 17 |
+
"note": "No external data. Scenarios are sampled from bc.scenario(seed) with a Mulberry32 PRNG.",
|
| 18 |
+
"tuning_seeds": [
|
| 19 |
+
1000,
|
| 20 |
+
1001,
|
| 21 |
+
1002,
|
| 22 |
+
1003,
|
| 23 |
+
1004,
|
| 24 |
+
1005,
|
| 25 |
+
1006,
|
| 26 |
+
1007,
|
| 27 |
+
1008,
|
| 28 |
+
1009,
|
| 29 |
+
1010,
|
| 30 |
+
1011,
|
| 31 |
+
1012,
|
| 32 |
+
1013,
|
| 33 |
+
1014,
|
| 34 |
+
1015,
|
| 35 |
+
1016,
|
| 36 |
+
1017,
|
| 37 |
+
1018,
|
| 38 |
+
1019,
|
| 39 |
+
1020,
|
| 40 |
+
1021,
|
| 41 |
+
1022,
|
| 42 |
+
1023,
|
| 43 |
+
1024,
|
| 44 |
+
1025,
|
| 45 |
+
1026,
|
| 46 |
+
1027,
|
| 47 |
+
1028,
|
| 48 |
+
1029,
|
| 49 |
+
1030,
|
| 50 |
+
1031,
|
| 51 |
+
1032,
|
| 52 |
+
1033,
|
| 53 |
+
1034,
|
| 54 |
+
1035,
|
| 55 |
+
1036,
|
| 56 |
+
1037,
|
| 57 |
+
1038,
|
| 58 |
+
1039
|
| 59 |
+
],
|
| 60 |
+
"test_seeds": [
|
| 61 |
+
5000,
|
| 62 |
+
5001,
|
| 63 |
+
5002,
|
| 64 |
+
5003,
|
| 65 |
+
5004,
|
| 66 |
+
5005,
|
| 67 |
+
5006,
|
| 68 |
+
5007,
|
| 69 |
+
5008,
|
| 70 |
+
5009,
|
| 71 |
+
5010,
|
| 72 |
+
5011,
|
| 73 |
+
5012,
|
| 74 |
+
5013,
|
| 75 |
+
5014,
|
| 76 |
+
5015,
|
| 77 |
+
5016,
|
| 78 |
+
5017,
|
| 79 |
+
5018,
|
| 80 |
+
5019,
|
| 81 |
+
5020,
|
| 82 |
+
5021,
|
| 83 |
+
5022,
|
| 84 |
+
5023,
|
| 85 |
+
5024,
|
| 86 |
+
5025,
|
| 87 |
+
5026,
|
| 88 |
+
5027,
|
| 89 |
+
5028,
|
| 90 |
+
5029,
|
| 91 |
+
5030,
|
| 92 |
+
5031,
|
| 93 |
+
5032,
|
| 94 |
+
5033,
|
| 95 |
+
5034,
|
| 96 |
+
5035,
|
| 97 |
+
5036,
|
| 98 |
+
5037,
|
| 99 |
+
5038,
|
| 100 |
+
5039,
|
| 101 |
+
5040,
|
| 102 |
+
5041,
|
| 103 |
+
5042,
|
| 104 |
+
5043,
|
| 105 |
+
5044,
|
| 106 |
+
5045,
|
| 107 |
+
5046,
|
| 108 |
+
5047,
|
| 109 |
+
5048,
|
| 110 |
+
5049,
|
| 111 |
+
5050,
|
| 112 |
+
5051,
|
| 113 |
+
5052,
|
| 114 |
+
5053,
|
| 115 |
+
5054,
|
| 116 |
+
5055,
|
| 117 |
+
5056,
|
| 118 |
+
5057,
|
| 119 |
+
5058,
|
| 120 |
+
5059,
|
| 121 |
+
5060,
|
| 122 |
+
5061,
|
| 123 |
+
5062,
|
| 124 |
+
5063,
|
| 125 |
+
5064,
|
| 126 |
+
5065,
|
| 127 |
+
5066,
|
| 128 |
+
5067,
|
| 129 |
+
5068,
|
| 130 |
+
5069,
|
| 131 |
+
5070,
|
| 132 |
+
5071,
|
| 133 |
+
5072,
|
| 134 |
+
5073,
|
| 135 |
+
5074,
|
| 136 |
+
5075,
|
| 137 |
+
5076,
|
| 138 |
+
5077,
|
| 139 |
+
5078,
|
| 140 |
+
5079,
|
| 141 |
+
5080,
|
| 142 |
+
5081,
|
| 143 |
+
5082,
|
| 144 |
+
5083,
|
| 145 |
+
5084,
|
| 146 |
+
5085,
|
| 147 |
+
5086,
|
| 148 |
+
5087,
|
| 149 |
+
5088,
|
| 150 |
+
5089,
|
| 151 |
+
5090,
|
| 152 |
+
5091,
|
| 153 |
+
5092,
|
| 154 |
+
5093,
|
| 155 |
+
5094,
|
| 156 |
+
5095,
|
| 157 |
+
5096,
|
| 158 |
+
5097,
|
| 159 |
+
5098,
|
| 160 |
+
5099,
|
| 161 |
+
5100,
|
| 162 |
+
5101,
|
| 163 |
+
5102,
|
| 164 |
+
5103,
|
| 165 |
+
5104,
|
| 166 |
+
5105,
|
| 167 |
+
5106,
|
| 168 |
+
5107,
|
| 169 |
+
5108,
|
| 170 |
+
5109,
|
| 171 |
+
5110,
|
| 172 |
+
5111,
|
| 173 |
+
5112,
|
| 174 |
+
5113,
|
| 175 |
+
5114,
|
| 176 |
+
5115,
|
| 177 |
+
5116,
|
| 178 |
+
5117,
|
| 179 |
+
5118,
|
| 180 |
+
5119,
|
| 181 |
+
5120,
|
| 182 |
+
5121,
|
| 183 |
+
5122,
|
| 184 |
+
5123,
|
| 185 |
+
5124,
|
| 186 |
+
5125,
|
| 187 |
+
5126,
|
| 188 |
+
5127,
|
| 189 |
+
5128,
|
| 190 |
+
5129,
|
| 191 |
+
5130,
|
| 192 |
+
5131,
|
| 193 |
+
5132,
|
| 194 |
+
5133,
|
| 195 |
+
5134,
|
| 196 |
+
5135,
|
| 197 |
+
5136,
|
| 198 |
+
5137,
|
| 199 |
+
5138,
|
| 200 |
+
5139,
|
| 201 |
+
5140,
|
| 202 |
+
5141,
|
| 203 |
+
5142,
|
| 204 |
+
5143,
|
| 205 |
+
5144,
|
| 206 |
+
5145,
|
| 207 |
+
5146,
|
| 208 |
+
5147,
|
| 209 |
+
5148,
|
| 210 |
+
5149,
|
| 211 |
+
5150,
|
| 212 |
+
5151,
|
| 213 |
+
5152,
|
| 214 |
+
5153,
|
| 215 |
+
5154,
|
| 216 |
+
5155,
|
| 217 |
+
5156,
|
| 218 |
+
5157,
|
| 219 |
+
5158,
|
| 220 |
+
5159,
|
| 221 |
+
5160,
|
| 222 |
+
5161,
|
| 223 |
+
5162,
|
| 224 |
+
5163,
|
| 225 |
+
5164,
|
| 226 |
+
5165,
|
| 227 |
+
5166,
|
| 228 |
+
5167,
|
| 229 |
+
5168,
|
| 230 |
+
5169,
|
| 231 |
+
5170,
|
| 232 |
+
5171,
|
| 233 |
+
5172,
|
| 234 |
+
5173,
|
| 235 |
+
5174,
|
| 236 |
+
5175,
|
| 237 |
+
5176,
|
| 238 |
+
5177,
|
| 239 |
+
5178,
|
| 240 |
+
5179,
|
| 241 |
+
5180,
|
| 242 |
+
5181,
|
| 243 |
+
5182,
|
| 244 |
+
5183,
|
| 245 |
+
5184,
|
| 246 |
+
5185,
|
| 247 |
+
5186,
|
| 248 |
+
5187,
|
| 249 |
+
5188,
|
| 250 |
+
5189,
|
| 251 |
+
5190,
|
| 252 |
+
5191,
|
| 253 |
+
5192,
|
| 254 |
+
5193,
|
| 255 |
+
5194,
|
| 256 |
+
5195,
|
| 257 |
+
5196,
|
| 258 |
+
5197,
|
| 259 |
+
5198,
|
| 260 |
+
5199
|
| 261 |
+
],
|
| 262 |
+
"splits": [
|
| 263 |
+
"nominal",
|
| 264 |
+
"stress"
|
| 265 |
+
]
|
| 266 |
+
},
|
| 267 |
+
"controllers": {
|
| 268 |
+
"pid": {
|
| 269 |
+
"kp": 300,
|
| 270 |
+
"ki": 400,
|
| 271 |
+
"kd": 80,
|
| 272 |
+
"imax": 0.2
|
| 273 |
+
},
|
| 274 |
+
"adaptive": {
|
| 275 |
+
"wn": 6,
|
| 276 |
+
"zeta": 0.7,
|
| 277 |
+
"ki_a": 30,
|
| 278 |
+
"imax": 0.5,
|
| 279 |
+
"wf": 10.0,
|
| 280 |
+
"lam": 0.99
|
| 281 |
+
}
|
| 282 |
+
},
|
| 283 |
+
"tuning": {
|
| 284 |
+
"pid_grid_size": 72,
|
| 285 |
+
"adaptive_grid_size": 72,
|
| 286 |
+
"cost": "IAE + 0.5*energy on tuning seeds only"
|
| 287 |
+
},
|
| 288 |
+
"results": {
|
| 289 |
+
"nominal": {
|
| 290 |
+
"all": {
|
| 291 |
+
"pid": {
|
| 292 |
+
"n": 200,
|
| 293 |
+
"settled_rate": 0.81,
|
| 294 |
+
"max_deviation_m": {
|
| 295 |
+
"mean": 0.14381613039013313,
|
| 296 |
+
"median": 0.1275249862696633,
|
| 297 |
+
"p90": 0.28253078007398874
|
| 298 |
+
},
|
| 299 |
+
"settling_time_s": {
|
| 300 |
+
"mean": 3.3608479333645196,
|
| 301 |
+
"median": 1.974241643268615,
|
| 302 |
+
"p90": 8.032996131209657
|
| 303 |
+
},
|
| 304 |
+
"control_energy_kN2s": {
|
| 305 |
+
"mean": 0.06102178558463826,
|
| 306 |
+
"median": 0.058176729725626895,
|
| 307 |
+
"p90": 0.09424600123462587
|
| 308 |
+
},
|
| 309 |
+
"step_overshoot_m": {
|
| 310 |
+
"mean": 0.157151631590862,
|
| 311 |
+
"median": 0.12665297152213068,
|
| 312 |
+
"p90": 0.29502007387936036
|
| 313 |
+
},
|
| 314 |
+
"iae_ms": {
|
| 315 |
+
"mean": 0.45503818964749354,
|
| 316 |
+
"median": 0.34905450568001656,
|
| 317 |
+
"p90": 0.8012585529421845
|
| 318 |
+
}
|
| 319 |
+
},
|
| 320 |
+
"adaptive": {
|
| 321 |
+
"n": 200,
|
| 322 |
+
"settled_rate": 0.955,
|
| 323 |
+
"max_deviation_m": {
|
| 324 |
+
"mean": 0.14021530867902102,
|
| 325 |
+
"median": 0.14211990702903765,
|
| 326 |
+
"p90": 0.26282767141740376
|
| 327 |
+
},
|
| 328 |
+
"settling_time_s": {
|
| 329 |
+
"mean": 4.2852495597766715,
|
| 330 |
+
"median": 5.032300224225037,
|
| 331 |
+
"p90": 6.566111610651016
|
| 332 |
+
},
|
| 333 |
+
"control_energy_kN2s": {
|
| 334 |
+
"mean": 0.05169536143361678,
|
| 335 |
+
"median": 0.049301098669162144,
|
| 336 |
+
"p90": 0.08660803776277522
|
| 337 |
+
},
|
| 338 |
+
"step_overshoot_m": {
|
| 339 |
+
"mean": 0.06807306284281793,
|
| 340 |
+
"median": 0.05462651443438038,
|
| 341 |
+
"p90": 0.07197861751892794
|
| 342 |
+
},
|
| 343 |
+
"iae_ms": {
|
| 344 |
+
"mean": 0.31863218517121167,
|
| 345 |
+
"median": 0.3099200971622497,
|
| 346 |
+
"p90": 0.43473902550345433
|
| 347 |
+
}
|
| 348 |
+
}
|
| 349 |
+
},
|
| 350 |
+
"heavy_load_change(dm>4kg)": {
|
| 351 |
+
"pid": {
|
| 352 |
+
"n": 67,
|
| 353 |
+
"settled_rate": 0.9850746268656716,
|
| 354 |
+
"max_deviation_m": {
|
| 355 |
+
"mean": 0.1939174812147893,
|
| 356 |
+
"median": 0.14942781295861973,
|
| 357 |
+
"p90": 0.32854777427635257
|
| 358 |
+
},
|
| 359 |
+
"settling_time_s": {
|
| 360 |
+
"mean": 2.2086951454247887,
|
| 361 |
+
"median": 1.9464817980211224,
|
| 362 |
+
"p90": 2.57688498785533
|
| 363 |
+
},
|
| 364 |
+
"control_energy_kN2s": {
|
| 365 |
+
"mean": 0.08139073330549218,
|
| 366 |
+
"median": 0.08282572389307474,
|
| 367 |
+
"p90": 0.10550095041535491
|
| 368 |
+
},
|
| 369 |
+
"step_overshoot_m": {
|
| 370 |
+
"mean": 0.15867556885673778,
|
| 371 |
+
"median": 0.127260511513145,
|
| 372 |
+
"p90": 0.297177782280586
|
| 373 |
+
},
|
| 374 |
+
"iae_ms": {
|
| 375 |
+
"mean": 0.43985131775261743,
|
| 376 |
+
"median": 0.36080689436090807,
|
| 377 |
+
"p90": 0.7026169507757137
|
| 378 |
+
}
|
| 379 |
+
},
|
| 380 |
+
"adaptive": {
|
| 381 |
+
"n": 67,
|
| 382 |
+
"settled_rate": 1.0,
|
| 383 |
+
"max_deviation_m": {
|
| 384 |
+
"mean": 0.23871260383227924,
|
| 385 |
+
"median": 0.22908867132835026,
|
| 386 |
+
"p90": 0.3158807588752011
|
| 387 |
+
},
|
| 388 |
+
"settling_time_s": {
|
| 389 |
+
"mean": 5.188844399156132,
|
| 390 |
+
"median": 5.154934212099761,
|
| 391 |
+
"p90": 5.94156158191152
|
| 392 |
+
},
|
| 393 |
+
"control_energy_kN2s": {
|
| 394 |
+
"mean": 0.07524801163671294,
|
| 395 |
+
"median": 0.07448805515987396,
|
| 396 |
+
"p90": 0.09967525569975574
|
| 397 |
+
},
|
| 398 |
+
"step_overshoot_m": {
|
| 399 |
+
"mean": 0.06427099545784856,
|
| 400 |
+
"median": 0.05457923988808033,
|
| 401 |
+
"p90": 0.06674600714256958
|
| 402 |
+
},
|
| 403 |
+
"iae_ms": {
|
| 404 |
+
"mean": 0.3978571445007959,
|
| 405 |
+
"median": 0.37780565983270314,
|
| 406 |
+
"p90": 0.48132419208651583
|
| 407 |
+
}
|
| 408 |
+
}
|
| 409 |
+
},
|
| 410 |
+
"load_removed(dm<0)": {
|
| 411 |
+
"pid": {
|
| 412 |
+
"n": 19,
|
| 413 |
+
"settled_rate": 0.15789473684210525,
|
| 414 |
+
"max_deviation_m": {
|
| 415 |
+
"mean": 0.1128876127513908,
|
| 416 |
+
"median": 0.11739043110441866,
|
| 417 |
+
"p90": 0.20563845249297036
|
| 418 |
+
},
|
| 419 |
+
"settling_time_s": {
|
| 420 |
+
"mean": 6.875238611656486,
|
| 421 |
+
"median": 7.9267780026514085,
|
| 422 |
+
"p90": 8.43277845416218
|
| 423 |
+
},
|
| 424 |
+
"control_energy_kN2s": {
|
| 425 |
+
"mean": 0.03884366443411085,
|
| 426 |
+
"median": 0.034648360295323026,
|
| 427 |
+
"p90": 0.06458584784046394
|
| 428 |
+
},
|
| 429 |
+
"step_overshoot_m": {
|
| 430 |
+
"mean": 0.18789962168813332,
|
| 431 |
+
"median": 0.18525218542524624,
|
| 432 |
+
"p90": 0.29504986475240497
|
| 433 |
+
},
|
| 434 |
+
"iae_ms": {
|
| 435 |
+
"mean": 0.6300266516621532,
|
| 436 |
+
"median": 0.6044820004599968,
|
| 437 |
+
"p90": 1.0325145076139173
|
| 438 |
+
}
|
| 439 |
+
},
|
| 440 |
+
"adaptive": {
|
| 441 |
+
"n": 19,
|
| 442 |
+
"settled_rate": 1.0,
|
| 443 |
+
"max_deviation_m": {
|
| 444 |
+
"mean": 0.02271264795568586,
|
| 445 |
+
"median": 0.02211078268154465,
|
| 446 |
+
"p90": 0.04005277304776542
|
| 447 |
+
},
|
| 448 |
+
"settling_time_s": {
|
| 449 |
+
"mean": 2.042689807377756,
|
| 450 |
+
"median": 0.8997931448742751,
|
| 451 |
+
"p90": 5.115223720042035
|
| 452 |
+
},
|
| 453 |
+
"control_energy_kN2s": {
|
| 454 |
+
"mean": 0.021113421114524338,
|
| 455 |
+
"median": 0.019201658162361995,
|
| 456 |
+
"p90": 0.032189804794278
|
| 457 |
+
},
|
| 458 |
+
"step_overshoot_m": {
|
| 459 |
+
"mean": 0.06459422780946056,
|
| 460 |
+
"median": 0.05521344274226492,
|
| 461 |
+
"p90": 0.06559316956522683
|
| 462 |
+
},
|
| 463 |
+
"iae_ms": {
|
| 464 |
+
"mean": 0.23374347776551188,
|
| 465 |
+
"median": 0.2282680759822837,
|
| 466 |
+
"p90": 0.27913082225159824
|
| 467 |
+
}
|
| 468 |
+
}
|
| 469 |
+
},
|
| 470 |
+
"long_delay(>=40ms)": {
|
| 471 |
+
"pid": {
|
| 472 |
+
"n": 62,
|
| 473 |
+
"settled_rate": 0.5645161290322581,
|
| 474 |
+
"max_deviation_m": {
|
| 475 |
+
"mean": 0.2407791149488127,
|
| 476 |
+
"median": 0.21280761616450272,
|
| 477 |
+
"p90": 0.3858241371327162
|
| 478 |
+
},
|
| 479 |
+
"settling_time_s": {
|
| 480 |
+
"mean": 5.277618588691488,
|
| 481 |
+
"median": 4.957231064066291,
|
| 482 |
+
"p90": 8.3026737767132
|
| 483 |
+
},
|
| 484 |
+
"control_energy_kN2s": {
|
| 485 |
+
"mean": 0.07509517649933214,
|
| 486 |
+
"median": 0.07437207582494504,
|
| 487 |
+
"p90": 0.10165739342190952
|
| 488 |
+
},
|
| 489 |
+
"step_overshoot_m": {
|
| 490 |
+
"mean": 0.2675470333453268,
|
| 491 |
+
"median": 0.26594952405233113,
|
| 492 |
+
"p90": 0.36475256487452856
|
| 493 |
+
},
|
| 494 |
+
"iae_ms": {
|
| 495 |
+
"mean": 0.7693706105551016,
|
| 496 |
+
"median": 0.707538456268709,
|
| 497 |
+
"p90": 1.1381948605541647
|
| 498 |
+
}
|
| 499 |
+
},
|
| 500 |
+
"adaptive": {
|
| 501 |
+
"n": 62,
|
| 502 |
+
"settled_rate": 1.0,
|
| 503 |
+
"max_deviation_m": {
|
| 504 |
+
"mean": 0.15305024112058524,
|
| 505 |
+
"median": 0.14901465023109176,
|
| 506 |
+
"p90": 0.31620177748851447
|
| 507 |
+
},
|
| 508 |
+
"settling_time_s": {
|
| 509 |
+
"mean": 3.3502900485416514,
|
| 510 |
+
"median": 4.293903235318139,
|
| 511 |
+
"p90": 5.179325788370333
|
| 512 |
+
},
|
| 513 |
+
"control_energy_kN2s": {
|
| 514 |
+
"mean": 0.05449004408333132,
|
| 515 |
+
"median": 0.05690684239022806,
|
| 516 |
+
"p90": 0.09111935116711836
|
| 517 |
+
},
|
| 518 |
+
"step_overshoot_m": {
|
| 519 |
+
"mean": 0.07132464641126016,
|
| 520 |
+
"median": 0.05911256317436431,
|
| 521 |
+
"p90": 0.07594615281114882
|
| 522 |
+
},
|
| 523 |
+
"iae_ms": {
|
| 524 |
+
"mean": 0.32209853346149275,
|
| 525 |
+
"median": 0.30820227729089733,
|
| 526 |
+
"p90": 0.45343736201826856
|
| 527 |
+
}
|
| 528 |
+
}
|
| 529 |
+
},
|
| 530 |
+
"high_noise(>2mm)": {
|
| 531 |
+
"pid": {
|
| 532 |
+
"n": 70,
|
| 533 |
+
"settled_rate": 0.7857142857142857,
|
| 534 |
+
"max_deviation_m": {
|
| 535 |
+
"mean": 0.15057118202286246,
|
| 536 |
+
"median": 0.1293700614760638,
|
| 537 |
+
"p90": 0.28822695681097454
|
| 538 |
+
},
|
| 539 |
+
"settling_time_s": {
|
| 540 |
+
"mean": 3.643820981279282,
|
| 541 |
+
"median": 1.989577950113453,
|
| 542 |
+
"p90": 7.700501924366691
|
| 543 |
+
},
|
| 544 |
+
"control_energy_kN2s": {
|
| 545 |
+
"mean": 0.06362102265633562,
|
| 546 |
+
"median": 0.06722487878803904,
|
| 547 |
+
"p90": 0.0941349233520182
|
| 548 |
+
},
|
| 549 |
+
"step_overshoot_m": {
|
| 550 |
+
"mean": 0.159221796995918,
|
| 551 |
+
"median": 0.11750359601555144,
|
| 552 |
+
"p90": 0.29304406989731313
|
| 553 |
+
},
|
| 554 |
+
"iae_ms": {
|
| 555 |
+
"mean": 0.47168919775495144,
|
| 556 |
+
"median": 0.3544814276576983,
|
| 557 |
+
"p90": 0.8329923944548401
|
| 558 |
+
}
|
| 559 |
+
},
|
| 560 |
+
"adaptive": {
|
| 561 |
+
"n": 70,
|
| 562 |
+
"settled_rate": 0.9714285714285714,
|
| 563 |
+
"max_deviation_m": {
|
| 564 |
+
"mean": 0.14975725300086618,
|
| 565 |
+
"median": 0.15679079466004922,
|
| 566 |
+
"p90": 0.28600987282253854
|
| 567 |
+
},
|
| 568 |
+
"settling_time_s": {
|
| 569 |
+
"mean": 4.368072947270502,
|
| 570 |
+
"median": 4.987164463400841,
|
| 571 |
+
"p90": 5.930746293212287
|
| 572 |
+
},
|
| 573 |
+
"control_energy_kN2s": {
|
| 574 |
+
"mean": 0.05387462666817054,
|
| 575 |
+
"median": 0.05008141456365969,
|
| 576 |
+
"p90": 0.08583034571152345
|
| 577 |
+
},
|
| 578 |
+
"step_overshoot_m": {
|
| 579 |
+
"mean": 0.08508197288755587,
|
| 580 |
+
"median": 0.05620082236190077,
|
| 581 |
+
"p90": 0.2011828996843872
|
| 582 |
+
},
|
| 583 |
+
"iae_ms": {
|
| 584 |
+
"mean": 0.34024497787619756,
|
| 585 |
+
"median": 0.34166469001385996,
|
| 586 |
+
"p90": 0.4557991979495734
|
| 587 |
+
}
|
| 588 |
+
}
|
| 589 |
+
}
|
| 590 |
+
},
|
| 591 |
+
"stress": {
|
| 592 |
+
"all": {
|
| 593 |
+
"pid": {
|
| 594 |
+
"n": 200,
|
| 595 |
+
"settled_rate": 0.685,
|
| 596 |
+
"max_deviation_m": {
|
| 597 |
+
"mean": 0.2855939910188152,
|
| 598 |
+
"median": 0.23694032002428864,
|
| 599 |
+
"p90": 0.5396913399858491
|
| 600 |
+
},
|
| 601 |
+
"settling_time_s": {
|
| 602 |
+
"mean": 4.152803508086223,
|
| 603 |
+
"median": 2.1942560235317794,
|
| 604 |
+
"p90": 8.201717946082354
|
| 605 |
+
},
|
| 606 |
+
"control_energy_kN2s": {
|
| 607 |
+
"mean": 0.09809141318590711,
|
| 608 |
+
"median": 0.09243937319578777,
|
| 609 |
+
"p90": 0.16079167666575148
|
| 610 |
+
},
|
| 611 |
+
"step_overshoot_m": {
|
| 612 |
+
"mean": 0.2524753639024782,
|
| 613 |
+
"median": 0.1612935042686407,
|
| 614 |
+
"p90": 0.5252708190521935
|
| 615 |
+
},
|
| 616 |
+
"iae_ms": {
|
| 617 |
+
"mean": 0.780565929476434,
|
| 618 |
+
"median": 0.5146139476911349,
|
| 619 |
+
"p90": 1.5846599095797098
|
| 620 |
+
}
|
| 621 |
+
},
|
| 622 |
+
"adaptive": {
|
| 623 |
+
"n": 200,
|
| 624 |
+
"settled_rate": 0.9,
|
| 625 |
+
"max_deviation_m": {
|
| 626 |
+
"mean": 0.2923813652853192,
|
| 627 |
+
"median": 0.2676242979614739,
|
| 628 |
+
"p90": 0.5040495683093934
|
| 629 |
+
},
|
| 630 |
+
"settling_time_s": {
|
| 631 |
+
"mean": 5.080503508086223,
|
| 632 |
+
"median": 5.097949104961008,
|
| 633 |
+
"p90": 7.22964180780854
|
| 634 |
+
},
|
| 635 |
+
"control_energy_kN2s": {
|
| 636 |
+
"mean": 0.0937084449248433,
|
| 637 |
+
"median": 0.08360216519365156,
|
| 638 |
+
"p90": 0.17271182264999302
|
| 639 |
+
},
|
| 640 |
+
"step_overshoot_m": {
|
| 641 |
+
"mean": 0.1167212926479068,
|
| 642 |
+
"median": 0.06783748113317511,
|
| 643 |
+
"p90": 0.22595619799185618
|
| 644 |
+
},
|
| 645 |
+
"iae_ms": {
|
| 646 |
+
"mean": 0.5682944281041116,
|
| 647 |
+
"median": 0.45527211799410616,
|
| 648 |
+
"p90": 0.816298976476413
|
| 649 |
+
}
|
| 650 |
+
}
|
| 651 |
+
},
|
| 652 |
+
"heavy_load_change(dm>4kg)": {
|
| 653 |
+
"pid": {
|
| 654 |
+
"n": 121,
|
| 655 |
+
"settled_rate": 0.7272727272727273,
|
| 656 |
+
"max_deviation_m": {
|
| 657 |
+
"mean": 0.3223715079909859,
|
| 658 |
+
"median": 0.26211731600950616,
|
| 659 |
+
"p90": 0.5383691063311008
|
| 660 |
+
},
|
| 661 |
+
"settling_time_s": {
|
| 662 |
+
"mean": 3.8171879221668297,
|
| 663 |
+
"median": 2.088499198630452,
|
| 664 |
+
"p90": 8.09921718296595
|
| 665 |
+
},
|
| 666 |
+
"control_energy_kN2s": {
|
| 667 |
+
"mean": 0.12467119658494172,
|
| 668 |
+
"median": 0.12463517436230521,
|
| 669 |
+
"p90": 0.1716531663196487
|
| 670 |
+
},
|
| 671 |
+
"step_overshoot_m": {
|
| 672 |
+
"mean": 0.25022927158644304,
|
| 673 |
+
"median": 0.15479492758800617,
|
| 674 |
+
"p90": 0.5225685379938618
|
| 675 |
+
},
|
| 676 |
+
"iae_ms": {
|
| 677 |
+
"mean": 0.7151869611765325,
|
| 678 |
+
"median": 0.5270401524578711,
|
| 679 |
+
"p90": 1.436820761246725
|
| 680 |
+
}
|
| 681 |
+
},
|
| 682 |
+
"adaptive": {
|
| 683 |
+
"n": 121,
|
| 684 |
+
"settled_rate": 0.8760330578512396,
|
| 685 |
+
"max_deviation_m": {
|
| 686 |
+
"mean": 0.4063501081883159,
|
| 687 |
+
"median": 0.3568336751505972,
|
| 688 |
+
"p90": 0.6017598572428797
|
| 689 |
+
},
|
| 690 |
+
"settling_time_s": {
|
| 691 |
+
"mean": 5.438097013075922,
|
| 692 |
+
"median": 5.0953152170684195,
|
| 693 |
+
"p90": 7.720291265994311
|
| 694 |
+
},
|
| 695 |
+
"control_energy_kN2s": {
|
| 696 |
+
"mean": 0.12892107364240388,
|
| 697 |
+
"median": 0.11976973322020527,
|
| 698 |
+
"p90": 0.18818024615324366
|
| 699 |
+
},
|
| 700 |
+
"step_overshoot_m": {
|
| 701 |
+
"mean": 0.11810218105307989,
|
| 702 |
+
"median": 0.06371030738129291,
|
| 703 |
+
"p90": 0.22602373008566723
|
| 704 |
+
},
|
| 705 |
+
"iae_ms": {
|
| 706 |
+
"mean": 0.7057153639455523,
|
| 707 |
+
"median": 0.5366930024814522,
|
| 708 |
+
"p90": 1.2922411988463978
|
| 709 |
+
}
|
| 710 |
+
}
|
| 711 |
+
},
|
| 712 |
+
"load_removed(dm<0)": {
|
| 713 |
+
"pid": {
|
| 714 |
+
"n": 10,
|
| 715 |
+
"settled_rate": 0.2,
|
| 716 |
+
"max_deviation_m": {
|
| 717 |
+
"mean": 0.23407067341693608,
|
| 718 |
+
"median": 0.16807861473900382,
|
| 719 |
+
"p90": 0.575180610729667
|
| 720 |
+
},
|
| 721 |
+
"settling_time_s": {
|
| 722 |
+
"mean": 6.8541850189408295,
|
| 723 |
+
"median": 7.759394548381679,
|
| 724 |
+
"p90": 8.398554700994865
|
| 725 |
+
},
|
| 726 |
+
"control_energy_kN2s": {
|
| 727 |
+
"mean": 0.04393635494869176,
|
| 728 |
+
"median": 0.038042035267232294,
|
| 729 |
+
"p90": 0.06271953718288988
|
| 730 |
+
},
|
| 731 |
+
"step_overshoot_m": {
|
| 732 |
+
"mean": 0.23466321259631515,
|
| 733 |
+
"median": 0.22331772455169557,
|
| 734 |
+
"p90": 0.4657983592759367
|
| 735 |
+
},
|
| 736 |
+
"iae_ms": {
|
| 737 |
+
"mean": 1.0400317268749772,
|
| 738 |
+
"median": 0.8415718584735021,
|
| 739 |
+
"p90": 2.5703854149281087
|
| 740 |
+
}
|
| 741 |
+
},
|
| 742 |
+
"adaptive": {
|
| 743 |
+
"n": 10,
|
| 744 |
+
"settled_rate": 1.0,
|
| 745 |
+
"max_deviation_m": {
|
| 746 |
+
"mean": 0.035379577297461426,
|
| 747 |
+
"median": 0.025984810007543102,
|
| 748 |
+
"p90": 0.056359457232016325
|
| 749 |
+
},
|
| 750 |
+
"settling_time_s": {
|
| 751 |
+
"mean": 3.678185018940829,
|
| 752 |
+
"median": 3.7247554179513824,
|
| 753 |
+
"p90": 5.904211094054394
|
| 754 |
+
},
|
| 755 |
+
"control_energy_kN2s": {
|
| 756 |
+
"mean": 0.02382208855485987,
|
| 757 |
+
"median": 0.018928991261040865,
|
| 758 |
+
"p90": 0.0390841207521684
|
| 759 |
+
},
|
| 760 |
+
"step_overshoot_m": {
|
| 761 |
+
"mean": 0.12013487717466238,
|
| 762 |
+
"median": 0.08345213568486481,
|
| 763 |
+
"p90": 0.20912883829208387
|
| 764 |
+
},
|
| 765 |
+
"iae_ms": {
|
| 766 |
+
"mean": 0.2961774346218216,
|
| 767 |
+
"median": 0.2900404095817386,
|
| 768 |
+
"p90": 0.37409044056783675
|
| 769 |
+
}
|
| 770 |
+
}
|
| 771 |
+
},
|
| 772 |
+
"long_delay(>=40ms)": {
|
| 773 |
+
"pid": {
|
| 774 |
+
"n": 88,
|
| 775 |
+
"settled_rate": 0.5113636363636364,
|
| 776 |
+
"max_deviation_m": {
|
| 777 |
+
"mean": 0.44748223389070324,
|
| 778 |
+
"median": 0.3958899683793515,
|
| 779 |
+
"p90": 0.6711262423014366
|
| 780 |
+
},
|
| 781 |
+
"settling_time_s": {
|
| 782 |
+
"mean": 5.467218355154089,
|
| 783 |
+
"median": 6.2690533157158645,
|
| 784 |
+
"p90": 8.312222193563358
|
| 785 |
+
},
|
| 786 |
+
"control_energy_kN2s": {
|
| 787 |
+
"mean": 0.11361830217404124,
|
| 788 |
+
"median": 0.11070854621766016,
|
| 789 |
+
"p90": 0.16927245292826815
|
| 790 |
+
},
|
| 791 |
+
"step_overshoot_m": {
|
| 792 |
+
"mean": 0.4377477733668394,
|
| 793 |
+
"median": 0.31696824992869704,
|
| 794 |
+
"p90": 0.8382593415607009
|
| 795 |
+
},
|
| 796 |
+
"iae_ms": {
|
| 797 |
+
"mean": 1.2921158375655375,
|
| 798 |
+
"median": 0.908040805394889,
|
| 799 |
+
"p90": 2.6628951601532784
|
| 800 |
+
}
|
| 801 |
+
},
|
| 802 |
+
"adaptive": {
|
| 803 |
+
"n": 88,
|
| 804 |
+
"settled_rate": 0.8181818181818182,
|
| 805 |
+
"max_deviation_m": {
|
| 806 |
+
"mean": 0.3591045269390054,
|
| 807 |
+
"median": 0.3160394942419994,
|
| 808 |
+
"p90": 0.6877679020814136
|
| 809 |
+
},
|
| 810 |
+
"settling_time_s": {
|
| 811 |
+
"mean": 5.046991082426818,
|
| 812 |
+
"median": 4.882426600623877,
|
| 813 |
+
"p90": 8.007146026331931
|
| 814 |
+
},
|
| 815 |
+
"control_energy_kN2s": {
|
| 816 |
+
"mean": 0.10769234997335562,
|
| 817 |
+
"median": 0.09289250705252046,
|
| 818 |
+
"p90": 0.20593977630573185
|
| 819 |
+
},
|
| 820 |
+
"step_overshoot_m": {
|
| 821 |
+
"mean": 0.1251615146624932,
|
| 822 |
+
"median": 0.08383211253162448,
|
| 823 |
+
"p90": 0.2130355115166301
|
| 824 |
+
},
|
| 825 |
+
"iae_ms": {
|
| 826 |
+
"mean": 0.738068806680679,
|
| 827 |
+
"median": 0.5295870522696209,
|
| 828 |
+
"p90": 1.610208459273406
|
| 829 |
+
}
|
| 830 |
+
}
|
| 831 |
+
},
|
| 832 |
+
"high_noise(>2mm)": {
|
| 833 |
+
"pid": {
|
| 834 |
+
"n": 143,
|
| 835 |
+
"settled_rate": 0.6503496503496503,
|
| 836 |
+
"max_deviation_m": {
|
| 837 |
+
"mean": 0.29415987011218553,
|
| 838 |
+
"median": 0.2380274981292655,
|
| 839 |
+
"p90": 0.5495332120095521
|
| 840 |
+
},
|
| 841 |
+
"settling_time_s": {
|
| 842 |
+
"mean": 4.362653108898655,
|
| 843 |
+
"median": 2.301162269562483,
|
| 844 |
+
"p90": 8.214102686112748
|
| 845 |
+
},
|
| 846 |
+
"control_energy_kN2s": {
|
| 847 |
+
"mean": 0.10091302880053449,
|
| 848 |
+
"median": 0.09599427160852374,
|
| 849 |
+
"p90": 0.1607164639012419
|
| 850 |
+
},
|
| 851 |
+
"step_overshoot_m": {
|
| 852 |
+
"mean": 0.26364479310089656,
|
| 853 |
+
"median": 0.16788356754574418,
|
| 854 |
+
"p90": 0.6146570039239294
|
| 855 |
+
},
|
| 856 |
+
"iae_ms": {
|
| 857 |
+
"mean": 0.8180334981865162,
|
| 858 |
+
"median": 0.5380534841109816,
|
| 859 |
+
"p90": 1.6515277272136497
|
| 860 |
+
}
|
| 861 |
+
},
|
| 862 |
+
"adaptive": {
|
| 863 |
+
"n": 143,
|
| 864 |
+
"settled_rate": 0.8951048951048951,
|
| 865 |
+
"max_deviation_m": {
|
| 866 |
+
"mean": 0.30965762148192066,
|
| 867 |
+
"median": 0.2777016596181938,
|
| 868 |
+
"p90": 0.5262971253416756
|
| 869 |
+
},
|
| 870 |
+
"settling_time_s": {
|
| 871 |
+
"mean": 5.187688073933619,
|
| 872 |
+
"median": 5.100582992853596,
|
| 873 |
+
"p90": 7.224360503148287
|
| 874 |
+
},
|
| 875 |
+
"control_energy_kN2s": {
|
| 876 |
+
"mean": 0.09728914269230954,
|
| 877 |
+
"median": 0.08675591607064322,
|
| 878 |
+
"p90": 0.17717254306391475
|
| 879 |
+
},
|
| 880 |
+
"step_overshoot_m": {
|
| 881 |
+
"mean": 0.13831806715781195,
|
| 882 |
+
"median": 0.10466612578841261,
|
| 883 |
+
"p90": 0.23406707310752048
|
| 884 |
+
},
|
| 885 |
+
"iae_ms": {
|
| 886 |
+
"mean": 0.615803499784918,
|
| 887 |
+
"median": 0.5035751254105679,
|
| 888 |
+
"p90": 1.0919949579896426
|
| 889 |
+
}
|
| 890 |
+
}
|
| 891 |
+
}
|
| 892 |
+
}
|
| 893 |
+
},
|
| 894 |
+
"paired_wins": {
|
| 895 |
+
"nominal": {
|
| 896 |
+
"max_deviation_m": {
|
| 897 |
+
"adaptive_better": 86,
|
| 898 |
+
"n": 200
|
| 899 |
+
},
|
| 900 |
+
"settling_time_s": {
|
| 901 |
+
"adaptive_better": 62,
|
| 902 |
+
"n": 200
|
| 903 |
+
},
|
| 904 |
+
"control_energy_kN2s": {
|
| 905 |
+
"adaptive_better": 178,
|
| 906 |
+
"n": 200
|
| 907 |
+
}
|
| 908 |
+
},
|
| 909 |
+
"stress": {
|
| 910 |
+
"max_deviation_m": {
|
| 911 |
+
"adaptive_better": 69,
|
| 912 |
+
"n": 200
|
| 913 |
+
},
|
| 914 |
+
"settling_time_s": {
|
| 915 |
+
"adaptive_better": 67,
|
| 916 |
+
"n": 200
|
| 917 |
+
},
|
| 918 |
+
"control_energy_kN2s": {
|
| 919 |
+
"adaptive_better": 148,
|
| 920 |
+
"n": 200
|
| 921 |
+
}
|
| 922 |
+
}
|
| 923 |
+
},
|
| 924 |
+
"failures_not_settled": [
|
| 925 |
+
{
|
| 926 |
+
"split": "stress",
|
| 927 |
+
"seed": 5006,
|
| 928 |
+
"ctrl": "pid",
|
| 929 |
+
"dm": 9.980523464269936,
|
| 930 |
+
"delay": 7,
|
| 931 |
+
"noise": 0.0001678999112918973,
|
| 932 |
+
"fric_gain": 3.147387076402083,
|
| 933 |
+
"max_deviation_m": 1.4955338006835528,
|
| 934 |
+
"settling_time_s": 7.829327588910237,
|
| 935 |
+
"settled": false,
|
| 936 |
+
"control_energy_kN2s": 0.19012256847329378,
|
| 937 |
+
"step_overshoot_m": 1.531371510018829,
|
| 938 |
+
"final_error_m": 0.06089847967813927,
|
| 939 |
+
"iae_ms": 3.6463211724444267
|
| 940 |
+
},
|
| 941 |
+
{
|
| 942 |
+
"split": "stress",
|
| 943 |
+
"seed": 5023,
|
| 944 |
+
"ctrl": "pid",
|
| 945 |
+
"dm": 0.6660738771315664,
|
| 946 |
+
"delay": 7,
|
| 947 |
+
"noise": 0.0033733501229435206,
|
| 948 |
+
"fric_gain": 1.198689583921805,
|
| 949 |
+
"max_deviation_m": 1.4831441445059361,
|
| 950 |
+
"settling_time_s": 8.359261705316603,
|
| 951 |
+
"settled": false,
|
| 952 |
+
"control_energy_kN2s": 0.07519035099964805,
|
| 953 |
+
"step_overshoot_m": 1.6284352896230545,
|
| 954 |
+
"final_error_m": 0.05351668852134883,
|
| 955 |
+
"iae_ms": 8.73299760011718
|
| 956 |
+
},
|
| 957 |
+
{
|
| 958 |
+
"split": "stress",
|
| 959 |
+
"seed": 5096,
|
| 960 |
+
"ctrl": "adaptive",
|
| 961 |
+
"dm": 7.563551286933944,
|
| 962 |
+
"delay": 7,
|
| 963 |
+
"noise": 0.003959082144778222,
|
| 964 |
+
"fric_gain": 2.2102824868634343,
|
| 965 |
+
"max_deviation_m": 1.316670825257937,
|
| 966 |
+
"settling_time_s": 8.486538743143901,
|
| 967 |
+
"settled": false,
|
| 968 |
+
"control_energy_kN2s": 0.20462467580768454,
|
| 969 |
+
"step_overshoot_m": 0.14727423074421797,
|
| 970 |
+
"final_error_m": 0.13277760877616462,
|
| 971 |
+
"iae_ms": 2.488541381759503
|
| 972 |
+
},
|
| 973 |
+
{
|
| 974 |
+
"split": "stress",
|
| 975 |
+
"seed": 5175,
|
| 976 |
+
"ctrl": "adaptive",
|
| 977 |
+
"dm": 6.1426523886621,
|
| 978 |
+
"delay": 7,
|
| 979 |
+
"noise": 0.0053911508638411765,
|
| 980 |
+
"fric_gain": 1.9120526164770126,
|
| 981 |
+
"max_deviation_m": 1.2476126604599047,
|
| 982 |
+
"settling_time_s": 7.529022064302117,
|
| 983 |
+
"settled": false,
|
| 984 |
+
"control_energy_kN2s": 0.17456117867565046,
|
| 985 |
+
"step_overshoot_m": 0.6249351654551218,
|
| 986 |
+
"final_error_m": 0.03972174106661125,
|
| 987 |
+
"iae_ms": 3.5915506243342383
|
| 988 |
+
},
|
| 989 |
+
{
|
| 990 |
+
"split": "stress",
|
| 991 |
+
"seed": 5006,
|
| 992 |
+
"ctrl": "adaptive",
|
| 993 |
+
"dm": 9.980523464269936,
|
| 994 |
+
"delay": 7,
|
| 995 |
+
"noise": 0.0001678999112918973,
|
| 996 |
+
"fric_gain": 3.147387076402083,
|
| 997 |
+
"max_deviation_m": 1.1536597679275231,
|
| 998 |
+
"settling_time_s": 7.829327588910237,
|
| 999 |
+
"settled": false,
|
| 1000 |
+
"control_energy_kN2s": 0.26824041120762354,
|
| 1001 |
+
"step_overshoot_m": 0.11207839091492533,
|
| 1002 |
+
"final_error_m": 0.019867886094438014,
|
| 1003 |
+
"iae_ms": 2.1177172781242066
|
| 1004 |
+
},
|
| 1005 |
+
{
|
| 1006 |
+
"split": "stress",
|
| 1007 |
+
"seed": 5195,
|
| 1008 |
+
"ctrl": "adaptive",
|
| 1009 |
+
"dm": 9.22272419044748,
|
| 1010 |
+
"delay": 7,
|
| 1011 |
+
"noise": 0.0058828911166638135,
|
| 1012 |
+
"fric_gain": 1.194676574319601,
|
| 1013 |
+
"max_deviation_m": 1.0659340221835816,
|
| 1014 |
+
"settling_time_s": 7.894380318708718,
|
| 1015 |
+
"settled": false,
|
| 1016 |
+
"control_energy_kN2s": 0.3454769769300227,
|
| 1017 |
+
"step_overshoot_m": 0.46184282776162233,
|
| 1018 |
+
"final_error_m": 0.1655872270968045,
|
| 1019 |
+
"iae_ms": 2.7988479737272667
|
| 1020 |
+
},
|
| 1021 |
+
{
|
| 1022 |
+
"split": "stress",
|
| 1023 |
+
"seed": 5133,
|
| 1024 |
+
"ctrl": "pid",
|
| 1025 |
+
"dm": 1.8998408154584467,
|
| 1026 |
+
"delay": 7,
|
| 1027 |
+
"noise": 0.0026589490757323803,
|
| 1028 |
+
"fric_gain": 4.598371108528227,
|
| 1029 |
+
"max_deviation_m": 1.0343645974383842,
|
| 1030 |
+
"settling_time_s": 8.154892178261653,
|
| 1031 |
+
"settled": false,
|
| 1032 |
+
"control_energy_kN2s": 0.08827018005550984,
|
| 1033 |
+
"step_overshoot_m": 1.033778911690269,
|
| 1034 |
+
"final_error_m": 0.03261518791343887,
|
| 1035 |
+
"iae_ms": 2.8476171062120263
|
| 1036 |
+
},
|
| 1037 |
+
{
|
| 1038 |
+
"split": "stress",
|
| 1039 |
+
"seed": 5100,
|
| 1040 |
+
"ctrl": "pid",
|
| 1041 |
+
"dm": 3.6696945358999074,
|
| 1042 |
+
"delay": 7,
|
| 1043 |
+
"noise": 0.0011527455830946565,
|
| 1044 |
+
"fric_gain": 4.752193516120315,
|
| 1045 |
+
"max_deviation_m": 0.9756993377577181,
|
| 1046 |
+
"settling_time_s": 7.547322923792526,
|
| 1047 |
+
"settled": false,
|
| 1048 |
+
"control_energy_kN2s": 0.09588222903427067,
|
| 1049 |
+
"step_overshoot_m": 0.9049223352851041,
|
| 1050 |
+
"final_error_m": 0.0685738247125311,
|
| 1051 |
+
"iae_ms": 2.894819580123207
|
| 1052 |
+
},
|
| 1053 |
+
{
|
| 1054 |
+
"split": "stress",
|
| 1055 |
+
"seed": 5102,
|
| 1056 |
+
"ctrl": "pid",
|
| 1057 |
+
"dm": 0.6093599193263799,
|
| 1058 |
+
"delay": 7,
|
| 1059 |
+
"noise": 0.005132095199078321,
|
| 1060 |
+
"fric_gain": 2.254251067293808,
|
| 1061 |
+
"max_deviation_m": 0.9170366202760085,
|
| 1062 |
+
"settling_time_s": 7.612362380614504,
|
| 1063 |
+
"settled": false,
|
| 1064 |
+
"control_energy_kN2s": 0.07657289572972086,
|
| 1065 |
+
"step_overshoot_m": 0.8800238157090448,
|
| 1066 |
+
"final_error_m": 0.19899685234966702,
|
| 1067 |
+
"iae_ms": 3.367243492551143
|
| 1068 |
+
},
|
| 1069 |
+
{
|
| 1070 |
+
"split": "stress",
|
| 1071 |
+
"seed": 5085,
|
| 1072 |
+
"ctrl": "adaptive",
|
| 1073 |
+
"dm": 9.970788925420493,
|
| 1074 |
+
"delay": 6,
|
| 1075 |
+
"noise": 0.003966700122691691,
|
| 1076 |
+
"fric_gain": 3.480353902792558,
|
| 1077 |
+
"max_deviation_m": 0.8416004299145812,
|
| 1078 |
+
"settling_time_s": 7.963486954141409,
|
| 1079 |
+
"settled": false,
|
| 1080 |
+
"control_energy_kN2s": 0.2674837837657171,
|
| 1081 |
+
"step_overshoot_m": 0.0928410096215192,
|
| 1082 |
+
"final_error_m": 0.007123170747089735,
|
| 1083 |
+
"iae_ms": 1.3334591852754718
|
| 1084 |
+
},
|
| 1085 |
+
{
|
| 1086 |
+
"split": "stress",
|
| 1087 |
+
"seed": 5157,
|
| 1088 |
+
"ctrl": "adaptive",
|
| 1089 |
+
"dm": 8.91988121997565,
|
| 1090 |
+
"delay": 7,
|
| 1091 |
+
"noise": 0.0031509445421397685,
|
| 1092 |
+
"fric_gain": 1.5880136415362358,
|
| 1093 |
+
"max_deviation_m": 0.7961974430793823,
|
| 1094 |
+
"settling_time_s": 8.317174410689622,
|
| 1095 |
+
"settled": false,
|
| 1096 |
+
"control_energy_kN2s": 0.2309670192260483,
|
| 1097 |
+
"step_overshoot_m": 0.10466612578841261,
|
| 1098 |
+
"final_error_m": 0.02264756800309564,
|
| 1099 |
+
"iae_ms": 1.7598109808020048
|
| 1100 |
+
},
|
| 1101 |
+
{
|
| 1102 |
+
"split": "stress",
|
| 1103 |
+
"seed": 5059,
|
| 1104 |
+
"ctrl": "pid",
|
| 1105 |
+
"dm": 4.724308278411627,
|
| 1106 |
+
"delay": 7,
|
| 1107 |
+
"noise": 0.0024085854361765085,
|
| 1108 |
+
"fric_gain": 3.715345413889736,
|
| 1109 |
+
"max_deviation_m": 0.7907129530513459,
|
| 1110 |
+
"settling_time_s": 7.909283031253144,
|
| 1111 |
+
"settled": false,
|
| 1112 |
+
"control_energy_kN2s": 0.12761404319137074,
|
| 1113 |
+
"step_overshoot_m": 1.080833673349849,
|
| 1114 |
+
"final_error_m": 0.10022215626914965,
|
| 1115 |
+
"iae_ms": 2.6648132729636957
|
| 1116 |
+
},
|
| 1117 |
+
{
|
| 1118 |
+
"split": "stress",
|
| 1119 |
+
"seed": 5016,
|
| 1120 |
+
"ctrl": "pid",
|
| 1121 |
+
"dm": -0.7718999427743256,
|
| 1122 |
+
"delay": 5,
|
| 1123 |
+
"noise": 0.005794490132946521,
|
| 1124 |
+
"fric_gain": 2.2526944710407406,
|
| 1125 |
+
"max_deviation_m": 0.7874831213894129,
|
| 1126 |
+
"settling_time_s": 7.621718591796235,
|
| 1127 |
+
"settled": false,
|
| 1128 |
+
"control_energy_kN2s": 0.0284492735268269,
|
| 1129 |
+
"step_overshoot_m": 0.4707945858910141,
|
| 1130 |
+
"final_error_m": 0.0037102530621222485,
|
| 1131 |
+
"iae_ms": 2.560197893052792
|
| 1132 |
+
},
|
| 1133 |
+
{
|
| 1134 |
+
"split": "stress",
|
| 1135 |
+
"seed": 5142,
|
| 1136 |
+
"ctrl": "adaptive",
|
| 1137 |
+
"dm": 8.864927280694246,
|
| 1138 |
+
"delay": 7,
|
| 1139 |
+
"noise": 0.004657371095381677,
|
| 1140 |
+
"fric_gain": 2.6148215322755277,
|
| 1141 |
+
"max_deviation_m": 0.744946802372582,
|
| 1142 |
+
"settling_time_s": 8.036368309762329,
|
| 1143 |
+
"settled": false,
|
| 1144 |
+
"control_energy_kN2s": 0.24463553623945897,
|
| 1145 |
+
"step_overshoot_m": 0.11217331513372353,
|
| 1146 |
+
"final_error_m": 0.1136988270425372,
|
| 1147 |
+
"iae_ms": 1.6716054537789706
|
| 1148 |
+
},
|
| 1149 |
+
{
|
| 1150 |
+
"split": "stress",
|
| 1151 |
+
"seed": 5195,
|
| 1152 |
+
"ctrl": "pid",
|
| 1153 |
+
"dm": 9.22272419044748,
|
| 1154 |
+
"delay": 7,
|
| 1155 |
+
"noise": 0.0058828911166638135,
|
| 1156 |
+
"fric_gain": 1.194676574319601,
|
| 1157 |
+
"max_deviation_m": 0.6989776707091494,
|
| 1158 |
+
"settling_time_s": 7.894380318708718,
|
| 1159 |
+
"settled": false,
|
| 1160 |
+
"control_energy_kN2s": 0.20964382807403195,
|
| 1161 |
+
"step_overshoot_m": 0.500946409112929,
|
| 1162 |
+
"final_error_m": 0.03501792355889133,
|
| 1163 |
+
"iae_ms": 1.4919790155406412
|
| 1164 |
+
},
|
| 1165 |
+
{
|
| 1166 |
+
"split": "stress",
|
| 1167 |
+
"seed": 5148,
|
| 1168 |
+
"ctrl": "pid",
|
| 1169 |
+
"dm": 0.36287928046658635,
|
| 1170 |
+
"delay": 7,
|
| 1171 |
+
"noise": 0.0021170607511885463,
|
| 1172 |
+
"fric_gain": 3.3758450464811176,
|
| 1173 |
+
"max_deviation_m": 0.6591899158409884,
|
| 1174 |
+
"settling_time_s": 7.522007108675316,
|
| 1175 |
+
"settled": false,
|
| 1176 |
+
"control_energy_kN2s": 0.10025643302486421,
|
| 1177 |
+
"step_overshoot_m": 0.7136313896317514,
|
| 1178 |
+
"final_error_m": 0.19634350996526406,
|
| 1179 |
+
"iae_ms": 2.687511950654677
|
| 1180 |
+
},
|
| 1181 |
+
{
|
| 1182 |
+
"split": "stress",
|
| 1183 |
+
"seed": 5142,
|
| 1184 |
+
"ctrl": "pid",
|
| 1185 |
+
"dm": 8.864927280694246,
|
| 1186 |
+
"delay": 7,
|
| 1187 |
+
"noise": 0.004657371095381677,
|
| 1188 |
+
"fric_gain": 2.6148215322755277,
|
| 1189 |
+
"max_deviation_m": 0.6439192597179966,
|
| 1190 |
+
"settling_time_s": 8.036368309762329,
|
| 1191 |
+
"settled": false,
|
| 1192 |
+
"control_energy_kN2s": 0.1711354579845949,
|
| 1193 |
+
"step_overshoot_m": 0.7740934650765139,
|
| 1194 |
+
"final_error_m": 0.022579959199304833,
|
| 1195 |
+
"iae_ms": 1.8425790706872633
|
| 1196 |
+
},
|
| 1197 |
+
{
|
| 1198 |
+
"split": "stress",
|
| 1199 |
+
"seed": 5061,
|
| 1200 |
+
"ctrl": "pid",
|
| 1201 |
+
"dm": 9.228373318677768,
|
| 1202 |
+
"delay": 6,
|
| 1203 |
+
"noise": 0.0011696923300623895,
|
| 1204 |
+
"fric_gain": 5.410471260780469,
|
| 1205 |
+
"max_deviation_m": 0.6325691107838162,
|
| 1206 |
+
"settling_time_s": 8.460148148247972,
|
| 1207 |
+
"settled": false,
|
| 1208 |
+
"control_energy_kN2s": 0.18089816930252955,
|
| 1209 |
+
"step_overshoot_m": 0.38499176730395857,
|
| 1210 |
+
"final_error_m": 0.035145666346633964,
|
| 1211 |
+
"iae_ms": 1.2513241669549189
|
| 1212 |
+
},
|
| 1213 |
+
{
|
| 1214 |
+
"split": "stress",
|
| 1215 |
+
"seed": 5157,
|
| 1216 |
+
"ctrl": "pid",
|
| 1217 |
+
"dm": 8.91988121997565,
|
| 1218 |
+
"delay": 7,
|
| 1219 |
+
"noise": 0.0031509445421397685,
|
| 1220 |
+
"fric_gain": 1.5880136415362358,
|
| 1221 |
+
"max_deviation_m": 0.6260006043022233,
|
| 1222 |
+
"settling_time_s": 8.317174410689622,
|
| 1223 |
+
"settled": false,
|
| 1224 |
+
"control_energy_kN2s": 0.15394873113543087,
|
| 1225 |
+
"step_overshoot_m": 0.7700712765468121,
|
| 1226 |
+
"final_error_m": 0.024501909634130847,
|
| 1227 |
+
"iae_ms": 1.6649193259750243
|
| 1228 |
+
},
|
| 1229 |
+
{
|
| 1230 |
+
"split": "stress",
|
| 1231 |
+
"seed": 5179,
|
| 1232 |
+
"ctrl": "pid",
|
| 1233 |
+
"dm": 1.4444636353291571,
|
| 1234 |
+
"delay": 7,
|
| 1235 |
+
"noise": 0.005041373414453119,
|
| 1236 |
+
"fric_gain": 3.1350709605030715,
|
| 1237 |
+
"max_deviation_m": 0.6189971076759178,
|
| 1238 |
+
"settling_time_s": 7.834829899957404,
|
| 1239 |
+
"settled": false,
|
| 1240 |
+
"control_energy_kN2s": 0.06073641417786291,
|
| 1241 |
+
"step_overshoot_m": 0.9190520239276558,
|
| 1242 |
+
"final_error_m": 0.057428660944872756,
|
| 1243 |
+
"iae_ms": 3.1538552150389405
|
| 1244 |
+
}
|
| 1245 |
+
],
|
| 1246 |
+
"n_not_settled": {
|
| 1247 |
+
"nominal/pid": 38,
|
| 1248 |
+
"nominal/adaptive": 9,
|
| 1249 |
+
"stress/pid": 63,
|
| 1250 |
+
"stress/adaptive": 20
|
| 1251 |
+
},
|
| 1252 |
+
"media": {
|
| 1253 |
+
"file": "replay.mp4",
|
| 1254 |
+
"frames": 600,
|
| 1255 |
+
"fps": 25,
|
| 1256 |
+
"bytes": 182074
|
| 1257 |
+
},
|
| 1258 |
+
"tests": {
|
| 1259 |
+
"reload": {
|
| 1260 |
+
"returncode": 0,
|
| 1261 |
+
"seconds": 0.26,
|
| 1262 |
+
"process": "fresh python -E subprocess, cwd = temporary copy of the model folder",
|
| 1263 |
+
"passed": true,
|
| 1264 |
+
"cases": 6,
|
| 1265 |
+
"max_abs_diff": 0.0
|
| 1266 |
+
},
|
| 1267 |
+
"node_parity": {
|
| 1268 |
+
"cases": 6,
|
| 1269 |
+
"failed": 0,
|
| 1270 |
+
"maxDiff": 8.459899447643693e-14,
|
| 1271 |
+
"results": [
|
| 1272 |
+
{
|
| 1273 |
+
"name": "case0-pid",
|
| 1274 |
+
"maxDiff": 1.1102230246251565e-16
|
| 1275 |
+
},
|
| 1276 |
+
{
|
| 1277 |
+
"name": "case0-adaptive",
|
| 1278 |
+
"maxDiff": 7.716050021144838e-15
|
| 1279 |
+
},
|
| 1280 |
+
{
|
| 1281 |
+
"name": "case1-pid",
|
| 1282 |
+
"maxDiff": 1.3322676295501878e-15
|
| 1283 |
+
},
|
| 1284 |
+
{
|
| 1285 |
+
"name": "case1-adaptive",
|
| 1286 |
+
"maxDiff": 8.459899447643693e-14
|
| 1287 |
+
},
|
| 1288 |
+
{
|
| 1289 |
+
"name": "case2-pid",
|
| 1290 |
+
"maxDiff": 1.1102230246251565e-16
|
| 1291 |
+
},
|
| 1292 |
+
{
|
| 1293 |
+
"name": "case2-adaptive",
|
| 1294 |
+
"maxDiff": 7.494005416219807e-16
|
| 1295 |
+
}
|
| 1296 |
+
],
|
| 1297 |
+
"ms": 29,
|
| 1298 |
+
"runtime": "node v22.23.4",
|
| 1299 |
+
"status": "passed"
|
| 1300 |
+
},
|
| 1301 |
+
"browser": {
|
| 1302 |
+
"status": "skipped",
|
| 1303 |
+
"reason": "playwright not installed"
|
| 1304 |
+
}
|
| 1305 |
+
},
|
| 1306 |
+
"not_run": [
|
| 1307 |
+
"No hardware experiment. Actuator, friction and sensor models are idealised."
|
| 1308 |
+
]
|
| 1309 |
+
}
|
index.html
CHANGED
|
@@ -1,19 +1,50 @@
|
|
| 1 |
<!doctype html>
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
</html>
|
|
|
|
| 1 |
<!doctype html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="utf-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
| 6 |
+
<link rel="icon" href="data:,">
|
| 7 |
+
<title>Next Balance</title>
|
| 8 |
+
<link rel="stylesheet" href="style.css">
|
| 9 |
+
</head>
|
| 10 |
+
<body>
|
| 11 |
+
<main>
|
| 12 |
+
<header>
|
| 13 |
+
<h1>Next Balance</h1>
|
| 14 |
+
<p>A lift platform must hold 0.5 m while its payload and friction change. Move the sliders: a fixed PID controller and an adaptive controller (online mass and friction estimation) are re-simulated in your browser under the same disturbances.</p>
|
| 15 |
+
<div class="badges"><span class="badge warn">Simulation only</span><span class="badge">Live in-browser simulation</span><a class="badge" href="https://huggingface.co/thelamapi/Next-Balance">Model repo</a></div>
|
| 16 |
+
</header>
|
| 17 |
+
<div class="grid">
|
| 18 |
+
<section class="card">
|
| 19 |
+
<h2>Conditions</h2>
|
| 20 |
+
<div id="sliders"></div>
|
| 21 |
+
</section>
|
| 22 |
+
<section class="card">
|
| 23 |
+
<h2>Platform</h2>
|
| 24 |
+
<canvas id="anim"></canvas>
|
| 25 |
+
<div class="row" style="margin-top:6px"><button id="play">Play</button><input type="range" id="scrub" min="0" max="1199" value="600" style="flex:1" aria-label="time"></div>
|
| 26 |
+
<div class="scroll" style="margin-top:8px"><table id="tbl"></table></div>
|
| 27 |
+
</section>
|
| 28 |
+
</div>
|
| 29 |
+
<section class="card" style="margin-top:12px">
|
| 30 |
+
<h2>Platform height</h2>
|
| 31 |
+
<canvas id="zc"></canvas><div id="zl"></div>
|
| 32 |
+
</section>
|
| 33 |
+
<div class="grid" style="margin-top:12px">
|
| 34 |
+
<section class="card"><h2>Actuator force (N)</h2><canvas id="uc"></canvas></section>
|
| 35 |
+
<section class="card"><h2>Mass estimate (kg)</h2><canvas id="mc"></canvas><div id="ml"></div></section>
|
| 36 |
+
</div>
|
| 37 |
+
<section class="card" style="margin-top:12px">
|
| 38 |
+
<h2>Recorded replay</h2>
|
| 39 |
+
<p class="small muted">Rendered by the notebook from a held-out stress scenario.</p>
|
| 40 |
+
<video src="replay.mp4" controls muted playsinline poster="preview.png"></video>
|
| 41 |
+
</section>
|
| 42 |
+
<p class="status" id="status"></p>
|
| 43 |
+
<footer>Planar 1-D simulation with idealised actuator and sensor. Not validated on hardware.</footer>
|
| 44 |
+
</main>
|
| 45 |
+
<script src="nlrt.js"></script>
|
| 46 |
+
<script src="nlui.js"></script>
|
| 47 |
+
<script src="core.js"></script>
|
| 48 |
+
<script src="app.js"></script>
|
| 49 |
+
</body>
|
| 50 |
</html>
|
model.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"format":"nlrt-1","meta":{"name":"Next Balance","params":{"pid":{"kp":300,"ki":400,"kd":80,"imax":0.2},"adaptive":{"wn":6,"zeta":0.7,"ki_a":30,"imax":0.5,"wf":10.0,"lam":0.99}},"dt":0.01,"u_max":400.0,"platform_mass":2.0,"target_m":0.5,"selection":"grid search on tuning seeds 1000.., cost IAE + 0.5*energy"},"nets":{},"tensors":{}}
|
nlrt.js
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* nlrt.js: browser and Node twin of nlrt.py. Batch size 1, float64 math. */
|
| 2 |
+
(function (root, factory) {
|
| 3 |
+
if (typeof module === "object" && module.exports) module.exports = factory();
|
| 4 |
+
else root.NLRT = factory();
|
| 5 |
+
})(typeof self !== "undefined" ? self : this, function () {
|
| 6 |
+
"use strict";
|
| 7 |
+
|
| 8 |
+
function b64d(s) {
|
| 9 |
+
let bin;
|
| 10 |
+
if (typeof atob === "function") bin = atob(s);
|
| 11 |
+
else bin = Buffer.from(s, "base64").toString("binary");
|
| 12 |
+
const bytes = new Uint8Array(bin.length);
|
| 13 |
+
for (let i = 0; i < bin.length; i++) bytes[i] = bin.charCodeAt(i);
|
| 14 |
+
return new Float32Array(bytes.buffer);
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
function decode(spec) {
|
| 18 |
+
for (const name in spec.nets || {}) {
|
| 19 |
+
for (const L of spec.nets[name]) {
|
| 20 |
+
if (typeof L.w === "string") L.w = b64d(L.w);
|
| 21 |
+
if (typeof L.b === "string") L.b = b64d(L.b);
|
| 22 |
+
}
|
| 23 |
+
}
|
| 24 |
+
for (const name in spec.tensors || {}) {
|
| 25 |
+
const t = spec.tensors[name];
|
| 26 |
+
if (typeof t.data === "string") t.data = b64d(t.data);
|
| 27 |
+
}
|
| 28 |
+
return spec;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
async function loadModel(url) {
|
| 32 |
+
const r = await fetch(url);
|
| 33 |
+
if (!r.ok) throw new Error("cannot load " + url);
|
| 34 |
+
return decode(await r.json());
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
function pair(v) { return Array.isArray(v) ? v : [v, v]; }
|
| 38 |
+
|
| 39 |
+
// Tensor: {shape: [D]} or {shape: [C, H, W]} or {shape: [C, L]}, data: Float64Array
|
| 40 |
+
function T(shape, data) {
|
| 41 |
+
const n = shape.reduce((a, b) => a * b, 1);
|
| 42 |
+
return { shape: shape.slice(), data: data || new Float64Array(n) };
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
function as3(x) {
|
| 46 |
+
if (x.shape.length === 2) return { t: T([x.shape[0], 1, x.shape[1]], x.data), sq: true };
|
| 47 |
+
return { t: x, sq: false };
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
function conv2d(x0, L) {
|
| 51 |
+
const { t: x, sq } = as3(x0);
|
| 52 |
+
const [C, H, W] = x.shape;
|
| 53 |
+
const [O, I, KH, KW] = L.w_shape;
|
| 54 |
+
const [sh, sw] = pair(L.stride), [ph, pw] = pair(L.pad);
|
| 55 |
+
const OH = Math.floor((H + 2 * ph - KH) / sh) + 1;
|
| 56 |
+
const OW = Math.floor((W + 2 * pw - KW) / sw) + 1;
|
| 57 |
+
const out = new Float64Array(O * OH * OW);
|
| 58 |
+
const w = L.w, b = L.b, xd = x.data;
|
| 59 |
+
for (let o = 0; o < O; o++) {
|
| 60 |
+
for (let oy = 0; oy < OH; oy++) {
|
| 61 |
+
for (let ox = 0; ox < OW; ox++) {
|
| 62 |
+
let s = b[o];
|
| 63 |
+
for (let c = 0; c < I; c++) {
|
| 64 |
+
for (let ky = 0; ky < KH; ky++) {
|
| 65 |
+
const iy = oy * sh + ky - ph;
|
| 66 |
+
if (iy < 0 || iy >= H) continue;
|
| 67 |
+
const wb = ((o * I + c) * KH + ky) * KW, xb = (c * H + iy) * W;
|
| 68 |
+
for (let kx = 0; kx < KW; kx++) {
|
| 69 |
+
const ix = ox * sw + kx - pw;
|
| 70 |
+
if (ix < 0 || ix >= W) continue;
|
| 71 |
+
s += w[wb + kx] * xd[xb + ix];
|
| 72 |
+
}
|
| 73 |
+
}
|
| 74 |
+
}
|
| 75 |
+
out[(o * OH + oy) * OW + ox] = s;
|
| 76 |
+
}
|
| 77 |
+
}
|
| 78 |
+
}
|
| 79 |
+
return sq ? T([O, OW], out) : T([O, OH, OW], out);
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
function maxpool(x0, L) {
|
| 83 |
+
const { t: x, sq } = as3(x0);
|
| 84 |
+
const [C, H, W] = x.shape, [kh, kw] = pair(L.k);
|
| 85 |
+
const OH = Math.floor(H / kh), OW = Math.floor(W / kw);
|
| 86 |
+
const out = new Float64Array(C * OH * OW);
|
| 87 |
+
for (let c = 0; c < C; c++)
|
| 88 |
+
for (let oy = 0; oy < OH; oy++)
|
| 89 |
+
for (let ox = 0; ox < OW; ox++) {
|
| 90 |
+
let m = -Infinity;
|
| 91 |
+
for (let i = 0; i < kh; i++)
|
| 92 |
+
for (let j = 0; j < kw; j++) {
|
| 93 |
+
const v = x.data[(c * H + oy * kh + i) * W + ox * kw + j];
|
| 94 |
+
if (v > m) m = v;
|
| 95 |
+
}
|
| 96 |
+
out[(c * OH + oy) * OW + ox] = m;
|
| 97 |
+
}
|
| 98 |
+
return sq ? T([C, OW], out) : T([C, OH, OW], out);
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
function linear(x, L) {
|
| 102 |
+
const [O, I] = L.w_shape;
|
| 103 |
+
const out = new Float64Array(O);
|
| 104 |
+
for (let o = 0; o < O; o++) {
|
| 105 |
+
let s = L.b[o];
|
| 106 |
+
const base = o * I;
|
| 107 |
+
for (let i = 0; i < I; i++) s += L.w[base + i] * x.data[i];
|
| 108 |
+
out[o] = s;
|
| 109 |
+
}
|
| 110 |
+
return T([O], out);
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
function map(x, f) {
|
| 114 |
+
const d = new Float64Array(x.data.length);
|
| 115 |
+
for (let i = 0; i < d.length; i++) d[i] = f(x.data[i]);
|
| 116 |
+
return T(x.shape, d);
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
function forward(layers, x) {
|
| 120 |
+
if (!(x.data instanceof Float64Array)) x = T(x.shape, Float64Array.from(x.data));
|
| 121 |
+
for (const L of layers) {
|
| 122 |
+
switch (L.type) {
|
| 123 |
+
case "linear": x = linear(x, L); break;
|
| 124 |
+
case "conv2d": x = conv2d(x, L); break;
|
| 125 |
+
case "relu": x = map(x, v => (v > 0 ? v : 0)); break;
|
| 126 |
+
case "tanh": x = map(x, Math.tanh); break;
|
| 127 |
+
case "sigmoid": x = map(x, v => 1 / (1 + Math.exp(-v))); break;
|
| 128 |
+
case "maxpool": x = maxpool(x, L); break;
|
| 129 |
+
case "gap": {
|
| 130 |
+
const C = x.shape[0], n = x.data.length / C, d = new Float64Array(C);
|
| 131 |
+
for (let c = 0; c < C; c++) { let s = 0; for (let i = 0; i < n; i++) s += x.data[c * n + i]; d[c] = s / n; }
|
| 132 |
+
x = T([C], d); break;
|
| 133 |
+
}
|
| 134 |
+
case "flatten": x = T([x.data.length], x.data); break;
|
| 135 |
+
case "reshape": x = T(L.shape, x.data); break;
|
| 136 |
+
case "upsample": {
|
| 137 |
+
const s = L.s;
|
| 138 |
+
if (x.shape.length === 3) {
|
| 139 |
+
const [C, H, W] = x.shape, d = new Float64Array(C * H * s * W * s);
|
| 140 |
+
for (let c = 0; c < C; c++)
|
| 141 |
+
for (let y = 0; y < H * s; y++)
|
| 142 |
+
for (let xx = 0; xx < W * s; xx++)
|
| 143 |
+
d[(c * H * s + y) * W * s + xx] = x.data[(c * H + Math.floor(y / s)) * W + Math.floor(xx / s)];
|
| 144 |
+
x = T([C, H * s, W * s], d);
|
| 145 |
+
} else {
|
| 146 |
+
const [C, Ln] = x.shape, d = new Float64Array(C * Ln * s);
|
| 147 |
+
for (let c = 0; c < C; c++) for (let i = 0; i < Ln * s; i++) d[c * Ln * s + i] = x.data[c * Ln + Math.floor(i / s)];
|
| 148 |
+
x = T([C, Ln * s], d);
|
| 149 |
+
}
|
| 150 |
+
break;
|
| 151 |
+
}
|
| 152 |
+
case "l2norm": {
|
| 153 |
+
let s = 0; for (const v of x.data) s += v * v;
|
| 154 |
+
const n = Math.max(Math.sqrt(s), 1e-12);
|
| 155 |
+
x = map(x, v => v / n); break;
|
| 156 |
+
}
|
| 157 |
+
default: throw new Error("unknown layer " + L.type);
|
| 158 |
+
}
|
| 159 |
+
}
|
| 160 |
+
return x;
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
function mulberry32(seed) {
|
| 164 |
+
let a = seed >>> 0;
|
| 165 |
+
const random = function () {
|
| 166 |
+
a = (a + 0x6D2B79F5) >>> 0;
|
| 167 |
+
let t = a;
|
| 168 |
+
t = Math.imul(t ^ (t >>> 15), t | 1) >>> 0;
|
| 169 |
+
t = (t ^ ((t + (Math.imul(t ^ (t >>> 7), t | 61) >>> 0)) >>> 0)) >>> 0;
|
| 170 |
+
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
|
| 171 |
+
};
|
| 172 |
+
return {
|
| 173 |
+
random,
|
| 174 |
+
uniform: (lo, hi) => lo + (hi - lo) * random(),
|
| 175 |
+
randint: n => Math.floor(random() * n),
|
| 176 |
+
normal: () => { const u = Math.max(random(), 1e-12), v = random(); return Math.sqrt(-2 * Math.log(u)) * Math.cos(2 * Math.PI * v); },
|
| 177 |
+
};
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
function softmax(arr) {
|
| 181 |
+
let m = -Infinity; for (const v of arr) if (v > m) m = v;
|
| 182 |
+
const e = Array.from(arr, v => Math.exp(v - m)); const s = e.reduce((a, b) => a + b, 0);
|
| 183 |
+
return e.map(v => v / s);
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
function argmax(arr) { let k = 0; for (let i = 1; i < arr.length; i++) if (arr[i] > arr[k]) k = i; return k; }
|
| 187 |
+
|
| 188 |
+
// Deep comparison used by parity tests: numbers within tol, everything else exact.
|
| 189 |
+
function compare(got, want, tol, path, acc) {
|
| 190 |
+
acc = acc || { maxDiff: 0, mismatches: [] };
|
| 191 |
+
path = path || "$";
|
| 192 |
+
if (typeof want === "number") {
|
| 193 |
+
const d = Math.abs(Number(got) - want);
|
| 194 |
+
if (!(d <= tol * Math.max(1, Math.abs(want)))) acc.mismatches.push(path + ": got " + got + " want " + want);
|
| 195 |
+
if (isFinite(d)) acc.maxDiff = Math.max(acc.maxDiff, d);
|
| 196 |
+
} else if (Array.isArray(want)) {
|
| 197 |
+
if (!got || got.length !== want.length) acc.mismatches.push(path + ": length " + (got && got.length) + " vs " + want.length);
|
| 198 |
+
else for (let i = 0; i < want.length; i++) compare(got[i], want[i], tol, path + "[" + i + "]", acc);
|
| 199 |
+
} else if (want && typeof want === "object") {
|
| 200 |
+
for (const k in want) compare(got ? got[k] : undefined, want[k], tol, path + "." + k, acc);
|
| 201 |
+
} else if (got !== want) acc.mismatches.push(path + ": got " + got + " want " + want);
|
| 202 |
+
return acc;
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
function runParity(core, ctx, parity) {
|
| 206 |
+
const results = [];
|
| 207 |
+
let maxDiff = 0, failed = 0;
|
| 208 |
+
for (const c of parity.cases) {
|
| 209 |
+
const out = core.runCase(ctx, c.input);
|
| 210 |
+
const r = compare(out, c.expected, c.tol != null ? c.tol : parity.tol);
|
| 211 |
+
maxDiff = Math.max(maxDiff, r.maxDiff);
|
| 212 |
+
if (r.mismatches.length) failed++;
|
| 213 |
+
results.push({ name: c.name, maxDiff: r.maxDiff, mismatches: r.mismatches.slice(0, 5) });
|
| 214 |
+
}
|
| 215 |
+
return { cases: parity.cases.length, failed, maxDiff, results };
|
| 216 |
+
}
|
| 217 |
+
|
| 218 |
+
return { b64d, decode, loadModel, T, forward, mulberry32, softmax, argmax, compare, runParity };
|
| 219 |
+
});
|
nlui.js
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* nlui.js: small DOM and canvas helpers shared by Next Lab Spaces. */
|
| 2 |
+
(function (root) {
|
| 3 |
+
"use strict";
|
| 4 |
+
const $ = id => document.getElementById(id);
|
| 5 |
+
function h(tag, attrs, ...kids) {
|
| 6 |
+
const e = document.createElement(tag);
|
| 7 |
+
for (const k in attrs || {}) {
|
| 8 |
+
if (k === "class") e.className = attrs[k];
|
| 9 |
+
else if (k.startsWith("on")) e.addEventListener(k.slice(2), attrs[k]);
|
| 10 |
+
else if (k === "html") e.innerHTML = attrs[k];
|
| 11 |
+
else e.setAttribute(k, attrs[k]);
|
| 12 |
+
}
|
| 13 |
+
for (const c of kids.flat()) if (c != null) e.append(c.nodeType ? c : document.createTextNode(String(c)));
|
| 14 |
+
return e;
|
| 15 |
+
}
|
| 16 |
+
const css = name => getComputedStyle(document.documentElement).getPropertyValue(name).trim();
|
| 17 |
+
const fmt = (v, d = 3) => (v == null || !isFinite(v) ? "–" : Number(v).toFixed(d));
|
| 18 |
+
|
| 19 |
+
function grayImage(canvas, data, w, h, scale, opts) {
|
| 20 |
+
opts = opts || {};
|
| 21 |
+
canvas.width = w * scale; canvas.height = h * scale;
|
| 22 |
+
const ctx = canvas.getContext("2d");
|
| 23 |
+
const img = ctx.createImageData(w, h);
|
| 24 |
+
let lo = opts.lo != null ? opts.lo : 0, hi = opts.hi != null ? opts.hi : 1;
|
| 25 |
+
for (let i = 0; i < w * h; i++) {
|
| 26 |
+
const v = Math.max(0, Math.min(255, Math.round(255 * (data[i] - lo) / (hi - lo || 1))));
|
| 27 |
+
img.data[4 * i] = img.data[4 * i + 1] = img.data[4 * i + 2] = v; img.data[4 * i + 3] = 255;
|
| 28 |
+
}
|
| 29 |
+
const tmp = document.createElement("canvas"); tmp.width = w; tmp.height = h;
|
| 30 |
+
tmp.getContext("2d").putImageData(img, 0, 0);
|
| 31 |
+
ctx.imageSmoothingEnabled = false;
|
| 32 |
+
ctx.drawImage(tmp, 0, 0, w * scale, h * scale);
|
| 33 |
+
return ctx;
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
function rgbImage(canvas, data, w, h, scale) { // data: CHW in [0,1]
|
| 37 |
+
canvas.width = w * scale; canvas.height = h * scale;
|
| 38 |
+
const ctx = canvas.getContext("2d");
|
| 39 |
+
const img = ctx.createImageData(w, h), n = w * h;
|
| 40 |
+
for (let i = 0; i < n; i++) {
|
| 41 |
+
for (let c = 0; c < 3; c++) img.data[4 * i + c] = Math.max(0, Math.min(255, Math.round(255 * data[c * n + i])));
|
| 42 |
+
img.data[4 * i + 3] = 255;
|
| 43 |
+
}
|
| 44 |
+
const tmp = document.createElement("canvas"); tmp.width = w; tmp.height = h;
|
| 45 |
+
tmp.getContext("2d").putImageData(img, 0, 0);
|
| 46 |
+
ctx.imageSmoothingEnabled = false;
|
| 47 |
+
ctx.drawImage(tmp, 0, 0, w * scale, h * scale);
|
| 48 |
+
return ctx;
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
// series: [{name, color, points: [[x,y],...], dash}]
|
| 52 |
+
function lineChart(canvas, series, opts) {
|
| 53 |
+
opts = opts || {};
|
| 54 |
+
const W = canvas.clientWidth || 600, H = opts.height || 240, dpr = window.devicePixelRatio || 1;
|
| 55 |
+
canvas.width = W * dpr; canvas.height = H * dpr; canvas.style.height = H + "px";
|
| 56 |
+
const ctx = canvas.getContext("2d"); ctx.scale(dpr, dpr);
|
| 57 |
+
const m = { l: 46, r: 10, t: 10, b: 34 };
|
| 58 |
+
let xs = [], ys = [];
|
| 59 |
+
for (const s of series) for (const [x, y] of s.points) { if (isFinite(y)) { xs.push(x); ys.push(y); } }
|
| 60 |
+
if (opts.hlines) for (const hl of opts.hlines) ys.push(hl.y);
|
| 61 |
+
let x0 = opts.xmin != null ? opts.xmin : Math.min(...xs), x1 = opts.xmax != null ? opts.xmax : Math.max(...xs);
|
| 62 |
+
let y0 = opts.ymin != null ? opts.ymin : Math.min(...ys), y1 = opts.ymax != null ? opts.ymax : Math.max(...ys);
|
| 63 |
+
if (y1 - y0 < 1e-9) { y0 -= 1; y1 += 1; }
|
| 64 |
+
if (x1 - x0 < 1e-9) x1 = x0 + 1;
|
| 65 |
+
const X = x => m.l + (x - x0) / (x1 - x0) * (W - m.l - m.r);
|
| 66 |
+
const Y = y => H - m.b - (y - y0) / (y1 - y0) * (H - m.t - m.b);
|
| 67 |
+
ctx.font = "11px system-ui"; ctx.fillStyle = css("--muted"); ctx.strokeStyle = css("--line"); ctx.lineWidth = 1;
|
| 68 |
+
for (let i = 0; i <= 4; i++) {
|
| 69 |
+
const y = y0 + (y1 - y0) * i / 4;
|
| 70 |
+
ctx.beginPath(); ctx.moveTo(m.l, Y(y)); ctx.lineTo(W - m.r, Y(y)); ctx.stroke();
|
| 71 |
+
ctx.fillText(Math.abs(y) >= 100 ? y.toFixed(0) : y.toFixed(2), 4, Y(y) + 4);
|
| 72 |
+
}
|
| 73 |
+
for (let i = 0; i <= 4; i++) {
|
| 74 |
+
const x = x0 + (x1 - x0) * i / 4;
|
| 75 |
+
ctx.fillText(Math.abs(x) >= 100 || Number.isInteger(x) ? x.toFixed(0) : x.toFixed(1), X(x) - 8, H - m.b + 14);
|
| 76 |
+
}
|
| 77 |
+
if (opts.xlabel) ctx.fillText(opts.xlabel, W / 2 - 30, H - 4);
|
| 78 |
+
if (opts.hlines) for (const hl of opts.hlines) {
|
| 79 |
+
ctx.setLineDash([4, 4]); ctx.strokeStyle = hl.color || css("--muted");
|
| 80 |
+
ctx.beginPath(); ctx.moveTo(m.l, Y(hl.y)); ctx.lineTo(W - m.r, Y(hl.y)); ctx.stroke(); ctx.setLineDash([]);
|
| 81 |
+
}
|
| 82 |
+
for (const s of series) {
|
| 83 |
+
ctx.strokeStyle = s.color; ctx.lineWidth = s.width || 2; ctx.setLineDash(s.dash || []);
|
| 84 |
+
ctx.beginPath(); let first = true;
|
| 85 |
+
for (const [x, y] of s.points) { if (!isFinite(y)) continue; if (first) ctx.moveTo(X(x), Y(y)); else ctx.lineTo(X(x), Y(y)); first = false; }
|
| 86 |
+
ctx.stroke(); ctx.setLineDash([]);
|
| 87 |
+
}
|
| 88 |
+
return { X, Y, ctx };
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
function legend(el, series) {
|
| 92 |
+
el.innerHTML = "";
|
| 93 |
+
for (const s of series) el.append(h("span", { class: "small", style: "margin-right:12px;white-space:nowrap" },
|
| 94 |
+
h("span", { style: `display:inline-block;width:14px;height:3px;background:${s.color};vertical-align:middle;margin-right:4px` }), s.name));
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
async function loadAssets(core) {
|
| 98 |
+
const assets = {};
|
| 99 |
+
for (const name of core.ASSETS) {
|
| 100 |
+
const r = await fetch(name);
|
| 101 |
+
if (!r.ok) throw new Error("cannot load " + name);
|
| 102 |
+
assets[name] = await r.json();
|
| 103 |
+
}
|
| 104 |
+
return assets;
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
// Standard bootstrap: load assets, init core, expose __parity for automated tests.
|
| 108 |
+
async function boot(core, start) {
|
| 109 |
+
try {
|
| 110 |
+
const assets = await loadAssets(core);
|
| 111 |
+
const ctx = core.init(assets);
|
| 112 |
+
const parity = await (await fetch("parity_cases.json")).json();
|
| 113 |
+
root.__parity = () => NLRT.runParity(core, ctx, parity);
|
| 114 |
+
await start(ctx, assets);
|
| 115 |
+
root.__ready = true;
|
| 116 |
+
} catch (e) {
|
| 117 |
+
console.error(e); root.__error = String(e && e.stack || e);
|
| 118 |
+
const s = document.getElementById("status"); if (s) s.textContent = "Failed to start: " + e;
|
| 119 |
+
}
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
root.NLUI = { $, h, css, fmt, grayImage, rgbImage, lineChart, legend, boot };
|
| 123 |
+
})(typeof self !== "undefined" ? self : this);
|
parity_cases.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"tol": 1e-06, "cases": [{"name": "case0-pid", "input": {"scenario": {"payload0": 2.5, "t_load": 4.0, "dm": 5.0, "c0": 3.5, "F0": 2.0, "t_fric": 7.0, "fric_gain": 2.5, "delay": 3, "noise": 0.002, "T": 12.0, "seed": 7}, "ctrl": "pid"}, "expected": {"metrics": {"max_deviation_m": 0.21246549316426738, "settling_time_s": 1.9100000000000001, "settled": true, "control_energy_kN2s": 0.08585167617097979, "step_overshoot_m": 0.16121816396249167, "final_error_m": 0.0012782173124000207, "iae_ms": 0.42688203186966583}, "z_every_50": [0.0, -0.0004085952017149544, 0.15066126971117708, 0.41661875752337924, 0.6094910142644665, 0.6415090752525874, 0.6143033723141853, 0.5751587989600206, 0.528398559084237, 0.3636567531787355, 0.4146990731389013, 0.4665136412775602, 0.4921308208534194, 0.5006121483442652, 0.5032290292135477, 0.5037900716700674, 0.5033920920662193, 0.5026327160709422, 0.5018160568887925, 0.5006884872379507, 0.49971137884403455, 0.4987963852462897, 0.49840961694528235, 0.4982643007722245]}}, {"name": "case0-adaptive", "input": {"scenario": {"payload0": 2.5, "t_load": 4.0, "dm": 5.0, "c0": 3.5, "F0": 2.0, "t_fric": 7.0, "fric_gain": 2.5, "delay": 3, "noise": 0.002, "T": 12.0, "seed": 7}, "ctrl": "adaptive"}, "expected": {"metrics": {"max_deviation_m": 0.2399659109836748, "settling_time_s": 5.130000000000001, "settled": true, "control_energy_kN2s": 0.07724842430435602, "step_overshoot_m": 0.054537633646371764, "final_error_m": 0.002987176552042059, "iae_ms": 0.37910133631047316}, "z_every_50": [0.0, 0.00036813324982064993, 0.15953353741137472, 0.43145749490406027, 0.5511399124343184, 0.5535085811597227, 0.5381420079623578, 0.5233610905351479, 0.5116053467777066, 0.2764536025529711, 0.5310339636037434, 0.5238555136219413, 0.5230668094927646, 0.5262128644162303, 0.5262643197379423, 0.5248269361417314, 0.5219424112628269, 0.5171340324423823, 0.5113981214708997, 0.5059766382120995, 0.5017643990420669, 0.49850304198796175, 0.496732849218459, 0.496408231480134]}}, {"name": "case1-pid", "input": {"scenario": {"payload0": 1.2, "t_load": 4.0, "dm": 11.0, "c0": 3.5, "F0": 2.0, "t_fric": 7.0, "fric_gain": 5.0, "delay": 6, "noise": 0.006, "T": 12.0, "seed": 3}, "ctrl": "pid"}, "expected": {"metrics": {"max_deviation_m": 0.6834092876786254, "settling_time_s": 7.99, "settled": false, "control_energy_kN2s": 0.19103139746244666, "step_overshoot_m": 0.7949034817694149, "final_error_m": 0.09350074369439826, "iae_ms": 2.16975488168198}, "z_every_50": [0.0, 0.006167418813875638, 0.3754448232032102, 0.4983127115905621, 1.216365064542975, 0.6785687878915853, 0.9810745043694489, 0.8989378666733674, 0.5408567421509758, -0.06373193954647269, 0.30582835091352817, 0.4208185500582201, 0.40104294920959555, 0.4053452006567008, 0.4061802043287324, 0.406545084046908, 0.4064038517455914, 0.4064094686969604, 0.4068262760237856, 0.406554736143254, 0.40656114999121074, 0.4064574082307643, 0.40648614346254197, 0.406721991424236]}}, {"name": "case1-adaptive", "input": {"scenario": {"payload0": 1.2, "t_load": 4.0, "dm": 11.0, "c0": 3.5, "F0": 2.0, "t_fric": 7.0, "fric_gain": 5.0, "delay": 6, "noise": 0.006, "T": 12.0, "seed": 3}, "ctrl": "adaptive"}, "expected": {"metrics": {"max_deviation_m": 0.7547817053580321, "settling_time_s": 5.710000000000001, "settled": true, "control_energy_kN2s": 0.2350248077818673, "step_overshoot_m": 0.07555317278466955, "final_error_m": 0.005155713014521002, "iae_ms": 1.1971782729946825}, "z_every_50": [0.0, 0.0014397408433107807, 0.14483125663673418, 0.40123898987494927, 0.535983206532774, 0.5596232790774621, 0.5458372902690339, 0.5229891028098075, 0.5116627259597123, -0.15889298125156825, 0.9287334425095327, 0.9657221775398724, 0.509921655294349, 0.41854863754375876, 0.6190805517292256, 0.4369755382094865, 0.436563156860101, 0.4710810138018651, 0.4835880448012429, 0.48814004774189207, 0.49366038292320813, 0.4978276518720943, 0.5011472560161704, 0.5041733532147272]}}, {"name": "case2-pid", "input": {"scenario": {"payload0": 3.9, "t_load": 4.0, "dm": -1.0, "c0": 3.5, "F0": 2.0, "t_fric": 7.0, "fric_gain": 1.0, "delay": 0, "noise": 0.0, "T": 12.0, "seed": 1}, "ctrl": "pid"}, "expected": {"metrics": {"max_deviation_m": 0.015467357512746749, "settling_time_s": 1.38, "settled": true, "control_energy_kN2s": 0.03196562041711937, "step_overshoot_m": 0.0723706591534844, "final_error_m": 8.959023124899268e-05, "iae_ms": 0.19405905613476956}, "z_every_50": [0.0, 0.0, 0.15451872841111916, 0.442146195253905, 0.5711277940952781, 0.5620282123935619, 0.5304703711553099, 0.5100777271925204, 0.5014127645050139, 0.5153849454787427, 0.5139255527305081, 0.5086965248132093, 0.503324792202987, 0.49976580903086565, 0.4979609116935066, 0.4974869024153101, 0.4978824147604195, 0.49868289249688535, 0.49950411590057475, 0.5001158637247262, 0.5004423034573194, 0.5005153353656008, 0.500420503801535, 0.5002525593073228]}}, {"name": "case2-adaptive", "input": {"scenario": {"payload0": 3.9, "t_load": 4.0, "dm": -1.0, "c0": 3.5, "F0": 2.0, "t_fric": 7.0, "fric_gain": 1.0, "delay": 0, "noise": 0.0, "T": 12.0, "seed": 1}, "ctrl": "adaptive"}, "expected": {"metrics": {"max_deviation_m": 0.03149865678202102, "settling_time_s": 0.8499999999999996, "settled": true, "control_energy_kN2s": 0.032041379768356255, "step_overshoot_m": 0.05414471009417465, "final_error_m": 0.0011271943141129004, "iae_ms": 0.22001462294797086}, "z_every_50": [0.0, 0.0, 0.15110556561311372, 0.43418702659633124, 0.5533073667269033, 0.5520328641315859, 0.5370447372329736, 0.5223707300937611, 0.512962901211704, 0.5285430476512999, 0.504545908816123, 0.5008285441299704, 0.49698713323738886, 0.49417265379408454, 0.4920768348834494, 0.4910061749644979, 0.4915843792429475, 0.4935773865893604, 0.4959579446406527, 0.49808236922501803, 0.49969767683808497, 0.5007440826124598, 0.5012481686974942, 0.5013162727407985]}}]}
|
preview.png
ADDED
|
Git LFS Details
|
replay.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ca7bc3f4c862bd01802435a15b075ef0f2f46cca1db7794e03493b4cf4f0a81f
|
| 3 |
+
size 182074
|
style.css
CHANGED
|
@@ -1,28 +1,55 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
|
|
|
| 4 |
}
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
p {
|
| 12 |
-
color: rgb(107, 114, 128);
|
| 13 |
-
font-size: 15px;
|
| 14 |
-
margin-bottom: 10px;
|
| 15 |
-
margin-top: 5px;
|
| 16 |
-
}
|
| 17 |
-
|
| 18 |
-
.card {
|
| 19 |
-
max-width: 620px;
|
| 20 |
-
margin: 0 auto;
|
| 21 |
-
padding: 16px;
|
| 22 |
-
border: 1px solid lightgray;
|
| 23 |
-
border-radius: 16px;
|
| 24 |
-
}
|
| 25 |
-
|
| 26 |
-
.card p:last-child {
|
| 27 |
-
margin-bottom: 0;
|
| 28 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
:root {
|
| 2 |
+
--bg: #f7f7f5; --panel: #ffffff; --ink: #1d1f22; --muted: #5f6670; --line: #dcdfe3;
|
| 3 |
+
--accent: #0b6e4f; --accent-soft: #e3f1ec; --warn: #a4471b; --warn-soft: #fbeee6;
|
| 4 |
+
--blue: #2f5fb3; --gold: #b07d12; --red: #c0392b;
|
| 5 |
}
|
| 6 |
+
@media (prefers-color-scheme: dark) {
|
| 7 |
+
:root {
|
| 8 |
+
--bg: #15171a; --panel: #1e2125; --ink: #eceef0; --muted: #a5acb5; --line: #33383e;
|
| 9 |
+
--accent: #4cc39a; --accent-soft: #1b3229; --warn: #f0a070; --warn-soft: #3a2519;
|
| 10 |
+
--blue: #7ea6f0; --gold: #e0b44c; --red: #f07a6c;
|
| 11 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
}
|
| 13 |
+
* { box-sizing: border-box; }
|
| 14 |
+
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); }
|
| 15 |
+
body { font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
|
| 16 |
+
main { max-width: 1040px; margin: 0 auto; padding: 16px; }
|
| 17 |
+
header h1 { font-size: 1.6rem; margin: 4px 0 2px; letter-spacing: -0.01em; }
|
| 18 |
+
header p { margin: 0 0 8px; color: var(--muted); max-width: 70ch; }
|
| 19 |
+
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 12px; }
|
| 20 |
+
.badge { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); border: 1px solid var(--line); }
|
| 21 |
+
.badge.warn { background: var(--warn-soft); color: var(--warn); }
|
| 22 |
+
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
|
| 23 |
+
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; min-width: 0; }
|
| 24 |
+
.card h2 { font-size: 1.02rem; margin: 0 0 8px; }
|
| 25 |
+
.card h3 { font-size: .95rem; margin: 10px 0 6px; }
|
| 26 |
+
label { display: block; font-size: 13px; color: var(--muted); margin: 8px 0 3px; }
|
| 27 |
+
input[type=text], textarea, select { width: 100%; font: inherit; padding: 7px 9px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
|
| 28 |
+
textarea { min-height: 110px; resize: vertical; }
|
| 29 |
+
input[type=range] { width: 100%; }
|
| 30 |
+
button { font: inherit; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; }
|
| 31 |
+
button.ghost { background: transparent; color: var(--accent); }
|
| 32 |
+
button:disabled { opacity: .5; cursor: default; }
|
| 33 |
+
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
|
| 34 |
+
canvas { max-width: 100%; height: auto; display: block; border-radius: 6px; }
|
| 35 |
+
.card > canvas { width: 100%; }
|
| 36 |
+
.muted { color: var(--muted); }
|
| 37 |
+
.small { font-size: 13px; }
|
| 38 |
+
.status { font-size: 13px; color: var(--muted); min-height: 1.4em; }
|
| 39 |
+
table { border-collapse: collapse; width: 100%; font-size: 13px; }
|
| 40 |
+
th, td { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
|
| 41 |
+
th { color: var(--muted); font-weight: 600; }
|
| 42 |
+
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
|
| 43 |
+
.scroll { overflow-x: auto; }
|
| 44 |
+
mark { background: #ffe58a; color: #1d1f22; padding: 0 2px; border-radius: 3px; }
|
| 45 |
+
mark.weak { background: #fff3c4; }
|
| 46 |
+
video { width: 100%; border-radius: 8px; }
|
| 47 |
+
footer { margin: 18px 0 8px; font-size: 13px; color: var(--muted); }
|
| 48 |
+
a { color: var(--blue); }
|
| 49 |
+
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
|
| 50 |
+
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; background: var(--bg); font-size: 13px; cursor: pointer; color: var(--ink); }
|
| 51 |
+
.chip.on { border-color: var(--accent); background: var(--accent-soft); }
|
| 52 |
+
.kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
|
| 53 |
+
.kpi div { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
|
| 54 |
+
.kpi b { display: block; font-size: 1.15rem; }
|
| 55 |
+
.kpi span { font-size: 12px; color: var(--muted); }
|