jharwinbarrozo / Fuse

Files

Pins

Symbol

PCB

Open in Flux
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const p1TerminalId = "0ef7e2aa-1f49-907f-be7f-b1952b36e6ea";
const p2TerminalId = "fae6d947-edae-f0a6-9bed-83b1e3724faa";
const p1Terminal = flux.getNodeById(p1TerminalId, "elementTerminal");
const p2Terminal = flux.getNodeById(p2TerminalId, "elementTerminal");
let fuseState = true;
flux.on("setup", () => {
    flux.simulationModel = simModel(fuseState);
});
flux.on("inputChange", (e) => {
    if (e.control_name === "Fuse") {
        fuseState = true;
        flux.currentSymbol = "good";
    }   
});
flux.on("beforeStep", () => {
    flux.simulationModel = simModel(fuseState);
});
flux.on("afterStep", () => {
    const current = Number(p1Terminal?.current);
    const currentRating = Number(flux.properties.find((prop) => prop.name === "Current Rating")?.value);
    if (Math.abs(current) > currentRating) {
        fuseState = false;
    }
Enter to Rename, Shift+Enter to Preview

Reviews