40 lines
1.7 KiB
JavaScript
40 lines
1.7 KiB
JavaScript
// HIL Test Bench & Supercap PLP Holdup Client
|
|
async function triggerSupercapPlpTest() {
|
|
const btn = document.getElementById('btn-hil-plp');
|
|
const resultBox = document.getElementById('hil-test-result');
|
|
if (btn) {
|
|
btn.disabled = true;
|
|
btn.innerHTML = '<i class="fa-solid fa-spinner fa-spin"></i> Triggering LTC3350 PFI Assertion...';
|
|
}
|
|
|
|
try {
|
|
const res = await fetch('/api/hil/simulate-plp', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ serial_number: "NAS-6U-2026-0001" })
|
|
});
|
|
const data = await res.json();
|
|
|
|
if (resultBox) {
|
|
resultBox.style.display = 'block';
|
|
resultBox.innerHTML = `
|
|
<div style="background:#0f172a; border-left:4px solid var(--accent-emerald); padding:0.6rem 0.8rem; border-radius:4px; font-size:0.75rem;">
|
|
<div style="font-weight:700; color:var(--accent-emerald);"><i class="fa-solid fa-circle-check"></i> HIL TEST PASSED: Supercapacitor Holdup Sustained ${data.holdup_time_ms}ms</div>
|
|
<div style="font-size:0.65rem; color:#94a3b8; margin-top:0.25rem;">
|
|
Initial: ${data.vcap_initial}V | Cutoff: ${data.vcap_cutoff}V | Load: ${data.discharge_power_w}W | Log: ${data.log_data}
|
|
</div>
|
|
</div>
|
|
`;
|
|
}
|
|
} catch (err) {
|
|
console.error("HIL Test Error:", err);
|
|
} finally {
|
|
if (btn) {
|
|
btn.disabled = false;
|
|
btn.innerHTML = '<i class="fa-solid fa-bolt"></i> Run Live PLP Holdup Discharge Test (120W Load)';
|
|
}
|
|
}
|
|
}
|
|
|
|
window.triggerSupercapPlpTest = triggerSupercapPlpTest;
|