jbreidfjord-dev / NAND Gate

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 aTerminalId = "07c3726b-5f3b-ba5e-1005-d10e69c8fbd7";
const bTerminalId = "a7f388fa-29f0-9d68-7eed-a728188c2df7";
const qTerminalId = "9e33bfd2-8be9-c43a-7e84-fb1bb18b559f";
const aTerminal = flux.getNodeById(aTerminalId, "elementTerminal");
const bTerminal = flux.getNodeById(bTerminalId, "elementTerminal");
const qTerminal = flux.getNodeById(qTerminalId, "elementTerminal");
if (!aTerminal || !bTerminal || !qTerminal) {
    throw new Error("Oops! Couldn't find terminals");
}
const aVoltage = flux.createOutputNode("a-voltage");
aVoltage.name = "A";
aVoltage.unit = "V";
const bVoltage = flux.createOutputNode("b-voltage");
bVoltage.name = "B";
bVoltage.unit = "V";
const qVoltage = flux.createOutputNode("q-voltage");
qVoltage.name = "Q";
qVoltage.unit = "V";
flux.on("setup", () => {
    const highVoltageProp = flux.properties.find((prop) => prop.name === "High Voltage");
    if (highVoltageProp === undefined) {
        throw new Error("Oops! Couldn't find high voltage property");
    }
    const highVoltage = isNaN(Number(highVoltageProp.value)) ? 5 : Number(highVoltageProp.value);
    flux.simulationModel = {
        type: "nandGate",
        highVoltage,
        map_input_one_to_terminal_uid: aTerminalId,
        map_input_two_to_terminal_uid: bTerminalId,
Design view of NAND GateDesign view of NAND Gate
Enter to Rename, Shift+Enter to Preview

Reviews